🎨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.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();