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 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>
|
||||
/// Checks if the underlying runtime runs in 64-bit mode
|
||||
@@ -115,6 +122,7 @@ namespace DiscImageChef.CommonTypes.Interop
|
||||
return PlatformID.Linux;
|
||||
#endif
|
||||
}
|
||||
|
||||
case "Darwin":
|
||||
{
|
||||
IntPtr pLen = Marshal.AllocHGlobal(sizeof(int));
|
||||
@@ -149,6 +157,7 @@ namespace DiscImageChef.CommonTypes.Interop
|
||||
|
||||
return PlatformID.MacOSX;
|
||||
}
|
||||
|
||||
case "GNU": return PlatformID.Hurd;
|
||||
case "FreeBSD":
|
||||
case "GNU/kFreeBSD": return PlatformID.FreeBSD;
|
||||
@@ -308,27 +317,27 @@ namespace DiscImageChef.CommonTypes.Interop
|
||||
/// System name
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string sysname;
|
||||
public readonly string sysname;
|
||||
/// <summary>
|
||||
/// Node name
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string nodename;
|
||||
public readonly string nodename;
|
||||
/// <summary>
|
||||
/// Release level
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string release;
|
||||
public readonly string release;
|
||||
/// <summary>
|
||||
/// Version level
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string version;
|
||||
public readonly string version;
|
||||
/// <summary>
|
||||
/// Hardware level
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)]
|
||||
public string machine;
|
||||
public readonly string machine;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -33,6 +33,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using DiscImageChef.CommonTypes.Interop;
|
||||
using DiscImageChef.Devices;
|
||||
using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID;
|
||||
@@ -69,8 +70,9 @@ namespace DiscImageChef.Core.Logging
|
||||
logSw.WriteLine("################# System information #################");
|
||||
logSw.WriteLine("{0} {1} ({2}-bit)", DetectOS.GetPlatformName(platId, platVer), platVer,
|
||||
Environment.Is64BitOperatingSystem ? 64 : 32);
|
||||
if(DetectOS.IsMono) logSw.WriteLine("Mono {0}", Version.GetMonoVersion());
|
||||
else logSw.WriteLine(".NET Framework {0}", Environment.Version);
|
||||
if(DetectOS.IsMono) logSw.WriteLine("Mono {0}", Version.GetMonoVersion());
|
||||
else if(DetectOS.IsNetCore) logSw.WriteLine(".NET Core {0}", Version.GetNetCoreVersion());
|
||||
else logSw.WriteLine(RuntimeInformation.FrameworkDescription);
|
||||
|
||||
logSw.WriteLine();
|
||||
|
||||
|
||||
@@ -34,6 +34,7 @@ using System;
|
||||
using System.ComponentModel;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using DiscImageChef.CommonTypes.Interop;
|
||||
using DiscImageChef.Console;
|
||||
using Eto.Drawing;
|
||||
@@ -142,8 +143,9 @@ namespace DiscImageChef.Gui.Forms
|
||||
logSw.WriteLine("################# System information #################");
|
||||
logSw.WriteLine("{0} {1} ({2}-bit)", DetectOS.GetPlatformName(platId, platVer), platVer,
|
||||
Environment.Is64BitOperatingSystem ? 64 : 32);
|
||||
if(DetectOS.IsMono) logSw.WriteLine("Mono {0}", Version.GetMonoVersion());
|
||||
else logSw.WriteLine(".NET Framework {0}", Environment.Version);
|
||||
if(DetectOS.IsMono) logSw.WriteLine("Mono {0}", Version.GetMonoVersion());
|
||||
else if(DetectOS.IsNetCore) logSw.WriteLine(".NET Core {0}", Version.GetNetCoreVersion());
|
||||
else logSw.WriteLine(RuntimeInformation.FrameworkDescription);
|
||||
|
||||
logSw.WriteLine();
|
||||
|
||||
@@ -161,8 +163,7 @@ namespace DiscImageChef.Gui.Forms
|
||||
foreach(LogEntry entry in ConsoleHandler.Entries)
|
||||
if(entry.Type != "Info")
|
||||
logSw.WriteLine("{0}: ({1}) {2}", entry.Timestamp, entry.Type.ToLower(), entry.Message);
|
||||
else
|
||||
logSw.WriteLine("{0}: {1}", entry.Timestamp, entry.Message);
|
||||
else logSw.WriteLine("{0}: {1}", entry.Timestamp, entry.Message);
|
||||
|
||||
logSw.Close();
|
||||
logFs.Close();
|
||||
|
||||
Reference in New Issue
Block a user