Safer way of detecing platform

This commit is contained in:
Matt Nadareski
2021-10-05 09:54:02 -07:00
parent 76415ae04f
commit 7b01715a11
3 changed files with 8 additions and 18 deletions

View File

@@ -9,6 +9,7 @@
<PropertyGroup Condition="'$(RuntimeIdentifier)|$(Configuration)' == 'win-x64|Debug'">
<DefineConstants>WindowsDebug</DefineConstants>
</PropertyGroup>
<ItemGroup>
<Compile Update="**\*.xaml.cs">
<DependentUpon>%(Filename)</DependentUpon>

View File

@@ -1,5 +1,6 @@
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading.Tasks;
using ReactiveUI;
using RedBookPlayer.Models.Discs;
@@ -119,7 +120,6 @@ namespace RedBookPlayer.Models.Hardware
_filterStage = new FilterStage();
}
/// <summary>
/// Initialize the output with a given image
/// </summary>
@@ -367,13 +367,10 @@ namespace RedBookPlayer.Models.Hardware
{
_source = new PlayerSource(ProviderRead);
#if LINUX
if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
_soundOut = new Linux.AudioBackend(_source);
#elif MACOS
_soundOut = new Mac.AudioBackend(_source);
#elif WINDOWS
else if(RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
_soundOut = new Windows.AudioBackend(_source);
#endif
}
else
{

View File

@@ -2,19 +2,11 @@
<PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'linux-x64'">
<DefineConstants>LINUX</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'osx-x64'">
<DefineConstants>MAC</DefineConstants>
</PropertyGroup>
<PropertyGroup Condition="'$(RuntimeIdentifier)' == 'win-x64'">
<DefineConstants>WINDOWS</DefineConstants>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Aaru.CommonTypes" Version="5.3.0" />
<PackageReference Include="Aaru.Decoders" Version="5.3.0" />