🎨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

@@ -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;