add list files for autoupdate feature

put new Versioning
fix bugs
This commit is contained in:
Alex Bezdieniezhnykh
2025-06-10 23:38:37 +03:00
parent dcd0fabc1f
commit f9815a0a3f
26 changed files with 204 additions and 127 deletions
+1 -1
View File
@@ -9,7 +9,7 @@
<PropertyGroup> <PropertyGroup>
<VersionDate>$([System.DateTime]::UtcNow.ToString("yyyy.MM.dd"))</VersionDate> <VersionDate>$([System.DateTime]::UtcNow.ToString("yyyy.MM.dd"))</VersionDate>
<VersionSeconds>$([System.Convert]::ToInt32($([System.DateTime]::UtcNow.TimeOfDay.TotalSeconds)))</VersionSeconds> <VersionSeconds>$([System.Convert]::ToInt32($([System.DateTime]::UtcNow.TimeOfDay.TotalMinutes)))</VersionSeconds>
<AssemblyVersion>$(VersionDate).$(VersionSeconds)</AssemblyVersion> <AssemblyVersion>$(VersionDate).$(VersionSeconds)</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion> <FileVersion>$(AssemblyVersion)</FileVersion>
+1 -1
View File
@@ -58,7 +58,7 @@ public class InferenceClient : IInferenceClient
process.OutputDataReceived += (_, e) => { if (e.Data != null) Console.WriteLine(e.Data); }; process.OutputDataReceived += (_, e) => { if (e.Data != null) Console.WriteLine(e.Data); };
process.ErrorDataReceived += (_, e) => { if (e.Data != null) Console.WriteLine(e.Data); }; process.ErrorDataReceived += (_, e) => { if (e.Data != null) Console.WriteLine(e.Data); };
// process.Start(); process.Start();
} }
catch (Exception e) catch (Exception e)
{ {
@@ -65,7 +65,7 @@ public class LoaderClient(LoaderClientConfig config, ILogger logger, Cancellatio
return new MemoryStream(result.Data!); return new MemoryStream(result.Data!);
} }
private RemoteCommand SendCommand(RemoteCommand command, int retryCount = 15, int retryDelayMs = 400) private RemoteCommand SendCommand(RemoteCommand command, int retryCount = 50, int retryDelayMs = 800)
{ {
try try
{ {
@@ -82,7 +82,7 @@ public class LoaderClient(LoaderClientConfig config, ILogger logger, Cancellatio
return res; return res;
} }
throw new Exception($"Sent {command} {retryCount} times. No response from client."); throw new Exception($"Sent {command} {retryCount} times, with wait time {retryDelayMs}ms for each call. No response from client.");
} }
catch (Exception e) catch (Exception e)
{ {
+1 -1
View File
@@ -9,7 +9,7 @@
<PropertyGroup> <PropertyGroup>
<VersionDate>$([System.DateTime]::UtcNow.ToString("yyyy.MM.dd"))</VersionDate> <VersionDate>$([System.DateTime]::UtcNow.ToString("yyyy.MM.dd"))</VersionDate>
<VersionSeconds>$([System.Convert]::ToInt32($([System.DateTime]::UtcNow.TimeOfDay.TotalSeconds)))</VersionSeconds> <VersionSeconds>$([System.Convert]::ToInt32($([System.DateTime]::UtcNow.TimeOfDay.TotalMinutes)))</VersionSeconds>
<AssemblyVersion>$(VersionDate).$(VersionSeconds)</AssemblyVersion> <AssemblyVersion>$(VersionDate).$(VersionSeconds)</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion> <FileVersion>$(AssemblyVersion)</FileVersion>
+1 -1
View File
@@ -4,7 +4,7 @@ from PyInstaller.utils.hooks import collect_all
datas = [('venv\\Lib\\site-packages\\cv2', 'cv2')] datas = [('venv\\Lib\\site-packages\\cv2', 'cv2')]
binaries = [] binaries = []
hiddenimports = ['constants', 'file_data', 'remote_command', 'remote_command_handler', 'annotation', 'loader_client', 'ai_config', 'tensorrt_engine', 'onnx_engine', 'inference_engine', 'inference', 'main-inf'] hiddenimports = ['constants', 'file_data', 'loader_client', 'remote_command', 'remote_command_handler', 'annotation', 'loader_client', 'ai_config', 'tensorrt_engine', 'onnx_engine', 'inference_engine', 'inference', 'main-inf']
hiddenimports += collect_submodules('cv2') hiddenimports += collect_submodules('cv2')
tmp_ret = collect_all('psutil') tmp_ret = collect_all('psutil')
datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2] datas += tmp_ret[0]; binaries += tmp_ret[1]; hiddenimports += tmp_ret[2]
+3 -5
View File
@@ -51,12 +51,10 @@ robocopy "dist\azaion-inference\_internal" "..\dist-azaion\_internal" "ai_config
robocopy "dist\azaion-inference\_internal" "..\dist-azaion\_internal" "constants.cp312-win_amd64.pyd" "file_data.cp312-win_amd64.pyd" robocopy "dist\azaion-inference\_internal" "..\dist-azaion\_internal" "constants.cp312-win_amd64.pyd" "file_data.cp312-win_amd64.pyd"
robocopy "dist\azaion-inference\_internal" "..\dist-azaion\_internal" "remote_command.cp312-win_amd64.pyd" "remote_command_handler.cp312-win_amd64.pyd" robocopy "dist\azaion-inference\_internal" "..\dist-azaion\_internal" "remote_command.cp312-win_amd64.pyd" "remote_command_handler.cp312-win_amd64.pyd"
robocopy "dist\azaion-inference\_internal" "..\dist-azaion\_internal" "inference.cp312-win_amd64.pyd" "inference_engine.cp312-win_amd64.pyd" robocopy "dist\azaion-inference\_internal" "..\dist-azaion\_internal" "inference.cp312-win_amd64.pyd" "inference_engine.cp312-win_amd64.pyd"
robocopy "dist\azaion-inference\_internal" "..\dist-azaion\_internal" "tensorrt_engine.cp312-win_amd64.pyd" "onnx_engine.cp312-win_amd64.pyd" "main_inference.cp312-win_amd64.pyd" robocopy "dist\azaion-inference\_internal" "..\dist-azaion\_internal" "loader_client.cp312-win_amd64.pyd" "tensorrt_engine.cp312-win_amd64.pyd"
robocopy "dist\azaion-inference\_internal" "..\dist-azaion\_internal" "onnx_engine.cp312-win_amd64.pyd" "main_inference.cp312-win_amd64.pyd"
robocopy "dist\azaion-inference\_internal" "..\dist-dlls\_internal" /E robocopy "dist\azaion-inference\_internal" "..\dist-dlls\_internal" /E
robocopy "dist\azaion-inference" "..\dist-azaion" "azaion-inference.exe" /E robocopy "dist\azaion-inference" "..\dist-azaion" "azaion-inference.exe"
REM copy for local run
robocopy "c:\share\" "dist\azaion-inference\_internal /E
cd /d %CURRENT_DIR% cd /d %CURRENT_DIR%
+8
View File
@@ -14,3 +14,11 @@ cdef class UploadFileData(FileData):
cdef from_msgpack(bytes data) cdef from_msgpack(bytes data)
cdef bytes serialize(self) cdef bytes serialize(self)
cdef class FileList:
cdef public list[str] files
@staticmethod
cdef from_msgpack(bytes data)
cdef bytes serialize(self)
+13 -1
View File
@@ -37,4 +37,16 @@ cdef class UploadFileData(FileData):
"Resource": self.resource, "Resource": self.resource,
"Folder": self.folder, "Folder": self.folder,
"Filename": self.filename "Filename": self.filename
}) })
cdef class FileList:
def __init__(self, list[str] files):
self.files = files
@staticmethod
cdef from_msgpack(bytes data):
unpacked = unpackb(data, strict_map_key=False)
return FileList(unpacked.get("files"))
cdef bytes serialize(self):
return packb({ "files": self.files })
+1 -1
View File
@@ -28,7 +28,7 @@ cdef class LoaderClient:
return LoadResult(f"Unexpected response command type: {response.command_type}") return LoadResult(f"Unexpected response command type: {response.command_type}")
cdef upload_big_small_resource(self, bytes content, str filename, str directory): cdef upload_big_small_resource(self, bytes content, str filename, str directory):
cdef UploadFileData upload_file_data = UploadFileData(content, filename, directory) cdef UploadFileData upload_file_data = UploadFileData(content, folder=directory, filename=filename)
cdef RemoteCommand upload_resp = self._send_receive_command(RemoteCommand(CommandType.UPLOAD_BIG_SMALL, data=upload_file_data.serialize())) cdef RemoteCommand upload_resp = self._send_receive_command(RemoteCommand(CommandType.UPLOAD_BIG_SMALL, data=upload_file_data.serialize()))
if upload_resp.command_type == CommandType.OK: if upload_resp.command_type == CommandType.OK:
return LoadResult(None, None) return LoadResult(None, None)
+2
View File
@@ -1,6 +1,8 @@
cdef enum CommandType: cdef enum CommandType:
OK = 3 OK = 3
LOGIN = 10 LOGIN = 10
LIST_REQUEST = 15
LIST_FILES = 18
LOAD = 20 LOAD = 20
LOAD_BIG_SMALL = 22 LOAD_BIG_SMALL = 22
UPLOAD_BIG_SMALL = 24 UPLOAD_BIG_SMALL = 24
+4 -2
View File
@@ -1,15 +1,17 @@
import msgpack import msgpack
cdef class RemoteCommand: cdef class RemoteCommand:
def __init__(self, CommandType command_type, bytes data, str message=None): def __init__(self, CommandType command_type, bytes data=None, str message=None):
self.command_type = command_type self.command_type = command_type
self.data = data self.data = data
self.message = message self.message = message
def __str__(self): def __str__(self):
command_type_names = { command_type_names = {
3: "OK", 3: "OK",
10: "LOGIN", 10: "LOGIN",
15: "LIST_REQUEST",
18: "LIST_FILES",
20: "LOAD", 20: "LOAD",
22: "LOAD_BIG_SMALL", 22: "LOAD_BIG_SMALL",
24: "UPLOAD_BIG_SMALL", 24: "UPLOAD_BIG_SMALL",
+2
View File
@@ -14,6 +14,8 @@ cdef class ApiClient:
cdef set_token(self, str token) cdef set_token(self, str token)
cdef get_user(self) cdef get_user(self)
cdef post(self, url, json)
cdef list_files(self, str folder, str search_file)
cdef load_bytes(self, str filename, str folder) cdef load_bytes(self, str filename, str folder)
cdef upload_file(self, str filename, bytes resource, str folder) cdef upload_file(self, str filename, bytes resource, str folder)
cdef load_big_file_cdn(self, str folder, str big_part) cdef load_big_file_cdn(self, str folder, str big_part)
+22 -13
View File
@@ -97,25 +97,38 @@ cdef class ApiClient:
except Exception as e: except Exception as e:
constants.log(f"Upload fail: {e}") constants.log(f"Upload fail: {e}")
cdef list_files(self, str folder, str search_file):
response = self.post(f'{self.api_url}/resources/list/{folder}', {
"search": search_file
})
constants.log(<str> f'Get files list by {folder}')
return response.json()
cdef load_bytes(self, str filename, str folder): cdef load_bytes(self, str filename, str folder):
cdef str hardware = HardwareService.get_hardware_info() cdef str hardware = HardwareService.get_hardware_info()
hw_hash = Security.get_hw_hash(hardware) hw_hash = Security.get_hw_hash(hardware)
key = Security.get_api_encryption_key(self.credentials, hw_hash) key = Security.get_api_encryption_key(self.credentials, hw_hash)
payload = json.dumps(
{
"password": self.credentials.password,
"hardware": hardware,
"fileName": filename
}, indent=4)
response = self.post(f'{self.api_url}/resources/get/{folder}', payload)
resp_bytes = response.raw.read()
data = Security.decrypt_to(resp_bytes, key)
constants.log(<str>f'Downloaded file: {filename}, {len(data)} bytes')
return data
cdef post(self, url, payload):
if self.token is None: if self.token is None:
self.login() self.login()
url = f"{self.api_url}/resources/get/{folder}"
headers = { headers = {
"Authorization": f"Bearer {self.token}", "Authorization": f"Bearer {self.token}",
"Content-Type": "application/json" "Content-Type": "application/json"
} }
payload = json.dumps(
{
"password": self.credentials.password,
"hardware": hardware,
"fileName": filename
}, indent=4)
response = requests.post(url, data=payload, headers=headers, stream=True) response = requests.post(url, data=payload, headers=headers, stream=True)
if response.status_code == HTTPStatus.UNAUTHORIZED or response.status_code == HTTPStatus.FORBIDDEN: if response.status_code == HTTPStatus.UNAUTHORIZED or response.status_code == HTTPStatus.FORBIDDEN:
self.login() self.login()
@@ -132,18 +145,14 @@ cdef class ApiClient:
err_code = res['ErrorCode'] err_code = res['ErrorCode']
err_msg = res['Message'] err_msg = res['Message']
raise Exception(f"Error {err_code}: {err_msg}") raise Exception(f"Error {err_code}: {err_msg}")
return response
resp_bytes = response.raw.read()
data = Security.decrypt_to(resp_bytes, key)
constants.log(<str>f'Downloaded file: {filename}, {len(data)} bytes')
return data
cdef load_big_file_cdn(self, str folder, str big_part): cdef load_big_file_cdn(self, str folder, str big_part):
print(f'downloading file {folder}\\{big_part} from cdn...') print(f'downloading file {folder}\\{big_part} from cdn...')
if self.cdn_manager.download(folder, big_part): if self.cdn_manager.download(folder, big_part):
with open(path.join(<str> folder, big_part), 'rb') as binary_file: with open(path.join(<str> folder, big_part), 'rb') as binary_file:
encrypted_bytes_big = binary_file.read() encrypted_bytes_big = binary_file.read()
# return encrypted_bytes_big return encrypted_bytes_big
else: else:
raise Exception(f'Cannot download file {folder}\\{big_part} from CDN!') raise Exception(f'Cannot download file {folder}\\{big_part} from CDN!')
+1 -1
View File
@@ -49,6 +49,6 @@ robocopy "dist\azaion-loader\_internal" "..\dist-azaion\_internal" "hardware_ser
robocopy "dist\azaion-loader\_internal" "..\dist-azaion\_internal" "main_loader.cp312-win_amd64.pyd" robocopy "dist\azaion-loader\_internal" "..\dist-azaion\_internal" "main_loader.cp312-win_amd64.pyd"
robocopy "dist\azaion-loader\_internal" "..\dist-dlls\_internal" /E robocopy "dist\azaion-loader\_internal" "..\dist-dlls\_internal" /E
robocopy "dist\azaion-loader" "..\dist-azaion" "azaion-loader.exe" /E robocopy "dist\azaion-loader" "..\dist-azaion" "azaion-loader.exe"
cd /d %CURRENT_DIR% cd /d %CURRENT_DIR%
+3 -3
View File
@@ -1,6 +1,6 @@
import io import io
import os import os
cimport constants
import boto3 import boto3
@@ -27,7 +27,7 @@ cdef class CDNManager:
cdef upload(self, str bucket, str filename, bytes file_bytes): cdef upload(self, str bucket, str filename, bytes file_bytes):
try: try:
self.upload_client.upload_fileobj(io.BytesIO(file_bytes), bucket, filename) self.upload_client.upload_fileobj(io.BytesIO(file_bytes), bucket, filename)
print(f'uploaded {filename} ({len(file_bytes)} bytes) to the {bucket}') constants.log(f'uploaded {filename} ({len(file_bytes)} bytes) to the {bucket}')
return True return True
except Exception as e: except Exception as e:
print(e) print(e)
@@ -37,7 +37,7 @@ cdef class CDNManager:
try: try:
os.makedirs(folder, exist_ok=True) os.makedirs(folder, exist_ok=True)
self.download_client.download_file(folder, filename, f'{folder}\\{filename}') self.download_client.download_file(folder, filename, f'{folder}\\{filename}')
print(f'downloaded {filename} from the {folder}') constants.log(f'downloaded {filename} from the {folder}')
return True return True
except Exception as e: except Exception as e:
print(e) print(e)
+8
View File
@@ -13,4 +13,12 @@ cdef class UploadFileData(FileData):
@staticmethod @staticmethod
cdef from_msgpack(bytes data) cdef from_msgpack(bytes data)
cdef bytes serialize(self)
cdef class FileList:
cdef public list[str] files
@staticmethod
cdef from_msgpack(bytes data)
cdef bytes serialize(self) cdef bytes serialize(self)
+13 -1
View File
@@ -37,4 +37,16 @@ cdef class UploadFileData(FileData):
"Resource": self.resource, "Resource": self.resource,
"Folder": self.folder, "Folder": self.folder,
"Filename": self.filename "Filename": self.filename
}) })
cdef class FileList:
def __init__(self, list[str] files):
self.files = files
@staticmethod
cdef from_msgpack(bytes data):
unpacked = unpackb(data, strict_map_key=False)
return FileList(unpacked.get("files"))
cdef bytes serialize(self):
return packb({ "files": self.files })
+6 -1
View File
@@ -4,7 +4,7 @@ import traceback
from credentials cimport Credentials from credentials cimport Credentials
from remote_command cimport RemoteCommand, CommandType from remote_command cimport RemoteCommand, CommandType
from remote_command_handler cimport RemoteCommandHandler from remote_command_handler cimport RemoteCommandHandler
from file_data cimport FileData, UploadFileData from file_data cimport FileData, UploadFileData, FileList
from api_client cimport ApiClient from api_client cimport ApiClient
cdef class CommandProcessor: cdef class CommandProcessor:
@@ -47,6 +47,11 @@ cdef class CommandProcessor:
file_data = FileData.from_msgpack(command.data) file_data = FileData.from_msgpack(command.data)
file_bytes = self.api_client.load_bytes(file_data.filename, file_data.folder) file_bytes = self.api_client.load_bytes(file_data.filename, file_data.folder)
self.remote_handler.send(command.client_id, RemoteCommand(CommandType.DATA_BYTES, file_bytes).serialize()) self.remote_handler.send(command.client_id, RemoteCommand(CommandType.DATA_BYTES, file_bytes).serialize())
elif command.command_type == CommandType.LIST_REQUEST:
search_data = FileData.from_msgpack(command.data)
list_files = self.api_client.load_bytes(search_data.folder, search_data.filename)
file_list_bytes = FileList(list_files).serialize()
self.remote_handler.send(command.client_id, RemoteCommand(CommandType.LIST_FILES, file_list_bytes).serialize())
elif command.command_type == CommandType.LOAD_BIG_SMALL: elif command.command_type == CommandType.LOAD_BIG_SMALL:
data = FileData.from_msgpack(command.data) data = FileData.from_msgpack(command.data)
file_bytes = self.api_client.load_big_small_resource(data.filename, data.folder) file_bytes = self.api_client.load_big_small_resource(data.filename, data.folder)
+2
View File
@@ -1,6 +1,8 @@
cdef enum CommandType: cdef enum CommandType:
OK = 3 OK = 3
LOGIN = 10 LOGIN = 10
LIST_REQUEST = 15
LIST_FILES = 18
LOAD = 20 LOAD = 20
LOAD_BIG_SMALL = 22 LOAD_BIG_SMALL = 22
UPLOAD_BIG_SMALL = 24 UPLOAD_BIG_SMALL = 24
+2
View File
@@ -10,6 +10,8 @@ cdef class RemoteCommand:
command_type_names = { command_type_names = {
3: "OK", 3: "OK",
10: "LOGIN", 10: "LOGIN",
15: "LIST_REQUEST",
18: "LIST_FILES",
20: "LOAD", 20: "LOAD",
22: "LOAD_BIG_SMALL", 22: "LOAD_BIG_SMALL",
24: "UPLOAD_BIG_SMALL", 24: "UPLOAD_BIG_SMALL",
+88 -82
View File
@@ -106,100 +106,106 @@ public partial class App
private void Start(ApiCredentials credentials) private void Start(ApiCredentials credentials)
{ {
new ConfigUpdater().CheckConfig(); try
var initConfig = SecurityConstants.ReadInitConfig(); {
var apiDir = initConfig.DirectoriesConfig.ApiResourcesDirectory; new ConfigUpdater().CheckConfig();
_loaderClient = new LoaderClient(initConfig.LoaderClientConfig, Log.Logger, _mainCTokenSource.Token); var initConfig = SecurityConstants.ReadInitConfig();
var apiDir = initConfig.DirectoriesConfig.ApiResourcesDirectory;
_loaderClient = new LoaderClient(initConfig.LoaderClientConfig, Log.Logger, _mainCTokenSource.Token);
#if DEBUG _loaderClient.StartClient();
_loaderClient.StartClient(); _loaderClient.Connect(); //Client app should be already started by LoaderUI
#endif _loaderClient.Login(credentials);
_loaderClient.Connect(); //Client app should be already started by LoaderUI
_loaderClient.Login(credentials);
var azaionApi = new AzaionApi(new HttpClient { BaseAddress = new Uri(initConfig.InferenceClientConfig.ApiUrl) }, _cache, credentials); var azaionApi = new AzaionApi(new HttpClient { BaseAddress = new Uri(initConfig.InferenceClientConfig.ApiUrl) }, _cache, credentials);
_host = Host.CreateDefaultBuilder() _host = Host.CreateDefaultBuilder()
.ConfigureAppConfiguration((_, config) => config .ConfigureAppConfiguration((_, config) => config
.AddCommandLine(Environment.GetCommandLineArgs()) .AddCommandLine(Environment.GetCommandLineArgs())
.AddJsonFile(SecurityConstants.CONFIG_PATH, optional: true, reloadOnChange: true) .AddJsonFile(SecurityConstants.CONFIG_PATH, optional: true, reloadOnChange: true)
.AddJsonStream(GetSystemConfig(_loaderClient, apiDir)) .AddJsonStream(GetSystemConfig(_loaderClient, apiDir))
.AddJsonStream(GetSecuredConfig(_loaderClient, apiDir))) .AddJsonStream(GetSecuredConfig(_loaderClient, apiDir)))
.UseSerilog() .UseSerilog()
.ConfigureServices((context, services) => .ConfigureServices((context, services) =>
{
services.AddSingleton<MainSuite>();
services.Configure<AppConfig>(context.Configuration);
services.ConfigureSection<QueueConfig>(context.Configuration);
services.ConfigureSection<DirectoriesConfig>(context.Configuration);
services.ConfigureSection<AnnotationConfig>(context.Configuration);
services.ConfigureSection<AIRecognitionConfig>(context.Configuration);
services.ConfigureSection<ThumbnailConfig>(context.Configuration);
services.ConfigureSection<UIConfig>(context.Configuration);
services.ConfigureSection<MapConfig>(context.Configuration);
#region External Services
services.ConfigureSection<LoaderClientConfig>(context.Configuration);
services.AddSingleton(_loaderClient);
services.ConfigureSection<InferenceClientConfig>(context.Configuration);
services.AddSingleton<IInferenceClient, InferenceClient>();
services.AddSingleton<IInferenceService, InferenceService>();
services.ConfigureSection<GpsDeniedClientConfig>(context.Configuration);
services.AddSingleton<IGpsMatcherClient, GpsMatcherClient>();
services.AddSingleton<IGpsMatcherService, GpsMatcherService>();
services.AddSingleton<ISatelliteDownloader, SatelliteDownloader>();
services.AddHttpClient();
services.AddSingleton<IAzaionApi>(azaionApi);
#endregion
services.AddSingleton<IConfigUpdater, ConfigUpdater>();
services.AddSingleton<Annotator.Annotator>();
services.AddSingleton<DatasetExplorer>();
services.AddSingleton<HelpWindow>();
services.AddMediatR(c => c.RegisterServicesFromAssemblies(
typeof(Annotator.Annotator).Assembly,
typeof(DatasetExplorer).Assembly,
typeof(AnnotationService).Assembly));
services.AddSingleton<LibVLC>(_ => new LibVLC());
services.AddSingleton<FormState>();
services.AddSingleton<MediaPlayer>(sp =>
{ {
var libVLC = sp.GetRequiredService<LibVLC>(); services.AddSingleton<MainSuite>();
return new MediaPlayer(libVLC);
});
services.AddSingleton<AnnotatorEventHandler>();
services.AddSingleton<IDbFactory, DbFactory>();
services.AddSingleton<FailsafeAnnotationsProducer>(); services.Configure<AppConfig>(context.Configuration);
services.ConfigureSection<QueueConfig>(context.Configuration);
services.ConfigureSection<DirectoriesConfig>(context.Configuration);
services.ConfigureSection<AnnotationConfig>(context.Configuration);
services.ConfigureSection<AIRecognitionConfig>(context.Configuration);
services.ConfigureSection<ThumbnailConfig>(context.Configuration);
services.ConfigureSection<UIConfig>(context.Configuration);
services.ConfigureSection<MapConfig>(context.Configuration);
services.AddSingleton<IAnnotationService, AnnotationService>(); #region External Services
services.AddSingleton<DatasetExplorer>(); services.ConfigureSection<LoaderClientConfig>(context.Configuration);
services.AddSingleton<IGalleryService, GalleryService>(); services.AddSingleton(_loaderClient);
services.AddSingleton<IAzaionModule, AnnotatorModule>(); services.ConfigureSection<InferenceClientConfig>(context.Configuration);
services.AddSingleton<IAzaionModule, DatasetExplorerModule>(); services.AddSingleton<IInferenceClient, InferenceClient>();
}) services.AddSingleton<IInferenceService, InferenceService>();
.Build();
Annotation.InitializeDirs(_host.Services.GetRequiredService<IOptions<DirectoriesConfig>>().Value); services.ConfigureSection<GpsDeniedClientConfig>(context.Configuration);
_host.Services.GetRequiredService<DatasetExplorer>(); services.AddSingleton<IGpsMatcherClient, GpsMatcherClient>();
// datasetExplorer.Show(); services.AddSingleton<IGpsMatcherService, GpsMatcherService>();
// datasetExplorer.Hide(); services.AddSingleton<ISatelliteDownloader, SatelliteDownloader>();
_mediator = _host.Services.GetRequiredService<IMediator>(); services.AddHttpClient();
services.AddSingleton<IAzaionApi>(azaionApi);
#endregion
_formState = _host.Services.GetRequiredService<FormState>(); services.AddSingleton<IConfigUpdater, ConfigUpdater>();
DispatcherUnhandledException += OnDispatcherUnhandledException; services.AddSingleton<Annotator.Annotator>();
services.AddSingleton<DatasetExplorer>();
services.AddSingleton<HelpWindow>();
services.AddMediatR(c => c.RegisterServicesFromAssemblies(
typeof(Annotator.Annotator).Assembly,
typeof(DatasetExplorer).Assembly,
typeof(AnnotationService).Assembly));
services.AddSingleton<LibVLC>(_ => new LibVLC());
services.AddSingleton<FormState>();
services.AddSingleton<MediaPlayer>(sp =>
{
var libVLC = sp.GetRequiredService<LibVLC>();
return new MediaPlayer(libVLC);
});
services.AddSingleton<AnnotatorEventHandler>();
services.AddSingleton<IDbFactory, DbFactory>();
_host.Start(); services.AddSingleton<FailsafeAnnotationsProducer>();
EventManager.RegisterClassHandler(typeof(UIElement), UIElement.PreviewKeyDownEvent, new RoutedEventHandler(GlobalKeyHandler));
_host.Services.GetRequiredService<MainSuite>().Show(); services.AddSingleton<IAnnotationService, AnnotationService>();
services.AddSingleton<DatasetExplorer>();
services.AddSingleton<IGalleryService, GalleryService>();
services.AddSingleton<IAzaionModule, AnnotatorModule>();
services.AddSingleton<IAzaionModule, DatasetExplorerModule>();
})
.Build();
Annotation.InitializeDirs(_host.Services.GetRequiredService<IOptions<DirectoriesConfig>>().Value);
_host.Services.GetRequiredService<DatasetExplorer>();
// datasetExplorer.Show();
// datasetExplorer.Hide();
_mediator = _host.Services.GetRequiredService<IMediator>();
_formState = _host.Services.GetRequiredService<FormState>();
DispatcherUnhandledException += OnDispatcherUnhandledException;
_host.Start();
EventManager.RegisterClassHandler(typeof(UIElement), UIElement.PreviewKeyDownEvent, new RoutedEventHandler(GlobalKeyHandler));
_host.Services.GetRequiredService<MainSuite>().Show();
}
catch (Exception e)
{
Log.Logger.Error(e, e.Message);
throw;
}
} }
private void GlobalKeyHandler(object sender, RoutedEventArgs e) private void GlobalKeyHandler(object sender, RoutedEventArgs e)
+1 -1
View File
@@ -13,7 +13,7 @@
<PropertyGroup> <PropertyGroup>
<VersionDate>$([System.DateTime]::UtcNow.ToString("yyyy.MM.dd"))</VersionDate> <VersionDate>$([System.DateTime]::UtcNow.ToString("yyyy.MM.dd"))</VersionDate>
<VersionSeconds>$([System.Convert]::ToInt32($([System.DateTime]::UtcNow.TimeOfDay.TotalSeconds)))</VersionSeconds> <VersionSeconds>$([System.Convert]::ToInt32($([System.DateTime]::UtcNow.TimeOfDay.TotalMinutes)))</VersionSeconds>
<AssemblyVersion>$(VersionDate).$(VersionSeconds)</AssemblyVersion> <AssemblyVersion>$(VersionDate).$(VersionSeconds)</AssemblyVersion>
<FileVersion>$(AssemblyVersion)</FileVersion> <FileVersion>$(AssemblyVersion)</FileVersion>
+7 -6
View File
@@ -1,17 +1,18 @@
{ {
"LoaderClientConfig": {
"ZeroMqHost": "127.0.0.1",
"ZeroMqPort": 5025,
"ApiUrl": "https://api.azaion.com"
},
"InferenceClientConfig": { "InferenceClientConfig": {
"ZeroMqHost": "127.0.0.1", "ZeroMqHost": "127.0.0.1",
"ZeroMqPort": 5131, "ZeroMqPort": 5127,
"RetryCount": 25,
"TimeoutSeconds": 5,
"ApiUrl": "https://api.azaion.com" "ApiUrl": "https://api.azaion.com"
}, },
"GpsDeniedClientConfig": { "GpsDeniedClientConfig": {
"ZeroMqHost": "127.0.0.1", "ZeroMqHost": "127.0.0.1",
"ZeroMqPort": 5555, "ZeroMqPort": 5555,
"ZeroMqReceiverPort": 5556, "ZeroMqReceiverPort": 5556
"RetryCount": 25,
"TimeoutSeconds": 5
}, },
"DirectoriesConfig": { "DirectoriesConfig": {
"ApiResourcesDirectory": "", "ApiResourcesDirectory": "",
+2
View File
@@ -10,6 +10,8 @@ if exist dist-dlls rmdir dist-dlls /s /q
mkdir dist-dlls mkdir dist-dlls
if exist dist-azaion rmdir dist-azaion /s /q if exist dist-azaion rmdir dist-azaion /s /q
mkdir dist-azaion mkdir dist-azaion
if exist dist rmdir dist /s /q
mkdir dist
echo Copying shared libs echo Copying shared libs
+6 -3
View File
@@ -1,12 +1,15 @@
#define MyAppVersion GetFileVersion("..\dist-azaion\Azaion.Suite.exe")
[Setup] [Setup]
AppId={{CCFEC8E2-0FCC-4B03-8EEA-00AF20D265E5}} AppId={{CCFEC8E2-0FCC-4B03-8EEA-00AF20D265E5}}
AppName=Azaion Suite AppName=Azaion Suite
AppVersion=1.5.0 AppVersion={#MyAppVersion}
AppPublisher=Azaion Ukraine VersionInfoVersion={#MyAppVersion}
AppPublisher=Azaion LLC
DefaultDirName={localappdata}\Azaion\Azaion Suite DefaultDirName={localappdata}\Azaion\Azaion Suite
DefaultGroupName=Azaion Suite DefaultGroupName=Azaion Suite
OutputDir=..\ OutputDir=..\
OutputBaseFilename=AzaionSuite.Iterative.1.5.0 OutputBaseFilename=AzaionSuite.Iterative.{#MyAppVersion}
SetupIconFile=..\dist-azaion\logo.ico SetupIconFile=..\dist-azaion\logo.ico
UninstallDisplayName=Azaion Suite UninstallDisplayName=Azaion Suite
UninstallDisplayIcon={app}\Azaion.Suite.exe UninstallDisplayIcon={app}\Azaion.Suite.exe
+4 -1
View File
@@ -1,10 +1,13 @@
@echo off rem
@echo off
pushd %~dp0.. pushd %~dp0..
call build\init call build\init
call build\build_dotnet call build\build_dotnet
call Azaion.Loader\build_loader
call Azaion.Inference\build_inference call Azaion.Inference\build_inference
call ..\gps-denied\image-matcher\build_gps call ..\gps-denied\image-matcher\build_gps