Cleans up static loggers

Adds test projects for different frameworks and architectures
Adds registration tool assembly
This commit is contained in:
Ryan Newington
2023-01-29 17:30:37 +11:00
parent 4366b24e63
commit 1205f217b3
46 changed files with 1589 additions and 200 deletions
@@ -0,0 +1,37 @@
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace Lithnet.CredentialProvider.ModuleInit
{
internal static class AssemblyResolver
{
private static string basePath;
[ModuleInitializer]
public static void AttachResolver()
{
Trace.WriteLine("Attaching assembly resolver");
AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
basePath = Path.GetFullPath(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));
}
private static Assembly CurrentDomain_AssemblyResolve(object sender, ResolveEventArgs args)
{
var name = new AssemblyName(args.Name);
string assyPath = Path.Combine(basePath, $"{name.Name}.dll");
Trace.WriteLine($"Request for {args.Name}");
if (File.Exists(assyPath))
{
Trace.WriteLine($"Found at {assyPath}");
return Assembly.Load(assyPath);
}
Trace.WriteLine($"Assembly {args.Name} not found");
return null;
}
}
}