File tree Expand file tree Collapse file tree 1 file changed +0
-39
lines changed
Expand file tree Collapse file tree 1 file changed +0
-39
lines changed Original file line number Diff line number Diff line change @@ -17,44 +17,5 @@ public static string GetCodebase(this string path)
1717 path = path . Replace ( '\\ ' , '/' ) ;
1818 return $ "file:///{ path } ";
1919 }
20-
21- internal static Assembly ReflectionOnlyLoadAssembly ( string path )
22- {
23- if ( File . Exists ( path ) )
24- {
25- var assemblyName = AssemblyName . GetAssemblyName ( path ) ;
26- var assemblies = AppDomain . CurrentDomain . ReflectionOnlyGetAssemblies ( ) ;
27- var existing = assemblies . FirstOrDefault ( assembly => assembly . FullName == assemblyName . FullName ) ;
28- if ( existing != null )
29- {
30- return existing ;
31- }
32-
33- var content = File . ReadAllBytes ( path ) ;
34- return Assembly . ReflectionOnlyLoad ( content ) ;
35- }
36-
37- return null ;
38- }
39-
40- internal static Assembly ReflectionOnlyAssemblyResolve ( ResolveEventArgs args , string baseDir )
41- {
42- Console . WriteLine ( $ "Assembly: { args ? . Name } by { args ? . RequestingAssembly ? . GetName ( ) } ") ;
43-
44- var name = new AssemblyName ( args . Name ) ;
45- var path = Path . Combine ( baseDir , name . Name + ".dll" ) ;
46- Assembly assembly = null ;
47- if ( File . Exists ( path ) )
48- {
49- assembly = ReflectionOnlyLoadAssembly ( path ) ;
50- }
51- else
52- {
53- // Log.LogWarning($"Loading assembly by name '{args.Name}'.");
54- assembly = Assembly . ReflectionOnlyLoad ( args . Name ) ;
55- }
56-
57- return assembly ;
58- }
5920 }
6021}
You can’t perform that action at this time.
0 commit comments