mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Possible 'System.NullReferenceException'.
This commit is contained in:
@@ -65,7 +65,7 @@ namespace DiscImageChef.Core
|
|||||||
{
|
{
|
||||||
if(!type.IsSubclassOf(typeof(ImagePlugin))) continue;
|
if(!type.IsSubclassOf(typeof(ImagePlugin))) continue;
|
||||||
|
|
||||||
ImagePlugin plugin = (ImagePlugin)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
|
ImagePlugin plugin = (ImagePlugin)type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
|
||||||
RegisterImagePlugin(plugin);
|
RegisterImagePlugin(plugin);
|
||||||
}
|
}
|
||||||
catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); }
|
catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); }
|
||||||
@@ -77,7 +77,7 @@ namespace DiscImageChef.Core
|
|||||||
{
|
{
|
||||||
if(!type.IsSubclassOf(typeof(PartitionPlugin))) continue;
|
if(!type.IsSubclassOf(typeof(PartitionPlugin))) continue;
|
||||||
|
|
||||||
PartitionPlugin plugin = (PartitionPlugin)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
|
PartitionPlugin plugin = (PartitionPlugin)type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
|
||||||
RegisterPartPlugin(plugin);
|
RegisterPartPlugin(plugin);
|
||||||
}
|
}
|
||||||
catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); }
|
catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); }
|
||||||
@@ -91,9 +91,8 @@ namespace DiscImageChef.Core
|
|||||||
|
|
||||||
Filesystem plugin;
|
Filesystem plugin;
|
||||||
if(encoding != null)
|
if(encoding != null)
|
||||||
plugin = (Filesystem)type.GetConstructor(new[] {encoding.GetType()})
|
plugin = (Filesystem)type.GetConstructor(new[] {encoding.GetType()})?.Invoke(new object[] {encoding});
|
||||||
.Invoke(new object[] {encoding});
|
else plugin = (Filesystem)type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
|
||||||
else plugin = (Filesystem)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
|
|
||||||
RegisterPlugin(plugin);
|
RegisterPlugin(plugin);
|
||||||
}
|
}
|
||||||
catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); }
|
catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); }
|
||||||
|
|||||||
@@ -259,7 +259,7 @@ namespace DiscImageChef.Devices.Windows
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Did we find an InterfaceID of a USB device?
|
// Did we find an InterfaceID of a USB device?
|
||||||
if(instanceId.StartsWith("USB\\")) foundDevice = FindDeviceByInstanceId(instanceId);
|
if(instanceId?.StartsWith("USB\\", StringComparison.Ordinal) == true) foundDevice = FindDeviceByInstanceId(instanceId);
|
||||||
return foundDevice;
|
return foundDevice;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -77,7 +77,7 @@ namespace DiscImageChef.DiscImages
|
|||||||
|
|
||||||
public override bool IdentifyImage(Filter imageFilter)
|
public override bool IdentifyImage(Filter imageFilter)
|
||||||
{
|
{
|
||||||
extension = Path.GetExtension(imageFilter.GetFilename()).ToLower();
|
extension = Path.GetExtension(imageFilter.GetFilename())?.ToLower();
|
||||||
|
|
||||||
if(imageFilter.GetDataForkLength() == 143360 && (extension == ".po" || extension == ".do")) return true;
|
if(imageFilter.GetDataForkLength() == 143360 && (extension == ".po" || extension == ".do")) return true;
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@ namespace DiscImageChef.DiscImages
|
|||||||
|
|
||||||
deinterleaved = new byte[tmp.Length];
|
deinterleaved = new byte[tmp.Length];
|
||||||
|
|
||||||
extension = Path.GetExtension(imageFilter.GetFilename()).ToLower();
|
extension = Path.GetExtension(imageFilter.GetFilename())?.ToLower();
|
||||||
|
|
||||||
int[] offsets;
|
int[] offsets;
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ namespace DiscImageChef.DiscImages
|
|||||||
// Check if file is not multiple of 512
|
// Check if file is not multiple of 512
|
||||||
if(imageFilter.GetDataForkLength() % 512 == 0) return true;
|
if(imageFilter.GetDataForkLength() % 512 == 0) return true;
|
||||||
|
|
||||||
extension = Path.GetExtension(imageFilter.GetFilename()).ToLower();
|
extension = Path.GetExtension(imageFilter.GetFilename())?.ToLower();
|
||||||
|
|
||||||
if(extension == ".hdf" && ImageInfo.ImageSize % 256 == 0) return true;
|
if(extension == ".hdf" && ImageInfo.ImageSize % 256 == 0) return true;
|
||||||
|
|
||||||
@@ -119,7 +119,7 @@ namespace DiscImageChef.DiscImages
|
|||||||
Stream stream = imageFilter.GetDataForkStream();
|
Stream stream = imageFilter.GetDataForkStream();
|
||||||
stream.Seek(0, SeekOrigin.Begin);
|
stream.Seek(0, SeekOrigin.Begin);
|
||||||
|
|
||||||
extension = Path.GetExtension(imageFilter.GetFilename()).ToLower();
|
extension = Path.GetExtension(imageFilter.GetFilename())?.ToLower();
|
||||||
switch(extension) {
|
switch(extension) {
|
||||||
case ".iso" when imageFilter.GetDataForkLength() % 2048 == 0: ImageInfo.SectorSize = 2048;
|
case ".iso" when imageFilter.GetDataForkLength() % 2048 == 0: ImageInfo.SectorSize = 2048;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ namespace DiscImageChef.Filters
|
|||||||
{
|
{
|
||||||
if(!type.IsSubclassOf(typeof(Filter))) continue;
|
if(!type.IsSubclassOf(typeof(Filter))) continue;
|
||||||
|
|
||||||
Filter filter = (Filter)type.GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
|
Filter filter = (Filter)type.GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
|
||||||
if(!filtersList.ContainsKey(filter.Name.ToLower())) filtersList.Add(filter.Name.ToLower(), filter);
|
if(filter != null && !filtersList.ContainsKey(filter.Name.ToLower())) filtersList.Add(filter.Name.ToLower(), filter);
|
||||||
}
|
}
|
||||||
catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); }
|
catch(Exception exception) { DicConsole.ErrorWriteLine("Exception {0}", exception); }
|
||||||
}
|
}
|
||||||
@@ -67,18 +67,17 @@ namespace DiscImageChef.Filters
|
|||||||
if(!filter.Identify(path)) continue;
|
if(!filter.Identify(path)) continue;
|
||||||
|
|
||||||
Filter foundFilter =
|
Filter foundFilter =
|
||||||
(Filter)filter.GetType().GetConstructor(Type.EmptyTypes).Invoke(new object[] { });
|
(Filter)filter.GetType().GetConstructor(Type.EmptyTypes)?.Invoke(new object[] { });
|
||||||
foundFilter.Open(path);
|
|
||||||
|
|
||||||
if(foundFilter.IsOpened()) return foundFilter;
|
foundFilter?.Open(path);
|
||||||
|
|
||||||
|
if(foundFilter?.IsOpened() == true) return foundFilter;
|
||||||
}
|
}
|
||||||
else noFilter = filter;
|
else noFilter = filter;
|
||||||
|
|
||||||
if(!noFilter.Identify(path)) return noFilter;
|
if(!noFilter?.Identify(path) == true) return noFilter;
|
||||||
|
|
||||||
noFilter.Open(path);
|
noFilter?.Open(path);
|
||||||
|
|
||||||
if(noFilter.IsOpened()) return noFilter;
|
|
||||||
|
|
||||||
return noFilter;
|
return noFilter;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -131,9 +131,9 @@ namespace DiscImageChef.Interop
|
|||||||
Marshal.FreeHGlobal(pStr);
|
Marshal.FreeHGlobal(pStr);
|
||||||
Marshal.FreeHGlobal(pLen);
|
Marshal.FreeHGlobal(pLen);
|
||||||
|
|
||||||
if(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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -579,6 +579,8 @@ namespace DiscImageChef.Server
|
|||||||
{
|
{
|
||||||
_line = tocStream.ReadLine();
|
_line = tocStream.ReadLine();
|
||||||
|
|
||||||
|
if(_line == null) break;
|
||||||
|
|
||||||
if(_line.Length == 0 || _line[0] == '#') continue;
|
if(_line.Length == 0 || _line[0] == '#') continue;
|
||||||
|
|
||||||
if(inManufacturer)
|
if(inManufacturer)
|
||||||
|
|||||||
@@ -242,7 +242,7 @@ namespace DiscImageChef.Settings
|
|||||||
case PlatformID.WinCE:
|
case PlatformID.WinCE:
|
||||||
case PlatformID.WindowsPhone:
|
case PlatformID.WindowsPhone:
|
||||||
{
|
{
|
||||||
RegistryKey parentKey = Registry.CurrentUser.OpenSubKey("SOFTWARE").OpenSubKey("Claunia.com");
|
RegistryKey parentKey = Registry.CurrentUser.OpenSubKey("SOFTWARE")?.OpenSubKey("Claunia.com");
|
||||||
if(parentKey == null)
|
if(parentKey == null)
|
||||||
{
|
{
|
||||||
SetDefaultSettings();
|
SetDefaultSettings();
|
||||||
@@ -358,40 +358,43 @@ namespace DiscImageChef.Settings
|
|||||||
case PlatformID.WindowsPhone:
|
case PlatformID.WindowsPhone:
|
||||||
{
|
{
|
||||||
RegistryKey parentKey =
|
RegistryKey parentKey =
|
||||||
Registry.CurrentUser.OpenSubKey("SOFTWARE", true).CreateSubKey("Claunia.com");
|
Registry.CurrentUser.OpenSubKey("SOFTWARE", true)?.CreateSubKey("Claunia.com");
|
||||||
RegistryKey key = parentKey.CreateSubKey("DiscImageChef");
|
RegistryKey key = parentKey?.CreateSubKey("DiscImageChef");
|
||||||
|
|
||||||
key.SetValue("SaveReportsGlobally", Current.SaveReportsGlobally);
|
if(key != null)
|
||||||
key.SetValue("ShareReports", Current.ShareReports);
|
{
|
||||||
|
key.SetValue("SaveReportsGlobally", Current.SaveReportsGlobally);
|
||||||
|
key.SetValue("ShareReports", Current.ShareReports);
|
||||||
|
|
||||||
if(Current.Stats != null)
|
if(Current.Stats != null)
|
||||||
{
|
{
|
||||||
key.SetValue("Statistics", true);
|
key.SetValue("Statistics", true);
|
||||||
key.SetValue("ShareStats", Current.Stats.ShareStats);
|
key.SetValue("ShareStats", Current.Stats.ShareStats);
|
||||||
key.SetValue("BenchmarkStats", Current.Stats.BenchmarkStats);
|
key.SetValue("BenchmarkStats", Current.Stats.BenchmarkStats);
|
||||||
key.SetValue("CommandStats", Current.Stats.CommandStats);
|
key.SetValue("CommandStats", Current.Stats.CommandStats);
|
||||||
key.SetValue("DeviceStats", Current.Stats.DeviceStats);
|
key.SetValue("DeviceStats", Current.Stats.DeviceStats);
|
||||||
key.SetValue("FilesystemStats", Current.Stats.FilesystemStats);
|
key.SetValue("FilesystemStats", Current.Stats.FilesystemStats);
|
||||||
key.SetValue("FilterStats", Current.Stats.FilterStats);
|
key.SetValue("FilterStats", Current.Stats.FilterStats);
|
||||||
key.SetValue("MediaImageStats", Current.Stats.MediaImageStats);
|
key.SetValue("MediaImageStats", Current.Stats.MediaImageStats);
|
||||||
key.SetValue("MediaScanStats", Current.Stats.MediaScanStats);
|
key.SetValue("MediaScanStats", Current.Stats.MediaScanStats);
|
||||||
key.SetValue("PartitionStats", Current.Stats.PartitionStats);
|
key.SetValue("PartitionStats", Current.Stats.PartitionStats);
|
||||||
key.SetValue("MediaStats", Current.Stats.MediaStats);
|
key.SetValue("MediaStats", Current.Stats.MediaStats);
|
||||||
key.SetValue("VerifyStats", Current.Stats.VerifyStats);
|
key.SetValue("VerifyStats", Current.Stats.VerifyStats);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
key.SetValue("Statistics", true);
|
key.SetValue("Statistics", true);
|
||||||
key.DeleteValue("ShareStats", false);
|
key.DeleteValue("ShareStats", false);
|
||||||
key.DeleteValue("BenchmarkStats", false);
|
key.DeleteValue("BenchmarkStats", false);
|
||||||
key.DeleteValue("CommandStats", false);
|
key.DeleteValue("CommandStats", false);
|
||||||
key.DeleteValue("DeviceStats", false);
|
key.DeleteValue("DeviceStats", false);
|
||||||
key.DeleteValue("FilesystemStats", false);
|
key.DeleteValue("FilesystemStats", false);
|
||||||
key.DeleteValue("MediaImageStats", false);
|
key.DeleteValue("MediaImageStats", false);
|
||||||
key.DeleteValue("MediaScanStats", false);
|
key.DeleteValue("MediaScanStats", false);
|
||||||
key.DeleteValue("PartitionStats", false);
|
key.DeleteValue("PartitionStats", false);
|
||||||
key.DeleteValue("MediaStats", false);
|
key.DeleteValue("MediaStats", false);
|
||||||
key.DeleteValue("VerifyStats", false);
|
key.DeleteValue("VerifyStats", false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -183,10 +183,13 @@ namespace DiscImageChef.Commands
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
plugins.PluginsList.TryGetValue(idPlugins[0], out plugin);
|
plugins.PluginsList.TryGetValue(idPlugins[0], out plugin);
|
||||||
DicConsole.WriteLine(string.Format("Identified by {0}.", plugin.Name));
|
if(plugin != null)
|
||||||
plugin.GetInformation(imageFormat, partitions[i], out information);
|
{
|
||||||
DicConsole.Write(information);
|
DicConsole.WriteLine(string.Format("Identified by {0}.", plugin.Name));
|
||||||
Core.Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
plugin.GetInformation(imageFormat, partitions[i], out information);
|
||||||
|
DicConsole.Write(information);
|
||||||
|
Core.Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -219,10 +222,13 @@ namespace DiscImageChef.Commands
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
plugins.PluginsList.TryGetValue(idPlugins[0], out plugin);
|
plugins.PluginsList.TryGetValue(idPlugins[0], out plugin);
|
||||||
DicConsole.WriteLine(string.Format("Identified by {0}.", plugin.Name));
|
if(plugin != null)
|
||||||
plugin.GetInformation(imageFormat, wholePart, out information);
|
{
|
||||||
DicConsole.Write(information);
|
DicConsole.WriteLine(string.Format("Identified by {0}.", plugin.Name));
|
||||||
Core.Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
plugin.GetInformation(imageFormat, wholePart, out information);
|
||||||
|
DicConsole.Write(information);
|
||||||
|
Core.Statistics.AddFilesystem(plugin.XmlFSType.Type);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@ namespace DiscImageChef.Commands
|
|||||||
|
|
||||||
byte[] hiddenSector = inputFormat.ReadSector(i);
|
byte[] hiddenSector = inputFormat.ReadSector(i);
|
||||||
|
|
||||||
mediaChecksum.Update(hiddenSector);
|
mediaChecksum?.Update(hiddenSector);
|
||||||
}
|
}
|
||||||
|
|
||||||
DicConsole.DebugWriteLine("Checksum command",
|
DicConsole.DebugWriteLine("Checksum command",
|
||||||
@@ -155,17 +155,19 @@ namespace DiscImageChef.Commands
|
|||||||
doneSectors += sectors - doneSectors;
|
doneSectors += sectors - doneSectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(options.WholeDisc) mediaChecksum.Update(sector);
|
if(options.WholeDisc)
|
||||||
|
mediaChecksum?.Update(sector);
|
||||||
|
|
||||||
if(options.SeparatedTracks) trackChecksum.Update(sector);
|
if(options.SeparatedTracks) trackChecksum?.Update(sector);
|
||||||
}
|
}
|
||||||
|
|
||||||
DicConsole.WriteLine();
|
DicConsole.WriteLine();
|
||||||
|
|
||||||
if(options.SeparatedTracks)
|
if(options.SeparatedTracks)
|
||||||
foreach(ChecksumType chk in trackChecksum.End())
|
if(trackChecksum != null)
|
||||||
DicConsole.WriteLine("Track {0}'s {1}: {2}", currentTrack.TrackSequence, chk.type,
|
foreach(ChecksumType chk in trackChecksum.End())
|
||||||
chk.Value);
|
DicConsole.WriteLine("Track {0}'s {1}: {2}", currentTrack.TrackSequence, chk.type,
|
||||||
|
chk.Value);
|
||||||
|
|
||||||
previousTrackEnd = currentTrack.TrackEndSector;
|
previousTrackEnd = currentTrack.TrackEndSector;
|
||||||
}
|
}
|
||||||
@@ -176,12 +178,13 @@ namespace DiscImageChef.Commands
|
|||||||
DicConsole.Write("\rHashing track-less sector {0}", i);
|
DicConsole.Write("\rHashing track-less sector {0}", i);
|
||||||
|
|
||||||
byte[] hiddenSector = inputFormat.ReadSector(i);
|
byte[] hiddenSector = inputFormat.ReadSector(i);
|
||||||
mediaChecksum.Update(hiddenSector);
|
mediaChecksum?.Update(hiddenSector);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(options.WholeDisc)
|
if(options.WholeDisc)
|
||||||
foreach(ChecksumType chk in mediaChecksum.End())
|
if(mediaChecksum != null)
|
||||||
DicConsole.WriteLine("Disk's {0}: {1}", chk.type, chk.Value);
|
foreach(ChecksumType chk in mediaChecksum.End())
|
||||||
|
DicConsole.WriteLine("Disk's {0}: {1}", chk.type, chk.Value);
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -152,14 +152,18 @@ namespace DiscImageChef.Commands
|
|||||||
.GetType().GetConstructor(new[]
|
.GetType().GetConstructor(new[]
|
||||||
{
|
{
|
||||||
typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
|
typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
|
||||||
}).Invoke(new object[] {imageFormat, partitions[i], null});
|
})
|
||||||
|
?.Invoke(new object[] {imageFormat, partitions[i], null});
|
||||||
|
|
||||||
|
if(fs == null) continue;
|
||||||
|
|
||||||
error = fs.Mount(options.Debug);
|
error = fs.Mount(options.Debug);
|
||||||
if(error == Errno.NoError)
|
if(error == Errno.NoError)
|
||||||
{
|
{
|
||||||
List<string> rootDir = new List<string>();
|
List<string> rootDir = new List<string>();
|
||||||
error = fs.ReadDir("/", ref rootDir);
|
error = fs.ReadDir("/", ref rootDir);
|
||||||
if(error == Errno.NoError) foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
|
if(error == Errno.NoError)
|
||||||
|
foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
|
||||||
else
|
else
|
||||||
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}",
|
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}",
|
||||||
error.ToString());
|
error.ToString());
|
||||||
@@ -179,15 +183,20 @@ namespace DiscImageChef.Commands
|
|||||||
.GetType().GetConstructor(new[]
|
.GetType().GetConstructor(new[]
|
||||||
{
|
{
|
||||||
typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
|
typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
|
||||||
}).Invoke(new object[] {imageFormat, partitions[i], null});
|
})
|
||||||
|
?.Invoke(new object[] {imageFormat, partitions[i], null});
|
||||||
|
if(fs == null) continue;
|
||||||
|
|
||||||
error = fs.Mount(options.Debug);
|
error = fs.Mount(options.Debug);
|
||||||
if(error == Errno.NoError)
|
if(error == Errno.NoError)
|
||||||
{
|
{
|
||||||
List<string> rootDir = new List<string>();
|
List<string> rootDir = new List<string>();
|
||||||
error = fs.ReadDir("/", ref rootDir);
|
error = fs.ReadDir("/", ref rootDir);
|
||||||
if(error == Errno.NoError) foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
|
if(error == Errno.NoError)
|
||||||
|
foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
|
||||||
else
|
else
|
||||||
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString());
|
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}",
|
||||||
|
error.ToString());
|
||||||
|
|
||||||
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
|
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
|
||||||
}
|
}
|
||||||
@@ -217,15 +226,20 @@ namespace DiscImageChef.Commands
|
|||||||
.GetType().GetConstructor(new[]
|
.GetType().GetConstructor(new[]
|
||||||
{
|
{
|
||||||
typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
|
typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
|
||||||
}).Invoke(new object[] {imageFormat, wholePart, null});
|
})
|
||||||
|
?.Invoke(new object[] {imageFormat, wholePart, null});
|
||||||
|
if(fs == null) continue;
|
||||||
|
|
||||||
error = fs.Mount(options.Debug);
|
error = fs.Mount(options.Debug);
|
||||||
if(error == Errno.NoError)
|
if(error == Errno.NoError)
|
||||||
{
|
{
|
||||||
List<string> rootDir = new List<string>();
|
List<string> rootDir = new List<string>();
|
||||||
error = fs.ReadDir("/", ref rootDir);
|
error = fs.ReadDir("/", ref rootDir);
|
||||||
if(error == Errno.NoError) foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
|
if(error == Errno.NoError)
|
||||||
|
foreach(string entry in rootDir) DicConsole.WriteLine("{0}", entry);
|
||||||
else
|
else
|
||||||
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString());
|
DicConsole.ErrorWriteLine("Error {0} reading root directory {0}",
|
||||||
|
error.ToString());
|
||||||
|
|
||||||
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
|
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
|
||||||
}
|
}
|
||||||
@@ -235,48 +249,50 @@ namespace DiscImageChef.Commands
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
plugins.PluginsList.TryGetValue(idPlugins[0], out plugin);
|
plugins.PluginsList.TryGetValue(idPlugins[0], out plugin);
|
||||||
DicConsole.WriteLine(string.Format("Identified by {0}.", plugin.Name));
|
if(plugin != null)
|
||||||
Filesystem fs = (Filesystem)plugin
|
|
||||||
.GetType().GetConstructor(new[]
|
|
||||||
{
|
|
||||||
typeof(ImagePlugin), typeof(Partition), typeof(Encoding)
|
|
||||||
}).Invoke(new object[] {imageFormat, wholePart, null});
|
|
||||||
error = fs.Mount(options.Debug);
|
|
||||||
if(error == Errno.NoError)
|
|
||||||
{
|
{
|
||||||
List<string> rootDir = new List<string>();
|
DicConsole.WriteLine(string.Format("Identified by {0}.", plugin.Name));
|
||||||
error = fs.ReadDir("/", ref rootDir);
|
Filesystem fs = (Filesystem)plugin
|
||||||
|
.GetType().GetConstructor(new[] {typeof(ImagePlugin), typeof(Partition), typeof(Encoding)})
|
||||||
|
?.Invoke(new object[] {imageFormat, wholePart, null});
|
||||||
|
error = fs.Mount(options.Debug);
|
||||||
if(error == Errno.NoError)
|
if(error == Errno.NoError)
|
||||||
foreach(string entry in rootDir)
|
{
|
||||||
if(options.Long)
|
List<string> rootDir = new List<string>();
|
||||||
{
|
error = fs.ReadDir("/", ref rootDir);
|
||||||
FileEntryInfo stat = new FileEntryInfo();
|
if(error == Errno.NoError)
|
||||||
List<string> xattrs = new List<string>();
|
foreach(string entry in rootDir)
|
||||||
|
if(options.Long)
|
||||||
error = fs.Stat(entry, ref stat);
|
|
||||||
if(error == Errno.NoError)
|
|
||||||
{
|
{
|
||||||
DicConsole.WriteLine("{0}\t{1}\t{2} bytes\t{3}", stat.CreationTimeUtc,
|
FileEntryInfo stat = new FileEntryInfo();
|
||||||
stat.Inode, stat.Length, entry);
|
List<string> xattrs = new List<string>();
|
||||||
|
|
||||||
error = fs.ListXAttr(entry, ref xattrs);
|
error = fs.Stat(entry, ref stat);
|
||||||
if(error != Errno.NoError) continue;
|
if(error == Errno.NoError)
|
||||||
|
|
||||||
foreach(string xattr in xattrs)
|
|
||||||
{
|
{
|
||||||
byte[] xattrBuf = new byte[0];
|
DicConsole.WriteLine("{0}\t{1}\t{2} bytes\t{3}", stat.CreationTimeUtc,
|
||||||
error = fs.GetXattr(entry, xattr, ref xattrBuf);
|
stat.Inode, stat.Length, entry);
|
||||||
if(error == Errno.NoError) DicConsole.WriteLine("\t\t{0}\t{1} bytes", xattr, xattrBuf.Length);
|
|
||||||
|
error = fs.ListXAttr(entry, ref xattrs);
|
||||||
|
if(error != Errno.NoError) continue;
|
||||||
|
|
||||||
|
foreach(string xattr in xattrs)
|
||||||
|
{
|
||||||
|
byte[] xattrBuf = new byte[0];
|
||||||
|
error = fs.GetXattr(entry, xattr, ref xattrBuf);
|
||||||
|
if(error == Errno.NoError)
|
||||||
|
DicConsole.WriteLine("\t\t{0}\t{1} bytes", xattr, xattrBuf.Length);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else DicConsole.WriteLine("{0}", entry);
|
||||||
}
|
}
|
||||||
else DicConsole.WriteLine("{0}", entry);
|
else DicConsole.WriteLine("{0}", entry);
|
||||||
}
|
else DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString());
|
||||||
else DicConsole.WriteLine("{0}", entry);
|
|
||||||
else DicConsole.ErrorWriteLine("Error {0} reading root directory {0}", error.ToString());
|
|
||||||
|
|
||||||
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
|
Core.Statistics.AddFilesystem(fs.XmlFSType.Type);
|
||||||
|
}
|
||||||
|
else DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString());
|
||||||
}
|
}
|
||||||
else DicConsole.ErrorWriteLine("Unable to mount device, error {0}", error.ToString());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch(Exception ex)
|
catch(Exception ex)
|
||||||
|
|||||||
Reference in New Issue
Block a user