Remove assembly hot loading
This commit is contained in:
parent
6d2624d52b
commit
17181811f0
@ -46,6 +46,9 @@ namespace LibationFileManager
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Commented code used to locate assemblies from the *ConfigApp.exe's module list.
|
||||||
|
* Use this method to locate dependencies when they are not in Libation's program files directory.
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|
||||||
// runs the exe and gets the exe's loaded modules
|
// runs the exe and gets the exe's loaded modules
|
||||||
@ -53,6 +56,7 @@ namespace LibationFileManager
|
|||||||
.OrderBy(x => x.ModuleName)
|
.OrderBy(x => x.ModuleName)
|
||||||
.ToList();
|
.ToList();
|
||||||
#endif
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
|
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
|
||||||
|
|
||||||
@ -76,6 +80,9 @@ namespace LibationFileManager
|
|||||||
return appName;
|
return appName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Use this method to locate dependencies when they are not in Libation's program files directory.
|
||||||
|
*
|
||||||
private static List<ProcessModule> LoadModuleList(string exeName)
|
private static List<ProcessModule> LoadModuleList(string exeName)
|
||||||
{
|
{
|
||||||
var proc = new Process
|
var proc = new Process
|
||||||
@ -112,24 +119,30 @@ namespace LibationFileManager
|
|||||||
|
|
||||||
return modules;
|
return modules;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
|
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
|
||||||
{
|
{
|
||||||
// e.g. "System.Windows.Forms, Version=6.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
// e.g. "System.Windows.Forms, Version=6.0.2.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
|
||||||
var asmName = args.Name.Split(',')[0] + ".dll";
|
var asmName = args.Name.Split(',')[0] + ".dll";
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Commented code used to locate assemblies from the *ConfigApp.exe's module list.
|
||||||
|
* Use this method to locate dependencies when they are not in Libation's program files directory.
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
|
||||||
var modulePath = ModuleList.SingleOrDefault(m => m.ModuleName.EqualsInsensitive(asmName))?.FileName;
|
var modulePath = ModuleList.SingleOrDefault(m => m.ModuleName.EqualsInsensitive(asmName))?.FileName;
|
||||||
#else
|
#else
|
||||||
|
*/
|
||||||
var here = Path.GetDirectoryName(Environment.ProcessPath);
|
var here = Path.GetDirectoryName(Environment.ProcessPath);
|
||||||
|
|
||||||
// find '*ConfigApp.dll' files
|
// find the requested assembly in the program files directory
|
||||||
var modulePath =
|
var modulePath =
|
||||||
Directory.EnumerateFiles(here, asmName, SearchOption.TopDirectoryOnly)
|
Directory.EnumerateFiles(here, asmName, SearchOption.TopDirectoryOnly)
|
||||||
.SingleOrDefault();
|
.SingleOrDefault();
|
||||||
|
|
||||||
#endif
|
//#endif
|
||||||
if (modulePath is null)
|
if (modulePath is null)
|
||||||
{
|
{
|
||||||
//Let the runtime handle any dll not found exceptions.
|
//Let the runtime handle any dll not found exceptions.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user