Code cleanup.

This commit is contained in:
2018-06-22 08:08:38 +01:00
parent 82f474c7e3
commit 88da8fc019
581 changed files with 22423 additions and 20839 deletions

View File

@@ -44,11 +44,11 @@ namespace DiscImageChef.Filesystems
// This may be missing fields, or not, I don't know russian so any help is appreciated
public class AODOS : IFilesystem
{
readonly byte[] AODOSIdentifier = {0x20, 0x41, 0x4F, 0x2D, 0x44, 0x4F, 0x53, 0x20};
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 { get; private set; }
readonly byte[] AODOSIdentifier = {0x20, 0x41, 0x4F, 0x2D, 0x44, 0x4F, 0x53, 0x20};
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 { get; private set; }
public bool Identify(IMediaImage imagePlugin, Partition partition)
{
@@ -61,9 +61,9 @@ namespace DiscImageChef.Filesystems
// Does AO-DOS support any other kind of disk?
if(imagePlugin.Info.Sectors != 800 && imagePlugin.Info.Sectors != 1600) return false;
byte[] sector = imagePlugin.ReadSector(0);
AODOS_BootBlock bb = new AODOS_BootBlock();
IntPtr bbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(bb));
byte[] sector = imagePlugin.ReadSector(0);
AODOS_BootBlock bb = new AODOS_BootBlock();
IntPtr bbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(bb));
Marshal.Copy(sector, 0, bbPtr, Marshal.SizeOf(bb));
bb = (AODOS_BootBlock)Marshal.PtrToStructure(bbPtr, typeof(AODOS_BootBlock));
Marshal.FreeHGlobal(bbPtr);
@@ -72,12 +72,12 @@ namespace DiscImageChef.Filesystems
}
public void GetInformation(IMediaImage imagePlugin, Partition partition, out string information,
Encoding encoding)
Encoding encoding)
{
Encoding = Encoding.GetEncoding("koi8-r");
byte[] sector = imagePlugin.ReadSector(0);
AODOS_BootBlock bb = new AODOS_BootBlock();
IntPtr bbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(bb));
byte[] sector = imagePlugin.ReadSector(0);
AODOS_BootBlock bb = new AODOS_BootBlock();
IntPtr bbPtr = Marshal.AllocHGlobal(Marshal.SizeOf(bb));
Marshal.Copy(sector, 0, bbPtr, Marshal.SizeOf(bb));
bb = (AODOS_BootBlock)Marshal.PtrToStructure(bbPtr, typeof(AODOS_BootBlock));
Marshal.FreeHGlobal(bbPtr);
@@ -88,15 +88,15 @@ namespace DiscImageChef.Filesystems
XmlFsType = new FileSystemType
{
Type = "Alexander Osipov DOS file system",
Clusters = (long)imagePlugin.Info.Sectors,
ClusterSize = (int)imagePlugin.Info.SectorSize,
Files = bb.files,
FilesSpecified = true,
FreeClusters = (long)(imagePlugin.Info.Sectors - bb.usedSectors),
Type = "Alexander Osipov DOS file system",
Clusters = (long)imagePlugin.Info.Sectors,
ClusterSize = (int)imagePlugin.Info.SectorSize,
Files = bb.files,
FilesSpecified = true,
FreeClusters = (long)(imagePlugin.Info.Sectors - bb.usedSectors),
FreeClustersSpecified = true,
VolumeName = StringHandlers.SpacePaddedToString(bb.volumeLabel, Encoding),
Bootable = true
VolumeName = StringHandlers.SpacePaddedToString(bb.volumeLabel, Encoding),
Bootable = true
};
sbInformation.AppendFormat("{0} files on volume", bb.files).AppendLine();
@@ -125,11 +125,13 @@ namespace DiscImageChef.Filesystems
/// <summary>
/// " AO-DOS "
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] identifier;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
public byte[] identifier;
/// <summary>
/// Volume label
/// </summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)] public byte[] volumeLabel;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 12)]
public byte[] volumeLabel;
/// <summary>
/// How many files are present in disk
/// </summary>