diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index c1f3d94..f3d3daa 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -9,10 +9,56 @@ on:
workflow_dispatch:
jobs:
+ windows:
+ runs-on: windows-latest
- build:
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
- runs-on: windows-latest
+ - name: Install .NET Core
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: 7.0.x
+
+ - name: Restore the application
+ run: nuget restore
+
+ - name: Build for Windows
+ run: dotnet publish Audio_Desktop -c Release -r win-x64
+
+ - name: Upload build artifacts
+ uses: actions/upload-artifact@v3
+ with:
+ name: net7.0_windows
+ path: Audio.Desktop/bin/Release/net7.0/win-x64/publish
+
+ linux:
+ runs-on: ubuntu-latest
+
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v3
+
+ - name: Install .NET Core
+ uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: 7.0.x
+
+ - name: Restore the application
+ run: nuget restore
+
+ - name: Build for Linux
+ run: dotnet publish Audio_Desktop -c Release -r linux-x64
+
+ - name: Upload build artifacts
+ uses: actions/upload-artifact@v3
+ with:
+ name: net7.0_linux
+ path: Audio.Desktop/bin/Release/net7.0/linux-x64/publish
+
+ mac:
+ runs-on: macos-latest
steps:
- name: Checkout
@@ -26,11 +72,11 @@ jobs:
- name: Restore the application
run: nuget restore
- - name: Build the application
- run: dotnet publish /t:Audio_Desktop /p:Configuration=Release
+ - name: Build for Mac
+ run: dotnet publish Audio_Desktop -c Release -r osx-x64
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
- name: net7.0
- path: Audio.Desktop/bin/Release/net7.0/publish
+ name: net7.0_mac
+ path: Audio.Desktop/bin/Release/net7.0/osx-x64/publish
\ No newline at end of file
diff --git a/Audio.Desktop/Audio.Desktop.csproj b/Audio.Desktop/Audio.Desktop.csproj
index 2c89c4c..ddc9103 100644
--- a/Audio.Desktop/Audio.Desktop.csproj
+++ b/Audio.Desktop/Audio.Desktop.csproj
@@ -10,10 +10,9 @@
-
-
-
-
+
+
+
diff --git a/Audio/Models/Utils/ConfigManager.cs b/Audio/Models/Utils/ConfigManager.cs
new file mode 100644
index 0000000..ff496ed
--- /dev/null
+++ b/Audio/Models/Utils/ConfigManager.cs
@@ -0,0 +1,47 @@
+using System;
+using System.IO;
+using System.Text.Json;
+using System.Text.Json.Serialization;
+
+namespace Audio.Models.Utils;
+public class ConfigManager
+{
+ private readonly string ConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "config.json");
+ [JsonIgnore]
+ public static ConfigManager Instance { get; private set; } = new ConfigManager();
+ public string VOPath { get; set; }
+ public string EventPath { get; set; }
+ public string WWiserPath { get; set; }
+ public string VGMStreamPath { get; set; }
+ public void Load()
+ {
+ try
+ {
+ var options = new JsonSerializerOptions()
+ {
+ WriteIndented = true
+ };
+ var json = File.ReadAllText(ConfigPath);
+ var clone = JsonSerializer.Deserialize(json, options);
+
+ VOPath = clone.VOPath;
+ EventPath = clone.EventPath;
+ WWiserPath = clone.WWiserPath;
+ VGMStreamPath = clone.VGMStreamPath;
+ }
+ catch (Exception) { }
+ }
+ public void Save()
+ {
+ try
+ {
+ var options = new JsonSerializerOptions()
+ {
+ WriteIndented = true
+ };
+ var str = JsonSerializer.Serialize(this, options);
+ File.WriteAllText(ConfigPath, str);
+ }
+ catch (Exception) { }
+ }
+}
diff --git a/Audio/ViewModels/MainViewModel.cs b/Audio/ViewModels/MainViewModel.cs
index f5d0cb4..497462d 100644
--- a/Audio/ViewModels/MainViewModel.cs
+++ b/Audio/ViewModels/MainViewModel.cs
@@ -38,8 +38,6 @@ public partial class MainViewModel : ViewModelBase
private double _time;
private bool _isPlay;
- public string WWiserPath { get; set; }
- public string VGMStreamPath { get; set; }
public FileInfo PreviewInput { get; set; }
public FileInfo PreviewOutput { get; set; }
public List Packages { get; set; }
@@ -121,8 +119,46 @@ public double Time
get => _time;
set => this.RaiseAndSetIfChanged(ref _time, value);
}
+ public string VOPath
+ {
+ get => ConfigManager.Instance.VOPath;
+ set
+ {
+ ConfigManager.Instance.VOPath = value;
+ ConfigManager.Instance.Save();
+ }
+ }
+ public string EventPath
+{
+ get => ConfigManager.Instance.EventPath;
+ set
+ {
+ ConfigManager.Instance.EventPath = value;
+ ConfigManager.Instance.Save();
+ }
+ }
+ public string WWiserPath
+{
+ get => ConfigManager.Instance.WWiserPath;
+ set
+ {
+ ConfigManager.Instance.WWiserPath = value;
+ ConfigManager.Instance.Save();
+ }
+ }
+ public string VGMStreamPath
+ {
+ get => ConfigManager.Instance.VGMStreamPath;
+ set
+ {
+ ConfigManager.Instance.VGMStreamPath = value;
+ ConfigManager.Instance.Save();
+ }
+ }
public MainViewModel()
{
+ ConfigManager.Instance.Load();
+
SearchText = "";
ClipboardText = "";
StatusText = "";
@@ -133,8 +169,6 @@ public MainViewModel()
PreviewInput = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "preview.wem"));
PreviewOutput = new FileInfo(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "preview.wav"));
- ProgressHelper.Instance = new Progress(value => ProgressValue = value);
-
Packages = new List();
Entries = new SourceList();
SelectedEntries = new List();
@@ -156,6 +190,7 @@ public MainViewModel()
EntrySource.RowSelection!.SelectionChanged += EntrySource_SelectionChanged;
AudioPreviewCommand = ReactiveCommand.Create(PreviewAudio, CanPreviewAudio);
+ ProgressHelper.Instance = new Progress(value => ProgressValue = value);
}
private void EntrySource_SelectionChanged(object? sender, Avalonia.Controls.Selection.TreeSelectionModelSelectionChangedEventArgs e)
@@ -178,10 +213,6 @@ public void Dispose()
_mediaPlayer?.Dispose();
_vlcLib?.Dispose();
- if (PreviewInput.Exists)
- {
- PreviewInput.Delete();
- }
if (PreviewOutput.Exists)
{
PreviewOutput.Delete();
@@ -200,8 +231,8 @@ public async void LoadFolder(string folder)
public async void ExportAudios(string outputDir) => await Task.Run(() => Export(Entries.Items.Where(x => x is not Bank).ToList(), outputDir));
public async void ExportBanks(string outputDir) => await Task.Run(() => Export(Entries.Items.Where(x => x is Bank).ToList(), outputDir));
public async void ExportAll(string outputDir) => await Task.Run(() => Export(Entries.Items.ToList(), outputDir));
- public async void LoadVO(string path) => await Task.Run(() => LoadVOInternal(path));
- public async void GenerateTXTP(string file) => await Task.Run(() => GenerateTXTPInternal(file));
+ public async void LoadVO() => await Task.Run(LoadVOInternal);
+ public async void GenerateTXTP() => await Task.Run(GenerateTXTPInternal);
public async void LoadDIFF(string src, string dst) => await Task.Run(() => LoadDIFFInternal(src, dst));
public async void DumpInfo(string output) => await Task.Run(() => DumpInfoInternal(output));
public void SelectAll()
@@ -252,6 +283,11 @@ public void LoadAudio()
using var process = Process.Start(startInfo);
process.WaitForExit();
+ if (PreviewInput.Exists)
+ {
+ PreviewInput.Delete();
+ }
+
if (PreviewOutput.Exists)
{
MediaPlayer.Media = new Media(_vlcLib, PreviewOutput.FullName);
@@ -436,13 +472,19 @@ private async void LoadDIFFInternal(string src, string dst)
Entries.AddRange(diff);
Refresh();
}
- private async void LoadVOInternal(string path)
+ private async void LoadVOInternal()
{
+ if (string.IsNullOrEmpty(VOPath))
+ {
+ StatusText = "VO path must be set first !!";
+ return;
+ }
+
StatusText = "Parsing VO file...";
var voMap = new Dictionary();
- var vos = await File.ReadAllLinesAsync(path);
+ var vos = await File.ReadAllLinesAsync(VOPath);
ProgressHelper.Reset();
for (int i = 0; i < vos.Length; i++)
{
@@ -468,7 +510,7 @@ private async void LoadVOInternal(string path)
}
Refresh();
- StatusText = $"VO file {Path.GetFileName(path)} Loaded Successfully, Matched {matched} out of {externals.Length} externals !!";
+ StatusText = $"VO file {Path.GetFileName(VOPath)} Loaded Successfully, Matched {matched} out of {externals.Length} externals !!";
}
private void Export(List entries, string outputDir)
{
@@ -545,8 +587,20 @@ private void Refresh()
var parsed = await Task.Run(() => Package.Parse(path, out package));
return (parsed, package);
}
- private void GenerateTXTPInternal(string file)
+ private void GenerateTXTPInternal()
{
+ if (string.IsNullOrEmpty(WWiserPath))
+ {
+ StatusText = "WWiser path must be set first !!";
+ return;
+ }
+
+ if (string.IsNullOrEmpty(EventPath))
+ {
+ StatusText = "Event path must be set first !!";
+ return;
+ }
+
var outputDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "output");
var banksDir = Path.Combine(outputDir, "banks");
StatusText = AllowBanks ? "Exporting banks..." : "Exporting banks temporarly to temp folder...";
@@ -597,7 +651,7 @@ private void GenerateTXTPInternal(string file)
startInfo.ArgumentList.Add("-gde");
}
startInfo.ArgumentList.Add("-nl");
- startInfo.ArgumentList.Add(file);
+ startInfo.ArgumentList.Add(EventPath);
startInfo.ArgumentList.Add("-gl");
startInfo.ArgumentList.Add(folder.Name);
startInfo.ArgumentList.Add("-go");
@@ -635,7 +689,7 @@ private void GenerateTXTPInternal(string file)
startInfo.ArgumentList.Add("-gde");
}
startInfo.ArgumentList.Add("-nl");
- startInfo.ArgumentList.Add(file);
+ startInfo.ArgumentList.Add(EventPath);
startInfo.WorkingDirectory = outputDir;
startInfo.UseShellExecute = true;
using var process = Process.Start(startInfo);
diff --git a/Audio/Views/MainView.axaml b/Audio/Views/MainView.axaml
index ec5c59d..3fa6d84 100644
--- a/Audio/Views/MainView.axaml
+++ b/Audio/Views/MainView.axaml
@@ -45,11 +45,12 @@