Update Bootstrap.cs

pull/1/head
a.bozhenov 5 years ago
parent 9e6cc90656
commit 211d701bc5

@ -97,13 +97,8 @@ namespace ZeroLevel
try try
{ {
Log.Info($"[Bootstrap] Resolve assembly '{args.Name}' {args.Name}"); Log.Info($"[Bootstrap] Resolve assembly '{args.Name}' {args.Name}");
if (args.Name.StartsWith("Newtonsoft.Json", StringComparison.Ordinal))
{
return Assembly.LoadFile(Path.Combine(Configuration.BaseDirectory, "Newtonsoft.Json.dll"));
}
string name = args.Name.Split(',')[0]; string name = args.Name.Split(',')[0];
if (name.EndsWith(".resources")) return null; if (name.EndsWith(".resources")) return null;
foreach (string file in Directory. foreach (string file in Directory.
GetFiles(Path.Combine(Configuration.BaseDirectory), "*.dll", SearchOption.TopDirectoryOnly)) GetFiles(Path.Combine(Configuration.BaseDirectory), "*.dll", SearchOption.TopDirectoryOnly))
{ {
@ -113,30 +108,6 @@ namespace ZeroLevel
return Assembly.LoadFile(file); return Assembly.LoadFile(file);
} }
} }
//var candidates = Directory.GetFiles(Path.Combine(Configuration.BaseDirectory), name + ".dll", SearchOption.TopDirectoryOnly)
// ?.Select(s => Path.GetFileNameWithoutExtension(s))
// ?.ToList();
//if (candidates != null && candidates.Any())
//{
// int max = -1; int index = -1;
// for (int i = 0; i < candidates.Count; i++)
// {
// if (args.Name.IndexOf(candidates[i], StringComparison.OrdinalIgnoreCase) >= 0)
// {
// if (max < candidates[i].Length)
// {
// max = candidates[i].Length;
// index = i;
// }
// }
// }
// if (index != -1)
// {
// return Assembly.LoadFile(Path.Combine(Configuration.BaseDirectory, candidates[index] + ".dll"));
// }
//}
} }
catch (Exception ex) catch (Exception ex)
{ {

Loading…
Cancel
Save

Powered by TurnKey Linux.