mirror of
https://github.com/azaion/annotations.git
synced 2026-04-22 09:56:31 +00:00
add default api url in case of no config file
This commit is contained in:
@@ -5,7 +5,6 @@
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<UseWPF>true</UseWPF>
|
||||
<TargetFramework>net8.0-windows</TargetFramework>
|
||||
<ApplicationIcon>..\logo.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -31,10 +30,6 @@
|
||||
<PackageReference Include="YoloV8.Gpu" Version="5.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="logo.ico" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Azaion.Common\Azaion.Common.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
@@ -12,7 +12,6 @@ using Azaion.Common.DTO;
|
||||
using Azaion.Common.DTO.Config;
|
||||
using Azaion.Common.Extensions;
|
||||
using Azaion.Common.Services;
|
||||
using Azaion.Suite.Services;
|
||||
using Azaion.Dataset;
|
||||
using Azaion.Suite.Services.DTO;
|
||||
using CommandLine;
|
||||
@@ -40,16 +39,31 @@ public partial class App
|
||||
"Azaion.Dataset.dll"
|
||||
];
|
||||
|
||||
private static readonly IResourceLoader? ResourceLoader;
|
||||
private static readonly IResourceLoader? ResourceLoader = new ResourceLoader("", "", null!, null!);
|
||||
|
||||
static App()
|
||||
{
|
||||
var result = Parser.Default.ParseArguments<SuiteCommandLineOptions>(Environment.GetCommandLineArgs());
|
||||
if (result.Errors.Any())
|
||||
return;
|
||||
|
||||
ApiConfig apiConfig;
|
||||
try
|
||||
{
|
||||
if (File.Exists(Constants.CONFIG_PATH))
|
||||
throw new FileNotFoundException(Constants.CONFIG_PATH);
|
||||
var configStr = File.ReadAllText(Constants.CONFIG_PATH);
|
||||
var apiConfig = JsonConvert.DeserializeObject<AppConfig>(configStr)!.ApiConfig;
|
||||
apiConfig = JsonConvert.DeserializeObject<AppConfig>(configStr)!.ApiConfig;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Console.WriteLine(e);
|
||||
apiConfig = new ApiConfig
|
||||
{
|
||||
Url = "https://api.azaion.com",
|
||||
RetryCount = 3,
|
||||
TimeoutSeconds = 40
|
||||
};
|
||||
}
|
||||
var api = new AzaionApiClient(new HttpClient
|
||||
{
|
||||
BaseAddress = new Uri(apiConfig.Url),
|
||||
|
||||
Reference in New Issue
Block a user