diff --git a/DiscImageChef.Core/Logging/DumpLog.cs b/DiscImageChef.Core/Logging/DumpLog.cs index 68e6d081b..a7ec3e4dd 100644 --- a/DiscImageChef.Core/Logging/DumpLog.cs +++ b/DiscImageChef.Core/Logging/DumpLog.cs @@ -36,7 +36,6 @@ using System.Reflection; using System.Runtime.InteropServices; using DiscImageChef.CommonTypes.Interop; using DiscImageChef.Devices; -using PlatformID = DiscImageChef.CommonTypes.Interop.PlatformID; using Version = DiscImageChef.CommonTypes.Interop.Version; namespace DiscImageChef.Core.Logging @@ -46,7 +45,7 @@ namespace DiscImageChef.Core.Logging /// public class DumpLog { - readonly StreamWriter logSw; + private readonly StreamWriter logSw; /// /// Initializes the dump log @@ -55,66 +54,77 @@ namespace DiscImageChef.Core.Logging /// Device public DumpLog(string outputFile, Device dev) { - if(string.IsNullOrEmpty(outputFile)) return; + if (string.IsNullOrEmpty(outputFile)) return; logSw = new StreamWriter(outputFile, true); logSw.WriteLine("Start logging at {0}", DateTime.Now); - PlatformID platId = DetectOS.GetRealPlatformID(); - string platVer = DetectOS.GetVersion(); - AssemblyInformationalVersionAttribute assemblyVersion = + var platId = DetectOS.GetRealPlatformID(); + var platVer = DetectOS.GetVersion(); + var assemblyVersion = Attribute.GetCustomAttribute(typeof(DumpLog).Assembly, typeof(AssemblyInformationalVersionAttribute)) as AssemblyInformationalVersionAttribute; 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 if(DetectOS.IsNetCore) logSw.WriteLine(".NET Core {0}", Version.GetNetCoreVersion()); + Environment.Is64BitOperatingSystem ? 64 : 32); + 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(); logSw.WriteLine("################# Program information ################"); - logSw.WriteLine("DiscImageChef {0}", assemblyVersion?.InformationalVersion); + logSw.WriteLine("DiscImageChef {0}", assemblyVersion?.InformationalVersion); logSw.WriteLine("Running in {0}-bit", Environment.Is64BitProcess ? 64 : 32); - #if DEBUG +#if DEBUG logSw.WriteLine("DEBUG version"); - #endif +#endif logSw.WriteLine("Command line: {0}", Environment.CommandLine); logSw.WriteLine(); - logSw.WriteLine("################# Device information #################"); - logSw.WriteLine("Manufacturer: {0}", dev.Manufacturer); - logSw.WriteLine("Model: {0}", dev.Model); - logSw.WriteLine("Firmware revision: {0}", dev.Revision); - logSw.WriteLine("Serial number: {0}", dev.Serial); - logSw.WriteLine("Removable device: {0}", dev.IsRemovable); - logSw.WriteLine("Device type: {0}", dev.Type); - logSw.WriteLine("CompactFlash device: {0}", dev.IsCompactFlash); - logSw.WriteLine("PCMCIA device: {0}", dev.IsPcmcia); - logSw.WriteLine("USB device: {0}", dev.IsUsb); - if(dev.IsUsb) + if (dev.IsRemote) { - logSw.WriteLine("USB manufacturer: {0}", dev.UsbManufacturerString); - logSw.WriteLine("USB product: {0}", dev.UsbProductString); - logSw.WriteLine("USB serial: {0}", dev.UsbSerialString); - logSw.WriteLine("USB vendor ID: {0:X4}h", dev.UsbVendorId); + logSw.WriteLine("################# Remote information #################"); + logSw.WriteLine("Server: {0}", dev.RemoteApplication); + logSw.WriteLine("Version: {0}", dev.RemoteVersion); + logSw.WriteLine("Operating system: {0} {1}", dev.RemoteOperatingSystem, + dev.RemoteOperatingSystemVersion); + logSw.WriteLine("Architecture: {0}", dev.RemoteArchitecture); + logSw.WriteLine("Protocol version: {0}", dev.RemoteProtocolVersion); + logSw.WriteLine("######################################################"); + } + + logSw.WriteLine("################# Device information #################"); + logSw.WriteLine("Manufacturer: {0}", dev.Manufacturer); + logSw.WriteLine("Model: {0}", dev.Model); + logSw.WriteLine("Firmware revision: {0}", dev.Revision); + logSw.WriteLine("Serial number: {0}", dev.Serial); + logSw.WriteLine("Removable device: {0}", dev.IsRemovable); + logSw.WriteLine("Device type: {0}", dev.Type); + logSw.WriteLine("CompactFlash device: {0}", dev.IsCompactFlash); + logSw.WriteLine("PCMCIA device: {0}", dev.IsPcmcia); + logSw.WriteLine("USB device: {0}", dev.IsUsb); + if (dev.IsUsb) + { + logSw.WriteLine("USB manufacturer: {0}", dev.UsbManufacturerString); + logSw.WriteLine("USB product: {0}", dev.UsbProductString); + logSw.WriteLine("USB serial: {0}", dev.UsbSerialString); + logSw.WriteLine("USB vendor ID: {0:X4}h", dev.UsbVendorId); logSw.WriteLine("USB product ID: {0:X4}h", dev.UsbProductId); } logSw.WriteLine("FireWire device: {0}", dev.IsFireWire); - if(dev.IsFireWire) + if (dev.IsFireWire) { - logSw.WriteLine("FireWire vendor: {0}", dev.FireWireVendorName); - logSw.WriteLine("FireWire model: {0}", dev.FireWireModelName); - logSw.WriteLine("FireWire GUID: 0x{0:X16}", dev.FireWireGuid); - logSw.WriteLine("FireWire vendor ID: 0x{0:X8}", dev.FireWireVendor); + logSw.WriteLine("FireWire vendor: {0}", dev.FireWireVendorName); + logSw.WriteLine("FireWire model: {0}", dev.FireWireModelName); + logSw.WriteLine("FireWire GUID: 0x{0:X16}", dev.FireWireGuid); + logSw.WriteLine("FireWire vendor ID: 0x{0:X8}", dev.FireWireVendor); logSw.WriteLine("FireWire product ID: 0x{0:X8}", dev.FireWireModel); } - logSw.WriteLine(); logSw.WriteLine("######################################################"); logSw.WriteLine(); @@ -129,9 +139,9 @@ namespace DiscImageChef.Core.Logging /// Arguments public void WriteLine(string format, params object[] args) { - if(logSw == null) return; + if (logSw == null) return; - string text = string.Format(format, args); + var text = string.Format(format, args); logSw.WriteLine("{0:s} {1}", DateTime.Now, text); logSw.Flush(); } diff --git a/DiscImageChef.Devices/Device/Variables.cs b/DiscImageChef.Devices/Device/Variables.cs index 007053a1e..330c0489a 100644 --- a/DiscImageChef.Devices/Device/Variables.cs +++ b/DiscImageChef.Devices/Device/Variables.cs @@ -219,5 +219,13 @@ namespace DiscImageChef.Devices public byte[] Cis { get; } private readonly Remote.Remote remote; + + public bool IsRemote => remote != null; + public string RemoteApplication => remote?.ServerApplication; + public string RemoteVersion => remote?.ServerVersion; + public string RemoteOperatingSystem => remote?.ServerOperatingSystem; + public string RemoteOperatingSystemVersion => remote?.ServerOperatingSystemVersion; + public string RemoteArchitecture => remote?.ServerArchitecture; + public int RemoteProtocolVersion => remote?.ServerProtocolVersion ?? 0; } } \ No newline at end of file