diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2244c84..24cc425 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -19,7 +19,7 @@ jobs: - name: Install .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Restore the application run: nuget restore @@ -30,8 +30,8 @@ jobs: - name: Upload build artifacts uses: actions/upload-artifact@v3 with: - name: net7.0_windows - path: Audio.Desktop/bin/Release/net7.0/win-x64/publish + name: net8.0_windows + path: Audio.Desktop/bin/Release/net8.0/win-x64/publish osx: runs-on: ubuntu-latest @@ -43,7 +43,7 @@ jobs: - name: Install .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Restore the application run: nuget restore @@ -54,5 +54,5 @@ jobs: - name: Upload build artifacts uses: actions/upload-artifact@v3 with: - name: net7.0_osx - path: Audio.Desktop/bin/Release/net7.0/osx-x64/publish \ No newline at end of file + name: net8.0_osx + path: Audio.Desktop/bin/Release/net8.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 49ecd77..b9cce9a 100644 --- a/Audio.Desktop/Audio.Desktop.csproj +++ b/Audio.Desktop/Audio.Desktop.csproj @@ -3,33 +3,24 @@ WinExe - net7.0 + net8.0 enable true app.manifest True true true - AnyCPU;x64 - - - win-x64 - - - - osx-64 - - + - + - + @@ -40,6 +31,12 @@ + + + + + + diff --git a/Audio.sln b/Audio.sln index c162467..b22c3b1 100644 --- a/Audio.sln +++ b/Audio.sln @@ -10,27 +10,17 @@ EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU - Debug|x64 = Debug|x64 Release|Any CPU = Release|Any CPU - Release|x64 = Release|x64 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution {380008C4-71AF-48B5-AB70-03968CD4826B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {380008C4-71AF-48B5-AB70-03968CD4826B}.Debug|Any CPU.Build.0 = Debug|Any CPU - {380008C4-71AF-48B5-AB70-03968CD4826B}.Debug|x64.ActiveCfg = Debug|Any CPU - {380008C4-71AF-48B5-AB70-03968CD4826B}.Debug|x64.Build.0 = Debug|Any CPU {380008C4-71AF-48B5-AB70-03968CD4826B}.Release|Any CPU.ActiveCfg = Release|Any CPU {380008C4-71AF-48B5-AB70-03968CD4826B}.Release|Any CPU.Build.0 = Release|Any CPU - {380008C4-71AF-48B5-AB70-03968CD4826B}.Release|x64.ActiveCfg = Release|x64 - {380008C4-71AF-48B5-AB70-03968CD4826B}.Release|x64.Build.0 = Release|x64 {5E7ED7B4-8376-4BBE-BEA3-4FE9E696C819}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {5E7ED7B4-8376-4BBE-BEA3-4FE9E696C819}.Debug|Any CPU.Build.0 = Debug|Any CPU - {5E7ED7B4-8376-4BBE-BEA3-4FE9E696C819}.Debug|x64.ActiveCfg = Debug|x64 - {5E7ED7B4-8376-4BBE-BEA3-4FE9E696C819}.Debug|x64.Build.0 = Debug|x64 {5E7ED7B4-8376-4BBE-BEA3-4FE9E696C819}.Release|Any CPU.ActiveCfg = Release|Any CPU {5E7ED7B4-8376-4BBE-BEA3-4FE9E696C819}.Release|Any CPU.Build.0 = Release|Any CPU - {5E7ED7B4-8376-4BBE-BEA3-4FE9E696C819}.Release|x64.ActiveCfg = Release|x64 - {5E7ED7B4-8376-4BBE-BEA3-4FE9E696C819}.Release|x64.Build.0 = Release|x64 EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/Audio/Audio.csproj b/Audio/Audio.csproj index e47200c..d18a2dc 100644 --- a/Audio/Audio.csproj +++ b/Audio/Audio.csproj @@ -1,6 +1,6 @@  - net7.0 + net8.0 enable latest diff --git a/Audio/Models/Utils/ConfigManager.cs b/Audio/Models/Utils/ConfigManager.cs index ff496ed..dc36ede 100644 --- a/Audio/Models/Utils/ConfigManager.cs +++ b/Audio/Models/Utils/ConfigManager.cs @@ -17,12 +17,8 @@ public void Load() { try { - var options = new JsonSerializerOptions() - { - WriteIndented = true - }; var json = File.ReadAllText(ConfigPath); - var clone = JsonSerializer.Deserialize(json, options); + var clone = JsonSerializer.Deserialize(json, ConfigManagerContext.Default.ConfigManager); VOPath = clone.VOPath; EventPath = clone.EventPath; @@ -35,13 +31,9 @@ public void Save() { try { - var options = new JsonSerializerOptions() - { - WriteIndented = true - }; - var str = JsonSerializer.Serialize(this, options); + var str = JsonSerializer.Serialize(this, ConfigManagerContext.Default.ConfigManager); File.WriteAllText(ConfigPath, str); } catch (Exception) { } } -} +} \ No newline at end of file diff --git a/Audio/Models/Utils/JsonSerializerContexts.cs b/Audio/Models/Utils/JsonSerializerContexts.cs new file mode 100644 index 0000000..0423d6f --- /dev/null +++ b/Audio/Models/Utils/JsonSerializerContexts.cs @@ -0,0 +1,13 @@ +using Audio.Models.Entries; +using System.Collections.Generic; +using System.Text.Json.Serialization; + +namespace Audio.Models.Utils; + +[JsonSourceGenerationOptions(WriteIndented = true)] +[JsonSerializable(typeof(ConfigManager))] +public partial class ConfigManagerContext : JsonSerializerContext { } + +[JsonSourceGenerationOptions(WriteIndented = true, UseStringEnumConverter = true)] +[JsonSerializable(typeof(IEnumerable))] +public partial class EntryContext : JsonSerializerContext { } \ No newline at end of file diff --git a/Audio/ViewModels/MainViewModel.cs b/Audio/ViewModels/MainViewModel.cs index 115d75e..df80a11 100644 --- a/Audio/ViewModels/MainViewModel.cs +++ b/Audio/ViewModels/MainViewModel.cs @@ -779,13 +779,7 @@ private void ExportAudio(List banks, string txtpDir) } private void DumpInfoInternal(string output) { - var options = new JsonSerializerOptions - { - ReferenceHandler = ReferenceHandler.IgnoreCycles, - WriteIndented = true - }; - options.Converters.Add(new JsonStringEnumConverter()); - var str = JsonSerializer.Serialize(Entries.Items, options); + var str = JsonSerializer.Serialize(Entries.Items, EntryContext.Default.IEnumerableEntry); File.WriteAllText(output, str); diff --git a/Audio/Views/MainView.axaml b/Audio/Views/MainView.axaml index 7bca9cb..cff44f7 100644 --- a/Audio/Views/MainView.axaml +++ b/Audio/Views/MainView.axaml @@ -7,7 +7,8 @@ xmlns:controls="clr-namespace:Audio.Controls" mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450" x:Class="Audio.Views.MainView" - x:DataType="vm:MainViewModel"> + x:DataType="vm:MainViewModel" + x:CompileBindings="True">