mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 08:36:29 +00:00
put default config if no config.json found
refactor Constants
This commit is contained in:
@@ -1,130 +0,0 @@
|
||||
using System.Windows;
|
||||
using Azaion.Common.DTO;
|
||||
using Azaion.Common.DTO.Config;
|
||||
using Azaion.Common.Extensions;
|
||||
|
||||
namespace Azaion.Common;
|
||||
|
||||
public class Constants
|
||||
{
|
||||
public const string JPG_EXT = ".jpg";
|
||||
public const string TXT_EXT = ".txt";
|
||||
#region DirectoriesConfig
|
||||
|
||||
public const string DEFAULT_VIDEO_DIR = "video";
|
||||
public const string DEFAULT_LABELS_DIR = "labels";
|
||||
public const string DEFAULT_IMAGES_DIR = "images";
|
||||
public const string DEFAULT_RESULTS_DIR = "results";
|
||||
public const string DEFAULT_THUMBNAILS_DIR = "thumbnails";
|
||||
public const string DEFAULT_GPS_SAT_DIRECTORY = "satellitesDir";
|
||||
public const string DEFAULT_GPS_ROUTE_DIRECTORY = "routeDir";
|
||||
|
||||
#endregion
|
||||
|
||||
#region AnnotatorConfig
|
||||
|
||||
public static readonly AnnotationConfig DefaultAnnotationConfig = new()
|
||||
{
|
||||
DetectionClasses = DefaultAnnotationClasses!,
|
||||
VideoFormats = DefaultVideoFormats!,
|
||||
ImageFormats = DefaultImageFormats!,
|
||||
AnnotationsDbFile = DEFAULT_ANNOTATIONS_DB_FILE
|
||||
};
|
||||
|
||||
private static readonly List<DetectionClass> DefaultAnnotationClasses =
|
||||
[
|
||||
new() { Id = 0, Name = "ArmorVehicle", ShortName = "Броня", Color = "#FF0000".ToColor() },
|
||||
new() { Id = 1, Name = "Truck", ShortName = "Вантаж.", Color = "#00FF00".ToColor() },
|
||||
new() { Id = 2, Name = "Vehicle", ShortName = "Машина", Color = "#0000FF".ToColor() },
|
||||
new() { Id = 3, Name = "Atillery", ShortName = "Арта", Color = "#FFFF00".ToColor() },
|
||||
new() { Id = 4, Name = "Shadow", ShortName = "Тінь", Color = "#FF00FF".ToColor() },
|
||||
new() { Id = 5, Name = "Trenches", ShortName = "Окопи", Color = "#00FFFF".ToColor() },
|
||||
new() { Id = 6, Name = "MilitaryMan", ShortName = "Військов", Color = "#188021".ToColor() },
|
||||
new() { Id = 7, Name = "TyreTracks", ShortName = "Накати", Color = "#800000".ToColor() },
|
||||
new() { Id = 8, Name = "AdditArmoredTank", ShortName = "Танк.захист", Color = "#008000".ToColor() },
|
||||
new() { Id = 9, Name = "Smoke", ShortName = "Дим", Color = "#000080".ToColor() },
|
||||
new() { Id = 10, Name = "Plane", ShortName = "Літак", Color = "#000080".ToColor() },
|
||||
new() { Id = 11, Name = "Moto", ShortName = "Мото", Color = "#808000".ToColor() },
|
||||
new() { Id = 12, Name = "CamouflageNet", ShortName = "Сітка", Color = "#800080".ToColor() },
|
||||
new() { Id = 13, Name = "CamouflageBranches", ShortName = "Гілки", Color = "#2f4f4f".ToColor() },
|
||||
new() { Id = 14, Name = "Roof", ShortName = "Дах", Color = "#1e90ff".ToColor() },
|
||||
new() { Id = 15, Name = "Building", ShortName = "Будівля", Color = "#ffb6c1".ToColor() },
|
||||
new() { Id = 16, Name = "Caponier", ShortName = "Капонір", Color = "#ffb6c1".ToColor() },
|
||||
];
|
||||
|
||||
public static readonly List<string> DefaultVideoFormats = ["mp4", "mov", "avi"];
|
||||
public static readonly List<string> DefaultImageFormats = ["jpg", "jpeg", "png", "bmp"];
|
||||
|
||||
public static int DEFAULT_LEFT_PANEL_WIDTH = 250;
|
||||
public static int DEFAULT_RIGHT_PANEL_WIDTH = 250;
|
||||
|
||||
public const string DEFAULT_ANNOTATIONS_DB_FILE = "annotations.db";
|
||||
|
||||
# endregion AnnotatorConfig
|
||||
|
||||
# region AIRecognitionConfig
|
||||
|
||||
public static readonly AIRecognitionConfig DefaultAIRecognitionConfig = new()
|
||||
{
|
||||
FrameRecognitionSeconds = DEFAULT_FRAME_RECOGNITION_SECONDS,
|
||||
TrackingDistanceConfidence = TRACKING_DISTANCE_CONFIDENCE,
|
||||
TrackingProbabilityIncrease = TRACKING_PROBABILITY_INCREASE,
|
||||
TrackingIntersectionThreshold = TRACKING_INTERSECTION_THRESHOLD,
|
||||
FramePeriodRecognition = DEFAULT_FRAME_PERIOD_RECOGNITION
|
||||
};
|
||||
|
||||
public const double DEFAULT_FRAME_RECOGNITION_SECONDS = 2;
|
||||
public const double TRACKING_DISTANCE_CONFIDENCE = 0.15;
|
||||
public const double TRACKING_PROBABILITY_INCREASE = 15;
|
||||
public const double TRACKING_INTERSECTION_THRESHOLD = 0.8;
|
||||
public const int DEFAULT_FRAME_PERIOD_RECOGNITION = 4;
|
||||
|
||||
# endregion AIRecognitionConfig
|
||||
|
||||
# region GpsDeniedConfig
|
||||
|
||||
public static readonly GpsDeniedConfig DefaultGpsDeniedConfig = new()
|
||||
{
|
||||
MinKeyPoints = 15
|
||||
};
|
||||
|
||||
# endregion
|
||||
|
||||
#region Thumbnails
|
||||
|
||||
public static readonly ThumbnailConfig DefaultThumbnailConfig = new()
|
||||
{
|
||||
Size = DefaultThumbnailSize,
|
||||
Border = DEFAULT_THUMBNAIL_BORDER
|
||||
};
|
||||
|
||||
public static readonly Size DefaultThumbnailSize = new(240, 135);
|
||||
|
||||
public const int DEFAULT_THUMBNAIL_BORDER = 10;
|
||||
|
||||
public const string THUMBNAIL_PREFIX = "_thumb";
|
||||
public const string RESULT_PREFIX = "_result";
|
||||
|
||||
#endregion
|
||||
|
||||
public const string MQ_ANNOTATIONS_QUEUE = "azaion-annotations";
|
||||
|
||||
#region Database
|
||||
|
||||
public const string ANNOTATIONS_TABLENAME = "annotations";
|
||||
public const string ANNOTATIONS_QUEUE_TABLENAME = "annotations_queue";
|
||||
public const string ADMIN_EMAIL = "admin@azaion.com";
|
||||
public const string DETECTIONS_TABLENAME = "detections";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mode Captions
|
||||
|
||||
public const string REGULAR_MODE_CAPTION = "Норма";
|
||||
public const string WINTER_MODE_CAPTION = "Зима";
|
||||
public const string NIGHT_MODE_CAPTION = "Ніч";
|
||||
|
||||
#endregion
|
||||
|
||||
public const string CSV_PATH = "matches.csv";
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using Azaion.Common.Extensions;
|
||||
using Azaion.CommonSecurity;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Azaion.Common.DTO.Config;
|
||||
@@ -44,38 +43,12 @@ public class ConfigUpdater : IConfigUpdater
|
||||
public void CheckConfig()
|
||||
{
|
||||
var exePath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory)!;
|
||||
var configFilePath = Path.Combine(exePath, SecurityConstants.CONFIG_PATH);
|
||||
var configFilePath = Path.Combine(exePath, Constants.CONFIG_PATH);
|
||||
|
||||
if (File.Exists(configFilePath))
|
||||
return;
|
||||
|
||||
var appConfig = new AppConfig
|
||||
{
|
||||
AnnotationConfig = Constants.DefaultAnnotationConfig,
|
||||
|
||||
UIConfig = new UIConfig
|
||||
{
|
||||
LeftPanelWidth = Constants.DEFAULT_LEFT_PANEL_WIDTH,
|
||||
RightPanelWidth = Constants.DEFAULT_RIGHT_PANEL_WIDTH,
|
||||
GenerateAnnotatedImage = false
|
||||
},
|
||||
|
||||
DirectoriesConfig = new DirectoriesConfig
|
||||
{
|
||||
VideosDirectory = Constants.DEFAULT_VIDEO_DIR,
|
||||
ImagesDirectory = Constants.DEFAULT_IMAGES_DIR,
|
||||
LabelsDirectory = Constants.DEFAULT_LABELS_DIR,
|
||||
ResultsDirectory = Constants.DEFAULT_RESULTS_DIR,
|
||||
ThumbnailsDirectory = Constants.DEFAULT_THUMBNAILS_DIR,
|
||||
GpsSatDirectory = Constants.DEFAULT_GPS_SAT_DIRECTORY,
|
||||
GpsRouteDirectory = Constants.DEFAULT_GPS_ROUTE_DIRECTORY
|
||||
},
|
||||
|
||||
ThumbnailConfig = Constants.DefaultThumbnailConfig,
|
||||
AIRecognitionConfig = Constants.DefaultAIRecognitionConfig,
|
||||
GpsDeniedConfig = Constants.DefaultGpsDeniedConfig,
|
||||
};
|
||||
Save(appConfig);
|
||||
Save(Constants.FailsafeAppConfig);
|
||||
}
|
||||
|
||||
public void Save(AppConfig config)
|
||||
@@ -91,7 +64,7 @@ public class ConfigUpdater : IConfigUpdater
|
||||
config.UIConfig
|
||||
};
|
||||
|
||||
await File.WriteAllTextAsync(SecurityConstants.CONFIG_PATH, JsonConvert.SerializeObject(publicConfig, Formatting.Indented), Encoding.UTF8);
|
||||
await File.WriteAllTextAsync(Constants.CONFIG_PATH, JsonConvert.SerializeObject(publicConfig, Formatting.Indented), Encoding.UTF8);
|
||||
}, SaveConfigTaskId, TimeSpan.FromSeconds(5));
|
||||
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
using System.IO;
|
||||
using Azaion.Common.DTO;
|
||||
using Azaion.Common.DTO.Config;
|
||||
using Azaion.Common.Extensions;
|
||||
using Newtonsoft.Json;
|
||||
using Serilog;
|
||||
using System.Windows;
|
||||
|
||||
namespace Azaion.Common;
|
||||
|
||||
public class SecurityConstants
|
||||
public class Constants
|
||||
{
|
||||
public const string CONFIG_PATH = "config.json";
|
||||
|
||||
@@ -25,7 +28,10 @@ public class SecurityConstants
|
||||
public const int DEFAULT_ZMQ_INFERENCE_PORT = 5227;
|
||||
|
||||
public const string DEFAULT_ZMQ_GPS_DENIED_HOST = "127.0.0.1";
|
||||
public const int DEFAULT_ZMQ_GPS_DENIED_PORT = 5227;
|
||||
public const int DEFAULT_ZMQ_GPS_DENIED_PORT = 5255;
|
||||
public const int DEFAULT_ZMQ_GPS_DENIED_PUBLISH_PORT = 5256;
|
||||
|
||||
#endregion ExternalClientsConfig
|
||||
|
||||
# region Cache keys
|
||||
|
||||
@@ -34,6 +40,128 @@ public class SecurityConstants
|
||||
|
||||
# endregion
|
||||
|
||||
public const string JPG_EXT = ".jpg";
|
||||
public const string TXT_EXT = ".txt";
|
||||
#region DirectoriesConfig
|
||||
|
||||
public const string DEFAULT_VIDEO_DIR = "video";
|
||||
public const string DEFAULT_LABELS_DIR = "labels";
|
||||
public const string DEFAULT_IMAGES_DIR = "images";
|
||||
public const string DEFAULT_RESULTS_DIR = "results";
|
||||
public const string DEFAULT_THUMBNAILS_DIR = "thumbnails";
|
||||
public const string DEFAULT_GPS_SAT_DIRECTORY = "satellitesDir";
|
||||
public const string DEFAULT_GPS_ROUTE_DIRECTORY = "routeDir";
|
||||
|
||||
#endregion
|
||||
|
||||
#region AnnotatorConfig
|
||||
|
||||
public static readonly AnnotationConfig DefaultAnnotationConfig = new()
|
||||
{
|
||||
DetectionClasses = DefaultAnnotationClasses!,
|
||||
VideoFormats = DefaultVideoFormats!,
|
||||
ImageFormats = DefaultImageFormats!,
|
||||
AnnotationsDbFile = DEFAULT_ANNOTATIONS_DB_FILE
|
||||
};
|
||||
|
||||
private static readonly List<DetectionClass> DefaultAnnotationClasses =
|
||||
[
|
||||
new() { Id = 0, Name = "ArmorVehicle", ShortName = "Броня", Color = "#FF0000".ToColor() },
|
||||
new() { Id = 1, Name = "Truck", ShortName = "Вантаж.", Color = "#00FF00".ToColor() },
|
||||
new() { Id = 2, Name = "Vehicle", ShortName = "Машина", Color = "#0000FF".ToColor() },
|
||||
new() { Id = 3, Name = "Atillery", ShortName = "Арта", Color = "#FFFF00".ToColor() },
|
||||
new() { Id = 4, Name = "Shadow", ShortName = "Тінь", Color = "#FF00FF".ToColor() },
|
||||
new() { Id = 5, Name = "Trenches", ShortName = "Окопи", Color = "#00FFFF".ToColor() },
|
||||
new() { Id = 6, Name = "MilitaryMan", ShortName = "Військов", Color = "#188021".ToColor() },
|
||||
new() { Id = 7, Name = "TyreTracks", ShortName = "Накати", Color = "#800000".ToColor() },
|
||||
new() { Id = 8, Name = "AdditArmoredTank", ShortName = "Танк.захист", Color = "#008000".ToColor() },
|
||||
new() { Id = 9, Name = "Smoke", ShortName = "Дим", Color = "#000080".ToColor() },
|
||||
new() { Id = 10, Name = "Plane", ShortName = "Літак", Color = "#000080".ToColor() },
|
||||
new() { Id = 11, Name = "Moto", ShortName = "Мото", Color = "#808000".ToColor() },
|
||||
new() { Id = 12, Name = "CamouflageNet", ShortName = "Сітка", Color = "#800080".ToColor() },
|
||||
new() { Id = 13, Name = "CamouflageBranches", ShortName = "Гілки", Color = "#2f4f4f".ToColor() },
|
||||
new() { Id = 14, Name = "Roof", ShortName = "Дах", Color = "#1e90ff".ToColor() },
|
||||
new() { Id = 15, Name = "Building", ShortName = "Будівля", Color = "#ffb6c1".ToColor() },
|
||||
new() { Id = 16, Name = "Caponier", ShortName = "Капонір", Color = "#ffb6c1".ToColor() },
|
||||
];
|
||||
|
||||
public static readonly List<string> DefaultVideoFormats = ["mp4", "mov", "avi"];
|
||||
public static readonly List<string> DefaultImageFormats = ["jpg", "jpeg", "png", "bmp"];
|
||||
|
||||
public static int DEFAULT_LEFT_PANEL_WIDTH = 250;
|
||||
public static int DEFAULT_RIGHT_PANEL_WIDTH = 250;
|
||||
|
||||
public const string DEFAULT_ANNOTATIONS_DB_FILE = "annotations.db";
|
||||
|
||||
# endregion AnnotatorConfig
|
||||
|
||||
# region AIRecognitionConfig
|
||||
|
||||
public static readonly AIRecognitionConfig DefaultAIRecognitionConfig = new()
|
||||
{
|
||||
FrameRecognitionSeconds = DEFAULT_FRAME_RECOGNITION_SECONDS,
|
||||
TrackingDistanceConfidence = TRACKING_DISTANCE_CONFIDENCE,
|
||||
TrackingProbabilityIncrease = TRACKING_PROBABILITY_INCREASE,
|
||||
TrackingIntersectionThreshold = TRACKING_INTERSECTION_THRESHOLD,
|
||||
FramePeriodRecognition = DEFAULT_FRAME_PERIOD_RECOGNITION
|
||||
};
|
||||
|
||||
public const double DEFAULT_FRAME_RECOGNITION_SECONDS = 2;
|
||||
public const double TRACKING_DISTANCE_CONFIDENCE = 0.15;
|
||||
public const double TRACKING_PROBABILITY_INCREASE = 15;
|
||||
public const double TRACKING_INTERSECTION_THRESHOLD = 0.8;
|
||||
public const int DEFAULT_FRAME_PERIOD_RECOGNITION = 4;
|
||||
|
||||
# endregion AIRecognitionConfig
|
||||
|
||||
# region GpsDeniedConfig
|
||||
|
||||
public static readonly GpsDeniedConfig DefaultGpsDeniedConfig = new()
|
||||
{
|
||||
MinKeyPoints = 15
|
||||
};
|
||||
|
||||
# endregion
|
||||
|
||||
#region Thumbnails
|
||||
|
||||
public static readonly ThumbnailConfig DefaultThumbnailConfig = new()
|
||||
{
|
||||
Size = DefaultThumbnailSize,
|
||||
Border = DEFAULT_THUMBNAIL_BORDER
|
||||
};
|
||||
|
||||
public static readonly Size DefaultThumbnailSize = new(240, 135);
|
||||
|
||||
public const int DEFAULT_THUMBNAIL_BORDER = 10;
|
||||
|
||||
public const string THUMBNAIL_PREFIX = "_thumb";
|
||||
public const string RESULT_PREFIX = "_result";
|
||||
|
||||
#endregion
|
||||
|
||||
public const string MQ_ANNOTATIONS_QUEUE = "azaion-annotations";
|
||||
|
||||
#region Database
|
||||
|
||||
public const string ANNOTATIONS_TABLENAME = "annotations";
|
||||
public const string ANNOTATIONS_QUEUE_TABLENAME = "annotations_queue";
|
||||
public const string ADMIN_EMAIL = "admin@azaion.com";
|
||||
public const string DETECTIONS_TABLENAME = "detections";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Mode Captions
|
||||
|
||||
public const string REGULAR_MODE_CAPTION = "Норма";
|
||||
public const string WINTER_MODE_CAPTION = "Зима";
|
||||
public const string NIGHT_MODE_CAPTION = "Ніч";
|
||||
|
||||
#endregion
|
||||
|
||||
public const string CSV_PATH = "matches.csv";
|
||||
|
||||
|
||||
public static readonly InitConfig DefaultInitConfig = new()
|
||||
{
|
||||
LoaderClientConfig = new LoaderClientConfig
|
||||
@@ -51,14 +179,60 @@ public class SecurityConstants
|
||||
GpsDeniedClientConfig = new GpsDeniedClientConfig
|
||||
{
|
||||
ZeroMqHost = DEFAULT_ZMQ_GPS_DENIED_HOST,
|
||||
ZeroMqPort = DEFAULT_ZMQ_GPS_DENIED_PORT
|
||||
ZeroMqPort = DEFAULT_ZMQ_GPS_DENIED_PORT,
|
||||
ZeroMqReceiverPort = DEFAULT_ZMQ_GPS_DENIED_PUBLISH_PORT
|
||||
},
|
||||
DirectoriesConfig = new DirectoriesConfig
|
||||
{
|
||||
ApiResourcesDirectory = ""
|
||||
}
|
||||
};
|
||||
#endregion ExternalClientsConfig
|
||||
|
||||
public static readonly AppConfig FailsafeAppConfig = new()
|
||||
{
|
||||
AnnotationConfig = DefaultAnnotationConfig,
|
||||
|
||||
UIConfig = new UIConfig
|
||||
{
|
||||
LeftPanelWidth = DEFAULT_LEFT_PANEL_WIDTH,
|
||||
RightPanelWidth = DEFAULT_RIGHT_PANEL_WIDTH,
|
||||
GenerateAnnotatedImage = false
|
||||
},
|
||||
|
||||
DirectoriesConfig = new DirectoriesConfig
|
||||
{
|
||||
VideosDirectory = DEFAULT_VIDEO_DIR,
|
||||
ImagesDirectory = DEFAULT_IMAGES_DIR,
|
||||
LabelsDirectory = DEFAULT_LABELS_DIR,
|
||||
ResultsDirectory = DEFAULT_RESULTS_DIR,
|
||||
ThumbnailsDirectory = DEFAULT_THUMBNAILS_DIR,
|
||||
GpsSatDirectory = DEFAULT_GPS_SAT_DIRECTORY,
|
||||
GpsRouteDirectory = DEFAULT_GPS_ROUTE_DIRECTORY
|
||||
},
|
||||
|
||||
ThumbnailConfig = DefaultThumbnailConfig,
|
||||
AIRecognitionConfig = DefaultAIRecognitionConfig,
|
||||
GpsDeniedConfig = DefaultGpsDeniedConfig,
|
||||
|
||||
LoaderClientConfig = new LoaderClientConfig
|
||||
{
|
||||
ZeroMqHost = DEFAULT_ZMQ_LOADER_HOST,
|
||||
ZeroMqPort = DEFAULT_ZMQ_LOADER_PORT,
|
||||
ApiUrl = DEFAULT_API_URL
|
||||
},
|
||||
InferenceClientConfig = new InferenceClientConfig
|
||||
{
|
||||
ZeroMqHost = DEFAULT_ZMQ_INFERENCE_HOST,
|
||||
ZeroMqPort = DEFAULT_ZMQ_INFERENCE_PORT,
|
||||
ApiUrl = DEFAULT_API_URL
|
||||
},
|
||||
GpsDeniedClientConfig = new GpsDeniedClientConfig
|
||||
{
|
||||
ZeroMqHost = DEFAULT_ZMQ_GPS_DENIED_HOST,
|
||||
ZeroMqPort = DEFAULT_ZMQ_GPS_DENIED_PORT,
|
||||
ZeroMqReceiverPort = DEFAULT_ZMQ_GPS_DENIED_PUBLISH_PORT
|
||||
}
|
||||
};
|
||||
|
||||
public static InitConfig ReadInitConfig(ILogger logger)
|
||||
{
|
||||
|
||||
@@ -28,7 +28,7 @@ public class AzaionApi(ILogger logger, HttpClient client, ICache cache, ApiCrede
|
||||
{
|
||||
get
|
||||
{
|
||||
var user = cache.GetFromCache(SecurityConstants.CURRENT_USER_CACHE_KEY,
|
||||
var user = cache.GetFromCache(Constants.CURRENT_USER_CACHE_KEY,
|
||||
() => Get<User>("currentUser"));
|
||||
if (user == null)
|
||||
throw new Exception("Can't get current user");
|
||||
|
||||
@@ -40,7 +40,7 @@ public class GpsMatcherService(IGpsMatcherClient gpsMatcherClient,
|
||||
|
||||
public async Task RunGpsMatching(string userRouteDir, GeoPoint initGeoPoint, CancellationToken detectToken = default)
|
||||
{
|
||||
_routeDir = Path.Combine(SecurityConstants.EXTERNAL_GPS_DENIED_FOLDER, _dirConfig.GpsRouteDirectory);
|
||||
_routeDir = Path.Combine(Constants.EXTERNAL_GPS_DENIED_FOLDER, _dirConfig.GpsRouteDirectory);
|
||||
_userRouteDir = userRouteDir;
|
||||
|
||||
_allRouteImages = Directory.GetFiles(userRouteDir)
|
||||
|
||||
@@ -49,9 +49,9 @@ public class GpsMatcherClient : IGpsMatcherClient
|
||||
using var process = new Process();
|
||||
process.StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = SecurityConstants.ExternalGpsDeniedPath,
|
||||
FileName = Constants.ExternalGpsDeniedPath,
|
||||
Arguments = $"zeromq --rep {gpsConfig.Value.ZeroMqPort} --pub {gpsConfig.Value.ZeroMqReceiverPort}",
|
||||
WorkingDirectory = SecurityConstants.EXTERNAL_GPS_DENIED_FOLDER,
|
||||
WorkingDirectory = Constants.EXTERNAL_GPS_DENIED_FOLDER,
|
||||
CreateNoWindow = true
|
||||
};
|
||||
process.Start();
|
||||
|
||||
@@ -45,7 +45,7 @@ public class InferenceClient : IInferenceClient
|
||||
using var process = new Process();
|
||||
process.StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = SecurityConstants.EXTERNAL_INFERENCE_PATH,
|
||||
FileName = Constants.EXTERNAL_INFERENCE_PATH,
|
||||
Arguments = $"-p {_inferenceClientConfig.ZeroMqPort} -lp {_loaderClientConfig.ZeroMqPort} -a {_inferenceClientConfig.ApiUrl}",
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
@@ -22,7 +22,7 @@ public class LoaderClient(LoaderClientConfig config, ILogger logger, Cancellatio
|
||||
using var process = new Process();
|
||||
process.StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = SecurityConstants.EXTERNAL_LOADER_PATH,
|
||||
FileName = Constants.EXTERNAL_LOADER_PATH,
|
||||
Arguments = $"--port {config.ZeroMqPort} --api {config.ApiUrl}",
|
||||
CreateNoWindow = true
|
||||
};
|
||||
|
||||
@@ -43,7 +43,7 @@ public class SatelliteDownloader(
|
||||
private const int OUTPUT_TILE_SIZE = 512;
|
||||
|
||||
private readonly string _apiKey = mapConfig.Value.ApiKey;
|
||||
private readonly string _satDirectory = Path.Combine(SecurityConstants.EXTERNAL_GPS_DENIED_FOLDER, directoriesConfig.Value.GpsSatDirectory);
|
||||
private readonly string _satDirectory = Path.Combine(Constants.EXTERNAL_GPS_DENIED_FOLDER, directoriesConfig.Value.GpsSatDirectory);
|
||||
|
||||
public async Task GetTiles(GeoPoint centerGeoPoint, double radiusM, int zoomLevel, CancellationToken token = default)
|
||||
{
|
||||
|
||||
@@ -107,7 +107,7 @@ public partial class App
|
||||
try
|
||||
{
|
||||
new ConfigUpdater().CheckConfig();
|
||||
var initConfig = SecurityConstants.ReadInitConfig(Log.Logger);
|
||||
var initConfig = Constants.ReadInitConfig(Log.Logger);
|
||||
var apiDir = initConfig.DirectoriesConfig.ApiResourcesDirectory;
|
||||
_loaderClient = new LoaderClient(initConfig.LoaderClientConfig, Log.Logger, _mainCTokenSource.Token);
|
||||
|
||||
@@ -120,7 +120,7 @@ public partial class App
|
||||
_host = Host.CreateDefaultBuilder()
|
||||
.ConfigureAppConfiguration((_, config) => config
|
||||
.AddCommandLine(Environment.GetCommandLineArgs())
|
||||
.AddJsonFile(SecurityConstants.CONFIG_PATH, optional: true, reloadOnChange: true)
|
||||
.AddJsonFile(Constants.CONFIG_PATH, optional: true, reloadOnChange: true)
|
||||
.AddJsonStream(GetSystemConfig(_loaderClient, apiDir))
|
||||
.AddJsonStream(GetSecuredConfig(_loaderClient, apiDir)))
|
||||
.UseSerilog()
|
||||
|
||||
Reference in New Issue
Block a user