mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Fix detection of .NET Core.
This commit is contained in:
@@ -46,7 +46,14 @@ namespace DiscImageChef.CommonTypes.Interop
|
|||||||
{
|
{
|
||||||
public static class DetectOS
|
public static class DetectOS
|
||||||
{
|
{
|
||||||
public static readonly bool IsMono = Type.GetType("Mono.Runtime") != null;
|
public static readonly bool IsMono =
|
||||||
|
RuntimeInformation.FrameworkDescription.StartsWith("Mono", StringComparison.Ordinal);
|
||||||
|
public static readonly bool IsNetFramework =
|
||||||
|
RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.Ordinal);
|
||||||
|
public static readonly bool IsNetCore =
|
||||||
|
RuntimeInformation.FrameworkDescription.StartsWith(".NET Core", StringComparison.Ordinal);
|
||||||
|
public static readonly bool IsNetNative =
|
||||||
|
RuntimeInformation.FrameworkDescription.StartsWith(".NET Native", StringComparison.Ordinal);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Checks if the underlying runtime runs in 64-bit mode
|
/// Checks if the underlying runtime runs in 64-bit mode
|
||||||
@@ -115,6 +122,7 @@ namespace DiscImageChef.CommonTypes.Interop
|
|||||||
return PlatformID.Linux;
|
return PlatformID.Linux;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
case "Darwin":
|
case "Darwin":
|
||||||
{
|
{
|
||||||
IntPtr pLen = Marshal.AllocHGlobal(sizeof(int));
|
IntPtr pLen = Marshal.AllocHGlobal(sizeof(int));
|
||||||
@@ -149,6 +157,7 @@ namespace DiscImageChef.CommonTypes.Interop
|
|||||||
|
|
||||||
return PlatformID.MacOSX;
|
return PlatformID.MacOSX;
|
||||||
}
|
}
|
||||||
|
|
||||||
case "GNU": return PlatformID.Hurd;
|
case "GNU": return PlatformID.Hurd;
|
||||||
case "FreeBSD":
|
case "FreeBSD":
|
||||||
case "GNU/kFreeBSD": return PlatformID.FreeBSD;
|
case "GNU/kFreeBSD": return PlatformID.FreeBSD;
|
||||||
@@ -308,27 +317,27 @@ namespace DiscImageChef.CommonTypes.Interop
|
|||||||
/// System name
|
/// System name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||||
public string sysname;
|
public readonly string sysname;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Node name
|
/// Node name
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||||
public string nodename;
|
public readonly string nodename;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Release level
|
/// Release level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||||
public string release;
|
public readonly string release;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Version level
|
/// Version level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||||
public string version;
|
public readonly string version;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Hardware level
|
/// Hardware level
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||||
public string machine;
|
public readonly string machine;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -33,6 +33,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using DiscImageChef.CommonTypes.Interop;
|
using DiscImageChef.CommonTypes.Interop;
|
||||||
using DiscImageChef.Devices;
|
using DiscImageChef.Devices;
|
||||||
using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID;
|
using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID;
|
||||||
@@ -70,7 +71,8 @@ namespace DiscImageChef.Core.Logging
|
|||||||
logSw.WriteLine("{0} {1} ({2}-bit)", DetectOS.GetPlatformName(platId, platVer), platVer,
|
logSw.WriteLine("{0} {1} ({2}-bit)", DetectOS.GetPlatformName(platId, platVer), platVer,
|
||||||
Environment.Is64BitOperatingSystem ? 64 : 32);
|
Environment.Is64BitOperatingSystem ? 64 : 32);
|
||||||
if(DetectOS.IsMono) logSw.WriteLine("Mono {0}", Version.GetMonoVersion());
|
if(DetectOS.IsMono) logSw.WriteLine("Mono {0}", Version.GetMonoVersion());
|
||||||
else logSw.WriteLine(".NET Framework {0}", Environment.Version);
|
else if(DetectOS.IsNetCore) logSw.WriteLine(".NET Core {0}", Version.GetNetCoreVersion());
|
||||||
|
else logSw.WriteLine(RuntimeInformation.FrameworkDescription);
|
||||||
|
|
||||||
logSw.WriteLine();
|
logSw.WriteLine();
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ using System;
|
|||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using DiscImageChef.CommonTypes.Interop;
|
using DiscImageChef.CommonTypes.Interop;
|
||||||
using DiscImageChef.Console;
|
using DiscImageChef.Console;
|
||||||
using Eto.Drawing;
|
using Eto.Drawing;
|
||||||
@@ -143,7 +144,8 @@ namespace DiscImageChef.Gui.Forms
|
|||||||
logSw.WriteLine("{0} {1} ({2}-bit)", DetectOS.GetPlatformName(platId, platVer), platVer,
|
logSw.WriteLine("{0} {1} ({2}-bit)", DetectOS.GetPlatformName(platId, platVer), platVer,
|
||||||
Environment.Is64BitOperatingSystem ? 64 : 32);
|
Environment.Is64BitOperatingSystem ? 64 : 32);
|
||||||
if(DetectOS.IsMono) logSw.WriteLine("Mono {0}", Version.GetMonoVersion());
|
if(DetectOS.IsMono) logSw.WriteLine("Mono {0}", Version.GetMonoVersion());
|
||||||
else logSw.WriteLine(".NET Framework {0}", Environment.Version);
|
else if(DetectOS.IsNetCore) logSw.WriteLine(".NET Core {0}", Version.GetNetCoreVersion());
|
||||||
|
else logSw.WriteLine(RuntimeInformation.FrameworkDescription);
|
||||||
|
|
||||||
logSw.WriteLine();
|
logSw.WriteLine();
|
||||||
|
|
||||||
@@ -161,8 +163,7 @@ namespace DiscImageChef.Gui.Forms
|
|||||||
foreach(LogEntry entry in ConsoleHandler.Entries)
|
foreach(LogEntry entry in ConsoleHandler.Entries)
|
||||||
if(entry.Type != "Info")
|
if(entry.Type != "Info")
|
||||||
logSw.WriteLine("{0}: ({1}) {2}", entry.Timestamp, entry.Type.ToLower(), entry.Message);
|
logSw.WriteLine("{0}: ({1}) {2}", entry.Timestamp, entry.Type.ToLower(), entry.Message);
|
||||||
else
|
else logSw.WriteLine("{0}: {1}", entry.Timestamp, entry.Message);
|
||||||
logSw.WriteLine("{0}: {1}", entry.Timestamp, entry.Message);
|
|
||||||
|
|
||||||
logSw.Close();
|
logSw.Close();
|
||||||
logFs.Close();
|
logFs.Close();
|
||||||
|
|||||||
Reference in New Issue
Block a user