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

View File

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

View File

@@ -2,19 +2,11 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netcoreapp3.1</TargetFramework> <TargetFramework>netcoreapp3.1</TargetFramework>
<RuntimeIdentifiers>win-x64;linux-x64</RuntimeIdentifiers>
<RuntimeIdentifier>linux-x64</RuntimeIdentifier>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup> </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> <ItemGroup>
<PackageReference Include="Aaru.CommonTypes" Version="5.3.0" /> <PackageReference Include="Aaru.CommonTypes" Version="5.3.0" />
<PackageReference Include="Aaru.Decoders" Version="5.3.0" /> <PackageReference Include="Aaru.Decoders" Version="5.3.0" />