🎨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

@@ -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)
{