mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
REFACTOR: Final cleanup of DiscImageChef.Metadata.
This commit is contained in:
@@ -45,34 +45,6 @@ namespace DiscImageChef.Interop
|
|||||||
{
|
{
|
||||||
public static class DetectOS
|
public static class DetectOS
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// POSIX uname structure, size from OSX, big enough to handle extra fields
|
|
||||||
/// </summary>
|
|
||||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
|
||||||
struct utsname
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// System name
|
|
||||||
/// </summary>
|
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string sysname;
|
|
||||||
/// <summary>
|
|
||||||
/// Node name
|
|
||||||
/// </summary>
|
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string nodename;
|
|
||||||
/// <summary>
|
|
||||||
/// Release level
|
|
||||||
/// </summary>
|
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string release;
|
|
||||||
/// <summary>
|
|
||||||
/// Version level
|
|
||||||
/// </summary>
|
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string version;
|
|
||||||
/// <summary>
|
|
||||||
/// Hardware level
|
|
||||||
/// </summary>
|
|
||||||
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string machine;
|
|
||||||
}
|
|
||||||
|
|
||||||
[DllImport("libc", SetLastError = true)]
|
[DllImport("libc", SetLastError = true)]
|
||||||
static extern int uname(out utsname name);
|
static extern int uname(out utsname name);
|
||||||
|
|
||||||
@@ -86,11 +58,11 @@ namespace DiscImageChef.Interop
|
|||||||
/// <exception cref="Exception">Unhandled exception</exception>
|
/// <exception cref="Exception">Unhandled exception</exception>
|
||||||
public static PlatformID GetRealPlatformID()
|
public static PlatformID GetRealPlatformID()
|
||||||
{
|
{
|
||||||
if((int)Environment.OSVersion.Platform < 4 || (int)Environment.OSVersion.Platform == 5) return (PlatformID)(int)Environment.OSVersion.Platform;
|
if((int)Environment.OSVersion.Platform < 4 || (int)Environment.OSVersion.Platform == 5)
|
||||||
|
return (PlatformID)(int)Environment.OSVersion.Platform;
|
||||||
|
|
||||||
int error = uname(out utsname unixname);
|
int error = uname(out utsname unixname);
|
||||||
if(error != 0)
|
if(error != 0) throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}");
|
||||||
throw new Exception($"Unhandled exception calling uname: {Marshal.GetLastWin32Error()}");
|
|
||||||
|
|
||||||
switch(unixname.sysname)
|
switch(unixname.sysname)
|
||||||
{
|
{
|
||||||
@@ -134,7 +106,8 @@ namespace DiscImageChef.Interop
|
|||||||
|
|
||||||
if(machine != null && (machine.StartsWith("iPad", StringComparison.Ordinal) ||
|
if(machine != null && (machine.StartsWith("iPad", StringComparison.Ordinal) ||
|
||||||
machine.StartsWith("iPod", StringComparison.Ordinal) ||
|
machine.StartsWith("iPod", StringComparison.Ordinal) ||
|
||||||
machine.StartsWith("iPhone", StringComparison.Ordinal))) return PlatformID.iOS;
|
machine.StartsWith("iPhone", StringComparison.Ordinal)))
|
||||||
|
return PlatformID.iOS;
|
||||||
|
|
||||||
return PlatformID.MacOSX;
|
return PlatformID.MacOSX;
|
||||||
}
|
}
|
||||||
@@ -203,7 +176,8 @@ namespace DiscImageChef.Interop
|
|||||||
if(Environment.OSVersion.Version.Major != 1)
|
if(Environment.OSVersion.Version.Major != 1)
|
||||||
return $"10.{Environment.OSVersion.Version.Major - 4}.{Environment.OSVersion.Version.Minor}";
|
return $"10.{Environment.OSVersion.Version.Major - 4}.{Environment.OSVersion.Version.Minor}";
|
||||||
|
|
||||||
switch(Environment.OSVersion.Version.Minor) {
|
switch(Environment.OSVersion.Version.Minor)
|
||||||
|
{
|
||||||
case 3: return "10.0";
|
case 3: return "10.0";
|
||||||
case 4: return "10.1";
|
case 4: return "10.1";
|
||||||
}
|
}
|
||||||
@@ -301,5 +275,33 @@ namespace DiscImageChef.Interop
|
|||||||
default: return id.ToString();
|
default: return id.ToString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// POSIX uname structure, size from OSX, big enough to handle extra fields
|
||||||
|
/// </summary>
|
||||||
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
|
||||||
|
struct utsname
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// System name
|
||||||
|
/// </summary>
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string sysname;
|
||||||
|
/// <summary>
|
||||||
|
/// Node name
|
||||||
|
/// </summary>
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string nodename;
|
||||||
|
/// <summary>
|
||||||
|
/// Release level
|
||||||
|
/// </summary>
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string release;
|
||||||
|
/// <summary>
|
||||||
|
/// Version level
|
||||||
|
/// </summary>
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string version;
|
||||||
|
/// <summary>
|
||||||
|
/// Hardware level
|
||||||
|
/// </summary>
|
||||||
|
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 256)] public string machine;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -31,11 +31,11 @@
|
|||||||
// ****************************************************************************/
|
// ****************************************************************************/
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Xml.Serialization;
|
using System.Xml.Serialization;
|
||||||
using DiscImageChef.Decoders.ATA;
|
using DiscImageChef.Decoders.ATA;
|
||||||
using DiscImageChef.Decoders.SCSI;
|
using DiscImageChef.Decoders.SCSI;
|
||||||
using DiscImageChef.Decoders.SCSI.MMC;
|
using DiscImageChef.Decoders.SCSI.MMC;
|
||||||
|
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
// ReSharper disable UnusedAutoPropertyAccessor.Global
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ namespace DiscImageChef.Metadata
|
|||||||
{
|
{
|
||||||
if(extents == null) return null;
|
if(extents == null) return null;
|
||||||
|
|
||||||
List<Tuple<ulong, ulong>> tuples = extents.Select(extent => new Tuple<ulong, ulong>(extent.Start, extent.End)).ToList();
|
List<Tuple<ulong, ulong>> tuples =
|
||||||
|
extents.Select(extent => new Tuple<ulong, ulong>(extent.Start, extent.End)).ToList();
|
||||||
|
|
||||||
return new ExtentsULong(tuples);
|
return new ExtentsULong(tuples);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,11 +38,11 @@ namespace DiscImageChef.Metadata
|
|||||||
[XmlRoot("DicStats", Namespace = "", IsNullable = false)]
|
[XmlRoot("DicStats", Namespace = "", IsNullable = false)]
|
||||||
public class Stats
|
public class Stats
|
||||||
{
|
{
|
||||||
|
public CommandsStats Commands;
|
||||||
[XmlArrayItem("OperatingSystem")]
|
[XmlArrayItem("OperatingSystem")]
|
||||||
public List<OsStats> OperatingSystems { get; set; }
|
public List<OsStats> OperatingSystems { get; set; }
|
||||||
[XmlArrayItem("Version")]
|
[XmlArrayItem("Version")]
|
||||||
public List<NameValueStats> Versions { get; set; }
|
public List<NameValueStats> Versions { get; set; }
|
||||||
public CommandsStats Commands;
|
|
||||||
[XmlArrayItem("Filesystem")]
|
[XmlArrayItem("Filesystem")]
|
||||||
public List<NameValueStats> Filesystems { get; set; }
|
public List<NameValueStats> Filesystems { get; set; }
|
||||||
[XmlArrayItem("Scheme")]
|
[XmlArrayItem("Scheme")]
|
||||||
@@ -74,13 +74,13 @@ namespace DiscImageChef.Metadata
|
|||||||
public long Entropy;
|
public long Entropy;
|
||||||
public long ExtractFiles;
|
public long ExtractFiles;
|
||||||
public long Formats;
|
public long Formats;
|
||||||
|
public long ListDevices;
|
||||||
|
public long ListEncodings;
|
||||||
public long Ls;
|
public long Ls;
|
||||||
public long MediaInfo;
|
public long MediaInfo;
|
||||||
public long MediaScan;
|
public long MediaScan;
|
||||||
public long PrintHex;
|
public long PrintHex;
|
||||||
public long Verify;
|
public long Verify;
|
||||||
public long ListDevices;
|
|
||||||
public long ListEncodings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class VerifiedItems
|
public class VerifiedItems
|
||||||
@@ -97,19 +97,19 @@ namespace DiscImageChef.Metadata
|
|||||||
|
|
||||||
public class ScannedSectors
|
public class ScannedSectors
|
||||||
{
|
{
|
||||||
public long Total;
|
|
||||||
public long Error;
|
|
||||||
public long Correct;
|
public long Correct;
|
||||||
|
public long Error;
|
||||||
|
public long Total;
|
||||||
public long Unverifiable;
|
public long Unverifiable;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TimeStats
|
public class TimeStats
|
||||||
{
|
{
|
||||||
public long LessThan3ms;
|
|
||||||
public long LessThan10ms;
|
public long LessThan10ms;
|
||||||
public long LessThan50ms;
|
|
||||||
public long LessThan150ms;
|
public long LessThan150ms;
|
||||||
|
public long LessThan3ms;
|
||||||
public long LessThan500ms;
|
public long LessThan500ms;
|
||||||
|
public long LessThan50ms;
|
||||||
public long MoreThan500ms;
|
public long MoreThan500ms;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,12 +127,12 @@ namespace DiscImageChef.Metadata
|
|||||||
|
|
||||||
public class BenchmarkStats
|
public class BenchmarkStats
|
||||||
{
|
{
|
||||||
|
public double All;
|
||||||
[XmlElement("Checksum")] public List<ChecksumStats> Checksum;
|
[XmlElement("Checksum")] public List<ChecksumStats> Checksum;
|
||||||
public double Entropy;
|
public double Entropy;
|
||||||
public double All;
|
|
||||||
public double Sequential;
|
|
||||||
public long MaxMemory;
|
public long MaxMemory;
|
||||||
public long MinMemory;
|
public long MinMemory;
|
||||||
|
public double Sequential;
|
||||||
}
|
}
|
||||||
|
|
||||||
public class MediaStats
|
public class MediaStats
|
||||||
@@ -144,12 +144,11 @@ namespace DiscImageChef.Metadata
|
|||||||
|
|
||||||
public class DeviceStats
|
public class DeviceStats
|
||||||
{
|
{
|
||||||
|
[XmlIgnore] public bool ManufacturerSpecified;
|
||||||
public string Manufacturer { get; set; }
|
public string Manufacturer { get; set; }
|
||||||
public string Model { get; set; }
|
public string Model { get; set; }
|
||||||
public string Revision { get; set; }
|
public string Revision { get; set; }
|
||||||
public string Bus { get; set; }
|
public string Bus { get; set; }
|
||||||
|
|
||||||
[XmlIgnore] public bool ManufacturerSpecified;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class NameValueStats
|
public class NameValueStats
|
||||||
|
|||||||
Reference in New Issue
Block a user