Skip to content

Commit 9492ae8

Browse files
authored
Move FrameworkFileUtils to logic contracts for more broad use (#112)
1 parent 6ba623e commit 9492ae8

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

dnSpy/dnSpy/Search/FrameworkFileUtils.cs renamed to dnSpy/dnSpy.Contracts.Logic/Utilities/FrameworkFileUtils.cs

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,12 @@ You should have received a copy of the GNU General Public License
2020
using System;
2121
using System.Collections.Generic;
2222
using System.IO;
23-
using dnSpy.Contracts.Utilities;
2423

25-
namespace dnSpy.Search {
26-
static class FrameworkFileUtils {
24+
namespace dnSpy.Contracts.Utilities {
25+
/// <summary>
26+
/// Helper functions for working with framework assembly files
27+
/// </summary>
28+
public static class FrameworkFileUtils {
2729
static readonly string[] frameworkAssemblyNamePrefixes = new string[] {
2830
"Unity.",
2931
"UnityEngine.",
@@ -454,7 +456,12 @@ static class FrameworkFileUtils {
454456
"Mono.Security",
455457
"System.EnterpriseServices",
456458
};
457-
459+
/// <summary>
460+
/// Guesses if an assembly is likely a standard framework assembly or external assembly. Uses some whitelisting and GAC checks.
461+
/// </summary>
462+
/// <param name="filename">Full path to the assembly file in question</param>
463+
/// <param name="assemblySimpleName">Optional unversioned simple assembly name to check against whitelist, ie: Microsoft.AspNetCore.Authorization</param>
464+
/// <returns></returns>
458465
public static bool IsFrameworkAssembly(string filename, string? assemblySimpleName) {
459466
// Check if it's in one of the .NET runtime dirs
460467
if (Path.GetDirectoryName(Path.GetDirectoryName(Path.GetDirectoryName(filename))) is string baseDir && Directory.Exists(Path.Combine(baseDir, "Microsoft.NETCore.App")))

0 commit comments

Comments
 (0)