queue + local sqlite WIP

This commit is contained in:
Alex Bezdieniezhnykh
2024-12-17 18:46:33 +02:00
parent 626767469a
commit 5fa18aa514
47 changed files with 694 additions and 222 deletions
@@ -15,4 +15,9 @@ public class AnnotationConfig
public List<string> VideoFormats { get; set; } = null!;
public List<string> ImageFormats { get; set; } = null!;
public string AnnotationsDbFile { get; set; } = null!;
public double LeftPanelWidth { get; set; }
public double RightPanelWidth { get; set; }
}
@@ -1,8 +0,0 @@
namespace Azaion.Common.DTO.Config;
public class AnnotatorWindowConfig
{
public double LeftPanelWidth { get; set; }
public double RightPanelWidth { get; set; }
public bool ShowHelpOnStart { get; set; }
}
-8
View File
@@ -1,8 +0,0 @@
namespace Azaion.Common.DTO.Config;
public class ApiConfig
{
public string Url { get; set; } = null!;
public int RetryCount {get;set;}
public double TimeoutSeconds { get; set; }
}
+12 -11
View File
@@ -1,5 +1,7 @@
using System.IO;
using System.Text;
using Azaion.CommonSecurity;
using Azaion.CommonSecurity.DTO;
using Newtonsoft.Json;
namespace Azaion.Common.DTO.Config;
@@ -8,12 +10,12 @@ public class AppConfig
{
public ApiConfig ApiConfig { get; set; } = null!;
public QueueConfig QueueConfig { get; set; } = null!;
public DirectoriesConfig DirectoriesConfig { get; set; } = null!;
public AnnotationConfig AnnotationConfig { get; set; } = null!;
public AnnotatorWindowConfig AnnotatorWindowConfig { get; set; } = null!;
public AIRecognitionConfig AIRecognitionConfig { get; set; } = null!;
public ThumbnailConfig ThumbnailConfig { get; set; } = null!;
@@ -30,7 +32,7 @@ public class ConfigUpdater : IConfigUpdater
public void CheckConfig()
{
var exePath = Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory)!;
var configFilePath = Path.Combine(exePath, Constants.CONFIG_PATH);
var configFilePath = Path.Combine(exePath, SecurityConstants.CONFIG_PATH);
if (File.Exists(configFilePath))
return;
@@ -39,9 +41,9 @@ public class ConfigUpdater : IConfigUpdater
{
ApiConfig = new ApiConfig
{
Url = Constants.DEFAULT_API_URL,
RetryCount = Constants.DEFAULT_API_RETRY_COUNT,
TimeoutSeconds = Constants.DEFAULT_API_TIMEOUT_SECONDS
Url = SecurityConstants.DEFAULT_API_URL,
RetryCount = SecurityConstants.DEFAULT_API_RETRY_COUNT,
TimeoutSeconds = SecurityConstants.DEFAULT_API_TIMEOUT_SECONDS
},
AnnotationConfig = new AnnotationConfig
@@ -49,12 +51,11 @@ public class ConfigUpdater : IConfigUpdater
AnnotationClasses = Constants.DefaultAnnotationClasses,
VideoFormats = Constants.DefaultVideoFormats,
ImageFormats = Constants.DefaultImageFormats,
},
AnnotatorWindowConfig = new AnnotatorWindowConfig
{
LeftPanelWidth = Constants.DEFAULT_LEFT_PANEL_WIDTH,
RightPanelWidth = Constants.DEFAULT_RIGHT_PANEL_WIDTH
RightPanelWidth = Constants.DEFAULT_RIGHT_PANEL_WIDTH,
AnnotationsDbFile = Constants.DEFAULT_ANNOTATIONS_DB_FILE
},
DirectoriesConfig = new DirectoriesConfig
@@ -86,6 +87,6 @@ public class ConfigUpdater : IConfigUpdater
public void Save(AppConfig config)
{
File.WriteAllText(Constants.CONFIG_PATH, JsonConvert.SerializeObject(config, Formatting.Indented), Encoding.UTF8);
File.WriteAllText(SecurityConstants.CONFIG_PATH, JsonConvert.SerializeObject(config, Formatting.Indented), Encoding.UTF8);
}
}
+14
View File
@@ -0,0 +1,14 @@
namespace Azaion.Common.DTO.Config;
public class QueueConfig
{
public string Host { get; set; } = null!;
public int Port { get; set; }
public string ProducerUsername { get; set; } = null!;
public string ProducerPassword { get; set; } = null!;
public string ConsumerUsername { get; set; } = null!;
public string ConsumerPassword { get; set; } = null!;
}