From cdb8ab6168533a5019b6cbc8440ea54116ae8541 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E9=87=91=E5=88=9A?= <1219318552@qq.com>
Date: Sat, 20 Jul 2024 11:24:05 +0800
Subject: [PATCH] fix: copy resources after build or publish
---
TuneLab/App.axaml.cs | 5 -----
TuneLab/Program.cs | 12 ++++++++++++
TuneLab/TuneLab.csproj | 12 +++++-------
3 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/TuneLab/App.axaml.cs b/TuneLab/App.axaml.cs
index 20037b2..5d17038 100644
--- a/TuneLab/App.axaml.cs
+++ b/TuneLab/App.axaml.cs
@@ -43,11 +43,6 @@ public override void OnFrameworkInitializationCompleted()
AudioEngine.Destroy();
};
- // init translation
- TranslationManager.Init(PathManager.TranslationsFolder);
- TranslationManager.CurrentLanguage.Value = TranslationManager.Languages.Contains(Settings.Language.Value) ? Settings.Language : TranslationManager.GetCurrentOSLanguage();
- Settings.Language.Modified.Subscribe(() => TranslationManager.CurrentLanguage.Value = Settings.Language);
-
// init audio engine
AudioUtils.Init(new NAudioCodec());
AudioEngine.Init(new SDLPlaybackHandler());
diff --git a/TuneLab/Program.cs b/TuneLab/Program.cs
index a486d19..1edde0d 100644
--- a/TuneLab/Program.cs
+++ b/TuneLab/Program.cs
@@ -1,11 +1,13 @@
using System;
using System.Diagnostics;
using System.IO;
+using System.Linq;
using Avalonia;
using Avalonia.Media;
using Avalonia.ReactiveUI;
using TuneLab.Base.Utils;
using TuneLab.Configs;
+using TuneLab.I18N;
using TuneLab.Utils;
namespace TuneLab;
@@ -18,9 +20,11 @@ class Program
[STAThread]
public static void Main(string[] args)
{
+ // init logger
Log.SetupLogger(new FileLogger(Path.Combine(PathManager.LogsFolder, "TuneLab_" + DateTime.Now.ToString("yyyy-MM-dd_hh-mm-ss") + ".log")));
Log.Info("Version: " + AppInfo.Version);
+ // check if other instance is running
var lockFile = LockFile.Create(PathManager.LockFilePath);
if (lockFile == null)
{
@@ -30,11 +34,19 @@ public static void Main(string[] args)
return;
}
+ // init setting
Settings.Init(PathManager.SettingsFilePath);
+ // init translation
+ TranslationManager.Init(PathManager.TranslationsFolder);
+ TranslationManager.CurrentLanguage.Value = TranslationManager.Languages.Contains(Settings.Language.Value) ? Settings.Language : TranslationManager.GetCurrentOSLanguage();
+ Settings.Language.Modified.Subscribe(() => TranslationManager.CurrentLanguage.Value = Settings.Language);
+
+ // event loop
BuildAvaloniaApp()
.StartWithClassicDesktopLifetime(args);
+ // exit
lockFile.Dispose();
}
diff --git a/TuneLab/TuneLab.csproj b/TuneLab/TuneLab.csproj
index 4c9b342..bbc8a44 100644
--- a/TuneLab/TuneLab.csproj
+++ b/TuneLab/TuneLab.csproj
@@ -46,11 +46,9 @@
-
-
-
-
-
-
-
+
+
+ Always
+
+