Skip to content

Commit

Permalink
Upgrade to .NET8
Browse files Browse the repository at this point in the history
  • Loading branch information
Razmoth committed Jan 22, 2024
1 parent da2ecb5 commit be455ae
Show file tree
Hide file tree
Showing 8 changed files with 36 additions and 49 deletions.
12 changes: 6 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
name: net8.0_osx
path: Audio.Desktop/bin/Release/net8.0/osx-x64/publish
23 changes: 10 additions & 13 deletions Audio.Desktop/Audio.Desktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,33 +3,24 @@
<OutputType>WinExe</OutputType>
<!--If you are willing to use Windows/MacOS native APIs you will need to create 3 projects.
One for Windows with net7.0-windows TFM, one for MacOS with net7.0-macos and one with net7.0 TFM for Linux.-->
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<ApplicationManifest>app.manifest</ApplicationManifest>
<SelfContained>True</SelfContained>
<PublishTrimmed>true</PublishTrimmed>
<PublishSingleFile>true</PublishSingleFile>
<Platforms>AnyCPU;x64</Platforms>
</PropertyGroup>

<PropertyGroup Condition="'$(RuntimeIdentifier)' == '' And '$(Platform)' == 'x64' And $([MSBuild]::IsOSPlatform('Windows'))">
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
</PropertyGroup>

<PropertyGroup Condition="'$(RuntimeIdentifier)' == '' And '$(Platform)' == 'x64' And $([MSBuild]::IsOSPlatform('OSX'))">
<RuntimeIdentifier>osx-64</RuntimeIdentifier>
</PropertyGroup>


<ItemGroup>
<PackageReference Include="Avalonia.Desktop" Version="11.0.5" />
</ItemGroup>

<ItemGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
<ItemGroup Condition="$(RuntimeIdentifier.StartsWith('win'))">
<PackageReference Include="VideoLAN.LibVLC.Windows" Version="3.0.20" />
</ItemGroup>

<ItemGroup Condition="'$(RuntimeIdentifier)' == 'osx-64'">
<ItemGroup Condition="$(RuntimeIdentifier.StartsWith('osx'))">
<PackageReference Include="VideoLAN.LibVLC.Mac" Version="3.1.3.1" />
</ItemGroup>

Expand All @@ -40,6 +31,12 @@
<VlcWindowsX64IncludeFiles Include="plugins\audio_output\libmmdevice_plugin.dll" />
<VlcWindowsX64IncludeFiles Include="plugins\audio_output\libwasapi_plugin.dll" />
<VlcWindowsX64IncludeFiles Include="plugins\codec\libavcodec_plugin.dll" />
<VlcWindowsX86IncludeFiles Include="libvlc.dll" />
<VlcWindowsX86IncludeFiles Include="libvlccore.dll" />
<VlcWindowsX86IncludeFiles Include="plugins\access\libfilesystem_plugin.dll" />
<VlcWindowsX86IncludeFiles Include="plugins\audio_output\libmmdevice_plugin.dll" />
<VlcWindowsX86IncludeFiles Include="plugins\audio_output\libwasapi_plugin.dll" />
<VlcWindowsX86IncludeFiles Include="plugins\codec\libavcodec_plugin.dll" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 0 additions & 10 deletions Audio.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion Audio/Audio.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<TargetFramework>net8.0</TargetFramework>
<Nullable>enable</Nullable>
<LangVersion>latest</LangVersion>
</PropertyGroup>
Expand Down
14 changes: 3 additions & 11 deletions Audio/Models/Utils/ConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,8 @@ public void Load()
{
try
{
var options = new JsonSerializerOptions()
{
WriteIndented = true
};
var json = File.ReadAllText(ConfigPath);
var clone = JsonSerializer.Deserialize<ConfigManager>(json, options);
var clone = JsonSerializer.Deserialize(json, ConfigManagerContext.Default.ConfigManager);

VOPath = clone.VOPath;
EventPath = clone.EventPath;
Expand All @@ -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) { }
}
}
}
13 changes: 13 additions & 0 deletions Audio/Models/Utils/JsonSerializerContexts.cs
Original file line number Diff line number Diff line change
@@ -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<Entry>))]
public partial class EntryContext : JsonSerializerContext { }
8 changes: 1 addition & 7 deletions Audio/ViewModels/MainViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -779,13 +779,7 @@ private void ExportAudio(List<Bank> 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);

Expand Down
3 changes: 2 additions & 1 deletion Audio/Views/MainView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
<Design.DataContext>
<!-- This only sets the DataContext for the previewer in an IDE,
to set the actual DataContext for runtime, set the DataContext property in code (look at App.axaml.cs) -->
Expand Down

0 comments on commit be455ae

Please sign in to comment.