Update to SK2 Alpha8 and .NET Core 2.0

pull/19/head
Yaakov 8 years ago
parent 0da80d9601
commit fb3e693755

@ -1,13 +1,11 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<OutputType>Exe</OutputType> <OutputType>Exe</OutputType>
<TargetFrameworks>netcoreapp1.1;net46</TargetFrameworks> <TargetFramework>netcoreapp2.0</TargetFramework>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo> <GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<RuntimeIdentifiers>win7-x86;win7-x64;ubuntu.16.10-x64;osx.10.12-x64</RuntimeIdentifiers>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="protobuf-net" Version="2.1.0" /> <PackageReference Include="protobuf-net" Version="2.1.0" />
<PackageReference Include="SteamKit2" Version="2.0.0-Alpha" /> <PackageReference Include="SteamKit2" Version="2.0.0-Alpha8" />
<PackageReference Include="system.componentmodel.typeconverter" Version="4.3.0" />
</ItemGroup> </ItemGroup>
</Project> </Project>

@ -12,8 +12,6 @@ namespace DepotDownloader
{ {
public static string GetSteamOS() public static string GetSteamOS()
{ {
#if NETCOREAPP1_1
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{ {
return "windows"; return "windows";
@ -27,22 +25,6 @@ namespace DepotDownloader
return "linux"; return "linux";
} }
#elif NET46
switch (Environment.OSVersion.Platform)
{
case PlatformID.Win32NT:
case PlatformID.Win32Windows:
return "windows";
case PlatformID.MacOSX:
return "macos";
case PlatformID.Unix:
return IsMacOSX() ? "macos" : "linux";
}
#else
#error Unknown Target Platform
#endif
return "unknown"; return "unknown";
} }
@ -145,52 +127,5 @@ namespace DepotDownloader
( sb, v ) => sb.Append( v.ToString( "x2" ) ) ( sb, v ) => sb.Append( v.ToString( "x2" ) )
).ToString(); ).ToString();
} }
#if NET46
[DllImport( "libc" )]
static extern int uname( IntPtr buf );
static int _isMacOSX = -1;
// Environment.OSVersion.Platform returns PlatformID.Unix under Mono on OS X
// Code adapted from Mono: mcs/class/Managed.Windows.Forms/System.Windows.Forms/XplatUI.cs
private static bool IsMacOSX()
{
if ( _isMacOSX != -1 )
return _isMacOSX == 1;
IntPtr buf = IntPtr.Zero;
try
{
// The size of the utsname struct varies from system to system, but this _seems_ more than enough
buf = Marshal.AllocHGlobal( 4096 );
if ( uname( buf ) == 0 )
{
string sys = Marshal.PtrToStringAnsi( buf );
if ( sys == "Darwin" )
{
_isMacOSX = 1;
return true;
}
}
}
catch
{
// Do nothing?
}
finally
{
if ( buf != IntPtr.Zero )
Marshal.FreeHGlobal( buf );
}
_isMacOSX = 0;
return false;
}
#endif
} }
} }

Loading…
Cancel
Save