mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 11:16:30 +00:00
small fixes, renames
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Windows;
|
||||
using System.Windows.Threading;
|
||||
using Azaion.Annotator;
|
||||
@@ -48,6 +49,12 @@ public partial class App
|
||||
StartLogin();
|
||||
}
|
||||
|
||||
private readonly List<string> _encryptedResources =
|
||||
[
|
||||
"Azaion.Annotator",
|
||||
"Azaion.Dataset"
|
||||
];
|
||||
|
||||
private void StartLogin()
|
||||
{
|
||||
new ConfigUpdater().CheckConfig();
|
||||
@@ -57,7 +64,30 @@ public partial class App
|
||||
_apiClient = AzaionApiClient.Create(args);
|
||||
_resourceLoader = new ResourceLoader(_apiClient, args);
|
||||
_securedConfig = await _resourceLoader.Load("secured-config.json");
|
||||
AppDomain.CurrentDomain.AssemblyResolve += (_, a) => _resourceLoader.LoadAssembly(a.Name);
|
||||
AppDomain.CurrentDomain.AssemblyResolve += (_, a) =>
|
||||
{
|
||||
var assemblyName = a.Name.Split(',').First();
|
||||
if (_encryptedResources.Contains(assemblyName))
|
||||
{
|
||||
try
|
||||
{
|
||||
var stream = _resourceLoader.Load($"{assemblyName}.dll").GetAwaiter().GetResult();
|
||||
return Assembly.Load(stream.ToArray());
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
var currentLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location)!;
|
||||
var dllPath = Path.Combine(currentLocation, SecurityConstants.DUMMY_DIR, $"{assemblyName}.dll");
|
||||
return Assembly.LoadFile(dllPath);
|
||||
}
|
||||
}
|
||||
|
||||
var loadedAssembly = AppDomain.CurrentDomain.GetAssemblies()
|
||||
.FirstOrDefault(a => a.GetName().Name == assemblyName);
|
||||
|
||||
return loadedAssembly;
|
||||
};
|
||||
|
||||
StartMain();
|
||||
await _host.StartAsync();
|
||||
@@ -108,7 +138,8 @@ public partial class App
|
||||
services.AddSingleton<IAIDetector, YOLODetector>();
|
||||
services.AddMediatR(c => c.RegisterServicesFromAssemblies(
|
||||
typeof(Annotator.Annotator).Assembly,
|
||||
typeof(DatasetExplorer).Assembly));
|
||||
typeof(DatasetExplorer).Assembly,
|
||||
typeof(AnnotationService).Assembly));
|
||||
services.AddSingleton<LibVLC>(_ => new LibVLC());
|
||||
services.AddSingleton<FormState>();
|
||||
services.AddSingleton<MediaPlayer>(sp =>
|
||||
|
||||
Reference in New Issue
Block a user