🎨REFACTOR: Use auto-properties.

This commit is contained in:
2017-12-26 08:01:40 +00:00
parent 94d8173b3a
commit 18f9a349c9
80 changed files with 947 additions and 1134 deletions

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
@@ -46,12 +45,10 @@ namespace DiscImageChef.Filesystems
public class AODOS : IFilesystem
{
readonly byte[] AODOSIdentifier = {0x20, 0x41, 0x4F, 0x2D, 0x44, 0x4F, 0x53, 0x20};
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public FileSystemType XmlFsType { get; private set; }
public string Name => "Alexander Osipov DOS file system";
public Guid Id => new Guid("668E5039-9DDD-442A-BE1B-A315D6E38E26");
public Encoding Encoding => currentEncoding;
public Encoding Encoding { get; private set; }
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -74,9 +71,10 @@ namespace DiscImageChef.Filesystems
return bb.identifier.SequenceEqual(AODOSIdentifier);
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = Encoding.GetEncoding("koi8-r");
Encoding = Encoding.GetEncoding("koi8-r");
byte[] sector = imagePlugin.ReadSector(0);
AODOS_BootBlock bb = new AODOS_BootBlock();
IntPtr bbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(bb));
@@ -88,7 +86,7 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendLine("Alexander Osipov DOS file system");
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "Alexander Osipov DOS file system",
Clusters = (long)imagePlugin.Info.Sectors,
@@ -97,13 +95,13 @@ namespace DiscImageChef.Filesystems
FilesSpecified = true,
FreeClusters = (long)(imagePlugin.Info.Sectors - bb.usedSectors),
FreeClustersSpecified = true,
VolumeName = StringHandlers.SpacePaddedToString(bb.volumeLabel, currentEncoding),
VolumeName = StringHandlers.SpacePaddedToString(bb.volumeLabel, Encoding),
Bootable = true
};
sbInformation.AppendFormat("{0} files on volume", bb.files).AppendLine();
sbInformation.AppendFormat("{0} used sectors on volume", bb.usedSectors).AppendLine();
sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(bb.volumeLabel, currentEncoding))
sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(bb.volumeLabel, Encoding))
.AppendLine();
information = sbInformation.ToString();

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -44,11 +43,9 @@ namespace DiscImageChef.Filesystems
{
const uint APFS_CONTAINER_MAGIC = 0x4253584E; // "NXSB"
const uint APFS_VOLUME_MAGIC = 0x42535041; // "APSB"
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
Encoding currentEncoding;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Apple File System";
public Guid Id => new Guid("A4060F9D-2909-42E2-9D95-DB31FA7EA797");
@@ -74,9 +71,9 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = Encoding.UTF8;
Encoding = Encoding.UTF8;
StringBuilder sbInformation = new StringBuilder();
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
information = "";
if(partition.Start >= partition.End) return;
@@ -103,7 +100,7 @@ namespace DiscImageChef.Filesystems
information = sbInformation.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Bootable = false,
Clusters = (long)nxSb.containerBlocks,

View File

@@ -76,13 +76,11 @@ namespace DiscImageChef.Filesystems
/// Old directory format magic number, "Hugo"
/// </summary>
const uint OLD_DIR_MAGIC = 0x6F677548;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public FileSystemType XmlFsType { get; private set; }
public string Name => "Acorn Advanced Disc Filing System";
public Guid Id => new Guid("BAFC1E50-9C64-4CD3-8400-80628CC27AFA");
public Encoding Encoding => currentEncoding;
public Encoding Encoding { get; private set; }
// TODO: BBC Master hard disks are untested...
public bool Identify(IMediaImage imagePlugin, Partition partition)
@@ -250,11 +248,12 @@ namespace DiscImageChef.Filesystems
// TODO: Find root directory on volumes with DiscRecord
// TODO: Support big directories (ADFS-G?)
// TODO: Find the real freemap on volumes with DiscRecord, as DiscRecord's discid may be empty but this one isn't
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
StringBuilder sbInformation = new StringBuilder();
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
information = "";
ulong sbSector;
@@ -300,7 +299,7 @@ namespace DiscImageChef.Filesystems
namebytes[i * 2 + 1] = oldMap1.name[i];
}
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Bootable = oldMap1.boot != 0, // Or not?
Clusters = (long)(bytes / imagePlugin.Info.SectorSize),
@@ -373,15 +372,15 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendLine();
sbInformation.AppendFormat("{0} bytes per sector", imagePlugin.Info.SectorSize).AppendLine();
sbInformation.AppendFormat("Volume has {0} bytes", bytes).AppendLine();
sbInformation.AppendFormat("Volume name: {0}", StringHandlers.CToString(namebytes, currentEncoding))
sbInformation.AppendFormat("Volume name: {0}", StringHandlers.CToString(namebytes, Encoding))
.AppendLine();
if(oldMap1.discId > 0)
{
xmlFsType.VolumeSerial = $"{oldMap1.discId:X4}";
XmlFsType.VolumeSerial = $"{oldMap1.discId:X4}";
sbInformation.AppendFormat("Volume ID: {0:X4}", oldMap1.discId).AppendLine();
}
if(!ArrayHelpers.ArrayIsNullOrEmpty(namebytes))
xmlFsType.VolumeName = StringHandlers.CToString(namebytes, currentEncoding);
XmlFsType.VolumeName = StringHandlers.CToString(namebytes, Encoding);
information = sbInformation.ToString();
@@ -439,7 +438,7 @@ namespace DiscImageChef.Filesystems
DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_size = {0}", drSb.disc_size);
DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_id = {0}", drSb.disc_id);
DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_name = {0}",
StringHandlers.CToString(drSb.disc_name, currentEncoding));
StringHandlers.CToString(drSb.disc_name, Encoding));
DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_type = {0}", drSb.disc_type);
DicConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_size_high = {0}", drSb.disc_size_high);
DicConsole.DebugWriteLine("ADFS Plugin", "drSb.flags = {0}", drSb.flags);
@@ -465,7 +464,7 @@ namespace DiscImageChef.Filesystems
if(bytes > imagePlugin.Info.Sectors * imagePlugin.Info.SectorSize) return;
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
sbInformation.AppendLine("Acorn Advanced Disc Filing System");
sbInformation.AppendLine();
@@ -483,22 +482,22 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("Volume flags: 0x{0:X4}", drSb.flags).AppendLine();
if(drSb.disc_id > 0)
{
xmlFsType.VolumeSerial = $"{drSb.disc_id:X4}";
XmlFsType.VolumeSerial = $"{drSb.disc_id:X4}";
sbInformation.AppendFormat("Volume ID: {0:X4}", drSb.disc_id).AppendLine();
}
if(!ArrayHelpers.ArrayIsNullOrEmpty(drSb.disc_name))
{
string discname = StringHandlers.CToString(drSb.disc_name, currentEncoding);
xmlFsType.VolumeName = discname;
string discname = StringHandlers.CToString(drSb.disc_name, Encoding);
XmlFsType.VolumeName = discname;
sbInformation.AppendFormat("Volume name: {0}", discname).AppendLine();
}
information = sbInformation.ToString();
xmlFsType.Bootable |= drSb.bootoption != 0; // Or not?
xmlFsType.Clusters = (long)(bytes / (ulong)(1 << drSb.log2secsize));
xmlFsType.ClusterSize = 1 << drSb.log2secsize;
xmlFsType.Type = "Acorn Advanced Disc Filing System";
XmlFsType.Bootable |= drSb.bootoption != 0; // Or not?
XmlFsType.Clusters = (long)(bytes / (ulong)(1 << drSb.log2secsize));
XmlFsType.ClusterSize = 1 << drSb.log2secsize;
XmlFsType.Type = "Acorn Advanced Disc Filing System";
}
byte AcornMapChecksum(byte[] data, int length)

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
@@ -50,13 +49,11 @@ namespace DiscImageChef.Filesystems
const uint TYPE_HEADER = 2;
const uint SUBTYPE_ROOT = 1;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public FileSystemType XmlFsType { get; private set; }
public string Name => "Amiga DOS filesystem";
public Guid Id => new Guid("3c882400-208c-427d-a086-9119852a1bc7");
public Encoding Encoding => currentEncoding;
public Encoding Encoding { get; private set; }
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -154,11 +151,12 @@ namespace DiscImageChef.Filesystems
return false;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
StringBuilder sbInformation = new StringBuilder();
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
information = null;
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
@@ -242,41 +240,41 @@ namespace DiscImageChef.Filesystems
rootBlk = MarshalRootBlock(rootBlockSector);
string diskName = StringHandlers.PascalToString(rootBlk.diskName, currentEncoding);
string diskName = StringHandlers.PascalToString(rootBlk.diskName, Encoding);
switch(bootBlk.diskType & 0xFF)
{
case 0:
sbInformation.Append("Amiga Original File System");
xmlFsType.Type = "Amiga OFS";
XmlFsType.Type = "Amiga OFS";
break;
case 1:
sbInformation.Append("Amiga Fast File System");
xmlFsType.Type = "Amiga FFS";
XmlFsType.Type = "Amiga FFS";
break;
case 2:
sbInformation.Append("Amiga Original File System with international characters");
xmlFsType.Type = "Amiga OFS";
XmlFsType.Type = "Amiga OFS";
break;
case 3:
sbInformation.Append("Amiga Fast File System with international characters");
xmlFsType.Type = "Amiga FFS";
XmlFsType.Type = "Amiga FFS";
break;
case 4:
sbInformation.Append("Amiga Original File System with directory cache");
xmlFsType.Type = "Amiga OFS";
XmlFsType.Type = "Amiga OFS";
break;
case 5:
sbInformation.Append("Amiga Fast File System with directory cache");
xmlFsType.Type = "Amiga FFS";
XmlFsType.Type = "Amiga FFS";
break;
case 6:
sbInformation.Append("Amiga Original File System with long filenames");
xmlFsType.Type = "Amiga OFS2";
XmlFsType.Type = "Amiga OFS2";
break;
case 7:
sbInformation.Append("Amiga Fast File System with long filenames");
xmlFsType.Type = "Amiga FFS2";
XmlFsType.Type = "Amiga FFS2";
break;
}
@@ -319,17 +317,17 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("Root block checksum is 0x{0:X8}", rootBlk.checksum).AppendLine();
information = sbInformation.ToString();
xmlFsType.CreationDate = DateHandlers.AmigaToDateTime(rootBlk.cDays, rootBlk.cMins, rootBlk.cTicks);
xmlFsType.CreationDateSpecified = true;
xmlFsType.ModificationDate = DateHandlers.AmigaToDateTime(rootBlk.vDays, rootBlk.vMins, rootBlk.vTicks);
xmlFsType.ModificationDateSpecified = true;
xmlFsType.Dirty = rootBlk.bitmapFlag != 0xFFFFFFFF;
xmlFsType.Clusters = blocks;
xmlFsType.ClusterSize = (int)blockSize;
xmlFsType.VolumeName = diskName;
xmlFsType.Bootable = bsum == bootBlk.checksum;
XmlFsType.CreationDate = DateHandlers.AmigaToDateTime(rootBlk.cDays, rootBlk.cMins, rootBlk.cTicks);
XmlFsType.CreationDateSpecified = true;
XmlFsType.ModificationDate = DateHandlers.AmigaToDateTime(rootBlk.vDays, rootBlk.vMins, rootBlk.vTicks);
XmlFsType.ModificationDateSpecified = true;
XmlFsType.Dirty = rootBlk.bitmapFlag != 0xFFFFFFFF;
XmlFsType.Clusters = blocks;
XmlFsType.ClusterSize = (int)blockSize;
XmlFsType.VolumeName = diskName;
XmlFsType.Bootable = bsum == bootBlk.checksum;
// Useful as a serial
xmlFsType.VolumeSerial = $"{rootBlk.checksum:X8}";
XmlFsType.VolumeSerial = $"{rootBlk.checksum:X8}";
}
static RootBlock MarshalRootBlock(byte[] block)

View File

@@ -32,19 +32,16 @@
using System;
using System.Collections.Generic;
using Claunia.Encoding;
using DiscImageChef.CommonTypes;
using System.Text;
using DiscImageChef.DiscImages;
using Schemas;
using Encoding = System.Text.Encoding;
namespace DiscImageChef.Filesystems.AppleDOS
{
public partial class AppleDOS : IReadOnlyFilesystem
{
IMediaImage device;
Encoding currentEncoding;
bool debug;
IMediaImage device;
bool mounted;
int sectorsPerTrack;
ulong start;
@@ -55,9 +52,8 @@ namespace DiscImageChef.Filesystems.AppleDOS
Vtoc vtoc;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Apple DOS File System";
public Guid Id => new Guid("8658A1E9-B2E7-4BCC-9638-157A31B0A700\n");

View File

@@ -111,7 +111,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
// Apple DOS has high byte set over ASCII.
for(int i = 0; i < 30; i++) filenameB[i] = (byte)(entry.filename[i] & 0x7F);
string filename = StringHandlers.SpacePaddedToString(filenameB, currentEncoding);
string filename = StringHandlers.SpacePaddedToString(filenameB, Encoding);
if(!catalogCache.ContainsKey(filename)) catalogCache.Add(filename, ts);

View File

@@ -63,10 +63,11 @@ namespace DiscImageChef.Filesystems.AppleDOS
vtoc.sectorsPerTrack == spt && vtoc.bytesPerSector == 256;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
// TODO: Until Apple ][ encoding is implemented
currentEncoding = new LisaRoman();
Encoding = new LisaRoman();
information = "";
StringBuilder sb = new StringBuilder();
@@ -95,7 +96,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
information = sb.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Bootable = true,
Clusters = (long)imagePlugin.Info.Sectors,

View File

@@ -51,7 +51,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
device = imagePlugin;
start = partition.Start;
// TODO: Until Apple ][ encoding is implemented
currentEncoding = new LisaRoman();
Encoding = new LisaRoman();
if(device.Info.Sectors != 455 && device.Info.Sectors != 560)
{
@@ -100,7 +100,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
}
// Create XML metadata for mounted filesystem
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Bootable = true,
Clusters = (long)device.Info.Sectors,
@@ -110,7 +110,7 @@ namespace DiscImageChef.Filesystems.AppleDOS
FreeClustersSpecified = true,
Type = "Apple DOS"
};
xmlFsType.FreeClusters = xmlFsType.Clusters - usedSectors;
XmlFsType.FreeClusters = XmlFsType.Clusters - usedSectors;
this.debug = debug;
mounted = true;

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -56,11 +55,9 @@ namespace DiscImageChef.Filesystems
/// "LK", HFS bootblock magic
/// </summary>
const ushort HFSBB_MAGIC = 0x4C4B;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Apple Hierarchical File System";
public Guid Id => new Guid("36405F8D-0D26-6ECC-0BBB-1D5225FF404F");
@@ -105,7 +102,7 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("macintosh");
Encoding = encoding ?? Encoding.GetEncoding("macintosh");
information = "";
StringBuilder sb = new StringBuilder();
@@ -193,7 +190,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("{0} bytes in the Extents B-Tree", MDB.drXTFlSize).AppendLine();
sb.AppendFormat("{0} bytes in the Catalog B-Tree", MDB.drCTFlSize).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.PascalToString(MDB.drVN, currentEncoding)).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.PascalToString(MDB.drVN, Encoding)).AppendLine();
sb.AppendLine("Finder info:");
sb.AppendFormat("CNID of bootable system's directory: {0}", MDB.drFndrInfo0).AppendLine();
@@ -229,20 +226,20 @@ namespace DiscImageChef.Filesystems
if(BB.boot_flags > 0) sb.AppendLine("Allocate secondary sound buffer at boot.");
else if(BB.boot_flags < 0) sb.AppendLine("Allocate secondary sound and video buffers at boot.");
sb.AppendFormat("System filename: {0}",
StringHandlers.PascalToString(BB.system_name, currentEncoding)).AppendLine();
sb.AppendFormat("Finder filename: {0}",
StringHandlers.PascalToString(BB.finder_name, currentEncoding)).AppendLine();
sb.AppendFormat("Debugger filename: {0}",
StringHandlers.PascalToString(BB.debug_name, currentEncoding)).AppendLine();
sb.AppendFormat("System filename: {0}", StringHandlers.PascalToString(BB.system_name, Encoding))
.AppendLine();
sb.AppendFormat("Finder filename: {0}", StringHandlers.PascalToString(BB.finder_name, Encoding))
.AppendLine();
sb.AppendFormat("Debugger filename: {0}", StringHandlers.PascalToString(BB.debug_name, Encoding))
.AppendLine();
sb.AppendFormat("Disassembler filename: {0}",
StringHandlers.PascalToString(BB.disasm_name, currentEncoding)).AppendLine();
StringHandlers.PascalToString(BB.disasm_name, Encoding)).AppendLine();
sb.AppendFormat("Startup screen filename: {0}",
StringHandlers.PascalToString(BB.stupscr_name, currentEncoding)).AppendLine();
StringHandlers.PascalToString(BB.stupscr_name, Encoding)).AppendLine();
sb.AppendFormat("First program to execute at boot: {0}",
StringHandlers.PascalToString(BB.bootup_name, currentEncoding)).AppendLine();
sb.AppendFormat("Clipboard filename: {0}",
StringHandlers.PascalToString(BB.clipbrd_name, currentEncoding)).AppendLine();
StringHandlers.PascalToString(BB.bootup_name, Encoding)).AppendLine();
sb.AppendFormat("Clipboard filename: {0}", StringHandlers.PascalToString(BB.clipbrd_name, Encoding))
.AppendLine();
sb.AppendFormat("Maximum opened files: {0}", BB.max_files * 4).AppendLine();
sb.AppendFormat("Event queue size: {0}", BB.queue_size).AppendLine();
sb.AppendFormat("Heap size with 128KiB of RAM: {0} bytes", BB.heap_128k).AppendLine();
@@ -256,35 +253,35 @@ namespace DiscImageChef.Filesystems
information = sb.ToString();
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
if(MDB.drVolBkUp > 0)
{
xmlFsType.BackupDate = DateHandlers.MacToDateTime(MDB.drVolBkUp);
xmlFsType.BackupDateSpecified = true;
XmlFsType.BackupDate = DateHandlers.MacToDateTime(MDB.drVolBkUp);
XmlFsType.BackupDateSpecified = true;
}
xmlFsType.Bootable = BB.signature == HFSBB_MAGIC || MDB.drFndrInfo0 != 0 || MDB.drFndrInfo3 != 0 ||
XmlFsType.Bootable = BB.signature == HFSBB_MAGIC || MDB.drFndrInfo0 != 0 || MDB.drFndrInfo3 != 0 ||
MDB.drFndrInfo5 != 0;
xmlFsType.Clusters = MDB.drNmAlBlks;
xmlFsType.ClusterSize = (int)MDB.drAlBlkSiz;
XmlFsType.Clusters = MDB.drNmAlBlks;
XmlFsType.ClusterSize = (int)MDB.drAlBlkSiz;
if(MDB.drCrDate > 0)
{
xmlFsType.CreationDate = DateHandlers.MacToDateTime(MDB.drCrDate);
xmlFsType.CreationDateSpecified = true;
XmlFsType.CreationDate = DateHandlers.MacToDateTime(MDB.drCrDate);
XmlFsType.CreationDateSpecified = true;
}
xmlFsType.Dirty = (MDB.drAtrb & 0x100) != 0x100;
xmlFsType.Files = MDB.drFilCnt;
xmlFsType.FilesSpecified = true;
xmlFsType.FreeClusters = MDB.drFreeBks;
xmlFsType.FreeClustersSpecified = true;
XmlFsType.Dirty = (MDB.drAtrb & 0x100) != 0x100;
XmlFsType.Files = MDB.drFilCnt;
XmlFsType.FilesSpecified = true;
XmlFsType.FreeClusters = MDB.drFreeBks;
XmlFsType.FreeClustersSpecified = true;
if(MDB.drLsMod > 0)
{
xmlFsType.ModificationDate = DateHandlers.MacToDateTime(MDB.drLsMod);
xmlFsType.ModificationDateSpecified = true;
XmlFsType.ModificationDate = DateHandlers.MacToDateTime(MDB.drLsMod);
XmlFsType.ModificationDateSpecified = true;
}
xmlFsType.Type = "HFS";
xmlFsType.VolumeName = StringHandlers.PascalToString(MDB.drVN, currentEncoding);
XmlFsType.Type = "HFS";
XmlFsType.VolumeName = StringHandlers.PascalToString(MDB.drVN, Encoding);
if(MDB.drFndrInfo6 != 0 && MDB.drFndrInfo7 != 0)
xmlFsType.VolumeSerial = $"{MDB.drFndrInfo6:X8}{MDB.drFndrInfo7:X8}";
XmlFsType.VolumeSerial = $"{MDB.drFndrInfo6:X8}{MDB.drFndrInfo7:X8}";
}
static byte[] Read2048SectorAs512(IMediaImage imagePlugin, ulong lba)

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -56,11 +55,8 @@ namespace DiscImageChef.Filesystems
/// </summary>
const ushort HFSX_MAGIC = 0x4858;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Apple HFS+ filesystem";
public Guid Id => new Guid("36405F8D-0D26-6EBE-436F-62F0586B4F08");
@@ -106,7 +102,7 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = Encoding.BigEndianUnicode;
Encoding = Encoding.BigEndianUnicode;
information = "";
ushort drSigWord;
@@ -219,35 +215,35 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Mac OS X Volume ID: {0:X8}{1:X8}", HPVH.drFndrInfo6, HPVH.drFndrInfo7)
.AppendLine();
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
if(HPVH.backupDate > 0)
{
xmlFsType.BackupDate = DateHandlers.MacToDateTime(HPVH.backupDate);
xmlFsType.BackupDateSpecified = true;
XmlFsType.BackupDate = DateHandlers.MacToDateTime(HPVH.backupDate);
XmlFsType.BackupDateSpecified = true;
}
xmlFsType.Bootable |= HPVH.drFndrInfo0 != 0 || HPVH.drFndrInfo3 != 0 || HPVH.drFndrInfo5 != 0;
xmlFsType.Clusters = HPVH.totalBlocks;
xmlFsType.ClusterSize = (int)HPVH.blockSize;
XmlFsType.Bootable |= HPVH.drFndrInfo0 != 0 || HPVH.drFndrInfo3 != 0 || HPVH.drFndrInfo5 != 0;
XmlFsType.Clusters = HPVH.totalBlocks;
XmlFsType.ClusterSize = (int)HPVH.blockSize;
if(HPVH.createDate > 0)
{
xmlFsType.CreationDate = DateHandlers.MacToDateTime(HPVH.createDate);
xmlFsType.CreationDateSpecified = true;
XmlFsType.CreationDate = DateHandlers.MacToDateTime(HPVH.createDate);
XmlFsType.CreationDateSpecified = true;
}
xmlFsType.Dirty = (HPVH.attributes & 0x100) != 0x100;
xmlFsType.Files = HPVH.fileCount;
xmlFsType.FilesSpecified = true;
xmlFsType.FreeClusters = HPVH.freeBlocks;
xmlFsType.FreeClustersSpecified = true;
XmlFsType.Dirty = (HPVH.attributes & 0x100) != 0x100;
XmlFsType.Files = HPVH.fileCount;
XmlFsType.FilesSpecified = true;
XmlFsType.FreeClusters = HPVH.freeBlocks;
XmlFsType.FreeClustersSpecified = true;
if(HPVH.modifyDate > 0)
{
xmlFsType.ModificationDate = DateHandlers.MacToDateTime(HPVH.modifyDate);
xmlFsType.ModificationDateSpecified = true;
XmlFsType.ModificationDate = DateHandlers.MacToDateTime(HPVH.modifyDate);
XmlFsType.ModificationDateSpecified = true;
}
if(HPVH.signature == 0x482B) xmlFsType.Type = "HFS+";
if(HPVH.signature == 0x4858) xmlFsType.Type = "HFSX";
if(HPVH.signature == 0x482B) XmlFsType.Type = "HFS+";
if(HPVH.signature == 0x4858) XmlFsType.Type = "HFSX";
if(HPVH.drFndrInfo6 != 0 && HPVH.drFndrInfo7 != 0)
xmlFsType.VolumeSerial = $"{HPVH.drFndrInfo6:X8}{HPVH.drFndrInfo7:X8}";
xmlFsType.SystemIdentifier = Encoding.ASCII.GetString(HPVH.lastMountedVersion);
XmlFsType.VolumeSerial = $"{HPVH.drFndrInfo6:X8}{HPVH.drFndrInfo7:X8}";
XmlFsType.SystemIdentifier = Encoding.ASCII.GetString(HPVH.lastMountedVersion);
}
else
{

View File

@@ -62,29 +62,27 @@ namespace DiscImageChef.Filesystems.AppleMFS
byte[] mdbTags;
byte[] directoryTags;
byte[] bitmapTags;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public FileSystemType XmlFsType { get; private set; }
public string Name => "Apple Macintosh File System";
public Guid Id => new Guid("36405F8D-0D26-4066-6538-5DBF5D065C3A");
public Encoding Encoding => currentEncoding;
public Encoding Encoding { get; private set; }
public AppleMFS()
{
currentEncoding = Encoding.GetEncoding("macintosh");
Encoding = Encoding.GetEncoding("macintosh");
}
public AppleMFS(Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("macintosh");
Encoding = encoding ?? Encoding.GetEncoding("macintosh");
}
public AppleMFS(IMediaImage imagePlugin, Partition partition, Encoding encoding)
{
device = imagePlugin;
partitionStart = partition.Start;
currentEncoding = encoding ?? Encoding.GetEncoding("macintosh");
Encoding = encoding ?? Encoding.GetEncoding("macintosh");
}
}
}

View File

@@ -92,7 +92,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
entry.flNam = new byte[directoryBlocks[offset + 50] + 1];
Array.Copy(directoryBlocks, offset + 50, entry.flNam, 0, entry.flNam.Length);
string lowerFilename = StringHandlers
.PascalToString(entry.flNam, currentEncoding).ToLowerInvariant().Replace('/', ':');
.PascalToString(entry.flNam, Encoding).ToLowerInvariant().Replace('/', ':');
if(entry.flFlags.HasFlag(MFS_FileFlags.Used) && !idToFilename.ContainsKey(entry.flFlNum) &&
!idToEntry.ContainsKey(entry.flFlNum) && !filenameToId.ContainsKey(lowerFilename) &&
@@ -100,7 +100,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
{
idToEntry.Add(entry.flFlNum, entry);
idToFilename.Add(entry.flFlNum,
StringHandlers.PascalToString(entry.flNam, currentEncoding).Replace('/', ':'));
StringHandlers.PascalToString(entry.flNam, Encoding).Replace('/', ':'));
filenameToId.Add(lowerFilename, entry.flFlNum);
DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flFlags = {0}", entry.flFlags);
@@ -117,7 +117,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flMdDat = {0}",
DateHandlers.MacToDateTime(entry.flMdDat));
DicConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flNam0 = {0}",
StringHandlers.PascalToString(entry.flNam, currentEncoding));
StringHandlers.PascalToString(entry.flNam, Encoding));
}
offset += 50 + entry.flNam.Length;

View File

@@ -56,7 +56,8 @@ namespace DiscImageChef.Filesystems.AppleMFS
return drSigWord == MFS_MAGIC;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
information = "";
@@ -90,7 +91,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
MDB.drVNSiz = mdbSector[0x024];
byte[] variableSize = new byte[MDB.drVNSiz + 1];
Array.Copy(mdbSector, 0x024, variableSize, 0, MDB.drVNSiz + 1);
MDB.drVN = StringHandlers.PascalToString(variableSize, currentEncoding);
MDB.drVN = StringHandlers.PascalToString(variableSize, Encoding);
BB.signature = BigEndianBitConverter.ToUInt16(bbSector, 0x000);
@@ -103,19 +104,19 @@ namespace DiscImageChef.Filesystems.AppleMFS
BB.sec_sv_pages = BigEndianBitConverter.ToInt16(bbSector, 0x008);
Array.Copy(mdbSector, 0x00A, pString, 0, 16);
BB.system_name = StringHandlers.PascalToString(pString, currentEncoding);
BB.system_name = StringHandlers.PascalToString(pString, Encoding);
Array.Copy(mdbSector, 0x01A, pString, 0, 16);
BB.finder_name = StringHandlers.PascalToString(pString, currentEncoding);
BB.finder_name = StringHandlers.PascalToString(pString, Encoding);
Array.Copy(mdbSector, 0x02A, pString, 0, 16);
BB.debug_name = StringHandlers.PascalToString(pString, currentEncoding);
BB.debug_name = StringHandlers.PascalToString(pString, Encoding);
Array.Copy(mdbSector, 0x03A, pString, 0, 16);
BB.disasm_name = StringHandlers.PascalToString(pString, currentEncoding);
BB.disasm_name = StringHandlers.PascalToString(pString, Encoding);
Array.Copy(mdbSector, 0x04A, pString, 0, 16);
BB.stupscr_name = StringHandlers.PascalToString(pString, currentEncoding);
BB.stupscr_name = StringHandlers.PascalToString(pString, Encoding);
Array.Copy(mdbSector, 0x05A, pString, 0, 16);
BB.bootup_name = StringHandlers.PascalToString(pString, currentEncoding);
BB.bootup_name = StringHandlers.PascalToString(pString, Encoding);
Array.Copy(mdbSector, 0x06A, pString, 0, 16);
BB.clipbrd_name = StringHandlers.PascalToString(pString, currentEncoding);
BB.clipbrd_name = StringHandlers.PascalToString(pString, Encoding);
BB.max_files = BigEndianBitConverter.ToUInt16(bbSector, 0x07A);
BB.queue_size = BigEndianBitConverter.ToUInt16(bbSector, 0x07C);
@@ -173,26 +174,26 @@ namespace DiscImageChef.Filesystems.AppleMFS
information = sb.ToString();
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
if(MDB.drLsBkUp > 0)
{
xmlFsType.BackupDate = DateHandlers.MacToDateTime(MDB.drLsBkUp);
xmlFsType.BackupDateSpecified = true;
XmlFsType.BackupDate = DateHandlers.MacToDateTime(MDB.drLsBkUp);
XmlFsType.BackupDateSpecified = true;
}
xmlFsType.Bootable = BB.signature == MFSBB_MAGIC;
xmlFsType.Clusters = MDB.drNmAlBlks;
xmlFsType.ClusterSize = (int)MDB.drAlBlkSiz;
XmlFsType.Bootable = BB.signature == MFSBB_MAGIC;
XmlFsType.Clusters = MDB.drNmAlBlks;
XmlFsType.ClusterSize = (int)MDB.drAlBlkSiz;
if(MDB.drCrDate > 0)
{
xmlFsType.CreationDate = DateHandlers.MacToDateTime(MDB.drCrDate);
xmlFsType.CreationDateSpecified = true;
XmlFsType.CreationDate = DateHandlers.MacToDateTime(MDB.drCrDate);
XmlFsType.CreationDateSpecified = true;
}
xmlFsType.Files = MDB.drNmFls;
xmlFsType.FilesSpecified = true;
xmlFsType.FreeClusters = MDB.drFreeBks;
xmlFsType.FreeClustersSpecified = true;
xmlFsType.Type = "MFS";
xmlFsType.VolumeName = MDB.drVN;
XmlFsType.Files = MDB.drNmFls;
XmlFsType.FilesSpecified = true;
XmlFsType.FreeClusters = MDB.drFreeBks;
XmlFsType.FreeClustersSpecified = true;
XmlFsType.Type = "MFS";
XmlFsType.VolumeName = MDB.drVN;
}
}
}

View File

@@ -45,7 +45,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
{
device = imagePlugin;
partitionStart = partition.Start;
currentEncoding = encoding ?? Encoding.GetEncoding("macintosh");
Encoding = encoding ?? Encoding.GetEncoding("macintosh");
this.debug = debug;
volMDB = new MFS_MasterDirectoryBlock();
@@ -72,7 +72,7 @@ namespace DiscImageChef.Filesystems.AppleMFS
volMDB.drVNSiz = mdbBlocks[0x024];
byte[] variableSize = new byte[volMDB.drVNSiz + 1];
Array.Copy(mdbBlocks, 0x024, variableSize, 0, volMDB.drVNSiz + 1);
volMDB.drVN = StringHandlers.PascalToString(variableSize, currentEncoding);
volMDB.drVN = StringHandlers.PascalToString(variableSize, Encoding);
directoryBlocks = device.ReadSectors(volMDB.drDirSt + partitionStart, volMDB.drBlLen);
int bytesInBlockMap = volMDB.drNmAlBlks * 12 / 8 + volMDB.drNmAlBlks * 12 % 8;
@@ -130,26 +130,26 @@ namespace DiscImageChef.Filesystems.AppleMFS
if(bbSig != MFSBB_MAGIC) bootBlocks = null;
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
if(volMDB.drLsBkUp > 0)
{
xmlFsType.BackupDate = DateHandlers.MacToDateTime(volMDB.drLsBkUp);
xmlFsType.BackupDateSpecified = true;
XmlFsType.BackupDate = DateHandlers.MacToDateTime(volMDB.drLsBkUp);
XmlFsType.BackupDateSpecified = true;
}
xmlFsType.Bootable = bbSig == MFSBB_MAGIC;
xmlFsType.Clusters = volMDB.drNmAlBlks;
xmlFsType.ClusterSize = (int)volMDB.drAlBlkSiz;
XmlFsType.Bootable = bbSig == MFSBB_MAGIC;
XmlFsType.Clusters = volMDB.drNmAlBlks;
XmlFsType.ClusterSize = (int)volMDB.drAlBlkSiz;
if(volMDB.drCrDate > 0)
{
xmlFsType.CreationDate = DateHandlers.MacToDateTime(volMDB.drCrDate);
xmlFsType.CreationDateSpecified = true;
XmlFsType.CreationDate = DateHandlers.MacToDateTime(volMDB.drCrDate);
XmlFsType.CreationDateSpecified = true;
}
xmlFsType.Files = volMDB.drNmFls;
xmlFsType.FilesSpecified = true;
xmlFsType.FreeClusters = volMDB.drFreeBks;
xmlFsType.FreeClustersSpecified = true;
xmlFsType.Type = "MFS";
xmlFsType.VolumeName = volMDB.drVN;
XmlFsType.Files = volMDB.drNmFls;
XmlFsType.FilesSpecified = true;
XmlFsType.FreeClusters = volMDB.drFreeBks;
XmlFsType.FreeClustersSpecified = true;
XmlFsType.Type = "MFS";
XmlFsType.VolumeName = volMDB.drVN;
return Errno.NoError;
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -49,11 +48,9 @@ namespace DiscImageChef.Filesystems
// Common constants
const uint AFS_SUPERBLOCK_SIZE = 1024;
const uint AFS_BOOTBLOCK_SIZE = AFS_SUPERBLOCK_SIZE;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "AtheOS Filesystem";
public Guid Id => new Guid("AAB2C4F1-DC07-49EE-A948-576CC51B58C5");
@@ -82,7 +79,7 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
@@ -107,7 +104,7 @@ namespace DiscImageChef.Filesystems
if(afsSb.flags == 1) sb.AppendLine("Filesystem is read-only");
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(afsSb.name, currentEncoding)).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(afsSb.name, Encoding)).AppendLine();
sb.AppendFormat("{0} bytes per block", afsSb.block_size).AppendLine();
sb.AppendFormat("{0} blocks in volume ({1} bytes)", afsSb.num_blocks, afsSb.num_blocks * afsSb.block_size)
.AppendLine();
@@ -139,7 +136,7 @@ namespace DiscImageChef.Filesystems
information = sb.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Clusters = afsSb.num_blocks,
ClusterSize = (int)afsSb.block_size,
@@ -147,7 +144,7 @@ namespace DiscImageChef.Filesystems
FreeClusters = afsSb.num_blocks - afsSb.used_blocks,
FreeClustersSpecified = true,
Type = "AtheOS filesystem",
VolumeName = StringHandlers.CToString(afsSb.name, currentEncoding)
VolumeName = StringHandlers.CToString(afsSb.name, Encoding)
};
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -54,11 +53,9 @@ namespace DiscImageChef.Filesystems
// Common constants
const uint BEFS_CLEAN = 0x434C454E;
const uint BEFS_DIRTY = 0x44495254;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Be Filesystem";
public Guid Id => new Guid("dc8572b3-b6ad-46e4-8de9-cbe123ff6672");
@@ -92,9 +89,10 @@ namespace DiscImageChef.Filesystems
return magic == BEFS_MAGIC1 || magicBe == BEFS_MAGIC1;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
@@ -170,7 +168,7 @@ namespace DiscImageChef.Filesystems
break;
}
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(besb.name, currentEncoding)).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(besb.name, Encoding)).AppendLine();
sb.AppendFormat("{0} bytes per block", besb.block_size).AppendLine();
sb.AppendFormat("{0} blocks in volume ({1} bytes)", besb.num_blocks, besb.num_blocks * besb.block_size)
.AppendLine();
@@ -196,7 +194,7 @@ namespace DiscImageChef.Filesystems
information = sb.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Clusters = besb.num_blocks,
ClusterSize = (int)besb.block_size,
@@ -204,7 +202,7 @@ namespace DiscImageChef.Filesystems
FreeClusters = besb.num_blocks - besb.used_blocks,
FreeClustersSpecified = true,
Type = "BeFS",
VolumeName = StringHandlers.CToString(besb.name, currentEncoding)
VolumeName = StringHandlers.CToString(besb.name, Encoding)
};
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -47,11 +46,9 @@ namespace DiscImageChef.Filesystems
/// BTRFS magic "_BHRfS_M"
/// </summary>
const ulong btrfsMagic = 0x4D5F53665248425F;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
Encoding currentEncoding;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "B-tree file system";
public Guid Id => new Guid("C904CF15-5222-446B-B7DB-02EAC5D781B3");
@@ -86,9 +83,9 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
StringBuilder sbInformation = new StringBuilder();
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
information = "";
ulong sbSectorOff = 0x10000 / imagePlugin.Info.SectorSize;
@@ -171,7 +168,7 @@ namespace DiscImageChef.Filesystems
information = sbInformation.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Clusters = (long)(btrfsSb.total_bytes / btrfsSb.sectorsize),
ClusterSize = (int)btrfsSb.sectorsize,
@@ -181,7 +178,7 @@ namespace DiscImageChef.Filesystems
VolumeSetIdentifier = $"{btrfsSb.dev_item.device_uuid}",
Type = Name
};
xmlFsType.FreeClusters = xmlFsType.Clusters - (long)(btrfsSb.bytes_used / btrfsSb.sectorsize);
XmlFsType.FreeClusters = XmlFsType.Clusters - (long)(btrfsSb.bytes_used / btrfsSb.sectorsize);
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using Claunia.Encoding;
@@ -44,13 +43,10 @@ namespace DiscImageChef.Filesystems
{
public class CBM : IFilesystem
{
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public FileSystemType XmlFsType { get; private set; }
public string Name => "Commodore file system";
public Guid Id => new Guid("D104744E-A376-450C-BAC0-1347C93F983B");
public Encoding Encoding => currentEncoding;
public Encoding Encoding { get; private set; }
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -91,16 +87,17 @@ namespace DiscImageChef.Filesystems
return false;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = new PETSCII();
Encoding = new PETSCII();
byte[] sector;
StringBuilder sbInformation = new StringBuilder();
sbInformation.AppendLine("Commodore file system");
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "Commodore file system",
Clusters = (long)imagePlugin.Info.Sectors,
@@ -126,11 +123,11 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("Disk Version: {0}", Encoding.ASCII.GetString(new[] {cbmHdr.diskVersion}))
.AppendLine();
sbInformation.AppendFormat("Disk ID: {0}", cbmHdr.diskId).AppendLine();
sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(cbmHdr.name, currentEncoding))
sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(cbmHdr.name, Encoding))
.AppendLine();
xmlFsType.VolumeName = StringHandlers.CToString(cbmHdr.name, currentEncoding);
xmlFsType.VolumeSerial = $"{cbmHdr.diskId}";
XmlFsType.VolumeName = StringHandlers.CToString(cbmHdr.name, Encoding);
XmlFsType.VolumeSerial = $"{cbmHdr.diskId}";
}
else
{
@@ -149,11 +146,11 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("DOS Version: {0}", Encoding.ASCII.GetString(new[] {cbmBam.dosVersion}))
.AppendLine();
sbInformation.AppendFormat("Disk ID: {0}", cbmBam.diskId).AppendLine();
sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(cbmBam.name, currentEncoding))
sbInformation.AppendFormat("Disk name: {0}", StringHandlers.CToString(cbmBam.name, Encoding))
.AppendLine();
xmlFsType.VolumeName = StringHandlers.CToString(cbmBam.name, currentEncoding);
xmlFsType.VolumeSerial = $"{cbmBam.diskId}";
XmlFsType.VolumeName = StringHandlers.CToString(cbmBam.name, Encoding);
XmlFsType.VolumeSerial = $"{cbmBam.diskId}";
}
information = sbInformation.ToString();

View File

@@ -51,7 +51,6 @@ namespace DiscImageChef.Filesystems.CPM
/// </summary>
FileSystemInfo cpmStat;
Encoding currentEncoding;
/// <summary>
/// Cached file passwords, decoded
/// </summary>
@@ -112,9 +111,9 @@ namespace DiscImageChef.Filesystems.CPM
/// If <see cref="Identify" /> thinks this is a CP/M filesystem, this is the definition for it
/// </summary>
CpmDefinition workingDefinition;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "CP/M File System";
public Guid Id => new Guid("AA2B8585-41DF-4E3B-8A35-D1A935E2F8A1");
}

View File

@@ -107,7 +107,7 @@ namespace DiscImageChef.Filesystems.CPM
if(labelCreationDate != null) stat.CreationTime = DateHandlers.CpmToDateTime(labelCreationDate);
if(labelUpdateDate != null) stat.StatusChangeTime = DateHandlers.CpmToDateTime(labelUpdateDate);
stat.Attributes = FileAttributes.Directory;
stat.BlockSize = xmlFsType.ClusterSize;
stat.BlockSize = XmlFsType.ClusterSize;
return Errno.NoError;
}

View File

@@ -203,8 +203,7 @@ namespace DiscImageChef.Filesystems.CPM
sectorSize = (ulong)(128 << amsSb.psh);
// Compare device limits from superblock to real limits
if(sectorSize == imagePlugin.Info.SectorSize &&
sectorCount == imagePlugin.Info.Sectors)
if(sectorSize == imagePlugin.Info.SectorSize && sectorCount == imagePlugin.Info.Sectors)
{
cpmFound = true;
firstDirectorySector = (ulong)(amsSb.off * amsSb.spt);
@@ -976,9 +975,10 @@ namespace DiscImageChef.Filesystems.CPM
}
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("IBM437");
Encoding = encoding ?? Encoding.GetEncoding("IBM437");
information = "";
// As the identification is so complex, just call Identify() and relay on its findings
if(!Identify(imagePlugin, partition) || !cpmFound || workingDefinition == null || dpb == null) return;
@@ -1051,23 +1051,23 @@ namespace DiscImageChef.Filesystems.CPM
if(labelUpdateDate != null)
sb.AppendFormat("Volume updated on {0}", DateHandlers.CpmToDateTime(labelUpdateDate)).AppendLine();
xmlFsType = new FileSystemType();
xmlFsType.Bootable |= workingDefinition.sofs > 0 || workingDefinition.ofs > 0;
xmlFsType.ClusterSize = 128 << dpb.bsh;
if(dpb.dsm > 0) xmlFsType.Clusters = dpb.dsm;
else xmlFsType.Clusters = (long)(partition.End - partition.Start);
XmlFsType = new FileSystemType();
XmlFsType.Bootable |= workingDefinition.sofs > 0 || workingDefinition.ofs > 0;
XmlFsType.ClusterSize = 128 << dpb.bsh;
if(dpb.dsm > 0) XmlFsType.Clusters = dpb.dsm;
else XmlFsType.Clusters = (long)(partition.End - partition.Start);
if(labelCreationDate != null)
{
xmlFsType.CreationDate = DateHandlers.CpmToDateTime(labelCreationDate);
xmlFsType.CreationDateSpecified = true;
XmlFsType.CreationDate = DateHandlers.CpmToDateTime(labelCreationDate);
XmlFsType.CreationDateSpecified = true;
}
if(labelUpdateDate != null)
{
xmlFsType.ModificationDate = DateHandlers.CpmToDateTime(labelUpdateDate);
xmlFsType.ModificationDateSpecified = true;
XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(labelUpdateDate);
XmlFsType.ModificationDateSpecified = true;
}
xmlFsType.Type = "CP/M";
xmlFsType.VolumeName = label;
XmlFsType.Type = "CP/M";
XmlFsType.VolumeName = label;
information = sb.ToString();
}

View File

@@ -50,8 +50,8 @@ namespace DiscImageChef.Filesystems.CPM
public Errno Mount(IMediaImage imagePlugin, Partition partition1, Encoding encoding, bool debug)
{
device = imagePlugin;
this.partition = partition;
currentEncoding = encoding ?? Encoding.GetEncoding("IBM437");
partition = partition;
Encoding = encoding ?? Encoding.GetEncoding("IBM437");
// As the identification is so complex, just call Identify() and relay on its findings
if(!Identify(device, partition) || !cpmFound || workingDefinition == null || dpb == null)
@@ -656,7 +656,7 @@ namespace DiscImageChef.Filesystems.CPM
cpmStat.Type = "CP/M filesystem";
// Generate XML info
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Clusters = cpmStat.Blocks,
ClusterSize = blockSize,
@@ -668,15 +668,15 @@ namespace DiscImageChef.Filesystems.CPM
};
if(labelCreationDate != null)
{
xmlFsType.CreationDate = DateHandlers.CpmToDateTime(labelCreationDate);
xmlFsType.CreationDateSpecified = true;
XmlFsType.CreationDate = DateHandlers.CpmToDateTime(labelCreationDate);
XmlFsType.CreationDateSpecified = true;
}
if(labelUpdateDate != null)
{
xmlFsType.ModificationDate = DateHandlers.CpmToDateTime(labelUpdateDate);
xmlFsType.ModificationDateSpecified = true;
XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(labelUpdateDate);
XmlFsType.ModificationDateSpecified = true;
}
if(!string.IsNullOrEmpty(label)) xmlFsType.VolumeName = label;
if(!string.IsNullOrEmpty(label)) XmlFsType.VolumeName = label;
mounted = true;
return Errno.NoError;

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -47,11 +46,9 @@ namespace DiscImageChef.Filesystems
/// </summary>
const uint CRAM_MAGIC = 0x28CD3D45;
const uint CRAM_CIGAM = 0x453DCD28;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Cram filesystem";
public Guid Id => new Guid("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09");
@@ -66,9 +63,10 @@ namespace DiscImageChef.Filesystems
return magic == CRAM_MAGIC || magic == CRAM_CIGAM;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
byte[] sector = imagePlugin.ReadSector(partition.Start);
uint magic = BitConverter.ToUInt32(sector, 0x00);
@@ -94,17 +92,16 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendLine("Cram file system");
sbInformation.AppendLine(littleEndian ? "Little-endian" : "Big-endian");
sbInformation.AppendFormat("Volume edition {0}", crSb.edition).AppendLine();
sbInformation.AppendFormat("Volume name: {0}", StringHandlers.CToString(crSb.name, currentEncoding))
.AppendLine();
sbInformation.AppendFormat("Volume name: {0}", StringHandlers.CToString(crSb.name, Encoding)).AppendLine();
sbInformation.AppendFormat("Volume has {0} bytes", crSb.size).AppendLine();
sbInformation.AppendFormat("Volume has {0} blocks", crSb.blocks).AppendLine();
sbInformation.AppendFormat("Volume has {0} files", crSb.files).AppendLine();
information = sbInformation.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
VolumeName = StringHandlers.CToString(crSb.name, currentEncoding),
VolumeName = StringHandlers.CToString(crSb.name, Encoding),
Type = "Cram file system",
Clusters = crSb.blocks,
Files = crSb.files,

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
@@ -45,12 +44,10 @@ namespace DiscImageChef.Filesystems
{
readonly byte[] ECMA67_Magic = {0x56, 0x4F, 0x4C};
Encoding currentEncoding;
public Encoding Encoding => currentEncoding;
public Encoding Encoding { get; private set; }
public string Name => "ECMA-67";
public Guid Id => new Guid("62A2D44A-CBC1-4377-B4B6-28C5C92034A1");
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public FileSystemType XmlFsType { get; private set; }
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -74,7 +71,7 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
byte[] sector = imagePlugin.ReadSector(6);
StringBuilder sbInformation = new StringBuilder();
@@ -90,7 +87,7 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("Volume name: {0}", Encoding.ASCII.GetString(vol.volumeIdentifier)).AppendLine();
sbInformation.AppendFormat("Volume owner: {0}", Encoding.ASCII.GetString(vol.owner)).AppendLine();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "ECMA-67",
ClusterSize = 256,

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
@@ -46,11 +45,9 @@ namespace DiscImageChef.Filesystems
{
const uint EFS_MAGIC = 0x00072959;
const uint EFS_MAGIC_NEW = 0x0007295A;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Extent File System Plugin";
public Guid Id => new Guid("52A43F90-9AF3-4391-ADFE-65598DEEABAB");
@@ -101,9 +98,10 @@ namespace DiscImageChef.Filesystems
return false;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
if(imagePlugin.Info.SectorSize < 512) return;
@@ -164,12 +162,12 @@ namespace DiscImageChef.Filesystems
if(efsSb.sb_lastinode > 0) sb.AppendFormat("Last inode allocated: {0}", efsSb.sb_lastinode).AppendLine();
if(efsSb.sb_dirty > 0) sb.AppendLine("Volume is dirty");
sb.AppendFormat("Checksum: 0x{0:X8}", efsSb.sb_checksum).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(efsSb.sb_fname, currentEncoding)).AppendLine();
sb.AppendFormat("Volume pack: {0}", StringHandlers.CToString(efsSb.sb_fpack, currentEncoding)).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(efsSb.sb_fname, Encoding)).AppendLine();
sb.AppendFormat("Volume pack: {0}", StringHandlers.CToString(efsSb.sb_fpack, Encoding)).AppendLine();
information = sb.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "Extent File System",
ClusterSize = 512,
@@ -177,7 +175,7 @@ namespace DiscImageChef.Filesystems
FreeClusters = efsSb.sb_tfree,
FreeClustersSpecified = true,
Dirty = efsSb.sb_dirty > 0,
VolumeName = StringHandlers.CToString(efsSb.sb_fname, currentEncoding),
VolumeName = StringHandlers.CToString(efsSb.sb_fname, Encoding),
VolumeSerial = $"{efsSb.sb_checksum:X8}",
CreationDate = DateHandlers.UnixToDateTime(efsSb.sb_time),
CreationDateSpecified = true

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
@@ -49,11 +48,8 @@ namespace DiscImageChef.Filesystems
const uint F2FS_MAX_SECTOR = 4096;
const uint F2FS_BLOCK_SIZE = 4096;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "F2FS Plugin";
public Guid Id => new Guid("82B0920F-5F0D-4063-9F57-ADE0AE02ECE5");
@@ -86,7 +82,7 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = Encoding.Unicode;
Encoding = Encoding.Unicode;
information = "";
if(imagePlugin.Info.SectorSize < F2FS_MIN_SECTOR || imagePlugin.Info.SectorSize > F2FS_MAX_SECTOR) return;
@@ -132,7 +128,7 @@ namespace DiscImageChef.Filesystems
information = sb.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "F2FS filesystem",
SystemIdentifier = Encoding.ASCII.GetString(f2fsSb.version),

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
@@ -53,11 +52,9 @@ namespace DiscImageChef.Filesystems
const uint FSINFO_SIGNATURE2 = 0x61417272;
const uint FSINFO_SIGNATURE3 = 0xAA550000;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding => currentEncoding;
public Encoding Encoding { get; private set; }
public string Name => "Microsoft File Allocation Table";
public Guid Id => new Guid("33513B2C-0D26-0D2D-32C3-79D8611158E0");
@@ -314,13 +311,14 @@ namespace DiscImageChef.Filesystems
return fatId == fat2Sector[0];
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("IBM437");
Encoding = encoding ?? Encoding.GetEncoding("IBM437");
information = "";
StringBuilder sb = new StringBuilder();
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
bool useAtariBpb = false;
bool useMsxBpb = false;
@@ -625,7 +623,7 @@ namespace DiscImageChef.Filesystems
fakeBpb.heads = 1;
fakeBpb.hsectors = 0;
fakeBpb.spfat = 3;
xmlFsType.Bootable = true;
XmlFsType.Bootable = true;
fakeBpb.boot_code = bpbSector;
isFat12 = true;
}
@@ -799,7 +797,7 @@ namespace DiscImageChef.Filesystems
}
// This assumes a bootable sector will jump somewhere or disable interrupts in x86 code
xmlFsType.Bootable |= bpbSector[0] == 0xFA || bpbSector[0] == 0xEB && bpbSector[1] <= 0x7F;
XmlFsType.Bootable |= bpbSector[0] == 0xFA || bpbSector[0] == 0xEB && bpbSector[1] <= 0x7F;
fakeBpb.boot_code = bpbSector;
}
else if(useShortFat32 || useLongFat32)
@@ -819,38 +817,38 @@ namespace DiscImageChef.Filesystems
if(fat32Bpb.version != 0)
{
sb.AppendLine("FAT+");
xmlFsType.Type = "FAT+";
XmlFsType.Type = "FAT+";
}
else
{
sb.AppendLine("Microsoft FAT32");
xmlFsType.Type = "FAT32";
XmlFsType.Type = "FAT32";
}
if(fat32Bpb.oem_name != null)
if(fat32Bpb.oem_name[5] == 0x49 && fat32Bpb.oem_name[6] == 0x48 && fat32Bpb.oem_name[7] == 0x43)
sb.AppendLine("Volume has been modified by Windows 9x/Me Volume Tracker.");
else xmlFsType.SystemIdentifier = StringHandlers.CToString(fat32Bpb.oem_name);
else XmlFsType.SystemIdentifier = StringHandlers.CToString(fat32Bpb.oem_name);
if(!string.IsNullOrEmpty(xmlFsType.SystemIdentifier))
sb.AppendFormat("OEM Name: {0}", xmlFsType.SystemIdentifier.Trim()).AppendLine();
if(!string.IsNullOrEmpty(XmlFsType.SystemIdentifier))
sb.AppendFormat("OEM Name: {0}", XmlFsType.SystemIdentifier.Trim()).AppendLine();
sb.AppendFormat("{0} bytes per sector.", fat32Bpb.bps).AppendLine();
sb.AppendFormat("{0} sectors per cluster.", fat32Bpb.spc).AppendLine();
xmlFsType.ClusterSize = fat32Bpb.bps * fat32Bpb.spc;
XmlFsType.ClusterSize = fat32Bpb.bps * fat32Bpb.spc;
sb.AppendFormat("{0} sectors reserved between BPB and FAT.", fat32Bpb.rsectors).AppendLine();
if(fat32Bpb.big_sectors == 0 && fat32Bpb.signature == 0x28)
{
sb.AppendFormat("{0} sectors on volume ({1} bytes).", shortFat32Bpb.huge_sectors,
shortFat32Bpb.huge_sectors * shortFat32Bpb.bps).AppendLine();
xmlFsType.Clusters = (long)(shortFat32Bpb.huge_sectors / shortFat32Bpb.spc);
XmlFsType.Clusters = (long)(shortFat32Bpb.huge_sectors / shortFat32Bpb.spc);
}
else
{
sb.AppendFormat("{0} sectors on volume ({1} bytes).", fat32Bpb.big_sectors,
fat32Bpb.big_sectors * fat32Bpb.bps).AppendLine();
xmlFsType.Clusters = fat32Bpb.big_sectors / fat32Bpb.spc;
XmlFsType.Clusters = fat32Bpb.big_sectors / fat32Bpb.spc;
}
sb.AppendFormat("{0} clusters on volume.", xmlFsType.Clusters).AppendLine();
sb.AppendFormat("{0} clusters on volume.", XmlFsType.Clusters).AppendLine();
sb.AppendFormat("Media descriptor: 0x{0:X2}", fat32Bpb.media).AppendLine();
sb.AppendFormat("{0} sectors per FAT.", fat32Bpb.big_spfat).AppendLine();
sb.AppendFormat("{0} sectors per track.", fat32Bpb.sptrk).AppendLine();
@@ -861,14 +859,14 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Sector of backup FAT32 parameter block: {0}", fat32Bpb.backup_sector).AppendLine();
sb.AppendFormat("Drive number: 0x{0:X2}", fat32Bpb.drive_no).AppendLine();
sb.AppendFormat("Volume Serial Number: 0x{0:X8}", fat32Bpb.serial_no).AppendLine();
xmlFsType.VolumeSerial = $"{fat32Bpb.serial_no:X8}";
XmlFsType.VolumeSerial = $"{fat32Bpb.serial_no:X8}";
if((fat32Bpb.flags & 0xF8) == 0x00)
{
if((fat32Bpb.flags & 0x01) == 0x01)
{
sb.AppendLine("Volume should be checked on next mount.");
xmlFsType.Dirty = true;
XmlFsType.Dirty = true;
}
if((fat32Bpb.flags & 0x02) == 0x02) sb.AppendLine("Disk surface should be on next mount.");
}
@@ -884,7 +882,7 @@ namespace DiscImageChef.Filesystems
if(fat32Bpb.signature == 0x29)
{
xmlFsType.VolumeName = Encoding.ASCII.GetString(fat32Bpb.volume_label);
XmlFsType.VolumeName = Encoding.ASCII.GetString(fat32Bpb.volume_label);
sb.AppendFormat("Filesystem type: {0}", Encoding.ASCII.GetString(fat32Bpb.fs_type)).AppendLine();
bootChk = sha1Ctx.Data(fat32Bpb.boot_code, out _);
}
@@ -892,7 +890,7 @@ namespace DiscImageChef.Filesystems
// Check that jumps to a correct boot code position and has boot signature set.
// This will mean that the volume will boot, even if just to say "this is not bootable change disk"......
xmlFsType.Bootable |= fat32Bpb.jump[0] == 0xEB && fat32Bpb.jump[1] > 0x58 && fat32Bpb.jump[1] < 0x80 &&
XmlFsType.Bootable |= fat32Bpb.jump[0] == 0xEB && fat32Bpb.jump[1] > 0x58 && fat32Bpb.jump[1] < 0x80 &&
fat32Bpb.boot_signature == 0xAA55;
sectorsPerRealSector = fat32Bpb.bps / imagePlugin.Info.SectorSize;
@@ -916,8 +914,8 @@ namespace DiscImageChef.Filesystems
if(fsInfo.free_clusters < 0xFFFFFFFF)
{
sb.AppendFormat("{0} free clusters", fsInfo.free_clusters).AppendLine();
xmlFsType.FreeClusters = fsInfo.free_clusters;
xmlFsType.FreeClustersSpecified = true;
XmlFsType.FreeClusters = fsInfo.free_clusters;
XmlFsType.FreeClustersSpecified = true;
}
if(fsInfo.last_cluster > 2 && fsInfo.last_cluster < 0xFFFFFFFF)
@@ -1039,7 +1037,7 @@ namespace DiscImageChef.Filesystems
fakeBpb.boot_signature = msxBpb.boot_signature;
fakeBpb.serial_no = msxBpb.serial_no;
// TODO: Is there any way to check this?
xmlFsType.Bootable = true;
XmlFsType.Bootable = true;
}
else if(useAtariBpb)
{
@@ -1064,7 +1062,7 @@ namespace DiscImageChef.Filesystems
// TODO: Check this
if(sum == 0x1234)
{
xmlFsType.Bootable = true;
XmlFsType.Bootable = true;
StringBuilder atariSb = new StringBuilder();
atariSb.AppendFormat("cmdload will be loaded with value {0:X4}h",
BigEndianBitConverter.ToUInt16(bpbSector, 0x01E)).AppendLine();
@@ -1107,7 +1105,7 @@ namespace DiscImageChef.Filesystems
fakeBpb.media = apricotBpb.mainBPB.media;
fakeBpb.spfat = apricotBpb.mainBPB.spfat;
fakeBpb.sptrk = apricotBpb.spt;
xmlFsType.Bootable = apricotBpb.bootType > 0;
XmlFsType.Bootable = apricotBpb.bootType > 0;
if(apricotBpb.bootLocation > 0 &&
apricotBpb.bootLocation + apricotBpb.bootSize < imagePlugin.Info.Sectors)
@@ -1152,12 +1150,12 @@ namespace DiscImageChef.Filesystems
if(useAtariBpb) sb.AppendLine("Atari FAT12");
else if(useApricotBpb) sb.AppendLine("Apricot FAT12");
else sb.AppendLine("Microsoft FAT12");
xmlFsType.Type = "FAT12";
XmlFsType.Type = "FAT12";
}
else if(isFat16)
{
sb.AppendLine(useAtariBpb ? "Atari FAT16" : "Microsoft FAT16");
xmlFsType.Type = "FAT16";
XmlFsType.Type = "FAT16";
}
if(useAtariBpb)
@@ -1165,11 +1163,11 @@ namespace DiscImageChef.Filesystems
if(atariBpb.serial_no[0] == 0x49 && atariBpb.serial_no[1] == 0x48 && atariBpb.serial_no[2] == 0x43)
sb.AppendLine("Volume has been modified by Windows 9x/Me Volume Tracker.");
else
xmlFsType.VolumeSerial =
XmlFsType.VolumeSerial =
$"{atariBpb.serial_no[0]:X2}{atariBpb.serial_no[1]:X2}{atariBpb.serial_no[2]:X2}";
xmlFsType.SystemIdentifier = StringHandlers.CToString(atariBpb.oem_name);
if(string.IsNullOrEmpty(xmlFsType.SystemIdentifier)) xmlFsType.SystemIdentifier = null;
XmlFsType.SystemIdentifier = StringHandlers.CToString(atariBpb.oem_name);
if(string.IsNullOrEmpty(XmlFsType.SystemIdentifier)) XmlFsType.SystemIdentifier = null;
}
else if(fakeBpb.oem_name != null)
{
@@ -1185,7 +1183,7 @@ namespace DiscImageChef.Filesystems
fakeBpb.oem_name[4] <= 0x7F && fakeBpb.oem_name[5] >= 0x20 && fakeBpb.oem_name[5] <= 0x7F &&
fakeBpb.oem_name[6] >= 0x20 && fakeBpb.oem_name[6] <= 0x7F && fakeBpb.oem_name[7] >= 0x20 &&
fakeBpb.oem_name[7] <= 0x7F)
xmlFsType.SystemIdentifier = StringHandlers.CToString(fakeBpb.oem_name);
XmlFsType.SystemIdentifier = StringHandlers.CToString(fakeBpb.oem_name);
else if(fakeBpb.oem_name[0] < 0x20 && fakeBpb.oem_name[1] >= 0x20 &&
fakeBpb.oem_name[1] <= 0x7F && fakeBpb.oem_name[2] >= 0x20 &&
fakeBpb.oem_name[2] <= 0x7F && fakeBpb.oem_name[3] >= 0x20 &&
@@ -1194,33 +1192,32 @@ namespace DiscImageChef.Filesystems
fakeBpb.oem_name[5] <= 0x7F && fakeBpb.oem_name[6] >= 0x20 &&
fakeBpb.oem_name[6] <= 0x7F && fakeBpb.oem_name[7] >= 0x20 &&
fakeBpb.oem_name[7] <= 0x7F)
xmlFsType.SystemIdentifier =
StringHandlers.CToString(fakeBpb.oem_name, currentEncoding, start: 1);
XmlFsType.SystemIdentifier = StringHandlers.CToString(fakeBpb.oem_name, Encoding, start: 1);
}
if(fakeBpb.signature == 0x28 || fakeBpb.signature == 0x29)
xmlFsType.VolumeSerial = $"{fakeBpb.serial_no:X8}";
XmlFsType.VolumeSerial = $"{fakeBpb.serial_no:X8}";
}
if(xmlFsType.SystemIdentifier != null)
sb.AppendFormat("OEM Name: {0}", xmlFsType.SystemIdentifier.Trim()).AppendLine();
if(XmlFsType.SystemIdentifier != null)
sb.AppendFormat("OEM Name: {0}", XmlFsType.SystemIdentifier.Trim()).AppendLine();
sb.AppendFormat("{0} bytes per sector.", fakeBpb.bps).AppendLine();
if(fakeBpb.sectors == 0)
{
sb.AppendFormat("{0} sectors on volume ({1} bytes).", fakeBpb.big_sectors,
fakeBpb.big_sectors * fakeBpb.bps).AppendLine();
xmlFsType.Clusters = fakeBpb.spc == 0 ? fakeBpb.big_sectors : fakeBpb.big_sectors / fakeBpb.spc;
XmlFsType.Clusters = fakeBpb.spc == 0 ? fakeBpb.big_sectors : fakeBpb.big_sectors / fakeBpb.spc;
}
else
{
sb.AppendFormat("{0} sectors on volume ({1} bytes).", fakeBpb.sectors,
fakeBpb.sectors * fakeBpb.bps).AppendLine();
xmlFsType.Clusters = fakeBpb.spc == 0 ? fakeBpb.sectors : fakeBpb.sectors / fakeBpb.spc;
XmlFsType.Clusters = fakeBpb.spc == 0 ? fakeBpb.sectors : fakeBpb.sectors / fakeBpb.spc;
}
sb.AppendFormat("{0} sectors per cluster.", fakeBpb.spc).AppendLine();
sb.AppendFormat("{0} clusters on volume.", xmlFsType.Clusters).AppendLine();
xmlFsType.ClusterSize = fakeBpb.bps * fakeBpb.spc;
sb.AppendFormat("{0} clusters on volume.", XmlFsType.Clusters).AppendLine();
XmlFsType.ClusterSize = fakeBpb.bps * fakeBpb.spc;
sb.AppendFormat("{0} sectors reserved between BPB and FAT.", fakeBpb.rsectors).AppendLine();
sb.AppendFormat("{0} FATs.", fakeBpb.fats_no).AppendLine();
sb.AppendFormat("{0} entries on root directory.", fakeBpb.root_ent).AppendLine();
@@ -1241,34 +1238,34 @@ namespace DiscImageChef.Filesystems
{
sb.AppendFormat("Drive number: 0x{0:X2}", fakeBpb.drive_no).AppendLine();
if(xmlFsType.VolumeSerial != null)
sb.AppendFormat("Volume Serial Number: {0}", xmlFsType.VolumeSerial).AppendLine();
if(XmlFsType.VolumeSerial != null)
sb.AppendFormat("Volume Serial Number: {0}", XmlFsType.VolumeSerial).AppendLine();
if((fakeBpb.flags & 0xF8) == 0x00)
{
if((fakeBpb.flags & 0x01) == 0x01)
{
sb.AppendLine("Volume should be checked on next mount.");
xmlFsType.Dirty = true;
XmlFsType.Dirty = true;
}
if((fakeBpb.flags & 0x02) == 0x02) sb.AppendLine("Disk surface should be on next mount.");
}
if(fakeBpb.signature == 0x29 || andosOemCorrect)
{
xmlFsType.VolumeName = Encoding.ASCII.GetString(fakeBpb.volume_label);
XmlFsType.VolumeName = Encoding.ASCII.GetString(fakeBpb.volume_label);
sb.AppendFormat("Filesystem type: {0}", Encoding.ASCII.GetString(fakeBpb.fs_type)).AppendLine();
}
}
else if(useAtariBpb && xmlFsType.VolumeSerial != null)
sb.AppendFormat("Volume Serial Number: {0}", xmlFsType.VolumeSerial).AppendLine();
else if(useAtariBpb && XmlFsType.VolumeSerial != null)
sb.AppendFormat("Volume Serial Number: {0}", XmlFsType.VolumeSerial).AppendLine();
bootChk = sha1Ctx.Data(fakeBpb.boot_code, out _);
// Check that jumps to a correct boot code position and has boot signature set.
// This will mean that the volume will boot, even if just to say "this is not bootable change disk"......
if(xmlFsType.Bootable == false && fakeBpb.jump != null)
xmlFsType.Bootable |= fakeBpb.jump[0] == 0xEB && fakeBpb.jump[1] > 0x58 && fakeBpb.jump[1] < 0x80 &&
if(XmlFsType.Bootable == false && fakeBpb.jump != null)
XmlFsType.Bootable |= fakeBpb.jump[0] == 0xEB && fakeBpb.jump[1] > 0x58 && fakeBpb.jump[1] < 0x80 &&
fakeBpb.boot_signature == 0xAA55;
sectorsPerRealSector = fakeBpb.bps / imagePlugin.Info.SectorSize;
@@ -1314,24 +1311,24 @@ namespace DiscImageChef.Filesystems
byte[] fullname = new byte[11];
Array.Copy(entry.filename, 0, fullname, 0, 8);
Array.Copy(entry.extension, 0, fullname, 8, 3);
string volname = currentEncoding.GetString(fullname).Trim();
string volname = Encoding.GetString(fullname).Trim();
if(!string.IsNullOrEmpty(volname))
xmlFsType.VolumeName = (entry.caseinfo & 0x0C) > 0 ? volname.ToLower() : volname;
XmlFsType.VolumeName = (entry.caseinfo & 0x0C) > 0 ? volname.ToLower() : volname;
if(entry.ctime > 0 && entry.cdate > 0)
{
xmlFsType.CreationDate = DateHandlers.DosToDateTime(entry.cdate, entry.ctime);
XmlFsType.CreationDate = DateHandlers.DosToDateTime(entry.cdate, entry.ctime);
if(entry.ctime_ms > 0)
xmlFsType.CreationDate = xmlFsType.CreationDate.AddMilliseconds(entry.ctime_ms * 10);
xmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Volume created on {0}", xmlFsType.CreationDate).AppendLine();
XmlFsType.CreationDate = XmlFsType.CreationDate.AddMilliseconds(entry.ctime_ms * 10);
XmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Volume created on {0}", XmlFsType.CreationDate).AppendLine();
}
if(entry.mtime > 0 && entry.mdate > 0)
{
xmlFsType.ModificationDate = DateHandlers.DosToDateTime(entry.mdate, entry.mtime);
xmlFsType.ModificationDateSpecified = true;
sb.AppendFormat("Volume last modified on {0}", xmlFsType.ModificationDate).AppendLine();
XmlFsType.ModificationDate = DateHandlers.DosToDateTime(entry.mdate, entry.mtime);
XmlFsType.ModificationDateSpecified = true;
sb.AppendFormat("Volume last modified on {0}", XmlFsType.ModificationDate).AppendLine();
}
if(entry.adate > 0)
@@ -1342,9 +1339,9 @@ namespace DiscImageChef.Filesystems
}
}
if(!string.IsNullOrEmpty(xmlFsType.VolumeName))
sb.AppendFormat("Volume label: {0}", xmlFsType.VolumeName).AppendLine();
if(xmlFsType.Bootable)
if(!string.IsNullOrEmpty(XmlFsType.VolumeName))
sb.AppendFormat("Volume label: {0}", XmlFsType.VolumeName).AppendLine();
if(XmlFsType.Bootable)
{
sb.AppendLine("Volume is bootable");
sb.AppendFormat("Boot code's SHA1: {0}", bootChk).AppendLine();

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -44,11 +43,8 @@ namespace DiscImageChef.Filesystems
{
const uint FATX_MAGIC = 0x58544146;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "FATX Filesystem Plugin";
public Guid Id => new Guid("ED27A721-4A17-4649-89FD-33633B46E228");
@@ -67,7 +63,7 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = Encoding.UTF8;
Encoding = Encoding.UTF8;
information = "";
if(imagePlugin.Info.SectorSize < 512) return;
@@ -89,13 +85,13 @@ namespace DiscImageChef.Filesystems
information = sb.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "FATX filesystem",
ClusterSize = (int)(fatxSb.sectorsPerCluster * imagePlugin.Info.SectorSize)
};
xmlFsType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize /
(ulong)xmlFsType.ClusterSize);
XmlFsType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize /
(ulong)XmlFsType.ClusterSize);
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Runtime.InteropServices;
@@ -81,11 +80,8 @@ namespace DiscImageChef.Filesystems
// Big-endian incomplete newfs
const uint UFS_BAD_CIGAM = 0x08049619;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "BSD Fast File System (aka UNIX File System, UFS)";
public Guid Id => new Guid("CC90D342-05DB-48A8-988C-C1FE000034A3");
@@ -114,9 +110,10 @@ namespace DiscImageChef.Filesystems
magic == UFS_BAD_MAGIC || magic == UFS_BAD_CIGAM);
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sbInformation = new StringBuilder();
@@ -164,43 +161,43 @@ namespace DiscImageChef.Filesystems
return;
}
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
switch(magic)
{
case UFS_MAGIC:
sbInformation.AppendLine("UFS filesystem");
xmlFsType.Type = "UFS";
XmlFsType.Type = "UFS";
break;
case UFS_CIGAM:
sbInformation.AppendLine("Big-endian UFS filesystem");
xmlFsType.Type = "UFS";
XmlFsType.Type = "UFS";
break;
case UFS_MAGIC_BW:
sbInformation.AppendLine("BorderWare UFS filesystem");
xmlFsType.Type = "UFS";
XmlFsType.Type = "UFS";
break;
case UFS_CIGAM_BW:
sbInformation.AppendLine("Big-endian BorderWare UFS filesystem");
xmlFsType.Type = "UFS";
XmlFsType.Type = "UFS";
break;
case UFS2_MAGIC:
sbInformation.AppendLine("UFS2 filesystem");
xmlFsType.Type = "UFS2";
XmlFsType.Type = "UFS2";
break;
case UFS2_CIGAM:
sbInformation.AppendLine("Big-endian UFS2 filesystem");
xmlFsType.Type = "UFS2";
XmlFsType.Type = "UFS2";
break;
case UFS_BAD_MAGIC:
sbInformation.AppendLine("Incompletely initialized UFS filesystem");
sbInformation.AppendLine("BEWARE!!! Following information may be completely wrong!");
xmlFsType.Type = "UFS";
XmlFsType.Type = "UFS";
break;
case UFS_BAD_CIGAM:
sbInformation.AppendLine("Incompletely initialized big-endian UFS filesystem");
sbInformation.AppendLine("BEWARE!!! Following information may be completely wrong!");
xmlFsType.Type = "UFS";
XmlFsType.Type = "UFS";
break;
}
@@ -346,12 +343,12 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("Cylinder group offset in cylinder: {0}", ufs_sb.fs_old_cgoffset).AppendLine();
sbInformation.AppendFormat("Volume last written on {0}", DateHandlers.UnixToDateTime(ufs_sb.fs_old_time))
.AppendLine();
xmlFsType.ModificationDate = DateHandlers.UnixToDateTime(ufs_sb.fs_old_time);
xmlFsType.ModificationDateSpecified = true;
XmlFsType.ModificationDate = DateHandlers.UnixToDateTime(ufs_sb.fs_old_time);
XmlFsType.ModificationDateSpecified = true;
sbInformation.AppendFormat("{0} blocks in volume ({1} bytes)", ufs_sb.fs_old_size,
(long)ufs_sb.fs_old_size * ufs_sb.fs_fsize).AppendLine();
xmlFsType.Clusters = ufs_sb.fs_old_size;
xmlFsType.ClusterSize = ufs_sb.fs_fsize;
XmlFsType.Clusters = ufs_sb.fs_old_size;
XmlFsType.ClusterSize = ufs_sb.fs_fsize;
sbInformation.AppendFormat("{0} data blocks in volume ({1} bytes)", ufs_sb.fs_old_dsize,
(long)ufs_sb.fs_old_dsize * ufs_sb.fs_fsize).AppendLine();
sbInformation.AppendFormat("{0} cylinder groups in volume", ufs_sb.fs_ncg).AppendLine();
@@ -411,14 +408,14 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("{0} directories", ufs_sb.fs_old_cstotal.cs_ndir).AppendLine();
sbInformation.AppendFormat("{0} free blocks ({1} bytes)", ufs_sb.fs_old_cstotal.cs_nbfree,
(long)ufs_sb.fs_old_cstotal.cs_nbfree * ufs_sb.fs_fsize).AppendLine();
xmlFsType.FreeClusters = ufs_sb.fs_old_cstotal.cs_nbfree;
xmlFsType.FreeClustersSpecified = true;
XmlFsType.FreeClusters = ufs_sb.fs_old_cstotal.cs_nbfree;
XmlFsType.FreeClustersSpecified = true;
sbInformation.AppendFormat("{0} free inodes", ufs_sb.fs_old_cstotal.cs_nifree).AppendLine();
sbInformation.AppendFormat("{0} free frags", ufs_sb.fs_old_cstotal.cs_nffree).AppendLine();
if(ufs_sb.fs_fmod == 1)
{
sbInformation.AppendLine("Superblock is under modification");
xmlFsType.Dirty = true;
XmlFsType.Dirty = true;
}
if(ufs_sb.fs_clean == 1) sbInformation.AppendLine("Volume is clean");
if(ufs_sb.fs_ronly == 1) sbInformation.AppendLine("Volume is read-only");
@@ -432,7 +429,7 @@ namespace DiscImageChef.Filesystems
.AppendLine();
sbInformation.AppendFormat("Volume name: \"{0}\"", StringHandlers.CToString(ufs_sb.fs_volname))
.AppendLine();
xmlFsType.VolumeName = StringHandlers.CToString(ufs_sb.fs_volname);
XmlFsType.VolumeName = StringHandlers.CToString(ufs_sb.fs_volname);
sbInformation.AppendFormat("Volume ID: 0x{0:X16}", ufs_sb.fs_swuid).AppendLine();
//xmlFSType.VolumeSerial = string.Format("{0:X16}", ufs_sb.fs_swuid);
sbInformation.AppendFormat("Last searched cylinder group: {0}", ufs_sb.fs_cgrotor).AppendLine();
@@ -441,18 +438,18 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendFormat("{0} directories", ufs_sb.fs_cstotal.cs_ndir).AppendLine();
sbInformation.AppendFormat("{0} free blocks ({1} bytes)", ufs_sb.fs_cstotal.cs_nbfree,
ufs_sb.fs_cstotal.cs_nbfree * ufs_sb.fs_fsize).AppendLine();
xmlFsType.FreeClusters = ufs_sb.fs_cstotal.cs_nbfree;
xmlFsType.FreeClustersSpecified = true;
XmlFsType.FreeClusters = ufs_sb.fs_cstotal.cs_nbfree;
XmlFsType.FreeClustersSpecified = true;
sbInformation.AppendFormat("{0} free inodes", ufs_sb.fs_cstotal.cs_nifree).AppendLine();
sbInformation.AppendFormat("{0} free frags", ufs_sb.fs_cstotal.cs_nffree).AppendLine();
sbInformation.AppendFormat("{0} free clusters", ufs_sb.fs_cstotal.cs_numclusters).AppendLine();
sbInformation.AppendFormat("Volume last written on {0}", DateHandlers.UnixToDateTime(ufs_sb.fs_time))
.AppendLine();
xmlFsType.ModificationDate = DateHandlers.UnixToDateTime(ufs_sb.fs_time);
xmlFsType.ModificationDateSpecified = true;
XmlFsType.ModificationDate = DateHandlers.UnixToDateTime(ufs_sb.fs_time);
XmlFsType.ModificationDateSpecified = true;
sbInformation.AppendFormat("{0} blocks ({1} bytes)", ufs_sb.fs_size, ufs_sb.fs_size * ufs_sb.fs_fsize)
.AppendLine();
xmlFsType.Clusters = ufs_sb.fs_size;
XmlFsType.Clusters = ufs_sb.fs_size;
sbInformation
.AppendFormat("{0} data blocks ({1} bytes)", ufs_sb.fs_dsize, ufs_sb.fs_dsize * ufs_sb.fs_fsize)
.AppendLine();

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -48,11 +47,8 @@ namespace DiscImageChef.Filesystems
// Fossil header starts at 128KiB
const ulong HEADER_POS = 128 * 1024;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Fossil Filesystem Plugin";
public Guid Id => new Guid("932BF104-43F6-494F-973C-45EF58A51DA9");
@@ -73,10 +69,11 @@ namespace DiscImageChef.Filesystems
return hdr.magic == FOSSIL_HDR_MAGIC;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
// Technically everything on Plan 9 from Bell Labs is in UTF-8
currentEncoding = Encoding.UTF8;
Encoding = Encoding.UTF8;
information = "";
if(imagePlugin.Info.SectorSize < 512) return;
@@ -102,7 +99,7 @@ namespace DiscImageChef.Filesystems
ulong sbLocation = hdr.super * (hdr.blockSize / imagePlugin.Info.SectorSize) + partition.Start;
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "Fossil filesystem",
ClusterSize = hdr.blockSize,
@@ -125,9 +122,8 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Active root block {0}", fsb.active).AppendLine();
sb.AppendFormat("Next root block {0}", fsb.next).AppendLine();
sb.AppendFormat("Curren root block {0}", fsb.current).AppendLine();
sb.AppendFormat("Volume label: \"{0}\"", StringHandlers.CToString(fsb.name, currentEncoding))
.AppendLine();
xmlFsType.VolumeName = StringHandlers.CToString(fsb.name, currentEncoding);
sb.AppendFormat("Volume label: \"{0}\"", StringHandlers.CToString(fsb.name, Encoding)).AppendLine();
XmlFsType.VolumeName = StringHandlers.CToString(fsb.name, Encoding);
}
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
@@ -53,11 +52,8 @@ namespace DiscImageChef.Filesystems
const uint HAMMER_VOLHDR_SIZE = 1928;
const int HAMMER_BIGBLOCK_SIZE = 8192 * 1024;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "HAMMER Filesystem";
public Guid Id => new Guid("91A188BF-5FD7-4677-BBD3-F59EBA9C864D");
@@ -78,9 +74,10 @@ namespace DiscImageChef.Filesystems
return magic == HAMMER_FSBUF_VOLUME || magic == HAMMER_FSBUF_VOLUME_REV;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
@@ -111,8 +108,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Volume version: {0}", hammerSb.vol_version).AppendLine();
sb.AppendFormat("Volume {0} of {1} on this filesystem", hammerSb.vol_no + 1, hammerSb.vol_count)
.AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(hammerSb.vol_label, currentEncoding))
.AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(hammerSb.vol_label, Encoding)).AppendLine();
sb.AppendFormat("Volume serial: {0}", hammerSb.vol_fsid).AppendLine();
sb.AppendFormat("Filesystem type: {0}", hammerSb.vol_fstype).AppendLine();
sb.AppendFormat("Boot area starts at {0}", hammerSb.vol_bot_beg).AppendLine();
@@ -120,13 +116,13 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("First volume buffer starts at {0}", hammerSb.vol_buf_beg).AppendLine();
sb.AppendFormat("Volume ends at {0}", hammerSb.vol_buf_end).AppendLine();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Clusters = (long)(partition.Size / HAMMER_BIGBLOCK_SIZE),
ClusterSize = HAMMER_BIGBLOCK_SIZE,
Dirty = false,
Type = "HAMMER",
VolumeName = StringHandlers.CToString(hammerSb.vol_label, currentEncoding),
VolumeName = StringHandlers.CToString(hammerSb.vol_label, Encoding),
VolumeSerial = hammerSb.vol_fsid.ToString()
};
@@ -138,11 +134,11 @@ namespace DiscImageChef.Filesystems
hammerSb.vol0_stat_freebigblocks * HAMMER_BIGBLOCK_SIZE).AppendLine();
sb.AppendFormat("Filesystem has {0} inode used", hammerSb.vol0_stat_inodes).AppendLine();
xmlFsType.Clusters = hammerSb.vol0_stat_bigblocks;
xmlFsType.FreeClusters = hammerSb.vol0_stat_freebigblocks;
xmlFsType.FreeClustersSpecified = true;
xmlFsType.Files = hammerSb.vol0_stat_inodes;
xmlFsType.FilesSpecified = true;
XmlFsType.Clusters = hammerSb.vol0_stat_bigblocks;
XmlFsType.FreeClusters = hammerSb.vol0_stat_freebigblocks;
XmlFsType.FreeClustersSpecified = true;
XmlFsType.Files = hammerSb.vol0_stat_inodes;
XmlFsType.FilesSpecified = true;
}
// 0 ?
//sb.AppendFormat("Volume header CRC: 0x{0:X8}", afs_sb.vol_crc).AppendLine();

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.Checksums;
@@ -44,11 +43,8 @@ namespace DiscImageChef.Filesystems
// Information from an old unnamed document
public class HPFS : IFilesystem
{
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "OS/2 High Performance File System";
public Guid Id => new Guid("33513B2C-f590-4acb-8bf2-0b1d5e19dec5");
@@ -66,9 +62,10 @@ namespace DiscImageChef.Filesystems
return magic1 == 0xF995E849 && magic2 == 0xFA53E9C5;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("ibm850");
Encoding = encoding ?? Encoding.GetEncoding("ibm850");
information = "";
StringBuilder sb = new StringBuilder();
@@ -126,8 +123,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("NT Flags: 0x{0:X2}", hpfsBpb.nt_flags).AppendLine();
sb.AppendFormat("Signature: 0x{0:X2}", hpfsBpb.signature).AppendLine();
sb.AppendFormat("Serial number: 0x{0:X8}", hpfsBpb.serial_no).AppendLine();
sb.AppendFormat("Volume label: {0}", StringHandlers.CToString(hpfsBpb.volume_label, currentEncoding))
.AppendLine();
sb.AppendFormat("Volume label: {0}", StringHandlers.CToString(hpfsBpb.volume_label, Encoding)).AppendLine();
// sb.AppendFormat("Filesystem type: \"{0}\"", hpfs_bpb.fs_type).AppendLine();
DateTime lastChk = DateHandlers.UnixToDateTime(hpfsSb.last_chkdsk);
@@ -177,13 +173,13 @@ namespace DiscImageChef.Filesystems
if((hpfsSp.flags2 & 0x40) == 0x40) sb.AppendLine("Unknown flag 0x40 on flags2 is active");
if((hpfsSp.flags2 & 0x80) == 0x80) sb.AppendLine("Unknown flag 0x80 on flags2 is active");
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
// Theoretically everything from BPB to SB is boot code, should I hash everything or only the sector loaded by BIOS itself?
if(hpfsBpb.jump[0] == 0xEB && hpfsBpb.jump[1] > 0x3C && hpfsBpb.jump[1] < 0x80 &&
hpfsBpb.signature2 == 0xAA55)
{
xmlFsType.Bootable = true;
XmlFsType.Bootable = true;
Sha1Context sha1Ctx = new Sha1Context();
sha1Ctx.Init();
string bootChk = sha1Ctx.Data(hpfsBpb.boot_code, out byte[] sha1_out);
@@ -191,13 +187,13 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Boot code's SHA1: {0}", bootChk).AppendLine();
}
xmlFsType.Dirty |= (hpfsSp.flags1 & 0x01) == 0x01;
xmlFsType.Clusters = hpfsSb.sectors;
xmlFsType.ClusterSize = hpfsBpb.bps;
xmlFsType.Type = "HPFS";
xmlFsType.VolumeName = StringHandlers.CToString(hpfsBpb.volume_label, currentEncoding);
xmlFsType.VolumeSerial = $"{hpfsBpb.serial_no:X8}";
xmlFsType.SystemIdentifier = StringHandlers.CToString(hpfsBpb.oem_name);
XmlFsType.Dirty |= (hpfsSp.flags1 & 0x01) == 0x01;
XmlFsType.Clusters = hpfsSb.sectors;
XmlFsType.ClusterSize = hpfsBpb.bps;
XmlFsType.Type = "HPFS";
XmlFsType.VolumeName = StringHandlers.CToString(hpfsBpb.volume_label, Encoding);
XmlFsType.VolumeSerial = $"{hpfsBpb.serial_no:X8}";
XmlFsType.SystemIdentifier = StringHandlers.CToString(hpfsBpb.oem_name);
information = sb.ToString();
}

View File

@@ -32,8 +32,6 @@
using System;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.DiscImages;
using Schemas;
namespace DiscImageChef.Filesystems.ISO9660
@@ -41,11 +39,8 @@ namespace DiscImageChef.Filesystems.ISO9660
// This is coded following ECMA-119.
public partial class ISO9660 : IFilesystem
{
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "ISO9660 Filesystem";
public Guid Id => new Guid("d812f4d3-c357-400d-90fd-3b22ef786aa8");
}

View File

@@ -77,9 +77,10 @@ namespace DiscImageChef.Filesystems.ISO9660
Encoding.ASCII.GetString(vdMagic) == CDI_MAGIC;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.ASCII;
Encoding = encoding ?? Encoding.ASCII;
information = "";
StringBuilder isoMetadata = new StringBuilder();
byte[] vdMagic = new byte[5]; // Volume Descriptor magic "CD001"
@@ -105,7 +106,7 @@ namespace DiscImageChef.Filesystems.ISO9660
byte[] vdSector = imagePlugin.ReadSector(16 + counter + partition.Start);
int xaOff = vdSector.Length == 2336 ? 8 : 0;
Array.Copy(vdSector, 0x009 + xaOff, hsMagic, 0, 5);
bool highSierra = currentEncoding.GetString(hsMagic) == HIGH_SIERRA_MAGIC;
bool highSierra = Encoding.GetString(hsMagic) == HIGH_SIERRA_MAGIC;
int hsOff = 0;
if(highSierra) hsOff = 8;
bool cdi = false;
@@ -132,9 +133,8 @@ namespace DiscImageChef.Filesystems.ISO9660
Array.Copy(vdSector, 0x001, vdMagic, 0, 5);
Array.Copy(vdSector, 0x009, hsMagic, 0, 5);
if(currentEncoding.GetString(vdMagic) != ISO_MAGIC &&
currentEncoding.GetString(hsMagic) != HIGH_SIERRA_MAGIC &&
currentEncoding.GetString(vdMagic) != CDI_MAGIC
if(Encoding.GetString(vdMagic) != ISO_MAGIC && Encoding.GetString(hsMagic) != HIGH_SIERRA_MAGIC &&
Encoding.GetString(vdMagic) != CDI_MAGIC
) // Recognized, it is an ISO9660, now check for rest of data.
{
if(counter == 0) return;
@@ -142,7 +142,7 @@ namespace DiscImageChef.Filesystems.ISO9660
break;
}
cdi |= currentEncoding.GetString(vdMagic) == CDI_MAGIC;
cdi |= Encoding.GetString(vdMagic) == CDI_MAGIC;
switch(vdType)
{
@@ -155,7 +155,7 @@ namespace DiscImageChef.Filesystems.ISO9660
bootSpec = "Unknown";
if(currentEncoding.GetString(bvd.Value.system_id).Substring(0, 23) == "EL TORITO SPECIFICATION")
if(Encoding.GetString(bvd.Value.system_id).Substring(0, 23) == "EL TORITO SPECIFICATION")
{
bootSpec = "El Torito";
ptr = Marshal.AllocHGlobal(2048);
@@ -214,7 +214,7 @@ namespace DiscImageChef.Filesystems.ISO9660
DecodedVolumeDescriptor decodedVd;
DecodedVolumeDescriptor decodedJolietVd = new DecodedVolumeDescriptor();
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
if(pvd == null && hsvd == null && fsvd == null)
{
@@ -449,10 +449,9 @@ namespace DiscImageChef.Filesystems.ISO9660
foreach(byte[] erb in refareas)
{
ReferenceArea er = BigEndianMarshal.ByteArrayToStructureBigEndian<ReferenceArea>(erb);
string extId = currentEncoding.GetString(erb, Marshal.SizeOf(er), er.id_len);
string extDes = currentEncoding.GetString(erb, Marshal.SizeOf(er) + er.id_len, er.des_len);
string extSrc =
currentEncoding.GetString(erb, Marshal.SizeOf(er) + er.id_len + er.des_len, er.src_len);
string extId = Encoding.GetString(erb, Marshal.SizeOf(er), er.id_len);
string extDes = Encoding.GetString(erb, Marshal.SizeOf(er) + er.id_len, er.des_len);
string extSrc = Encoding.GetString(erb, Marshal.SizeOf(er) + er.id_len + er.des_len, er.src_len);
suspInformation.AppendFormat("Extension: {0}", counter).AppendLine();
suspInformation.AppendFormat("\tID: {0}, version {1}", extId, er.ext_ver).AppendLine();
suspInformation.AppendFormat("\tDescription: {0}", extDes).AppendLine();
@@ -582,8 +581,7 @@ namespace DiscImageChef.Filesystems.ISO9660
isoMetadata.AppendLine("----------------------");
isoMetadata.AppendLine("Initial entry:");
isoMetadata.AppendFormat("\tDeveloper ID: {0}", currentEncoding.GetString(valentry.developer_id))
.AppendLine();
isoMetadata.AppendFormat("\tDeveloper ID: {0}", Encoding.GetString(valentry.developer_id)).AppendLine();
if(initialEntry.bootable == ElToritoIndicator.Bootable)
{
isoMetadata.AppendFormat("\tBootable on {0}", valentry.platform_id).AppendLine();
@@ -637,7 +635,7 @@ namespace DiscImageChef.Filesystems.ISO9660
toritoOff += EL_TORITO_ENTRY_SIZE;
isoMetadata.AppendFormat("Boot section {0}:", SECTION_COUNTER);
isoMetadata.AppendFormat("\tSection ID: {0}", currentEncoding.GetString(sectionHeader.identifier))
isoMetadata.AppendFormat("\tSection ID: {0}", Encoding.GetString(sectionHeader.identifier))
.AppendLine();
for(int entryCounter = 1; entryCounter <= sectionHeader.entries && toritoOff < vdSector.Length;
@@ -725,85 +723,85 @@ namespace DiscImageChef.Filesystems.ISO9660
exit_torito:
if(refareas.Count > 0) isoMetadata.Append(suspInformation);
xmlFsType.Type = fsFormat;
XmlFsType.Type = fsFormat;
if(jolietvd != null)
{
xmlFsType.VolumeName = decodedJolietVd.VolumeIdentifier;
XmlFsType.VolumeName = decodedJolietVd.VolumeIdentifier;
if(decodedJolietVd.SystemIdentifier == null ||
decodedVd.SystemIdentifier.Length > decodedJolietVd.SystemIdentifier.Length)
xmlFsType.SystemIdentifier = decodedVd.SystemIdentifier;
else xmlFsType.SystemIdentifier = decodedJolietVd.SystemIdentifier;
XmlFsType.SystemIdentifier = decodedVd.SystemIdentifier;
else XmlFsType.SystemIdentifier = decodedJolietVd.SystemIdentifier;
if(decodedJolietVd.VolumeSetIdentifier == null || decodedVd.VolumeSetIdentifier.Length >
decodedJolietVd.VolumeSetIdentifier.Length)
xmlFsType.VolumeSetIdentifier = decodedVd.VolumeSetIdentifier;
else xmlFsType.VolumeSetIdentifier = decodedJolietVd.VolumeSetIdentifier;
XmlFsType.VolumeSetIdentifier = decodedVd.VolumeSetIdentifier;
else XmlFsType.VolumeSetIdentifier = decodedJolietVd.VolumeSetIdentifier;
if(decodedJolietVd.PublisherIdentifier == null || decodedVd.PublisherIdentifier.Length >
decodedJolietVd.PublisherIdentifier.Length)
xmlFsType.PublisherIdentifier = decodedVd.PublisherIdentifier;
else xmlFsType.PublisherIdentifier = decodedJolietVd.PublisherIdentifier;
XmlFsType.PublisherIdentifier = decodedVd.PublisherIdentifier;
else XmlFsType.PublisherIdentifier = decodedJolietVd.PublisherIdentifier;
if(decodedJolietVd.DataPreparerIdentifier == null || decodedVd.DataPreparerIdentifier.Length >
decodedJolietVd.DataPreparerIdentifier.Length)
xmlFsType.DataPreparerIdentifier = decodedVd.DataPreparerIdentifier;
else xmlFsType.DataPreparerIdentifier = decodedJolietVd.SystemIdentifier;
XmlFsType.DataPreparerIdentifier = decodedVd.DataPreparerIdentifier;
else XmlFsType.DataPreparerIdentifier = decodedJolietVd.SystemIdentifier;
if(decodedJolietVd.ApplicationIdentifier == null || decodedVd.ApplicationIdentifier.Length >
decodedJolietVd.ApplicationIdentifier.Length)
xmlFsType.ApplicationIdentifier = decodedVd.ApplicationIdentifier;
else xmlFsType.ApplicationIdentifier = decodedJolietVd.SystemIdentifier;
XmlFsType.ApplicationIdentifier = decodedVd.ApplicationIdentifier;
else XmlFsType.ApplicationIdentifier = decodedJolietVd.SystemIdentifier;
xmlFsType.CreationDate = decodedJolietVd.CreationTime;
xmlFsType.CreationDateSpecified = true;
XmlFsType.CreationDate = decodedJolietVd.CreationTime;
XmlFsType.CreationDateSpecified = true;
if(decodedJolietVd.HasModificationTime)
{
xmlFsType.ModificationDate = decodedJolietVd.ModificationTime;
xmlFsType.ModificationDateSpecified = true;
XmlFsType.ModificationDate = decodedJolietVd.ModificationTime;
XmlFsType.ModificationDateSpecified = true;
}
if(decodedJolietVd.HasExpirationTime)
{
xmlFsType.ExpirationDate = decodedJolietVd.ExpirationTime;
xmlFsType.ExpirationDateSpecified = true;
XmlFsType.ExpirationDate = decodedJolietVd.ExpirationTime;
XmlFsType.ExpirationDateSpecified = true;
}
if(decodedJolietVd.HasEffectiveTime)
{
xmlFsType.EffectiveDate = decodedJolietVd.EffectiveTime;
xmlFsType.EffectiveDateSpecified = true;
XmlFsType.EffectiveDate = decodedJolietVd.EffectiveTime;
XmlFsType.EffectiveDateSpecified = true;
}
}
else
{
xmlFsType.SystemIdentifier = decodedVd.SystemIdentifier;
xmlFsType.VolumeName = decodedVd.VolumeIdentifier;
xmlFsType.VolumeSetIdentifier = decodedVd.VolumeSetIdentifier;
xmlFsType.PublisherIdentifier = decodedVd.PublisherIdentifier;
xmlFsType.DataPreparerIdentifier = decodedVd.DataPreparerIdentifier;
xmlFsType.ApplicationIdentifier = decodedVd.ApplicationIdentifier;
xmlFsType.CreationDate = decodedVd.CreationTime;
xmlFsType.CreationDateSpecified = true;
XmlFsType.SystemIdentifier = decodedVd.SystemIdentifier;
XmlFsType.VolumeName = decodedVd.VolumeIdentifier;
XmlFsType.VolumeSetIdentifier = decodedVd.VolumeSetIdentifier;
XmlFsType.PublisherIdentifier = decodedVd.PublisherIdentifier;
XmlFsType.DataPreparerIdentifier = decodedVd.DataPreparerIdentifier;
XmlFsType.ApplicationIdentifier = decodedVd.ApplicationIdentifier;
XmlFsType.CreationDate = decodedVd.CreationTime;
XmlFsType.CreationDateSpecified = true;
if(decodedVd.HasModificationTime)
{
xmlFsType.ModificationDate = decodedVd.ModificationTime;
xmlFsType.ModificationDateSpecified = true;
XmlFsType.ModificationDate = decodedVd.ModificationTime;
XmlFsType.ModificationDateSpecified = true;
}
if(decodedVd.HasExpirationTime)
{
xmlFsType.ExpirationDate = decodedVd.ExpirationTime;
xmlFsType.ExpirationDateSpecified = true;
XmlFsType.ExpirationDate = decodedVd.ExpirationTime;
XmlFsType.ExpirationDateSpecified = true;
}
if(decodedVd.HasEffectiveTime)
{
xmlFsType.EffectiveDate = decodedVd.EffectiveTime;
xmlFsType.EffectiveDateSpecified = true;
XmlFsType.EffectiveDate = decodedVd.EffectiveTime;
XmlFsType.EffectiveDateSpecified = true;
}
}
xmlFsType.Bootable |= bvd != null || segaCd != null || saturn != null || dreamcast != null;
xmlFsType.Clusters = decodedVd.Blocks;
xmlFsType.ClusterSize = decodedVd.BlockSize;
XmlFsType.Bootable |= bvd != null || segaCd != null || saturn != null || dreamcast != null;
XmlFsType.Clusters = decodedVd.Blocks;
XmlFsType.ClusterSize = decodedVd.BlockSize;
information = isoMetadata.ToString();
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -45,11 +44,8 @@ namespace DiscImageChef.Filesystems
const uint JFS_BOOT_BLOCKS_SIZE = 0x8000;
const uint JFS_MAGIC = 0x3153464A;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "JFS Plugin";
public Guid Id => new Guid("D3BE2A41-8F28-4055-94DC-BB6C72A0E9C4");
@@ -70,9 +66,10 @@ namespace DiscImageChef.Filesystems
return jfsSb.s_magic == JFS_MAGIC;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
uint bootSectors = JFS_BOOT_BLOCKS_SIZE / imagePlugin.Info.SectorSize;
@@ -120,22 +117,22 @@ namespace DiscImageChef.Filesystems
DateHandlers.UnixUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec))
.AppendLine();
if(jfsSb.s_version == 1)
sb.AppendFormat("Volume name: {0}", currentEncoding.GetString(jfsSb.s_fpack)).AppendLine();
else sb.AppendFormat("Volume name: {0}", currentEncoding.GetString(jfsSb.s_label)).AppendLine();
sb.AppendFormat("Volume name: {0}", Encoding.GetString(jfsSb.s_fpack)).AppendLine();
else sb.AppendFormat("Volume name: {0}", Encoding.GetString(jfsSb.s_label)).AppendLine();
sb.AppendFormat("Volume UUID: {0}", jfsSb.s_uuid).AppendLine();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "JFS filesystem",
Clusters = (long)jfsSb.s_size,
ClusterSize = (int)jfsSb.s_bsize,
Bootable = true,
VolumeName = currentEncoding.GetString(jfsSb.s_version == 1 ? jfsSb.s_fpack : jfsSb.s_label),
VolumeName = Encoding.GetString(jfsSb.s_version == 1 ? jfsSb.s_fpack : jfsSb.s_label),
VolumeSerial = $"{jfsSb.s_uuid}",
ModificationDate = DateHandlers.UnixUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec),
ModificationDateSpecified = true
};
if(jfsSb.s_state != 0) xmlFsType.Dirty = true;
if(jfsSb.s_state != 0) XmlFsType.Dirty = true;
information = sb.ToString();
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -46,11 +45,8 @@ namespace DiscImageChef.Filesystems
{
const uint LIF_MAGIC = 0x8000;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "HP Logical Interchange Format Plugin";
public Guid Id => new Guid("41535647-77A5-477B-9206-DA727ACDC704");
@@ -65,9 +61,10 @@ namespace DiscImageChef.Filesystems
return lifSb.magic == LIF_MAGIC;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
if(imagePlugin.Info.SectorSize < 256) return;
@@ -88,20 +85,19 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("{0} tracks", lifSb.tracks).AppendLine();
sb.AppendFormat("{0} heads", lifSb.heads).AppendLine();
sb.AppendFormat("{0} sectors", lifSb.sectors).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(lifSb.volumeLabel, currentEncoding))
.AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(lifSb.volumeLabel, Encoding)).AppendLine();
sb.AppendFormat("Volume created on {0}", DateHandlers.LifToDateTime(lifSb.creationDate)).AppendLine();
information = sb.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "HP Logical Interchange Format",
ClusterSize = 256,
Clusters = (long)(partition.Size / 256),
CreationDate = DateHandlers.LifToDateTime(lifSb.creationDate),
CreationDateSpecified = true,
VolumeName = StringHandlers.CToString(lifSb.volumeLabel, currentEncoding)
VolumeName = StringHandlers.CToString(lifSb.volumeLabel, Encoding)
};
}

View File

@@ -92,7 +92,7 @@ namespace DiscImageChef.Filesystems.LisaFS
// as '-' is the path separator in Lisa OS
contents = (from entry in catalogCache
where entry.parentID == dirId
select StringHandlers.CToString(entry.filename, currentEncoding).Replace('/', '-')).ToList();
select StringHandlers.CToString(entry.filename, Encoding).Replace('/', '-')).ToList();
return Errno.NoError;
}
@@ -118,15 +118,17 @@ namespace DiscImageChef.Filesystems.LisaFS
// For each entry on the catalog
while(offset + 54 < buf.Length)
{
CatalogEntryV2 entV2 = new CatalogEntryV2();
entV2.filenameLen = buf[offset];
entV2.filename = new byte[E_NAME];
CatalogEntryV2 entV2 = new CatalogEntryV2
{
filenameLen = buf[offset],
filename = new byte[E_NAME],
unknown1 = buf[offset + 0x21],
fileType = buf[offset + 0x22],
unknown2 = buf[offset + 0x23],
fileID = BigEndianBitConverter.ToInt16(buf, offset + 0x24),
unknown3 = new byte[16]
};
Array.Copy(buf, offset + 0x01, entV2.filename, 0, E_NAME);
entV2.unknown1 = buf[offset + 0x21];
entV2.fileType = buf[offset + 0x22];
entV2.unknown2 = buf[offset + 0x23];
entV2.fileID = BigEndianBitConverter.ToInt16(buf, offset + 0x24);
entV2.unknown3 = new byte[16];
Array.Copy(buf, offset + 0x26, entV2.unknown3, 0, 16);
offset += 54;

View File

@@ -185,7 +185,7 @@ namespace DiscImageChef.Filesystems.LisaFS
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filenameLen = {1}", fileId, file.filenameLen);
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filename = {1}", fileId,
StringHandlers.CToString(file.filename, currentEncoding));
StringHandlers.CToString(file.filename, Encoding));
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown1 = 0x{1:X4}", fileId, file.unknown1);
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].file_uid = 0x{1:X16}", fileId, file.file_uid);
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown2 = 0x{1:X2}", fileId, file.unknown2);
@@ -219,7 +219,7 @@ namespace DiscImageChef.Filesystems.LisaFS
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].password_valid = {1}", fileId,
file.password_valid > 0);
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].password = {1}", fileId,
currentEncoding.GetString(file.password));
Encoding.GetString(file.password));
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown7 = 0x{1:X2}{2:X2}{3:X2}", fileId,
file.unknown7[0], file.unknown7[1], file.unknown7[2]);
DicConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].overhead = {1}", fileId, file.overhead);

View File

@@ -423,7 +423,7 @@ namespace DiscImageChef.Filesystems.LisaFS
foreach(CatalogEntry entry in catalogCache)
{
string filename = StringHandlers.CToString(entry.filename, currentEncoding);
string filename = StringHandlers.CToString(entry.filename, Encoding);
// LisaOS is case insensitive
if(string.Compare(wantedFilename, filename, StringComparison.InvariantCultureIgnoreCase) != 0 ||

View File

@@ -85,14 +85,12 @@ namespace DiscImageChef.Filesystems.LisaFS
DicConsole.DebugWriteLine("LisaFS plugin", "Current sector = {0}", i);
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.mddf_block = {0}", infoMddf.mddf_block);
DicConsole.DebugWriteLine("LisaFS plugin", "Disk size = {0} sectors",
imagePlugin.Info.Sectors);
DicConsole.DebugWriteLine("LisaFS plugin", "Disk size = {0} sectors", imagePlugin.Info.Sectors);
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size = {0} sectors", infoMddf.vol_size);
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - 1 = {0}", infoMddf.volsize_minus_one);
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.vol_size - mddf.mddf_block -1 = {0}",
infoMddf.volsize_minus_mddf_minus_one);
DicConsole.DebugWriteLine("LisaFS plugin", "Disk sector = {0} bytes",
imagePlugin.Info.SectorSize);
DicConsole.DebugWriteLine("LisaFS plugin", "Disk sector = {0} bytes", imagePlugin.Info.SectorSize);
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.blocksize = {0} bytes", infoMddf.blocksize);
DicConsole.DebugWriteLine("LisaFS plugin", "mddf.datasize = {0} bytes", infoMddf.datasize);
@@ -120,9 +118,10 @@ namespace DiscImageChef.Filesystems.LisaFS
}
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = new LisaRoman();
Encoding = new LisaRoman();
information = "";
StringBuilder sb = new StringBuilder();
@@ -161,11 +160,11 @@ namespace DiscImageChef.Filesystems.LisaFS
infoMddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02);
infoMddf.volnum = BigEndianBitConverter.ToUInt16(sector, 0x0A);
Array.Copy(sector, 0x0C, pString, 0, 33);
infoMddf.volname = StringHandlers.PascalToString(pString, currentEncoding);
infoMddf.volname = StringHandlers.PascalToString(pString, Encoding);
infoMddf.unknown1 = sector[0x2D];
Array.Copy(sector, 0x2E, pString, 0, 33);
// Prevent garbage
infoMddf.password = pString[0] <= 32 ? StringHandlers.PascalToString(pString, currentEncoding) : "";
infoMddf.password = pString[0] <= 32 ? StringHandlers.PascalToString(pString, Encoding) : "";
infoMddf.unknown2 = sector[0x4F];
infoMddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
infoMddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
@@ -351,27 +350,27 @@ namespace DiscImageChef.Filesystems.LisaFS
information = sb.ToString();
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
if(DateTime.Compare(infoMddf.dtvb, DateHandlers.LisaToDateTime(0)) > 0)
{
xmlFsType.BackupDate = infoMddf.dtvb;
xmlFsType.BackupDateSpecified = true;
XmlFsType.BackupDate = infoMddf.dtvb;
XmlFsType.BackupDateSpecified = true;
}
xmlFsType.Clusters = infoMddf.vol_size;
xmlFsType.ClusterSize = infoMddf.clustersize * infoMddf.datasize;
XmlFsType.Clusters = infoMddf.vol_size;
XmlFsType.ClusterSize = infoMddf.clustersize * infoMddf.datasize;
if(DateTime.Compare(infoMddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0)
{
xmlFsType.CreationDate = infoMddf.dtvc;
xmlFsType.CreationDateSpecified = true;
XmlFsType.CreationDate = infoMddf.dtvc;
XmlFsType.CreationDateSpecified = true;
}
xmlFsType.Dirty = infoMddf.vol_left_mounted != 0;
xmlFsType.Files = infoMddf.filecount;
xmlFsType.FilesSpecified = true;
xmlFsType.FreeClusters = infoMddf.freecount;
xmlFsType.FreeClustersSpecified = true;
xmlFsType.Type = "LisaFS";
xmlFsType.VolumeName = infoMddf.volname;
xmlFsType.VolumeSerial = $"{infoMddf.volid:X16}";
XmlFsType.Dirty = infoMddf.vol_left_mounted != 0;
XmlFsType.Files = infoMddf.filecount;
XmlFsType.FilesSpecified = true;
XmlFsType.FreeClusters = infoMddf.freecount;
XmlFsType.FreeClustersSpecified = true;
XmlFsType.Type = "LisaFS";
XmlFsType.VolumeName = infoMddf.volname;
XmlFsType.VolumeSerial = $"{infoMddf.volid:X16}";
return;
}

View File

@@ -32,11 +32,9 @@
using System;
using System.Collections.Generic;
using Claunia.Encoding;
using DiscImageChef.CommonTypes;
using System.Text;
using DiscImageChef.DiscImages;
using Schemas;
using Encoding = System.Text.Encoding;
namespace DiscImageChef.Filesystems.LisaFS
{
@@ -44,9 +42,8 @@ namespace DiscImageChef.Filesystems.LisaFS
// Variable names from Lisa API
public partial class LisaFS : IReadOnlyFilesystem
{
IMediaImage device;
Encoding currentEncoding;
bool debug;
IMediaImage device;
int devTagSize;
MDDF mddf;
@@ -56,9 +53,8 @@ namespace DiscImageChef.Filesystems.LisaFS
public string Name => "Apple Lisa File System";
public Guid Id => new Guid("7E6034D1-D823-4248-A54D-239742B28391");
public Encoding Encoding => currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding { get; private set; }
public FileSystemType XmlFsType { get; private set; }
#region Caches
/// <summary>Caches Extents Files</summary>

View File

@@ -52,7 +52,7 @@ namespace DiscImageChef.Filesystems.LisaFS
try
{
device = imagePlugin;
currentEncoding = new LisaRoman();
Encoding = new LisaRoman();
// Lisa OS is unable to work on disks without tags.
// This code is designed like that.
@@ -100,11 +100,11 @@ namespace DiscImageChef.Filesystems.LisaFS
mddf.volid = BigEndianBitConverter.ToUInt64(sector, 0x02);
mddf.volnum = BigEndianBitConverter.ToUInt16(sector, 0x0A);
Array.Copy(sector, 0x0C, pString, 0, 33);
mddf.volname = StringHandlers.PascalToString(pString, currentEncoding);
mddf.volname = StringHandlers.PascalToString(pString, Encoding);
mddf.unknown1 = sector[0x2D];
Array.Copy(sector, 0x2E, pString, 0, 33);
// Prevent garbage
mddf.password = pString[0] <= 32 ? StringHandlers.PascalToString(pString, currentEncoding) : "";
mddf.password = pString[0] <= 32 ? StringHandlers.PascalToString(pString, Encoding) : "";
mddf.unknown2 = sector[0x4F];
mddf.machine_id = BigEndianBitConverter.ToUInt32(sector, 0x50);
mddf.master_copy_id = BigEndianBitConverter.ToUInt32(sector, 0x54);
@@ -281,27 +281,27 @@ namespace DiscImageChef.Filesystems.LisaFS
}
// Create XML metadata for mounted filesystem
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
if(DateTime.Compare(mddf.dtvb, DateHandlers.LisaToDateTime(0)) > 0)
{
xmlFsType.BackupDate = mddf.dtvb;
xmlFsType.BackupDateSpecified = true;
XmlFsType.BackupDate = mddf.dtvb;
XmlFsType.BackupDateSpecified = true;
}
xmlFsType.Clusters = mddf.vol_size;
xmlFsType.ClusterSize = mddf.clustersize * mddf.datasize;
XmlFsType.Clusters = mddf.vol_size;
XmlFsType.ClusterSize = mddf.clustersize * mddf.datasize;
if(DateTime.Compare(mddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0)
{
xmlFsType.CreationDate = mddf.dtvc;
xmlFsType.CreationDateSpecified = true;
XmlFsType.CreationDate = mddf.dtvc;
XmlFsType.CreationDateSpecified = true;
}
xmlFsType.Dirty = mddf.vol_left_mounted != 0;
xmlFsType.Files = mddf.filecount;
xmlFsType.FilesSpecified = true;
xmlFsType.FreeClusters = mddf.freecount;
xmlFsType.FreeClustersSpecified = true;
xmlFsType.Type = "LisaFS";
xmlFsType.VolumeName = mddf.volname;
xmlFsType.VolumeSerial = $"{mddf.volid:X16}";
XmlFsType.Dirty = mddf.vol_left_mounted != 0;
XmlFsType.Files = mddf.filecount;
XmlFsType.FilesSpecified = true;
XmlFsType.FreeClusters = mddf.freecount;
XmlFsType.FreeClustersSpecified = true;
XmlFsType.Type = "LisaFS";
XmlFsType.VolumeName = mddf.volname;
XmlFsType.VolumeSerial = $"{mddf.volid:X16}";
return Errno.NoError;
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
@@ -68,11 +67,8 @@ namespace DiscImageChef.Filesystems
const uint Locus_OldMagic = 0xFFEEDDCC;
const uint Locus_OldCigam = 0xCCDDEEFF;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Locus Filesystem Plugin";
public Guid Id => new Guid("1A70B30A-437D-479A-88E1-D0C9C1797FF4");
@@ -106,9 +102,10 @@ namespace DiscImageChef.Filesystems
return false;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
if(imagePlugin.Info.SectorSize < 512) return;
@@ -149,8 +146,8 @@ namespace DiscImageChef.Filesystems
int blockSize = LocusSb.s_version == LocusVersion.SB_SB4096 ? 4096 : 1024;
string s_fsmnt = StringHandlers.CToString(LocusSb.s_fsmnt, currentEncoding);
string s_fpack = StringHandlers.CToString(LocusSb.s_fpack, currentEncoding);
string s_fsmnt = StringHandlers.CToString(LocusSb.s_fsmnt, Encoding);
string s_fpack = StringHandlers.CToString(LocusSb.s_fpack, Encoding);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_magic = 0x{0:X8}", LocusSb.s_magic);
DicConsole.DebugWriteLine("Locus plugin", "LocusSb.s_gfs = {0}", LocusSb.s_gfs);
@@ -203,7 +200,7 @@ namespace DiscImageChef.Filesystems
information = sb.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "Locus filesystem",
ClusterSize = blockSize,

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -46,11 +45,9 @@ namespace DiscImageChef.Filesystems
{
const ushort MAGIC = 0xA72E;
const ushort MAGIC2 = 0x530C;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
Encoding currentEncoding;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "MicroDOS file system";
public Guid Id => new Guid("9F9A364A-1A27-48A3-B730-7A7122000324");
@@ -73,7 +70,7 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("koi8-r");
Encoding = encoding ?? Encoding.GetEncoding("koi8-r");
information = "";
StringBuilder sb = new StringBuilder();
@@ -92,7 +89,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Volume contains {0} files", block0.files).AppendLine();
sb.AppendFormat("First used block is {0}", block0.firstUsedBlock).AppendLine();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "MicroDOS",
ClusterSize = 512,

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -64,11 +63,9 @@ namespace DiscImageChef.Filesystems
const ushort MINIX2_CIGAM2 = 0x7824;
/// <summary>Minix v3, 60 char filenames</summary>
const ushort MINIX3_CIGAM = 0x5A4D;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
Encoding currentEncoding;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Minix Filesystem";
public Guid Id => new Guid("FE248C3B-B727-4AE5-A39F-79EA9A07D4B3");
@@ -113,7 +110,7 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
@@ -143,7 +140,7 @@ namespace DiscImageChef.Filesystems
magic = BitConverter.ToUInt16(minixSbSector, 0x018);
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
bool littleEndian;
@@ -158,16 +155,16 @@ namespace DiscImageChef.Filesystems
case MINIX3_MAGIC:
case MINIX3_CIGAM:
minixVersion = "Minix v3 filesystem";
xmlFsType.Type = "Minix v3";
XmlFsType.Type = "Minix v3";
break;
case MINIX2_MAGIC:
case MINIX2_CIGAM:
minixVersion = "Minix 3 v2 filesystem";
xmlFsType.Type = "Minix 3 v2";
XmlFsType.Type = "Minix 3 v2";
break;
default:
minixVersion = "Minix 3 v1 filesystem";
xmlFsType.Type = "Minix 3 v1";
XmlFsType.Type = "Minix 3 v1";
break;
}
@@ -183,49 +180,49 @@ namespace DiscImageChef.Filesystems
filenamesize = 14;
minixVersion = "Minix v1 filesystem";
littleEndian = true;
xmlFsType.Type = "Minix v1";
XmlFsType.Type = "Minix v1";
break;
case MINIX_MAGIC2:
filenamesize = 30;
minixVersion = "Minix v1 filesystem";
littleEndian = true;
xmlFsType.Type = "Minix v1";
XmlFsType.Type = "Minix v1";
break;
case MINIX2_MAGIC:
filenamesize = 14;
minixVersion = "Minix v2 filesystem";
littleEndian = true;
xmlFsType.Type = "Minix v2";
XmlFsType.Type = "Minix v2";
break;
case MINIX2_MAGIC2:
filenamesize = 30;
minixVersion = "Minix v2 filesystem";
littleEndian = true;
xmlFsType.Type = "Minix v2";
XmlFsType.Type = "Minix v2";
break;
case MINIX_CIGAM:
filenamesize = 14;
minixVersion = "Minix v1 filesystem";
littleEndian = false;
xmlFsType.Type = "Minix v1";
XmlFsType.Type = "Minix v1";
break;
case MINIX_CIGAM2:
filenamesize = 30;
minixVersion = "Minix v1 filesystem";
littleEndian = false;
xmlFsType.Type = "Minix v1";
XmlFsType.Type = "Minix v1";
break;
case MINIX2_CIGAM:
filenamesize = 14;
minixVersion = "Minix v2 filesystem";
littleEndian = false;
xmlFsType.Type = "Minix v2";
XmlFsType.Type = "Minix v2";
break;
case MINIX2_CIGAM2:
filenamesize = 30;
minixVersion = "Minix v2 filesystem";
littleEndian = false;
xmlFsType.Type = "Minix v2";
XmlFsType.Type = "Minix v2";
break;
default: return;
}
@@ -265,8 +262,8 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("{0} bytes maximum per file", mnxSb.s_max_size).AppendLine();
sb.AppendFormat("On-disk filesystem version: {0}", mnxSb.s_disk_version).AppendLine();
xmlFsType.ClusterSize = mnxSb.s_blocksize;
xmlFsType.Clusters = mnxSb.s_zones > 0 ? mnxSb.s_zones : mnxSb.s_nzones;
XmlFsType.ClusterSize = mnxSb.s_blocksize;
XmlFsType.Clusters = mnxSb.s_zones > 0 ? mnxSb.s_zones : mnxSb.s_nzones;
}
else
{
@@ -298,8 +295,8 @@ namespace DiscImageChef.Filesystems
//sb.AppendFormat("log2 of blocks/zone: {0}", mnx_sb.s_log_zone_size).AppendLine(); // Apparently 0
sb.AppendFormat("{0} bytes maximum per file", mnxSb.s_max_size).AppendLine();
sb.AppendFormat("Filesystem state: {0:X4}", mnxSb.s_state).AppendLine();
xmlFsType.ClusterSize = 1024;
xmlFsType.Clusters = mnxSb.s_zones > 0 ? mnxSb.s_zones : mnxSb.s_nzones;
XmlFsType.ClusterSize = 1024;
XmlFsType.Clusters = mnxSb.s_zones > 0 ? mnxSb.s_zones : mnxSb.s_nzones;
}
information = sb.ToString();
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -45,11 +44,8 @@ namespace DiscImageChef.Filesystems
const ushort NILFS2_MAGIC = 0x3434;
const uint NILFS2_SUPER_OFFSET = 1024;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "NILFS2 Plugin";
public Guid Id => new Guid("35224226-C5CC-48B5-8FFD-3781E91E86B6");
@@ -78,9 +74,10 @@ namespace DiscImageChef.Filesystems
return nilfsSb.magic == NILFS2_MAGIC;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.UTF8;
Encoding = encoding ?? Encoding.UTF8;
information = "";
if(imagePlugin.Info.SectorSize < 512) return;
@@ -114,8 +111,7 @@ namespace DiscImageChef.Filesystems
else sb.AppendFormat("Creator OS code: {0}", nilfsSb.creator_os).AppendLine();
sb.AppendFormat("{0} bytes per inode", nilfsSb.inode_size).AppendLine();
sb.AppendFormat("Volume UUID: {0}", nilfsSb.uuid).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(nilfsSb.volume_name, currentEncoding))
.AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(nilfsSb.volume_name, Encoding)).AppendLine();
sb.AppendFormat("Volume created on {0}", DateHandlers.UnixUnsignedToDateTime(nilfsSb.ctime)).AppendLine();
sb.AppendFormat("Volume last mounted on {0}", DateHandlers.UnixUnsignedToDateTime(nilfsSb.mtime))
.AppendLine();
@@ -124,19 +120,19 @@ namespace DiscImageChef.Filesystems
information = sb.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "NILFS2 filesystem",
ClusterSize = 1 << (int)(nilfsSb.log_block_size + 10),
VolumeName = StringHandlers.CToString(nilfsSb.volume_name, currentEncoding),
VolumeName = StringHandlers.CToString(nilfsSb.volume_name, Encoding),
VolumeSerial = nilfsSb.uuid.ToString(),
CreationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.ctime),
CreationDateSpecified = true,
ModificationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.wtime),
ModificationDateSpecified = true
};
if(nilfsSb.creator_os == 0) xmlFsType.SystemIdentifier = "Linux";
xmlFsType.Clusters = (long)nilfsSb.dev_size / xmlFsType.ClusterSize;
if(nilfsSb.creator_os == 0) XmlFsType.SystemIdentifier = "Linux";
XmlFsType.Clusters = (long)nilfsSb.dev_size / XmlFsType.ClusterSize;
}
enum NILFS2_State : ushort

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.Checksums;
@@ -44,10 +43,8 @@ namespace DiscImageChef.Filesystems
// Information from Inside Windows NT
public class NTFS : IFilesystem
{
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "New Technology File System (NTFS)";
public Guid Id => new Guid("33513B2C-1e6d-4d21-a660-0bbc789c3871");
@@ -79,9 +76,10 @@ namespace DiscImageChef.Filesystems
return signature == 0xAA55;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = Encoding.Unicode;
Encoding = Encoding.Unicode;
information = "";
StringBuilder sb = new StringBuilder();
@@ -125,11 +123,11 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Volume serial number: {0:X16}", ntfsBb.serial_no).AppendLine();
// sb.AppendFormat("Signature 2: 0x{0:X4}", ntfs_bb.signature2).AppendLine();
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
if(ntfsBb.jump[0] == 0xEB && ntfsBb.jump[1] > 0x4E && ntfsBb.jump[1] < 0x80 && ntfsBb.signature2 == 0xAA55)
{
xmlFsType.Bootable = true;
XmlFsType.Bootable = true;
Sha1Context sha1Ctx = new Sha1Context();
sha1Ctx.Init();
string bootChk = sha1Ctx.Data(ntfsBb.boot_code, out _);
@@ -137,10 +135,10 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Boot code's SHA1: {0}", bootChk).AppendLine();
}
xmlFsType.ClusterSize = ntfsBb.spc * ntfsBb.bps;
xmlFsType.Clusters = ntfsBb.sectors / ntfsBb.spc;
xmlFsType.VolumeSerial = $"{ntfsBb.serial_no:X16}";
xmlFsType.Type = "NTFS";
XmlFsType.ClusterSize = ntfsBb.spc * ntfsBb.bps;
XmlFsType.Clusters = ntfsBb.sectors / ntfsBb.spc;
XmlFsType.VolumeSerial = $"{ntfsBb.serial_no:X16}";
XmlFsType.Type = "NTFS";
information = sb.ToString();
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
@@ -42,11 +41,8 @@ namespace DiscImageChef.Filesystems
{
public class NintendoPlugin : IFilesystem
{
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Nintendo optical filesystems";
public Guid Id => new Guid("4675fcb4-4418-4288-9e4a-33d6a4ac1126");
@@ -66,12 +62,13 @@ namespace DiscImageChef.Filesystems
return magicGc == 0xC2339F3D || magicWii == 0x5D1C9EA3;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("shift_jis");
Encoding = encoding ?? Encoding.GetEncoding("shift_jis");
StringBuilder sbInformation = new StringBuilder();
information = "";
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
NintendoFields fields = new NintendoFields();
BigEndianBitConverter.IsLittleEndian = BitConverter.IsLittleEndian;
@@ -97,7 +94,7 @@ namespace DiscImageChef.Filesystems
fields.StreamBufferSize = header[9];
byte[] temp = new byte[64];
Array.Copy(header, 0x20, temp, 0, 64);
fields.Title = StringHandlers.CToString(temp, currentEncoding);
fields.Title = StringHandlers.CToString(temp, Encoding);
if(!wii)
{
@@ -291,12 +288,12 @@ namespace DiscImageChef.Filesystems
.AppendLine();
information = sbInformation.ToString();
xmlFsType.Bootable = true;
xmlFsType.Clusters = (long)(imagePlugin.Info.Sectors * imagePlugin.Info.SectorSize / 2048);
xmlFsType.ClusterSize = 2048;
xmlFsType.Type = wii ? "Nintendo Wii filesystem" : "Nintendo Gamecube filesystem";
xmlFsType.VolumeName = fields.Title;
xmlFsType.VolumeSerial = fields.DiscId;
XmlFsType.Bootable = true;
XmlFsType.Clusters = (long)(imagePlugin.Info.Sectors * imagePlugin.Info.SectorSize / 2048);
XmlFsType.ClusterSize = 2048;
XmlFsType.Type = wii ? "Nintendo Wii filesystem" : "Nintendo Gamecube filesystem";
XmlFsType.VolumeName = fields.Title;
XmlFsType.VolumeSerial = fields.DiscId;
}
static string DiscTypeToString(string discType)

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -52,11 +51,8 @@ namespace DiscImageChef.Filesystems
// TODO: Implement checksum
public class ODS : IFilesystem
{
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Files-11 On-Disk Structure";
public Guid Id => new Guid("de20633c-8021-4384-aeb0-83b0df14491f");
@@ -91,9 +87,10 @@ namespace DiscImageChef.Filesystems
return magic == "DECFILE11A " || magic == "DECFILE11B ";
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
information = "";
StringBuilder sb = new StringBuilder();
@@ -129,8 +126,8 @@ namespace DiscImageChef.Filesystems
sb.AppendLine("The following information may be incorrect for this volume.");
if(homeblock.resfiles < 5 || homeblock.devtype != 0) sb.AppendLine("This volume may be corrupted.");
sb.AppendFormat("Volume format is {0}",
StringHandlers.SpacePaddedToString(homeblock.format, currentEncoding)).AppendLine();
sb.AppendFormat("Volume format is {0}", StringHandlers.SpacePaddedToString(homeblock.format, Encoding))
.AppendLine();
sb.AppendFormat("Volume is Level {0} revision {1}", (homeblock.struclev & 0xFF00) >> 8,
homeblock.struclev & 0xFF).AppendLine();
sb.AppendFormat("Lowest structure in the volume is Level {0}, revision {1}",
@@ -154,12 +151,12 @@ namespace DiscImageChef.Filesystems
if(homeblock.rvn > 0 && homeblock.setcount > 0 &&
StringHandlers.CToString(homeblock.strucname) != " ")
sb.AppendFormat("Volume is {0} of {1} in set \"{2}\".", homeblock.rvn, homeblock.setcount,
StringHandlers.SpacePaddedToString(homeblock.strucname, currentEncoding)).AppendLine();
StringHandlers.SpacePaddedToString(homeblock.strucname, Encoding)).AppendLine();
sb.AppendFormat("Volume owner is \"{0}\" (ID 0x{1:X8})",
StringHandlers.SpacePaddedToString(homeblock.ownername, currentEncoding),
homeblock.volowner).AppendLine();
sb.AppendFormat("Volume label: \"{0}\"",
StringHandlers.SpacePaddedToString(homeblock.volname, currentEncoding)).AppendLine();
StringHandlers.SpacePaddedToString(homeblock.ownername, Encoding), homeblock.volowner)
.AppendLine();
sb.AppendFormat("Volume label: \"{0}\"", StringHandlers.SpacePaddedToString(homeblock.volname, Encoding))
.AppendLine();
sb.AppendFormat("Drive serial number: 0x{0:X8}", homeblock.serialnum).AppendLine();
sb.AppendFormat("Volume was created on {0}", DateHandlers.VmsToDateTime(homeblock.credate)).AppendLine();
if(homeblock.revdate > 0)
@@ -207,23 +204,23 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("File protection: 0x{0:X4}", homeblock.fileprot).AppendLine();
sb.AppendFormat("Record protection: 0x{0:X4}", homeblock.recprot).AppendLine();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "FILES-11",
ClusterSize = homeblock.cluster * 512,
Clusters = (long)partition.Size / (homeblock.cluster * 512),
VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, currentEncoding),
VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, Encoding),
VolumeSerial = $"{homeblock.serialnum:X8}"
};
if(homeblock.credate > 0)
{
xmlFsType.CreationDate = DateHandlers.VmsToDateTime(homeblock.credate);
xmlFsType.CreationDateSpecified = true;
XmlFsType.CreationDate = DateHandlers.VmsToDateTime(homeblock.credate);
XmlFsType.CreationDateSpecified = true;
}
if(homeblock.revdate > 0)
{
xmlFsType.ModificationDate = DateHandlers.VmsToDateTime(homeblock.revdate);
xmlFsType.ModificationDateSpecified = true;
XmlFsType.ModificationDate = DateHandlers.VmsToDateTime(homeblock.revdate);
XmlFsType.ModificationDateSpecified = true;
}
information = sb.ToString();

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -42,11 +41,8 @@ namespace DiscImageChef.Filesystems
{
public class OperaFS : IFilesystem
{
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Opera Filesystem Plugin";
public Guid Id => new Guid("0ec84ec7-eae6-4196-83fe-943b3fe46dbd");
@@ -67,10 +63,11 @@ namespace DiscImageChef.Filesystems
return Encoding.ASCII.GetString(syncBytes) == "ZZZZZ";
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
// TODO: Find correct default encoding
currentEncoding = Encoding.ASCII;
Encoding = Encoding.ASCII;
information = "";
StringBuilder superBlockMetadata = new StringBuilder();
@@ -83,13 +80,13 @@ namespace DiscImageChef.Filesystems
if(Encoding.ASCII.GetString(sb.sync_bytes) != "ZZZZZ") return;
superBlockMetadata.AppendFormat("Opera filesystem disc.").AppendLine();
if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_label, currentEncoding)))
if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_label, Encoding)))
superBlockMetadata
.AppendFormat("Volume label: {0}", StringHandlers.CToString(sb.volume_label, currentEncoding))
.AppendFormat("Volume label: {0}", StringHandlers.CToString(sb.volume_label, Encoding))
.AppendLine();
if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_comment, currentEncoding)))
superBlockMetadata.AppendFormat("Volume comment: {0}",
StringHandlers.CToString(sb.volume_comment, currentEncoding))
if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_comment, Encoding)))
superBlockMetadata
.AppendFormat("Volume comment: {0}", StringHandlers.CToString(sb.volume_comment, Encoding))
.AppendLine();
superBlockMetadata.AppendFormat("Volume identifier: 0x{0:X8}", sb.volume_id).AppendLine();
superBlockMetadata.AppendFormat("Block size: {0} bytes", sb.block_size).AppendLine();
@@ -120,10 +117,10 @@ namespace DiscImageChef.Filesystems
information = superBlockMetadata.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "Opera",
VolumeName = StringHandlers.CToString(sb.volume_label, currentEncoding),
VolumeName = StringHandlers.CToString(sb.volume_label, Encoding),
ClusterSize = sb.block_size,
Clusters = sb.block_count
};

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.DiscImages;
@@ -41,10 +40,8 @@ namespace DiscImageChef.Filesystems
{
public class PCEnginePlugin : IFilesystem
{
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "PC Engine CD Plugin";
public Guid Id => new Guid("e5ee6d7c-90fa-49bd-ac89-14ef750b8af3");
@@ -63,9 +60,9 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("shift_jis");
Encoding = encoding ?? Encoding.GetEncoding("shift_jis");
information = "";
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "PC Engine filesystem",
Clusters = (long)((partition.End - partition.Start + 1) / imagePlugin.Info.SectorSize * 2048),

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -63,11 +62,8 @@ namespace DiscImageChef.Filesystems
/// </summary>
const uint MUPFS_DISK = 0x6D755046;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Professional File System";
public Guid Id => new Guid("68DE769E-D957-406A-8AE4-3781CA8CDA77");
@@ -85,30 +81,31 @@ namespace DiscImageChef.Filesystems
magic == MUPFS_DISK;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
byte[] rootBlockSector = imagePlugin.ReadSector(2 + partition.Start);
RootBlock rootBlock = BigEndianMarshal.ByteArrayToStructureBigEndian<RootBlock>(rootBlockSector);
StringBuilder sbInformation = new StringBuilder();
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
switch(rootBlock.diskType)
{
case AFS_DISK:
case MUAF_DISK:
sbInformation.Append("Professional File System v1");
xmlFsType.Type = "PFS v1";
XmlFsType.Type = "PFS v1";
break;
case PFS2_DISK:
sbInformation.Append("Professional File System v2");
xmlFsType.Type = "PFS v2";
XmlFsType.Type = "PFS v2";
break;
case PFS_DISK:
case MUPFS_DISK:
sbInformation.Append("Professional File System v3");
xmlFsType.Type = "PFS v3";
XmlFsType.Type = "PFS v3";
break;
}
@@ -117,8 +114,7 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendLine();
sbInformation
.AppendFormat("Volume name: {0}", StringHandlers.PascalToString(rootBlock.diskname, currentEncoding))
sbInformation.AppendFormat("Volume name: {0}", StringHandlers.PascalToString(rootBlock.diskname, Encoding))
.AppendLine();
sbInformation.AppendFormat("Volume has {0} free sectors of {1}", rootBlock.blocksfree, rootBlock.diskSize)
.AppendLine();
@@ -131,14 +127,14 @@ namespace DiscImageChef.Filesystems
information = sbInformation.ToString();
xmlFsType.CreationDate =
XmlFsType.CreationDate =
DateHandlers.AmigaToDateTime(rootBlock.creationday, rootBlock.creationminute, rootBlock.creationtick);
xmlFsType.CreationDateSpecified = true;
xmlFsType.FreeClusters = rootBlock.blocksfree;
xmlFsType.FreeClustersSpecified = true;
xmlFsType.Clusters = rootBlock.diskSize;
xmlFsType.ClusterSize = (int)imagePlugin.Info.SectorSize;
xmlFsType.VolumeName = StringHandlers.PascalToString(rootBlock.diskname, currentEncoding);
XmlFsType.CreationDateSpecified = true;
XmlFsType.FreeClusters = rootBlock.blocksfree;
XmlFsType.FreeClustersSpecified = true;
XmlFsType.Clusters = rootBlock.diskSize;
XmlFsType.ClusterSize = (int)imagePlugin.Info.SectorSize;
XmlFsType.VolumeName = StringHandlers.PascalToString(rootBlock.diskname, Encoding);
}
/// <summary>

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Claunia.Encoding;
@@ -84,11 +83,8 @@ namespace DiscImageChef.Filesystems
const byte ENTRY_LENGTH = 0x27;
const byte ENTRIES_PER_BLOCK = 0x0D;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Apple ProDOS filesystem";
public Guid Id => new Guid("43874265-7B8A-4739-BCF7-07F80D5932BF");
@@ -154,10 +150,11 @@ namespace DiscImageChef.Filesystems
return totalBlocks <= partition.End - partition.Start + 1;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
// TODO: Until Apple ][ encoding is implemented
currentEncoding = new LisaRoman();
Encoding = new LisaRoman();
StringBuilder sbInformation = new StringBuilder();
// Blocks 0 and 1 are boot code
@@ -201,7 +198,7 @@ namespace DiscImageChef.Filesystems
rootDirectoryKeyBlock.header.name_length = (byte)(rootDirectoryKeyBlockBytes[0x04] & NAME_LENGTH_MASK);
byte[] temporal = new byte[rootDirectoryKeyBlock.header.name_length];
Array.Copy(rootDirectoryKeyBlockBytes, 0x05, temporal, 0, rootDirectoryKeyBlock.header.name_length);
rootDirectoryKeyBlock.header.volume_name = currentEncoding.GetString(temporal);
rootDirectoryKeyBlock.header.volume_name = Encoding.GetString(temporal);
rootDirectoryKeyBlock.header.reserved = BitConverter.ToUInt64(rootDirectoryKeyBlockBytes, 0x14);
ushort tempTimestampLeft = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x1C);
@@ -296,19 +293,19 @@ namespace DiscImageChef.Filesystems
information = sbInformation.ToString();
xmlFsType = new FileSystemType();
xmlFsType.VolumeName = rootDirectoryKeyBlock.header.volume_name;
XmlFsType = new FileSystemType();
XmlFsType.VolumeName = rootDirectoryKeyBlock.header.volume_name;
if(dateCorrect)
{
xmlFsType.CreationDate = rootDirectoryKeyBlock.header.creation_time;
xmlFsType.CreationDateSpecified = true;
XmlFsType.CreationDate = rootDirectoryKeyBlock.header.creation_time;
XmlFsType.CreationDateSpecified = true;
}
xmlFsType.Files = rootDirectoryKeyBlock.header.file_count;
xmlFsType.FilesSpecified = true;
xmlFsType.Clusters = rootDirectoryKeyBlock.header.total_blocks;
xmlFsType.ClusterSize = (int)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize /
(ulong)xmlFsType.Clusters);
xmlFsType.Type = "ProDOS";
XmlFsType.Files = rootDirectoryKeyBlock.header.file_count;
XmlFsType.FilesSpecified = true;
XmlFsType.Clusters = rootDirectoryKeyBlock.header.total_blocks;
XmlFsType.ClusterSize = (int)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize /
(ulong)XmlFsType.Clusters);
XmlFsType.Type = "ProDOS";
}
/// <summary>

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
@@ -46,10 +45,8 @@ namespace DiscImageChef.Filesystems
readonly byte[] QNX4_RootDir_Fname =
{0x2F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "QNX4 Plugin";
public Guid Id => new Guid("E73A63FA-B5B0-48BF-BF82-DA5F0A8170D2");
@@ -89,7 +86,7 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
byte[] sector = imagePlugin.ReadSector(partition.Start + 1);
if(sector.Length < 512) return;
@@ -177,7 +174,7 @@ namespace DiscImageChef.Filesystems
information =
$"QNX4 filesystem\nCreated on {DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_ftime)}\n";
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "QNX4 filesystem",
Clusters = (long)partition.Length,
@@ -187,7 +184,7 @@ namespace DiscImageChef.Filesystems
ModificationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_mtime),
ModificationDateSpecified = true
};
xmlFsType.Bootable |= qnxSb.boot.di_size != 0 || qnxSb.altBoot.di_size != 0;
XmlFsType.Bootable |= qnxSb.boot.di_size != 0 || qnxSb.altBoot.di_size != 0;
}
struct QNX4_Extent

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -46,10 +45,8 @@ namespace DiscImageChef.Filesystems
const uint QNX6_BOOT_BLOCKS_SIZE = 0x2000;
const uint QNX6_MAGIC = 0x68191122;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "QNX6 Plugin";
public Guid Id => new Guid("3E610EA2-4D08-4D70-8947-830CD4C74FC0");
@@ -82,7 +79,7 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
uint sectors = QNX6_SUPER_BLOCK_SIZE / imagePlugin.Info.SectorSize;
@@ -117,7 +114,7 @@ namespace DiscImageChef.Filesystems
audiSb.freeBlocks * audiSb.blockSize, audiSb.numBlocks,
audiSb.numBlocks * audiSb.blockSize).AppendLine();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "QNX6 (Audi) filesystem",
Clusters = audiSb.numBlocks,
@@ -150,7 +147,7 @@ namespace DiscImageChef.Filesystems
qnxSb.freeBlocks * qnxSb.blockSize, qnxSb.numBlocks, qnxSb.numBlocks * qnxSb.blockSize)
.AppendLine();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "QNX6 filesystem",
Clusters = qnxSb.numBlocks,

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -47,11 +46,8 @@ namespace DiscImageChef.Filesystems
const uint RBF_SYNC = 0x4372757A;
const uint RBF_CNYS = 0x7A757243;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "OS-9 Random Block File Plugin";
public Guid Id => new Guid("E864E45B-0B52-4D29-A858-7BDFA9199FB2");
@@ -88,9 +84,10 @@ namespace DiscImageChef.Filesystems
return false;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
if(imagePlugin.Info.SectorSize < 256) return;
@@ -154,10 +151,10 @@ namespace DiscImageChef.Filesystems
.AppendLine();
sb.AppendFormat("Volume's identification block was last written on {0}",
DateHandlers.UnixToDateTime(rbf9000Sb.rid_mtime)).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(rbf9000Sb.rid_name, currentEncoding))
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(rbf9000Sb.rid_name, Encoding))
.AppendLine();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "OS-9 Random Block File",
Bootable = rbf9000Sb.rid_bootfile > 0,
@@ -167,7 +164,7 @@ namespace DiscImageChef.Filesystems
CreationDateSpecified = true,
ModificationDate = DateHandlers.UnixToDateTime(rbf9000Sb.rid_mtime),
ModificationDateSpecified = true,
VolumeName = StringHandlers.CToString(rbf9000Sb.rid_name, currentEncoding),
VolumeName = StringHandlers.CToString(rbf9000Sb.rid_name, Encoding),
VolumeSerial = $"{rbf9000Sb.rid_diskid:X8}"
};
}
@@ -198,12 +195,11 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Disk is owned by user {0}", rbfSb.dd_own).AppendLine();
sb.AppendFormat("Volume was created on {0}", DateHandlers.Os9ToDateTime(rbfSb.dd_dat)).AppendLine();
sb.AppendFormat("Volume attributes: {0:X2}", rbfSb.dd_att).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(rbfSb.dd_nam, currentEncoding))
.AppendLine();
sb.AppendFormat("Path descriptor options: {0}", StringHandlers.CToString(rbfSb.dd_opt, currentEncoding))
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(rbfSb.dd_nam, Encoding)).AppendLine();
sb.AppendFormat("Path descriptor options: {0}", StringHandlers.CToString(rbfSb.dd_opt, Encoding))
.AppendLine();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "OS-9 Random Block File",
Bootable = LSNToUInt32(rbfSb.dd_bt) > 0 && rbfSb.dd_bsz > 0,
@@ -211,7 +207,7 @@ namespace DiscImageChef.Filesystems
Clusters = LSNToUInt32(rbfSb.dd_tot),
CreationDate = DateHandlers.Os9ToDateTime(rbfSb.dd_dat),
CreationDateSpecified = true,
VolumeName = StringHandlers.CToString(rbfSb.dd_nam, currentEncoding),
VolumeName = StringHandlers.CToString(rbfSb.dd_nam, Encoding),
VolumeSerial = $"{rbfSb.dd_dsk:X4}"
};
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -44,11 +43,8 @@ namespace DiscImageChef.Filesystems
// TODO: Implement Radix-50
public class RT11 : IFilesystem
{
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "RT-11 file system";
public Guid Id => new Guid("DB3E2F98-8F98-463C-8126-E937843DA024");
@@ -67,9 +63,10 @@ namespace DiscImageChef.Filesystems
return magic == "DECRT11A ";
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
information = "";
StringBuilder sb = new StringBuilder();
@@ -93,25 +90,25 @@ namespace DiscImageChef.Filesystems
ushort check = 0;
for(int i = 0; i < 512; i += 2) check += BitConverter.ToUInt16(hbSector, i);
sb.AppendFormat("Volume format is {0}",
StringHandlers.SpacePaddedToString(homeblock.format, currentEncoding)).AppendLine();
sb.AppendFormat("Volume format is {0}", StringHandlers.SpacePaddedToString(homeblock.format, Encoding))
.AppendLine();
sb.AppendFormat("{0} sectors per cluster ({1} bytes)", homeblock.cluster, homeblock.cluster * 512)
.AppendLine();
sb.AppendFormat("First directory segment starts at block {0}", homeblock.rootBlock).AppendLine();
sb.AppendFormat("Volume owner is \"{0}\"",
StringHandlers.SpacePaddedToString(homeblock.ownername, currentEncoding)).AppendLine();
sb.AppendFormat("Volume label: \"{0}\"",
StringHandlers.SpacePaddedToString(homeblock.volname, currentEncoding)).AppendLine();
StringHandlers.SpacePaddedToString(homeblock.ownername, Encoding)).AppendLine();
sb.AppendFormat("Volume label: \"{0}\"", StringHandlers.SpacePaddedToString(homeblock.volname, Encoding))
.AppendLine();
sb.AppendFormat("Checksum: 0x{0:X4} (calculated 0x{1:X4})", homeblock.checksum, check).AppendLine();
byte[] bootBlock = imagePlugin.ReadSector(0);
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "RT-11",
ClusterSize = homeblock.cluster * 512,
Clusters = homeblock.cluster,
VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, currentEncoding),
VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, Encoding),
Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(bootBlock)
};

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
@@ -49,11 +48,8 @@ namespace DiscImageChef.Filesystems
readonly byte[] Reiser36_Magic = {0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x32, 0x46, 0x73, 0x00};
readonly byte[] ReiserJr_Magic = {0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x33, 0x46, 0x73, 0x00};
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Reiser Filesystem Plugin";
public Guid Id => new Guid("1D8CD8B8-27E6-410F-9973-D16409225FBA");
@@ -83,9 +79,10 @@ namespace DiscImageChef.Filesystems
ReiserJr_Magic.SequenceEqual(reiserSb.magic);
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
if(imagePlugin.Info.SectorSize < 512) return;
@@ -123,24 +120,24 @@ namespace DiscImageChef.Filesystems
if(reiserSb.version >= 2)
{
sb.AppendFormat("Volume UUID: {0}", reiserSb.uuid).AppendLine();
sb.AppendFormat("Volume name: {0}", currentEncoding.GetString(reiserSb.label)).AppendLine();
sb.AppendFormat("Volume name: {0}", Encoding.GetString(reiserSb.label)).AppendLine();
}
information = sb.ToString();
xmlFsType = new FileSystemType();
if(Reiser35_Magic.SequenceEqual(reiserSb.magic)) xmlFsType.Type = "Reiser 3.5 filesystem";
else if(Reiser36_Magic.SequenceEqual(reiserSb.magic)) xmlFsType.Type = "Reiser 3.6 filesystem";
else if(ReiserJr_Magic.SequenceEqual(reiserSb.magic)) xmlFsType.Type = "Reiser Jr. filesystem";
xmlFsType.ClusterSize = reiserSb.blocksize;
xmlFsType.Clusters = reiserSb.block_count;
xmlFsType.FreeClusters = reiserSb.free_blocks;
xmlFsType.FreeClustersSpecified = true;
xmlFsType.Dirty = reiserSb.umount_state == 2;
XmlFsType = new FileSystemType();
if(Reiser35_Magic.SequenceEqual(reiserSb.magic)) XmlFsType.Type = "Reiser 3.5 filesystem";
else if(Reiser36_Magic.SequenceEqual(reiserSb.magic)) XmlFsType.Type = "Reiser 3.6 filesystem";
else if(ReiserJr_Magic.SequenceEqual(reiserSb.magic)) XmlFsType.Type = "Reiser Jr. filesystem";
XmlFsType.ClusterSize = reiserSb.blocksize;
XmlFsType.Clusters = reiserSb.block_count;
XmlFsType.FreeClusters = reiserSb.free_blocks;
XmlFsType.FreeClustersSpecified = true;
XmlFsType.Dirty = reiserSb.umount_state == 2;
if(reiserSb.version < 2) return;
xmlFsType.VolumeName = currentEncoding.GetString(reiserSb.label);
xmlFsType.VolumeSerial = reiserSb.uuid.ToString();
XmlFsType.VolumeName = Encoding.GetString(reiserSb.label);
XmlFsType.VolumeSerial = reiserSb.uuid.ToString();
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
@@ -48,11 +47,8 @@ namespace DiscImageChef.Filesystems
readonly byte[] Reiser4_Magic =
{0x52, 0x65, 0x49, 0x73, 0x45, 0x72, 0x34, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Reiser4 Filesystem Plugin";
public Guid Id => new Guid("301F2D00-E8D5-4F04-934E-81DFB21D15BA");
@@ -81,9 +77,10 @@ namespace DiscImageChef.Filesystems
return Reiser4_Magic.SequenceEqual(reiserSb.magic);
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
if(imagePlugin.Info.SectorSize < 512) return;
@@ -111,16 +108,16 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("{0} bytes per block", reiserSb.blocksize).AppendLine();
sb.AppendFormat("Volume disk format: {0}", reiserSb.diskformat).AppendLine();
sb.AppendFormat("Volume UUID: {0}", reiserSb.uuid).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(reiserSb.label, currentEncoding)).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(reiserSb.label, Encoding)).AppendLine();
information = sb.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "Reiser 4 filesystem",
ClusterSize = reiserSb.blocksize,
Clusters = (long)((partition.End - partition.Start) * imagePlugin.Info.SectorSize / reiserSb.blocksize),
VolumeName = StringHandlers.CToString(reiserSb.label, currentEncoding),
VolumeName = StringHandlers.CToString(reiserSb.label, Encoding),
VolumeSerial = reiserSb.uuid.ToString()
};
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -46,11 +45,9 @@ namespace DiscImageChef.Filesystems
const uint SFS_MAGIC = 0x53465300;
/// <summary>Identifier for SFS v2</summary>
const uint SFS2_MAGIC = 0x53465302;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
Encoding currentEncoding;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "SmartFileSystem";
public Guid Id => new Guid("26550C19-3671-4A2D-BC2F-F20CEB7F48DC");
@@ -67,9 +64,10 @@ namespace DiscImageChef.Filesystems
return magic == SFS_MAGIC || magic == SFS2_MAGIC;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
byte[] rootBlockSector = imagePlugin.ReadSector(partition.Start);
RootBlock rootBlock = BigEndianMarshal.ByteArrayToStructureBigEndian<RootBlock>(rootBlockSector);
@@ -100,7 +98,7 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendLine("Volume moves deleted files to a recycled folder");
information = sbInformation.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
CreationDate = DateHandlers.UnixUnsignedToDateTime(rootBlock.datecreated).AddYears(8),
CreationDateSpecified = true,

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
@@ -43,11 +42,8 @@ namespace DiscImageChef.Filesystems
// Based on FAT's BPB, cannot find a FAT or directory
public class SolarFS : IFilesystem
{
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Solar_OS filesystem";
public Guid Id => new Guid("EA3101C1-E777-4B4F-B5A3-8C57F50F6E65");
@@ -68,9 +64,10 @@ namespace DiscImageChef.Filesystems
return signature == 0x29 && fsType == "SOL_FS ";
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
@@ -92,10 +89,10 @@ namespace DiscImageChef.Filesystems
bpb.OEMName = StringHandlers.CToString(bpbStrings);
bpbStrings = new byte[8];
Array.Copy(bpbSector, 0x2A, bpbStrings, 0, 11);
bpb.vol_name = StringHandlers.CToString(bpbStrings, currentEncoding);
bpb.vol_name = StringHandlers.CToString(bpbStrings, Encoding);
bpbStrings = new byte[8];
Array.Copy(bpbSector, 0x35, bpbStrings, 0, 8);
bpb.fs_type = StringHandlers.CToString(bpbStrings, currentEncoding);
bpb.fs_type = StringHandlers.CToString(bpbStrings, Encoding);
bpb.x86_jump = new byte[3];
Array.Copy(bpbSector, 0x00, bpb.x86_jump, 0, 3);
@@ -149,7 +146,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("{0} sectors per track", bpb.sptrk).AppendLine();
sb.AppendFormat("Volume name: {0}", bpb.vol_name).AppendLine();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "SolarFS",
Clusters = bpb.sectors,

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -48,10 +47,8 @@ namespace DiscImageChef.Filesystems
const uint SQUASH_MAGIC = 0x73717368;
const uint SQUASH_CIGAM = 0x68737173;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Squash filesystem";
public Guid Id => new Guid("F8F6E46F-7A2A-48E3-9C0A-46AF4DC29E09");
@@ -69,7 +66,7 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.UTF8;
Encoding = encoding ?? Encoding.UTF8;
byte[] sector = imagePlugin.ReadSector(partition.Start);
uint magic = BitConverter.ToUInt32(sector, 0x00);
@@ -128,7 +125,7 @@ namespace DiscImageChef.Filesystems
information = sbInformation.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "Squash file system",
CreationDate = DateHandlers.UnixUnsignedToDateTime(sqSb.mkfs_time),

View File

@@ -63,11 +63,8 @@ namespace DiscImageChef.Filesystems
const ushort V7_NICFREE = 100;
const uint V7_MAXSIZE = 0x00FFFFFF;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "UNIX System V filesystem";
public Guid Id => new Guid("9B8D016A-8561-400E-A12A-A198283C211D");
@@ -154,7 +151,7 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
@@ -254,9 +251,9 @@ namespace DiscImageChef.Filesystems
byte[] coherent_string = new byte[6];
Array.Copy(sb_sector, 0x1E4, coherent_string, 0, 6); // Coherent UNIX s_fname location
string s_fname = StringHandlers.CToString(coherent_string, currentEncoding);
string s_fname = StringHandlers.CToString(coherent_string, Encoding);
Array.Copy(sb_sector, 0x1EA, coherent_string, 0, 6); // Coherent UNIX s_fpack location
string s_fpack = StringHandlers.CToString(coherent_string, currentEncoding);
string s_fpack = StringHandlers.CToString(coherent_string, Encoding);
if(s_fname == COH_FNAME && s_fpack == COH_FPACK || s_fname == COH_XXXXX && s_fpack == COH_XXXXX ||
s_fname == COH_XXXXS && s_fpack == COH_XXXXN)
@@ -300,7 +297,7 @@ namespace DiscImageChef.Filesystems
if(!sys7th && !sysv && !coherent && !xenix && !xenix3) return;
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
if(xenix || xenix3)
{
@@ -326,9 +323,9 @@ namespace DiscImageChef.Filesystems
xnx_sb.s_dinfo0 = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AC);
xnx_sb.s_dinfo1 = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AE);
Array.Copy(sb_sector, 0x1B0, xenix_strings, 0, 6);
xnx_sb.s_fname = StringHandlers.CToString(xenix_strings, currentEncoding);
xnx_sb.s_fname = StringHandlers.CToString(xenix_strings, Encoding);
Array.Copy(sb_sector, 0x1B6, xenix_strings, 0, 6);
xnx_sb.s_fpack = StringHandlers.CToString(xenix_strings, currentEncoding);
xnx_sb.s_fpack = StringHandlers.CToString(xenix_strings, Encoding);
xnx_sb.s_clean = sb_sector[0x1BC];
xnx_sb.s_magic = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F0);
xnx_sb.s_type = BigEndianBitConverter.ToUInt32(sb_sector, 0x1F4);
@@ -351,9 +348,9 @@ namespace DiscImageChef.Filesystems
xnx_sb.s_dinfo0 = BigEndianBitConverter.ToUInt16(sb_sector, 0x274);
xnx_sb.s_dinfo1 = BigEndianBitConverter.ToUInt16(sb_sector, 0x276);
Array.Copy(sb_sector, 0x278, xenix_strings, 0, 6);
xnx_sb.s_fname = StringHandlers.CToString(xenix_strings, currentEncoding);
xnx_sb.s_fname = StringHandlers.CToString(xenix_strings, Encoding);
Array.Copy(sb_sector, 0x27E, xenix_strings, 0, 6);
xnx_sb.s_fpack = StringHandlers.CToString(xenix_strings, currentEncoding);
xnx_sb.s_fpack = StringHandlers.CToString(xenix_strings, Encoding);
xnx_sb.s_clean = sb_sector[0x284];
xnx_sb.s_magic = BigEndianBitConverter.ToUInt32(sb_sector, 0x3F8);
xnx_sb.s_type = BigEndianBitConverter.ToUInt32(sb_sector, 0x3FC);
@@ -361,22 +358,22 @@ namespace DiscImageChef.Filesystems
uint bs = 512;
sb.AppendLine("XENIX filesystem");
xmlFsType.Type = "XENIX fs";
XmlFsType.Type = "XENIX fs";
switch(xnx_sb.s_type)
{
case 1:
sb.AppendLine("512 bytes per block");
xmlFsType.ClusterSize = 512;
XmlFsType.ClusterSize = 512;
break;
case 2:
sb.AppendLine("1024 bytes per block");
bs = 1024;
xmlFsType.ClusterSize = 1024;
XmlFsType.ClusterSize = 1024;
break;
case 3:
sb.AppendLine("2048 bytes per block");
bs = 2048;
xmlFsType.ClusterSize = 2048;
XmlFsType.ClusterSize = 2048;
break;
default:
sb.AppendFormat("Unknown s_type value: 0x{0:X8}", xnx_sb.s_type).AppendLine();
@@ -417,17 +414,17 @@ namespace DiscImageChef.Filesystems
.AppendLine();
if(xnx_sb.s_time != 0)
{
xmlFsType.ModificationDate = DateHandlers.UnixToDateTime(xnx_sb.s_time);
xmlFsType.ModificationDateSpecified = true;
XmlFsType.ModificationDate = DateHandlers.UnixToDateTime(xnx_sb.s_time);
XmlFsType.ModificationDateSpecified = true;
}
sb.AppendFormat("Volume name: {0}", xnx_sb.s_fname).AppendLine();
xmlFsType.VolumeName = xnx_sb.s_fname;
XmlFsType.VolumeName = xnx_sb.s_fname;
sb.AppendFormat("Pack name: {0}", xnx_sb.s_fpack).AppendLine();
if(xnx_sb.s_clean == 0x46) sb.AppendLine("Volume is clean");
else
{
sb.AppendLine("Volume is dirty");
xmlFsType.Dirty = true;
XmlFsType.Dirty = true;
}
}
@@ -444,15 +441,15 @@ namespace DiscImageChef.Filesystems
switch(sysv_sb.s_type)
{
case 1:
xmlFsType.ClusterSize = 512;
XmlFsType.ClusterSize = 512;
break;
case 2:
bs = 1024;
xmlFsType.ClusterSize = 1024;
XmlFsType.ClusterSize = 1024;
break;
case 3:
bs = 2048;
xmlFsType.ClusterSize = 2048;
XmlFsType.ClusterSize = 2048;
break;
default:
sb.AppendFormat("Unknown s_type value: 0x{0:X8}", sysv_sb.s_type).AppendLine();
@@ -483,11 +480,11 @@ namespace DiscImageChef.Filesystems
sysv_sb.s_tfree = BigEndianBitConverter.ToUInt32(sb_sector, 0x1B0 + offset);
sysv_sb.s_tinode = BigEndianBitConverter.ToUInt16(sb_sector, 0x1B4 + offset);
Array.Copy(sb_sector, 0x1B6 + offset, sysv_strings, 0, 6);
sysv_sb.s_fname = StringHandlers.CToString(sysv_strings, currentEncoding);
sysv_sb.s_fname = StringHandlers.CToString(sysv_strings, Encoding);
Array.Copy(sb_sector, 0x1BC + offset, sysv_strings, 0, 6);
sysv_sb.s_fpack = StringHandlers.CToString(sysv_strings, currentEncoding);
sysv_sb.s_fpack = StringHandlers.CToString(sysv_strings, Encoding);
sb.AppendLine("System V Release 4 filesystem");
xmlFsType.Type = "SVR4 fs";
XmlFsType.Type = "SVR4 fs";
}
else
{
@@ -509,15 +506,15 @@ namespace DiscImageChef.Filesystems
sysv_sb.s_tfree = BigEndianBitConverter.ToUInt32(sb_sector, 0x1AA + offset);
sysv_sb.s_tinode = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AE + offset);
Array.Copy(sb_sector, 0x1B0 + offset, sysv_strings, 0, 6);
sysv_sb.s_fname = StringHandlers.CToString(sysv_strings, currentEncoding);
sysv_sb.s_fname = StringHandlers.CToString(sysv_strings, Encoding);
Array.Copy(sb_sector, 0x1B6 + offset, sysv_strings, 0, 6);
sysv_sb.s_fpack = StringHandlers.CToString(sysv_strings, currentEncoding);
sysv_sb.s_fpack = StringHandlers.CToString(sysv_strings, Encoding);
sb.AppendLine("System V Release 2 filesystem");
xmlFsType.Type = "SVR2 fs";
XmlFsType.Type = "SVR2 fs";
}
sb.AppendFormat("{0} bytes per block", bs).AppendLine();
xmlFsType.Clusters = sysv_sb.s_fsize;
XmlFsType.Clusters = sysv_sb.s_fsize;
sb.AppendFormat("{0} zones on volume ({1} bytes)", sysv_sb.s_fsize, sysv_sb.s_fsize * bs).AppendLine();
sb.AppendFormat("{0} free zones on volume ({1} bytes)", sysv_sb.s_tfree, sysv_sb.s_tfree * bs)
.AppendLine();
@@ -538,17 +535,17 @@ namespace DiscImageChef.Filesystems
.AppendLine();
if(sysv_sb.s_time != 0)
{
xmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(sysv_sb.s_time);
xmlFsType.ModificationDateSpecified = true;
XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(sysv_sb.s_time);
XmlFsType.ModificationDateSpecified = true;
}
sb.AppendFormat("Volume name: {0}", sysv_sb.s_fname).AppendLine();
xmlFsType.VolumeName = sysv_sb.s_fname;
XmlFsType.VolumeName = sysv_sb.s_fname;
sb.AppendFormat("Pack name: {0}", sysv_sb.s_fpack).AppendLine();
if(sysv_sb.s_state == 0x7C269D38 - sysv_sb.s_time) sb.AppendLine("Volume is clean");
else
{
sb.AppendLine("Volume is dirty");
xmlFsType.Dirty = true;
XmlFsType.Dirty = true;
}
}
@@ -572,13 +569,13 @@ namespace DiscImageChef.Filesystems
coh_sb.s_int_m = BitConverter.ToUInt16(sb_sector, 0x1E0);
coh_sb.s_int_n = BitConverter.ToUInt16(sb_sector, 0x1E2);
Array.Copy(sb_sector, 0x1E4, coh_strings, 0, 6);
coh_sb.s_fname = StringHandlers.CToString(coh_strings, currentEncoding);
coh_sb.s_fname = StringHandlers.CToString(coh_strings, Encoding);
Array.Copy(sb_sector, 0x1EA, coh_strings, 0, 6);
coh_sb.s_fpack = StringHandlers.CToString(coh_strings, currentEncoding);
coh_sb.s_fpack = StringHandlers.CToString(coh_strings, Encoding);
xmlFsType.Type = "Coherent fs";
xmlFsType.ClusterSize = 512;
xmlFsType.Clusters = coh_sb.s_fsize;
XmlFsType.Type = "Coherent fs";
XmlFsType.ClusterSize = 512;
XmlFsType.Clusters = coh_sb.s_fsize;
sb.AppendLine("Coherent UNIX filesystem");
if(imagePlugin.Info.SectorSize != 512)
@@ -601,11 +598,11 @@ namespace DiscImageChef.Filesystems
.AppendLine();
if(coh_sb.s_time != 0)
{
xmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(coh_sb.s_time);
xmlFsType.ModificationDateSpecified = true;
XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(coh_sb.s_time);
XmlFsType.ModificationDateSpecified = true;
}
sb.AppendFormat("Volume name: {0}", coh_sb.s_fname).AppendLine();
xmlFsType.VolumeName = coh_sb.s_fname;
XmlFsType.VolumeName = coh_sb.s_fname;
sb.AppendFormat("Pack name: {0}", coh_sb.s_fpack).AppendLine();
}
@@ -629,13 +626,13 @@ namespace DiscImageChef.Filesystems
v7_sb.s_int_m = BigEndianBitConverter.ToUInt16(sb_sector, 0x1A8);
v7_sb.s_int_n = BigEndianBitConverter.ToUInt16(sb_sector, 0x1AA);
Array.Copy(sb_sector, 0x1AC, sys7_strings, 0, 6);
v7_sb.s_fname = StringHandlers.CToString(sys7_strings, currentEncoding);
v7_sb.s_fname = StringHandlers.CToString(sys7_strings, Encoding);
Array.Copy(sb_sector, 0x1B2, sys7_strings, 0, 6);
v7_sb.s_fpack = StringHandlers.CToString(sys7_strings, currentEncoding);
v7_sb.s_fpack = StringHandlers.CToString(sys7_strings, Encoding);
xmlFsType.Type = "UNIX 7th Edition fs";
xmlFsType.ClusterSize = 512;
xmlFsType.Clusters = v7_sb.s_fsize;
XmlFsType.Type = "UNIX 7th Edition fs";
XmlFsType.ClusterSize = 512;
XmlFsType.Clusters = v7_sb.s_fsize;
sb.AppendLine("UNIX 7th Edition filesystem");
if(imagePlugin.Info.SectorSize != 512)
sb
@@ -656,11 +653,11 @@ namespace DiscImageChef.Filesystems
.AppendLine();
if(v7_sb.s_time != 0)
{
xmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(v7_sb.s_time);
xmlFsType.ModificationDateSpecified = true;
XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(v7_sb.s_time);
XmlFsType.ModificationDateSpecified = true;
}
sb.AppendFormat("Volume name: {0}", v7_sb.s_fname).AppendLine();
xmlFsType.VolumeName = v7_sb.s_fname;
XmlFsType.VolumeName = v7_sb.s_fname;
sb.AppendFormat("Pack name: {0}", v7_sb.s_fpack).AppendLine();
}

View File

@@ -46,7 +46,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
if(!string.IsNullOrEmpty(path) && string.Compare(path, "/", StringComparison.OrdinalIgnoreCase) != 0)
return Errno.NotSupported;
contents = fileEntries.Select(ent => StringHandlers.PascalToString(ent.filename, currentEncoding)).ToList();
contents = fileEntries.Select(ent => StringHandlers.PascalToString(ent.filename, Encoding)).ToList();
if(debug)
{

View File

@@ -79,8 +79,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
if(error != Errno.NoError) return error;
byte[] tmp = device.ReadSectors((ulong)entry.firstBlock, (uint)(entry.lastBlock - entry.firstBlock));
file = new byte[(entry.lastBlock - entry.firstBlock - 1) * device.Info.SectorSize +
entry.lastBytes];
file = new byte[(entry.lastBlock - entry.firstBlock - 1) * device.Info.SectorSize + entry.lastBytes];
Array.Copy(tmp, 0, file, 0, file.Length);
}
@@ -164,7 +163,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
string.Compare(path,
StringHandlers
.PascalToString(ent.filename,
currentEncoding),
Encoding),
StringComparison
.InvariantCultureIgnoreCase) == 0))
{

View File

@@ -83,7 +83,8 @@ namespace DiscImageChef.Filesystems.UCSDPascal
return volEntry.files >= 0;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
StringBuilder sbInformation = new StringBuilder();
information = "";
@@ -129,8 +130,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
sbInformation.AppendFormat("Volume record spans from block {0} to block {1}", volEntry.firstBlock,
volEntry.lastBlock).AppendLine();
sbInformation.AppendFormat("Volume name: {0}",
StringHandlers.PascalToString(volEntry.volumeName, currentEncoding))
sbInformation.AppendFormat("Volume name: {0}", StringHandlers.PascalToString(volEntry.volumeName, Encoding))
.AppendLine();
sbInformation.AppendFormat("Volume has {0} blocks", volEntry.blocks).AppendLine();
sbInformation.AppendFormat("Volume has {0} files", volEntry.files).AppendLine();
@@ -140,7 +140,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
information = sbInformation.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(imagePlugin.ReadSectors(partition.Start, 2)),
Clusters = volEntry.blocks,
@@ -148,7 +148,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
Files = volEntry.files,
FilesSpecified = true,
Type = "UCSD Pascal",
VolumeName = StringHandlers.PascalToString(volEntry.volumeName, currentEncoding)
VolumeName = StringHandlers.PascalToString(volEntry.volumeName, Encoding)
};
}
}

View File

@@ -47,7 +47,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
{
device = imagePlugin;
// TODO: Until Apple ][ encoding is implemented
currentEncoding = new LisaRoman();
Encoding = new LisaRoman();
this.debug = debug;
if(device.Info.Sectors < 3) return Errno.InvalidArgument;
@@ -98,7 +98,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
bootBlocks = device.ReadSectors(0, 2);
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(bootBlocks),
Clusters = mountedVolEntry.blocks,
@@ -106,7 +106,7 @@ namespace DiscImageChef.Filesystems.UCSDPascal
Files = mountedVolEntry.files,
FilesSpecified = true,
Type = "UCSD Pascal",
VolumeName = StringHandlers.PascalToString(mountedVolEntry.volumeName, currentEncoding)
VolumeName = StringHandlers.PascalToString(mountedVolEntry.volumeName, Encoding)
};
mounted = true;

View File

@@ -32,32 +32,29 @@
using System;
using System.Collections.Generic;
using Claunia.Encoding;
using DiscImageChef.CommonTypes;
using System.Text;
using DiscImageChef.DiscImages;
using Schemas;
using Encoding = System.Text.Encoding;
namespace DiscImageChef.Filesystems.UCSDPascal
{
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
public partial class PascalPlugin : IReadOnlyFilesystem
{
IMediaImage device;
byte[] bootBlocks;
byte[] catalogBlocks;
Encoding currentEncoding;
bool debug;
IMediaImage device;
List<PascalFileEntry> fileEntries;
bool mounted;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
PascalVolumeEntry mountedVolEntry;
public FileSystemType XmlFsType { get; private set; }
public string Name => "U.C.S.D. Pascal filesystem";
public Guid Id => new Guid("B0AC2CB5-72AA-473A-9200-270B5A2C2D53");
public Encoding Encoding => currentEncoding;
public Encoding Encoding { get; private set; }
public Errno ListXAttr(string path, ref List<string> xattrs)
{

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
@@ -51,11 +50,8 @@ namespace DiscImageChef.Filesystems
0x74, 0x00, 0x00, 0x00, 0x00
};
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Universal Disk Format";
public Guid Id => new Guid("83976FEC-A91B-464B-9293-56C719461BAB");
@@ -146,10 +142,11 @@ namespace DiscImageChef.Filesystems
return false;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
// UDF is always UTF-8
currentEncoding = Encoding.UTF8;
Encoding = Encoding.UTF8;
byte[] sector;
StringBuilder sbInformation = new StringBuilder();
@@ -255,11 +252,10 @@ namespace DiscImageChef.Filesystems
.AppendFormat("Volume contains {0} files and {1} directories", lvidiu.files, lvidiu.directories)
.AppendLine();
sbInformation.AppendFormat("Volume conforms to {0}",
currentEncoding.GetString(lvd.domainIdentifier.identifier).TrimEnd('\u0000'))
Encoding.GetString(lvd.domainIdentifier.identifier).TrimEnd('\u0000'))
.AppendLine();
sbInformation.AppendFormat("Volume was last written by: {0}",
currentEncoding
.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000'))
Encoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000'))
.AppendLine();
sbInformation.AppendFormat("Volume requires UDF version {0}.{1:X2} to be read",
Convert.ToInt32($"{(lvidiu.minimumReadUDF & 0xFF00) >> 8}", 10),
@@ -271,12 +267,11 @@ namespace DiscImageChef.Filesystems
Convert.ToInt32($"{(lvidiu.maximumWriteUDF & 0xFF00) >> 8}", 10),
Convert.ToInt32($"{lvidiu.maximumWriteUDF & 0xFF}", 10)).AppendLine();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type =
$"UDF v{Convert.ToInt32($"{(lvidiu.maximumWriteUDF & 0xFF00) >> 8}", 10)}.{Convert.ToInt32($"{lvidiu.maximumWriteUDF & 0xFF}", 10):X2}",
ApplicationIdentifier =
currentEncoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000'),
ApplicationIdentifier = Encoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000'),
ClusterSize = (int)lvd.logicalBlockSize,
ModificationDate = EcmaToDateTime(lvid.recordingDateTime),
ModificationDateSpecified = true,
@@ -284,10 +279,10 @@ namespace DiscImageChef.Filesystems
FilesSpecified = true,
VolumeName = StringHandlers.DecompressUnicode(lvd.logicalVolumeIdentifier),
VolumeSetIdentifier = StringHandlers.DecompressUnicode(pvd.volumeSetIdentifier),
SystemIdentifier = currentEncoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000')
SystemIdentifier = Encoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000')
};
xmlFsType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize /
(ulong)xmlFsType.ClusterSize);
XmlFsType.Clusters = (long)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize /
(ulong)XmlFsType.ClusterSize);
information = sbInformation.ToString();
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
@@ -57,11 +56,8 @@ namespace DiscImageChef.Filesystems
const ulong UNICOS_Magic = 0x6e6331667331636e;
const ulong UNICOS_Secure = 0xcd076d1771d670cd;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "UNICOS Filesystem Plugin";
public Guid Id => new Guid("61712F04-066C-44D5-A2A0-1E44C66B33F0");
@@ -85,9 +81,10 @@ namespace DiscImageChef.Filesystems
return unicosSb.s_magic == UNICOS_Magic;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
if(imagePlugin.Info.SectorSize < 512) return;
@@ -116,21 +113,20 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Volume last updated on {0}", DateHandlers.UnixToDateTime(unicosSb.s_time)).AppendLine();
if(unicosSb.s_error > 0)
sb.AppendFormat("Volume is dirty, error code = 0x{0:X16}", unicosSb.s_error).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(unicosSb.s_fname, currentEncoding))
.AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(unicosSb.s_fname, Encoding)).AppendLine();
information = sb.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "UNICOS filesystem",
ClusterSize = 4096,
Clusters = unicosSb.s_fsize,
VolumeName = StringHandlers.CToString(unicosSb.s_fname, currentEncoding),
VolumeName = StringHandlers.CToString(unicosSb.s_fname, Encoding),
ModificationDate = DateHandlers.UnixToDateTime(unicosSb.s_time),
ModificationDateSpecified = true
};
xmlFsType.Dirty |= unicosSb.s_error > 0;
XmlFsType.Dirty |= unicosSb.s_error > 0;
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Text;
using DiscImageChef.CommonTypes;
using DiscImageChef.Console;
@@ -45,11 +44,8 @@ namespace DiscImageChef.Filesystems
{
const uint BFS_MAGIC = 0x1BADFACE;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "UNIX Boot filesystem";
public Guid Id => new Guid("1E6E0DA6-F7E4-494C-80C6-CB5929E96155");
@@ -64,9 +60,10 @@ namespace DiscImageChef.Filesystems
return magic == BFS_MAGIC;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
@@ -85,9 +82,9 @@ namespace DiscImageChef.Filesystems
};
Array.Copy(bfsSbSector, 0x1C, sbStrings, 0, 6);
bfsSb.s_fsname = StringHandlers.CToString(sbStrings, currentEncoding);
bfsSb.s_fsname = StringHandlers.CToString(sbStrings, Encoding);
Array.Copy(bfsSbSector, 0x22, sbStrings, 0, 6);
bfsSb.s_volume = StringHandlers.CToString(sbStrings, currentEncoding);
bfsSb.s_volume = StringHandlers.CToString(sbStrings, Encoding);
DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_magic: 0x{0:X8}", bfsSb.s_magic);
DicConsole.DebugWriteLine("BFS plugin", "bfs_sb.s_start: 0x{0:X8}", bfsSb.s_start);
@@ -105,7 +102,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Filesystem name: {0}", bfsSb.s_fsname).AppendLine();
sb.AppendFormat("Volume name: {0}", bfsSb.s_volume).AppendLine();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "BFS",
VolumeName = bfsSb.s_volume,

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -48,11 +47,8 @@ namespace DiscImageChef.Filesystems
const uint VMFS_MAGIC = 0xC001D00D;
const uint VMFS_BASE = 0x00100000;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "VMware filesystem";
public Guid Id => new Guid("EE52BDB8-B49C-4122-A3DA-AD21CBE79843");
@@ -71,9 +67,10 @@ namespace DiscImageChef.Filesystems
return magic == VMFS_MAGIC;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.UTF8;
Encoding = encoding ?? Encoding.UTF8;
ulong vmfsSuperOff = VMFS_BASE / imagePlugin.Info.SectorSize;
byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff);
@@ -93,7 +90,7 @@ namespace DiscImageChef.Filesystems
uint mtimeNanoSecs = (uint)(volInfo.mtime % 1000000);
sbInformation.AppendFormat("Volume version {0}", volInfo.version).AppendLine();
sbInformation.AppendFormat("Volume name {0}", StringHandlers.CToString(volInfo.name, currentEncoding))
sbInformation.AppendFormat("Volume name {0}", StringHandlers.CToString(volInfo.name, Encoding))
.AppendLine();
sbInformation.AppendFormat("Volume size {0} bytes", volInfo.size * 256).AppendLine();
sbInformation.AppendFormat("Volume UUID {0}", volInfo.uuid).AppendLine();
@@ -105,7 +102,7 @@ namespace DiscImageChef.Filesystems
information = sbInformation.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "VMware file system",
CreationDate = DateHandlers.UnixUnsignedToDateTime(ctimeSecs, ctimeNanoSecs),

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -48,11 +47,8 @@ namespace DiscImageChef.Filesystems
const uint VXFS_MAGIC = 0xA501FCF5;
const uint VXFS_BASE = 0x400;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Veritas filesystem";
public Guid Id => new Guid("EC372605-7687-453C-8BEA-7E0DFF79CB03");
@@ -69,9 +65,10 @@ namespace DiscImageChef.Filesystems
return magic == VXFS_MAGIC;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.UTF8;
Encoding = encoding ?? Encoding.UTF8;
ulong vmfsSuperOff = VXFS_BASE / imagePlugin.Info.SectorSize;
byte[] sector = imagePlugin.ReadSector(partition.Start + vmfsSuperOff);
@@ -86,7 +83,7 @@ namespace DiscImageChef.Filesystems
sbInformation.AppendLine("Veritas file system");
sbInformation.AppendFormat("Volume version {0}", vxSb.vs_version).AppendLine();
sbInformation.AppendFormat("Volume name {0}", StringHandlers.CToString(vxSb.vs_fname, currentEncoding))
sbInformation.AppendFormat("Volume name {0}", StringHandlers.CToString(vxSb.vs_fname, Encoding))
.AppendLine();
sbInformation.AppendFormat("Volume has {0} blocks of {1} bytes each", vxSb.vs_bsize, vxSb.vs_size)
.AppendLine();
@@ -101,7 +98,7 @@ namespace DiscImageChef.Filesystems
information = sbInformation.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "Veritas file system",
CreationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime),

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -45,11 +44,8 @@ namespace DiscImageChef.Filesystems
{
const uint XFS_MAGIC = 0x58465342;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "XFS Filesystem Plugin";
public Guid Id => new Guid("1D8CD8B8-27E6-410F-9973-D16409225FBA");
@@ -104,9 +100,10 @@ namespace DiscImageChef.Filesystems
return false;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
if(imagePlugin.Info.SectorSize < 512) return;
@@ -166,12 +163,12 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("{0} allocation groups in volume", xfsSb.agcount).AppendLine();
sb.AppendFormat("{0} inodes in volume, {1} free", xfsSb.icount, xfsSb.ifree).AppendLine();
if(xfsSb.inprogress > 0) sb.AppendLine("fsck in progress");
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(xfsSb.fname, currentEncoding)).AppendLine();
sb.AppendFormat("Volume name: {0}", StringHandlers.CToString(xfsSb.fname, Encoding)).AppendLine();
sb.AppendFormat("Volume UUID: {0}", xfsSb.uuid).AppendLine();
information = sb.ToString();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "XFS filesystem",
ClusterSize = (int)xfsSb.blocksize,
@@ -181,7 +178,7 @@ namespace DiscImageChef.Filesystems
Files = (long)(xfsSb.icount - xfsSb.ifree),
FilesSpecified = true,
Dirty = xfsSb.inprogress > 0,
VolumeName = StringHandlers.CToString(xfsSb.fname, currentEncoding),
VolumeName = StringHandlers.CToString(xfsSb.fname, Encoding),
VolumeSerial = xfsSb.uuid.ToString()
};
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -51,10 +50,8 @@ namespace DiscImageChef.Filesystems
const int XIAFS_NUM_BLOCK_POINTERS = 10;
const int XIAFS_NAME_LEN = 248;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Xia filesystem";
public Guid Id => new Guid("169E1DE5-24F2-4EF6-A04D-A4B2CA66DE9D");
@@ -74,9 +71,10 @@ namespace DiscImageChef.Filesystems
return supblk.s_magic == XIAFS_SUPER_MAGIC;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
@@ -108,7 +106,7 @@ namespace DiscImageChef.Filesystems
supblk.s_kernzones * supblk.s_zone_size).AppendLine();
sb.AppendFormat("First kernel zone: {0}", supblk.s_firstkernzone).AppendLine();
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(supblk.s_boot_segment),
Clusters = supblk.s_nzones,

View File

@@ -76,10 +76,8 @@ namespace DiscImageChef.Filesystems
const uint ZFS_MAGIC = 0x58465342;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "ZFS Filesystem Plugin";
public Guid Id => new Guid("0750014F-A714-4692-A369-E23F6EC3659C");
@@ -108,7 +106,7 @@ namespace DiscImageChef.Filesystems
Encoding encoding)
{
// ZFS is always UTF-8
currentEncoding = Encoding.UTF8;
Encoding = Encoding.UTF8;
information = "";
if(imagePlugin.Info.SectorSize < 512) return;
@@ -143,11 +141,11 @@ namespace DiscImageChef.Filesystems
information = sb.ToString();
xmlFsType = new FileSystemType {Type = "ZFS filesystem"};
if(decodedNvList.TryGetValue("name", out NVS_Item tmpObj)) xmlFsType.VolumeName = (string)tmpObj.value;
if(decodedNvList.TryGetValue("guid", out tmpObj)) xmlFsType.VolumeSerial = $"{(ulong)tmpObj.value}";
XmlFsType = new FileSystemType {Type = "ZFS filesystem"};
if(decodedNvList.TryGetValue("name", out NVS_Item tmpObj)) XmlFsType.VolumeName = (string)tmpObj.value;
if(decodedNvList.TryGetValue("guid", out tmpObj)) XmlFsType.VolumeSerial = $"{(ulong)tmpObj.value}";
if(decodedNvList.TryGetValue("pool_guid", out tmpObj))
xmlFsType.VolumeSetIdentifier = $"{(ulong)tmpObj.value}";
XmlFsType.VolumeSetIdentifier = $"{(ulong)tmpObj.value}";
}
static bool DecodeNvList(byte[] nvlist, out Dictionary<string, NVS_Item> decodedNvList)

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
@@ -99,12 +98,10 @@ namespace DiscImageChef.Filesystems
const int NDADDR = 12;
const int NIADDR = 3;
Encoding currentEncoding;
public Encoding Encoding => currentEncoding;
public Encoding Encoding { get; private set; }
public string Name => "dump(8) Plugin";
public Guid Id => new Guid("E53B4D28-C858-4800-B092-DDAE80D361B9");
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public FileSystemType XmlFsType { get; private set; }
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -150,7 +147,7 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
if(imagePlugin.Info.SectorSize < 512) return;
@@ -213,71 +210,71 @@ namespace DiscImageChef.Filesystems
StringBuilder sb = new StringBuilder();
xmlFsType = new FileSystemType {ClusterSize = 1024, Clusters = (long)(partition.Size / 1024)};
XmlFsType = new FileSystemType {ClusterSize = 1024, Clusters = (long)(partition.Size / 1024)};
if(useOld)
{
xmlFsType.Type = "Old 16-bit dump(8)";
sb.AppendLine(xmlFsType.Type);
XmlFsType.Type = "Old 16-bit dump(8)";
sb.AppendLine(XmlFsType.Type);
if(oldHdr.c_date > 0)
{
xmlFsType.CreationDate = DateHandlers.UnixToDateTime(oldHdr.c_date);
xmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Dump created on {0}", xmlFsType.CreationDate).AppendLine();
XmlFsType.CreationDate = DateHandlers.UnixToDateTime(oldHdr.c_date);
XmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine();
}
if(oldHdr.c_ddate > 0)
{
xmlFsType.BackupDate = DateHandlers.UnixToDateTime(oldHdr.c_ddate);
xmlFsType.BackupDateSpecified = true;
sb.AppendFormat("Previous dump created on {0}", xmlFsType.BackupDate).AppendLine();
XmlFsType.BackupDate = DateHandlers.UnixToDateTime(oldHdr.c_ddate);
XmlFsType.BackupDateSpecified = true;
sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine();
}
sb.AppendFormat("Dump volume number: {0}", oldHdr.c_volume).AppendLine();
}
else if(useAix)
{
xmlFsType.Type = "AIX dump(8)";
sb.AppendLine(xmlFsType.Type);
XmlFsType.Type = "AIX dump(8)";
sb.AppendLine(XmlFsType.Type);
if(aixHdr.c_date > 0)
{
xmlFsType.CreationDate = DateHandlers.UnixToDateTime(aixHdr.c_date);
xmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Dump created on {0}", xmlFsType.CreationDate).AppendLine();
XmlFsType.CreationDate = DateHandlers.UnixToDateTime(aixHdr.c_date);
XmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine();
}
if(aixHdr.c_ddate > 0)
{
xmlFsType.BackupDate = DateHandlers.UnixToDateTime(aixHdr.c_ddate);
xmlFsType.BackupDateSpecified = true;
sb.AppendFormat("Previous dump created on {0}", xmlFsType.BackupDate).AppendLine();
XmlFsType.BackupDate = DateHandlers.UnixToDateTime(aixHdr.c_ddate);
XmlFsType.BackupDateSpecified = true;
sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine();
}
sb.AppendFormat("Dump volume number: {0}", aixHdr.c_volume).AppendLine();
}
else
{
xmlFsType.Type = "dump(8)";
sb.AppendLine(xmlFsType.Type);
XmlFsType.Type = "dump(8)";
sb.AppendLine(XmlFsType.Type);
if(newHdr.c_ndate > 0)
{
xmlFsType.CreationDate = DateHandlers.UnixToDateTime(newHdr.c_ndate);
xmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Dump created on {0}", xmlFsType.CreationDate).AppendLine();
XmlFsType.CreationDate = DateHandlers.UnixToDateTime(newHdr.c_ndate);
XmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine();
}
else if(newHdr.c_date > 0)
{
xmlFsType.CreationDate = DateHandlers.UnixToDateTime(newHdr.c_date);
xmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Dump created on {0}", xmlFsType.CreationDate).AppendLine();
XmlFsType.CreationDate = DateHandlers.UnixToDateTime(newHdr.c_date);
XmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Dump created on {0}", XmlFsType.CreationDate).AppendLine();
}
if(newHdr.c_nddate > 0)
{
xmlFsType.BackupDate = DateHandlers.UnixToDateTime(newHdr.c_nddate);
xmlFsType.BackupDateSpecified = true;
sb.AppendFormat("Previous dump created on {0}", xmlFsType.BackupDate).AppendLine();
XmlFsType.BackupDate = DateHandlers.UnixToDateTime(newHdr.c_nddate);
XmlFsType.BackupDateSpecified = true;
sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine();
}
else if(newHdr.c_ddate > 0)
{
xmlFsType.BackupDate = DateHandlers.UnixToDateTime(newHdr.c_ddate);
xmlFsType.BackupDateSpecified = true;
sb.AppendFormat("Previous dump created on {0}", xmlFsType.BackupDate).AppendLine();
XmlFsType.BackupDate = DateHandlers.UnixToDateTime(newHdr.c_ddate);
XmlFsType.BackupDateSpecified = true;
sb.AppendFormat("Previous dump created on {0}", XmlFsType.BackupDate).AppendLine();
}
sb.AppendFormat("Dump volume number: {0}", newHdr.c_volume).AppendLine();
sb.AppendFormat("Dump level: {0}", newHdr.c_level).AppendLine();

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
@@ -47,11 +46,9 @@ namespace DiscImageChef.Filesystems
readonly Guid OEM_FLASH_PARAMETER_GUID = new Guid("0A0C7E46-3399-4021-90C8-FA6D389C4BA2");
readonly byte[] Signature = {0x45, 0x58, 0x46, 0x41, 0x54, 0x20, 0x20, 0x20};
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
Encoding currentEncoding;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Microsoft Extended File Allocation Table";
public Guid Id => new Guid("8271D088-1533-4CB3-AC28-D802B68BB95C");
@@ -73,11 +70,11 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
byte[] vbrSector = imagePlugin.ReadSector(0 + partition.Start);
IntPtr vbrPtr = Marshal.AllocHGlobal(512);
@@ -139,11 +136,11 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Checksum 0x{0:X8}", chksector.checksum[0]).AppendLine();
xmlFsType.ClusterSize = (1 << vbr.sectorShift) * (1 << vbr.clusterShift);
xmlFsType.Clusters = vbr.clusterHeapLength;
xmlFsType.Dirty = vbr.flags.HasFlag(VolumeFlags.VolumeDirty);
xmlFsType.Type = "exFAT";
xmlFsType.VolumeSerial = $"{vbr.volumeSerial:X8}";
XmlFsType.ClusterSize = (1 << vbr.sectorShift) * (1 << vbr.clusterShift);
XmlFsType.Clusters = vbr.clusterHeapLength;
XmlFsType.Dirty = vbr.flags.HasFlag(VolumeFlags.VolumeDirty);
XmlFsType.Type = "exFAT";
XmlFsType.VolumeSerial = $"{vbr.volumeSerial:X8}";
information = sb.ToString();
}

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
using System.Text;
@@ -162,11 +161,8 @@ namespace DiscImageChef.Filesystems
/// <summary>Testing development code</summary>
const uint EXT2_FLAGS_TEST_FILESYS = 0x00000004;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public Encoding Encoding => currentEncoding;
public FileSystemType XmlFsType { get; private set; }
public Encoding Encoding { get; private set; }
public string Name => "Linux extended Filesystem 2, 3 and 4";
public Guid Id => new Guid("6AA91B88-150B-4A7B-AD56-F84FB2DF4184");
@@ -190,9 +186,10 @@ namespace DiscImageChef.Filesystems
return magic == EXT2_MAGIC || magic == EXT2_MAGIC_OLD;
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information, Encoding encoding)
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
@@ -216,13 +213,13 @@ namespace DiscImageChef.Filesystems
ext2FSSuperBlock supblk = (ext2FSSuperBlock)Marshal.PtrToStructure(sbPtr, typeof(ext2FSSuperBlock));
Marshal.FreeHGlobal(sbPtr);
xmlFsType = new FileSystemType();
XmlFsType = new FileSystemType();
switch(supblk.magic)
{
case EXT2_MAGIC_OLD:
sb.AppendLine("ext2 (old) filesystem");
xmlFsType.Type = "ext2";
XmlFsType.Type = "ext2";
break;
case EXT2_MAGIC:
ext3 |= (supblk.ftr_compat & EXT3_FEATURE_COMPAT_HAS_JOURNAL) == EXT3_FEATURE_COMPAT_HAS_JOURNAL ||
@@ -250,17 +247,17 @@ namespace DiscImageChef.Filesystems
if(newExt2)
{
sb.AppendLine("ext2 filesystem");
xmlFsType.Type = "ext2";
XmlFsType.Type = "ext2";
}
if(ext3)
{
sb.AppendLine("ext3 filesystem");
xmlFsType.Type = "ext3";
XmlFsType.Type = "ext3";
}
if(ext4)
{
sb.AppendLine("ext4 filesystem");
xmlFsType.Type = "ext4";
XmlFsType.Type = "ext4";
}
break;
default:
@@ -291,14 +288,14 @@ namespace DiscImageChef.Filesystems
break;
}
xmlFsType.SystemIdentifier = extOs;
XmlFsType.SystemIdentifier = extOs;
if(supblk.mkfs_t > 0)
{
sb.AppendFormat("Volume was created on {0} for {1}", DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t),
extOs).AppendLine();
xmlFsType.CreationDate = DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t);
xmlFsType.CreationDateSpecified = true;
XmlFsType.CreationDate = DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t);
XmlFsType.CreationDateSpecified = true;
}
else sb.AppendFormat("Volume was created for {0}", extOs).AppendLine();
@@ -356,8 +353,8 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Volume has {0} blocks of {1} bytes, for a total of {2} bytes", blocks,
1024 << (int)supblk.block_size, blocks * (ulong)(1024 << (int)supblk.block_size))
.AppendLine();
xmlFsType.Clusters = (long)blocks;
xmlFsType.ClusterSize = 1024 << (int)supblk.block_size;
XmlFsType.Clusters = (long)blocks;
XmlFsType.ClusterSize = 1024 << (int)supblk.block_size;
if(supblk.mount_t > 0 || supblk.mount_c > 0)
{
if(supblk.mount_t > 0)
@@ -369,12 +366,12 @@ namespace DiscImageChef.Filesystems
else
sb.AppendFormat("Volume has been mounted {0} times with no maximum no. of mounts before checking",
supblk.mount_c).AppendLine();
if(!string.IsNullOrEmpty(StringHandlers.CToString(supblk.last_mount_dir, currentEncoding)))
if(!string.IsNullOrEmpty(StringHandlers.CToString(supblk.last_mount_dir, Encoding)))
sb.AppendFormat("Last mounted on: \"{0}\"",
StringHandlers.CToString(supblk.last_mount_dir, currentEncoding)).AppendLine();
if(!string.IsNullOrEmpty(StringHandlers.CToString(supblk.mount_options, currentEncoding)))
StringHandlers.CToString(supblk.last_mount_dir, Encoding)).AppendLine();
if(!string.IsNullOrEmpty(StringHandlers.CToString(supblk.mount_options, Encoding)))
sb.AppendFormat("Last used mount options were: {0}",
StringHandlers.CToString(supblk.mount_options, currentEncoding)).AppendLine();
StringHandlers.CToString(supblk.mount_options, Encoding)).AppendLine();
}
else
{
@@ -403,17 +400,17 @@ namespace DiscImageChef.Filesystems
{
sb.AppendFormat("Last written on {0}", DateHandlers.UnixUnsignedToDateTime(supblk.write_t))
.AppendLine();
xmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(supblk.write_t);
xmlFsType.ModificationDateSpecified = true;
XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(supblk.write_t);
XmlFsType.ModificationDateSpecified = true;
}
else sb.AppendLine("Volume has never been written");
xmlFsType.Dirty = true;
XmlFsType.Dirty = true;
switch(supblk.state)
{
case EXT2_VALID_FS:
sb.AppendLine("Volume is clean");
xmlFsType.Dirty = false;
XmlFsType.Dirty = false;
break;
case EXT2_ERROR_FS:
sb.AppendLine("Volume is dirty");
@@ -426,11 +423,11 @@ namespace DiscImageChef.Filesystems
break;
}
if(!string.IsNullOrEmpty(StringHandlers.CToString(supblk.volume_name, currentEncoding)))
if(!string.IsNullOrEmpty(StringHandlers.CToString(supblk.volume_name, Encoding)))
{
sb.AppendFormat("Volume name: \"{0}\"", StringHandlers.CToString(supblk.volume_name, currentEncoding))
sb.AppendFormat("Volume name: \"{0}\"", StringHandlers.CToString(supblk.volume_name, Encoding))
.AppendLine();
xmlFsType.VolumeName = StringHandlers.CToString(supblk.volume_name, currentEncoding);
XmlFsType.VolumeName = StringHandlers.CToString(supblk.volume_name, Encoding);
}
switch(supblk.err_behaviour)
@@ -456,15 +453,15 @@ namespace DiscImageChef.Filesystems
if(supblk.uuid != Guid.Empty)
{
sb.AppendFormat("Volume UUID: {0}", supblk.uuid).AppendLine();
xmlFsType.VolumeSerial = supblk.uuid.ToString();
XmlFsType.VolumeSerial = supblk.uuid.ToString();
}
if(supblk.kbytes_written > 0)
sb.AppendFormat("{0} KiB has been written on volume", supblk.kbytes_written).AppendLine();
sb.AppendFormat("{0} reserved and {1} free blocks", reserved, free).AppendLine();
xmlFsType.FreeClusters = (long)free;
xmlFsType.FreeClustersSpecified = true;
XmlFsType.FreeClusters = (long)free;
XmlFsType.FreeClustersSpecified = true;
sb.AppendFormat("{0} inodes with {1} free inodes ({2}%)", supblk.inodes, supblk.free_inodes,
supblk.free_inodes * 100 / supblk.inodes).AppendLine();
if(supblk.first_inode > 0) sb.AppendFormat("First inode is {0}", supblk.first_inode).AppendLine();

View File

@@ -31,7 +31,6 @@
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using DiscImageChef.CommonTypes;
@@ -49,13 +48,11 @@ namespace DiscImageChef.Filesystems
/// ext superblock magic
/// </summary>
const ushort EXT_MAGIC = 0x137D;
Encoding currentEncoding;
FileSystemType xmlFsType;
public FileSystemType XmlFsType => xmlFsType;
public FileSystemType XmlFsType { get; private set; }
public string Name => "Linux extended Filesystem";
public Guid Id => new Guid("076CB3A2-08C2-4D69-BC8A-FCAA2E502BE2");
public Encoding Encoding => currentEncoding;
public Encoding Encoding { get; private set; }
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -78,7 +75,7 @@ namespace DiscImageChef.Filesystems
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
{
currentEncoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
information = "";
StringBuilder sb = new StringBuilder();
@@ -118,7 +115,7 @@ namespace DiscImageChef.Filesystems
sb.AppendFormat("Log zone size: {0}", extSb.logzonesize);
sb.AppendFormat("Max zone size: {0}", extSb.maxsize);
xmlFsType = new FileSystemType
XmlFsType = new FileSystemType
{
Type = "ext",
FreeClusters = extSb.freecountblk,