mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Make Encoding a private field only for IReadOnlyFilesystem implementors.
This commit is contained in:
Submodule Aaru.CommonTypes updated: b7366181b4...2a4635bb38
@@ -31,7 +31,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -47,7 +46,5 @@ public sealed partial class AODOS : IFilesystem
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("668E5039-9DDD-442A-BE1B-A315D6E38E26");
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
}
|
||||
@@ -77,7 +77,7 @@ public sealed partial class AODOS
|
||||
out FileSystem metadata)
|
||||
{
|
||||
information = "";
|
||||
Encoding = Encoding.GetEncoding("koi8-r");
|
||||
encoding = Encoding.GetEncoding("koi8-r");
|
||||
ErrorNumber errno = imagePlugin.ReadSector(0, out byte[] sector);
|
||||
metadata = new FileSystem();
|
||||
|
||||
@@ -97,14 +97,14 @@ public sealed partial class AODOS
|
||||
ClusterSize = imagePlugin.Info.SectorSize,
|
||||
Files = bb.files,
|
||||
FreeClusters = imagePlugin.Info.Sectors - bb.usedSectors,
|
||||
VolumeName = StringHandlers.SpacePaddedToString(bb.volumeLabel, Encoding),
|
||||
VolumeName = StringHandlers.SpacePaddedToString(bb.volumeLabel, encoding),
|
||||
Bootable = true
|
||||
};
|
||||
|
||||
sbInformation.AppendFormat(Localization._0_files_on_volume, bb.files).AppendLine();
|
||||
sbInformation.AppendFormat(Localization._0_used_sectors_on_volume, bb.usedSectors).AppendLine();
|
||||
|
||||
sbInformation.AppendFormat(Localization.Disk_name_0, StringHandlers.CToString(bb.volumeLabel, Encoding)).
|
||||
sbInformation.AppendFormat(Localization.Disk_name_0, StringHandlers.CToString(bb.volumeLabel, encoding)).
|
||||
AppendLine();
|
||||
|
||||
information = sbInformation.ToString();
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -38,8 +37,6 @@ namespace Aaru.Filesystems;
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public sealed partial class APFS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.APFS_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -70,7 +70,6 @@ public sealed partial class APFS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = Encoding.UTF8;
|
||||
var sbInformation = new StringBuilder();
|
||||
metadata = new FileSystem();
|
||||
information = "";
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -41,7 +40,5 @@ public sealed partial class AcornADFS : IFilesystem
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("BAFC1E50-9C64-4CD3-8400-80628CC27AFA");
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
}
|
||||
@@ -262,7 +262,7 @@ public sealed partial class AcornADFS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
|
||||
encoding ??= Encoding.GetEncoding("iso-8859-1");
|
||||
var sbInformation = new StringBuilder();
|
||||
metadata = new FileSystem();
|
||||
information = "";
|
||||
@@ -416,7 +416,7 @@ public sealed partial class AcornADFS
|
||||
sbInformation.AppendFormat(Localization._0_bytes_per_sector, imagePlugin.Info.SectorSize).AppendLine();
|
||||
sbInformation.AppendFormat(Localization.Volume_has_0_bytes, bytes).AppendLine();
|
||||
|
||||
sbInformation.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(namebytes, Encoding)).
|
||||
sbInformation.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(namebytes, encoding)).
|
||||
AppendLine();
|
||||
|
||||
if(oldMap1.discId > 0)
|
||||
@@ -426,7 +426,7 @@ public sealed partial class AcornADFS
|
||||
}
|
||||
|
||||
if(!ArrayHelpers.ArrayIsNullOrEmpty(namebytes))
|
||||
metadata.VolumeName = StringHandlers.CToString(namebytes, Encoding);
|
||||
metadata.VolumeName = StringHandlers.CToString(namebytes, encoding);
|
||||
|
||||
information = sbInformation.ToString();
|
||||
|
||||
@@ -495,7 +495,7 @@ public sealed partial class AcornADFS
|
||||
AaruConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_id = {0}", drSb.disc_id);
|
||||
|
||||
AaruConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_name = {0}",
|
||||
StringHandlers.CToString(drSb.disc_name, Encoding));
|
||||
StringHandlers.CToString(drSb.disc_name, encoding));
|
||||
|
||||
AaruConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_type = {0}", drSb.disc_type);
|
||||
AaruConsole.DebugWriteLine("ADFS Plugin", "drSb.disc_size_high = {0}", drSb.disc_size_high);
|
||||
@@ -555,7 +555,7 @@ public sealed partial class AcornADFS
|
||||
|
||||
if(!ArrayHelpers.ArrayIsNullOrEmpty(drSb.disc_name))
|
||||
{
|
||||
string discname = StringHandlers.CToString(drSb.disc_name, Encoding);
|
||||
string discname = StringHandlers.CToString(drSb.disc_name, encoding);
|
||||
metadata.VolumeName = discname;
|
||||
sbInformation.AppendFormat(Localization.Volume_name_0, discname).AppendLine();
|
||||
}
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -41,7 +40,5 @@ public sealed partial class AmigaDOSPlugin : IFilesystem
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("3c882400-208c-427d-a086-9119852a1bc7");
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
}
|
||||
@@ -168,7 +168,7 @@ public sealed partial class AmigaDOSPlugin
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
|
||||
encoding ??= Encoding.GetEncoding("iso-8859-1");
|
||||
var sbInformation = new StringBuilder();
|
||||
metadata = new FileSystem();
|
||||
information = null;
|
||||
@@ -273,7 +273,7 @@ public sealed partial class AmigaDOSPlugin
|
||||
|
||||
rootBlk = MarshalRootBlock(rootBlockSector);
|
||||
|
||||
string diskName = StringHandlers.PascalToString(rootBlk.diskName, Encoding);
|
||||
string diskName = StringHandlers.PascalToString(rootBlk.diskName, encoding);
|
||||
|
||||
switch(bootBlk.diskType & 0xFF)
|
||||
{
|
||||
|
||||
@@ -42,6 +42,7 @@ public sealed partial class AppleDOS : IReadOnlyFilesystem
|
||||
const string FS_TYPE = "appledos";
|
||||
bool _debug;
|
||||
IMediaImage _device;
|
||||
Encoding _encoding;
|
||||
bool _mounted;
|
||||
int _sectorsPerTrack;
|
||||
ulong _start;
|
||||
@@ -51,8 +52,6 @@ public sealed partial class AppleDOS : IReadOnlyFilesystem
|
||||
uint _usedSectors;
|
||||
Vtoc _vtoc;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public FileSystem Metadata { get; private set; }
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -117,7 +117,7 @@ public sealed partial class AppleDOS
|
||||
for(int i = 0; i < 30; i++)
|
||||
filenameB[i] = (byte)(entry.filename[i] & 0x7F);
|
||||
|
||||
string filename = StringHandlers.SpacePaddedToString(filenameB, Encoding);
|
||||
string filename = StringHandlers.SpacePaddedToString(filenameB, _encoding);
|
||||
|
||||
if(!_catalogCache.ContainsKey(filename))
|
||||
_catalogCache.Add(filename, ts);
|
||||
|
||||
@@ -31,8 +31,6 @@ using Aaru.CommonTypes.AaruMetadata;
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Helpers;
|
||||
using Claunia.Encoding;
|
||||
using Encoding = System.Text.Encoding;
|
||||
using Partition = Aaru.CommonTypes.Partition;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -67,7 +65,6 @@ public sealed partial class AppleDOS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? new Apple2();
|
||||
information = "";
|
||||
var sb = new StringBuilder();
|
||||
metadata = new FileSystem();
|
||||
|
||||
@@ -45,9 +45,9 @@ public sealed partial class AppleDOS
|
||||
public ErrorNumber Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
|
||||
Dictionary<string, string> options, string @namespace)
|
||||
{
|
||||
_device = imagePlugin;
|
||||
_start = partition.Start;
|
||||
Encoding = encoding ?? new Apple2();
|
||||
_device = imagePlugin;
|
||||
_start = partition.Start;
|
||||
_encoding = encoding ?? new Apple2();
|
||||
|
||||
if(_device.Info.Sectors != 455 &&
|
||||
_device.Info.Sectors != 560)
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -43,8 +42,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of the Apple Hierarchical File System (HFS)</summary>
|
||||
public sealed partial class AppleHFS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.Name_Apple_Hierarchical_File_System;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -100,9 +100,9 @@ public sealed partial class AppleHFS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("macintosh");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= Encoding.GetEncoding("macintosh");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
@@ -232,7 +232,7 @@ public sealed partial class AppleHFS
|
||||
sb.AppendFormat(Localization._0_bytes_in_the_Extents_B_Tree, mdb.drXTFlSize).AppendLine();
|
||||
sb.AppendFormat(Localization._0_bytes_in_the_Catalog_B_Tree, mdb.drCTFlSize).AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.PascalToString(mdb.drVN, Encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.PascalToString(mdb.drVN, encoding)).AppendLine();
|
||||
|
||||
sb.AppendLine(Localization.Finder_info);
|
||||
sb.AppendFormat(Localization.CNID_of_bootable_system_directory_0, mdb.drFndrInfo0).AppendLine();
|
||||
@@ -258,7 +258,7 @@ public sealed partial class AppleHFS
|
||||
sb.AppendFormat(Localization._0_blocks_in_volume_common_cache, mdb.drCtlCSize).AppendLine();
|
||||
}
|
||||
|
||||
string bootBlockInfo = AppleCommon.GetBootBlockInformation(bbSector, Encoding);
|
||||
string bootBlockInfo = AppleCommon.GetBootBlockInformation(bbSector, encoding);
|
||||
|
||||
if(bootBlockInfo != null)
|
||||
{
|
||||
@@ -303,7 +303,7 @@ public sealed partial class AppleHFS
|
||||
}
|
||||
|
||||
metadata.Type = FS_TYPE;
|
||||
metadata.VolumeName = StringHandlers.PascalToString(mdb.drVN, Encoding);
|
||||
metadata.VolumeName = StringHandlers.PascalToString(mdb.drVN, encoding);
|
||||
|
||||
if(mdb.drFndrInfo6 != 0 &&
|
||||
mdb.drFndrInfo7 != 0)
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -37,8 +36,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of Apple Hierarchical File System Plus (HFS+)</summary>
|
||||
public sealed partial class AppleHFSPlus : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.AppleHFSPlus_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -100,7 +100,6 @@ public sealed partial class AppleHFSPlus
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = Encoding.BigEndianUnicode;
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ public sealed partial class AppleMFS : IReadOnlyFilesystem
|
||||
byte[] _mdbTags;
|
||||
byte[] _directoryTags;
|
||||
byte[] _bitmapTags;
|
||||
Encoding _encoding;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.AppleMFS_Name;
|
||||
@@ -65,8 +66,6 @@ public sealed partial class AppleMFS : IReadOnlyFilesystem
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("36405F8D-0D26-4066-6538-5DBF5D065C3A");
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
// TODO: Implement Finder namespace (requires decoding Desktop database)
|
||||
|
||||
@@ -101,7 +101,7 @@ public sealed partial class 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, Encoding).ToLowerInvariant().
|
||||
string lowerFilename = StringHandlers.PascalToString(entry.flNam, _encoding).ToLowerInvariant().
|
||||
Replace('/', ':');
|
||||
|
||||
if(entry.flFlags.HasFlag(FileFlags.Used) &&
|
||||
@@ -113,7 +113,7 @@ public sealed partial class AppleMFS
|
||||
_idToEntry.Add(entry.flFlNum, entry);
|
||||
|
||||
_idToFilename.Add(entry.flFlNum,
|
||||
StringHandlers.PascalToString(entry.flNam, Encoding).Replace('/', ':'));
|
||||
StringHandlers.PascalToString(entry.flNam, _encoding).Replace('/', ':'));
|
||||
|
||||
_filenameToId.Add(lowerFilename, entry.flFlNum);
|
||||
|
||||
@@ -134,7 +134,7 @@ public sealed partial class AppleMFS
|
||||
DateHandlers.MacToDateTime(entry.flMdDat));
|
||||
|
||||
AaruConsole.DebugWriteLine("DEBUG (AppleMFS plugin)", "entry.flNam0 = {0}",
|
||||
StringHandlers.PascalToString(entry.flNam, Encoding));
|
||||
StringHandlers.PascalToString(entry.flNam, _encoding));
|
||||
}
|
||||
|
||||
offset += 50 + entry.flNam.Length;
|
||||
|
||||
@@ -61,9 +61,9 @@ public sealed partial class AppleMFS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? new MacRoman();
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= new MacRoman();
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
@@ -99,7 +99,7 @@ public sealed partial class 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, Encoding);
|
||||
mdb.drVN = StringHandlers.PascalToString(variableSize, encoding);
|
||||
|
||||
sb.AppendLine(Localization.AppleMFS_Name);
|
||||
sb.AppendLine();
|
||||
@@ -142,7 +142,7 @@ public sealed partial class AppleMFS
|
||||
sb.AppendFormat(Localization._0_unused_allocation_blocks, mdb.drFreeBks).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_name_0, mdb.drVN).AppendLine();
|
||||
|
||||
string bootBlockInfo = AppleCommon.GetBootBlockInformation(bbSector, Encoding);
|
||||
string bootBlockInfo = AppleCommon.GetBootBlockInformation(bbSector, encoding);
|
||||
|
||||
if(bootBlockInfo != null)
|
||||
{
|
||||
|
||||
@@ -49,7 +49,7 @@ public sealed partial class AppleMFS
|
||||
{
|
||||
_device = imagePlugin;
|
||||
_partitionStart = partition.Start;
|
||||
Encoding = encoding ?? Encoding.GetEncoding("macintosh");
|
||||
_encoding = encoding ?? Encoding.GetEncoding("macintosh");
|
||||
|
||||
options ??= GetDefaultOptions();
|
||||
|
||||
@@ -88,7 +88,7 @@ public sealed partial class 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, Encoding);
|
||||
_volMdb.drVN = StringHandlers.PascalToString(variableSize, _encoding);
|
||||
|
||||
errno = _device.ReadSectors(_volMdb.drDirSt + _partitionStart, _volMdb.drBlLen, out _directoryBlocks);
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -38,8 +37,6 @@ namespace Aaru.Filesystems;
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public sealed partial class AtheOS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.AtheOS_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -76,9 +76,9 @@ public sealed partial class AtheOS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
@@ -104,7 +104,7 @@ public sealed partial class AtheOS
|
||||
if(afsSb.flags == 1)
|
||||
sb.AppendLine(Localization.Filesystem_is_read_only);
|
||||
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(afsSb.name, Encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(afsSb.name, encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization._0_bytes_per_block, afsSb.block_size).AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization._0_blocks_in_volume_1_bytes, afsSb.num_blocks,
|
||||
@@ -154,7 +154,7 @@ public sealed partial class AtheOS
|
||||
Dirty = false,
|
||||
FreeClusters = (ulong)(afsSb.num_blocks - afsSb.used_blocks),
|
||||
Type = FS_TYPE,
|
||||
VolumeName = StringHandlers.CToString(afsSb.name, Encoding)
|
||||
VolumeName = StringHandlers.CToString(afsSb.name, encoding)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -39,8 +38,6 @@ namespace Aaru.Filesystems;
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public sealed partial class BeFS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.BeFS_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -86,9 +86,9 @@ public sealed partial class BeFS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
@@ -184,7 +184,7 @@ public sealed partial class BeFS
|
||||
break;
|
||||
}
|
||||
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(besb.name, Encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(besb.name, encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization._0_bytes_per_block, besb.block_size).AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization._0_blocks_in_volume_1_bytes, besb.num_blocks, besb.num_blocks * besb.block_size).
|
||||
@@ -226,7 +226,7 @@ public sealed partial class BeFS
|
||||
Dirty = besb.flags == BEFS_DIRTY,
|
||||
FreeClusters = (ulong)(besb.num_blocks - besb.used_blocks),
|
||||
Type = FS_TYPE,
|
||||
VolumeName = StringHandlers.CToString(besb.name, Encoding)
|
||||
VolumeName = StringHandlers.CToString(besb.name, encoding)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -40,8 +39,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of the b-tree filesystem (btrfs)</summary>
|
||||
public sealed partial class BTRFS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.BTRFS_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -84,7 +84,6 @@ public sealed partial class BTRFS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
||||
var sbInformation = new StringBuilder();
|
||||
metadata = new FileSystem();
|
||||
information = "";
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -41,7 +40,5 @@ public sealed partial class CBM : IFilesystem
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("D104744E-A376-450C-BAC0-1347C93F983B");
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
}
|
||||
@@ -92,7 +92,7 @@ public sealed partial class CBM
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = new PETSCII();
|
||||
encoding = new PETSCII();
|
||||
information = "";
|
||||
byte[] sector;
|
||||
|
||||
@@ -136,10 +136,10 @@ public sealed partial class CBM
|
||||
|
||||
sbInformation.AppendFormat(Localization.Disk_ID_0, cbmHdr.diskId).AppendLine();
|
||||
|
||||
sbInformation.AppendFormat(Localization.Disk_name_0, StringHandlers.CToString(cbmHdr.name, Encoding)).
|
||||
sbInformation.AppendFormat(Localization.Disk_name_0, StringHandlers.CToString(cbmHdr.name, encoding)).
|
||||
AppendLine();
|
||||
|
||||
metadata.VolumeName = StringHandlers.CToString(cbmHdr.name, Encoding);
|
||||
metadata.VolumeName = StringHandlers.CToString(cbmHdr.name, encoding);
|
||||
metadata.VolumeSerial = $"{cbmHdr.diskId}";
|
||||
}
|
||||
else
|
||||
@@ -164,10 +164,10 @@ public sealed partial class CBM
|
||||
|
||||
sbInformation.AppendFormat(Localization.Disk_ID_0, cbmBam.diskId).AppendLine();
|
||||
|
||||
sbInformation.AppendFormat(Localization.Disk_name_0, StringHandlers.CToString(cbmBam.name, Encoding)).
|
||||
sbInformation.AppendFormat(Localization.Disk_name_0, StringHandlers.CToString(cbmBam.name, encoding)).
|
||||
AppendLine();
|
||||
|
||||
metadata.VolumeName = StringHandlers.CToString(cbmBam.name, Encoding);
|
||||
metadata.VolumeName = StringHandlers.CToString(cbmBam.name, encoding);
|
||||
metadata.VolumeSerial = $"{cbmBam.diskId}";
|
||||
}
|
||||
|
||||
|
||||
@@ -59,6 +59,7 @@ public sealed partial class CPM : IReadOnlyFilesystem
|
||||
List<string> _dirList;
|
||||
/// <summary>CP/M disc parameter block (on-memory)</summary>
|
||||
DiscParameterBlock _dpb;
|
||||
Encoding _encoding;
|
||||
/// <summary>Cached file data</summary>
|
||||
Dictionary<string, byte[]> _fileCache;
|
||||
/// <summary>The volume label, if the CP/M filesystem contains one</summary>
|
||||
@@ -81,8 +82,6 @@ public sealed partial class CPM : IReadOnlyFilesystem
|
||||
/// <summary>If <see cref="Identify" /> thinks this is a CP/M filesystem, this is the definition for it</summary>
|
||||
CpmDefinition _workingDefinition;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public FileSystem Metadata { get; private set; }
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -1141,7 +1141,6 @@ public sealed partial class CPM
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("IBM437");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
@@ -1214,13 +1213,11 @@ public sealed partial class CPM
|
||||
sb.AppendFormat(Localization.Device_uses_0_one_hardware_interleaving, _workingDefinition.skew).AppendLine();
|
||||
|
||||
if(_workingDefinition.sofs > 0)
|
||||
sb.AppendFormat("BSH {0} BLM {1} EXM {2} DSM {3} DRM {4} AL0 {5:X2}H AL1 {6:X2}H SOFS {7}", _dpb.bsh,
|
||||
_dpb.blm, _dpb.exm, _dpb.dsm, _dpb.drm, _dpb.al0, _dpb.al1, _workingDefinition.sofs).
|
||||
AppendLine();
|
||||
sb.AppendLine($"BSH {_dpb.bsh} BLM {_dpb.blm} EXM {_dpb.exm} DSM {_dpb.dsm} DRM {_dpb.drm} AL0 {_dpb.al0
|
||||
:X2}H AL1 {_dpb.al1:X2}H SOFS {_workingDefinition.sofs}");
|
||||
else
|
||||
sb.AppendFormat("BSH {0} BLM {1} EXM {2} DSM {3} DRM {4} AL0 {5:X2}H AL1 {6:X2}H OFS {7}", _dpb.bsh,
|
||||
_dpb.blm, _dpb.exm, _dpb.dsm, _dpb.drm, _dpb.al0, _dpb.al1, _workingDefinition.ofs).
|
||||
AppendLine();
|
||||
sb.AppendLine($"BSH {_dpb.bsh} BLM {_dpb.blm} EXM {_dpb.exm} DSM {_dpb.dsm} DRM {_dpb.drm} AL0 {_dpb.al0
|
||||
:X2}H AL1 {_dpb.al1:X2}H OFS {_workingDefinition.ofs}");
|
||||
|
||||
if(_label != null)
|
||||
sb.AppendFormat(Localization.Volume_label_0, _label).AppendLine();
|
||||
|
||||
@@ -55,8 +55,8 @@ public sealed partial class CPM
|
||||
public ErrorNumber Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
|
||||
Dictionary<string, string> options, string @namespace)
|
||||
{
|
||||
_device = imagePlugin;
|
||||
Encoding = encoding ?? Encoding.GetEncoding("IBM437");
|
||||
_device = imagePlugin;
|
||||
_encoding = encoding ?? Encoding.GetEncoding("IBM437");
|
||||
|
||||
// As the identification is so complex, just call Identify() and relay on its findings
|
||||
if(!Identify(_device, partition) ||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -40,8 +39,6 @@ namespace Aaru.Filesystems;
|
||||
[SuppressMessage("ReSharper", "UnusedType.Local")]
|
||||
public sealed partial class Cram : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.Cram_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -64,8 +64,8 @@ public sealed partial class Cram
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
encoding ??= Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
ErrorNumber errno = imagePlugin.ReadSector(partition.Start, out byte[] sector);
|
||||
metadata = new FileSystem();
|
||||
|
||||
@@ -96,7 +96,7 @@ public sealed partial class Cram
|
||||
sbInformation.AppendLine(littleEndian ? Localization.Little_endian : Localization.Big_endian);
|
||||
sbInformation.AppendFormat(Localization.Volume_edition_0, crSb.edition).AppendLine();
|
||||
|
||||
sbInformation.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(crSb.name, Encoding)).
|
||||
sbInformation.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(crSb.name, encoding)).
|
||||
AppendLine();
|
||||
|
||||
sbInformation.AppendFormat(Localization.Volume_has_0_bytes, crSb.size).AppendLine();
|
||||
@@ -107,7 +107,7 @@ public sealed partial class Cram
|
||||
|
||||
metadata = new FileSystem
|
||||
{
|
||||
VolumeName = StringHandlers.CToString(crSb.name, Encoding),
|
||||
VolumeName = StringHandlers.CToString(crSb.name, encoding),
|
||||
Type = FS_TYPE,
|
||||
Clusters = crSb.blocks,
|
||||
Files = crSb.files,
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -40,8 +39,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of the filesystem described in ECMA-67</summary>
|
||||
public sealed partial class ECMA67 : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.ECMA67_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -70,7 +70,6 @@ public sealed partial class ECMA67
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
ErrorNumber errno = imagePlugin.ReadSector(6, out byte[] sector);
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -36,8 +35,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements identification for the SGI Extent FileSystem</summary>
|
||||
public sealed partial class EFS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.EFS_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -106,9 +106,9 @@ public sealed partial class EFS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
if(imagePlugin.Info.SectorSize < 512)
|
||||
return;
|
||||
@@ -197,8 +197,8 @@ public sealed partial class EFS
|
||||
sb.AppendLine(Localization.Volume_is_dirty);
|
||||
|
||||
sb.AppendFormat(Localization.Checksum_0_X8, efsSb.sb_checksum).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(efsSb.sb_fname, Encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_pack_0, StringHandlers.CToString(efsSb.sb_fpack, Encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(efsSb.sb_fname, encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_pack_0, StringHandlers.CToString(efsSb.sb_fpack, encoding)).AppendLine();
|
||||
|
||||
information = sb.ToString();
|
||||
|
||||
@@ -209,7 +209,7 @@ public sealed partial class EFS
|
||||
Clusters = (ulong)efsSb.sb_size,
|
||||
FreeClusters = (ulong)efsSb.sb_tfree,
|
||||
Dirty = efsSb.sb_dirty > 0,
|
||||
VolumeName = StringHandlers.CToString(efsSb.sb_fname, Encoding),
|
||||
VolumeName = StringHandlers.CToString(efsSb.sb_fname, encoding),
|
||||
VolumeSerial = $"{efsSb.sb_checksum:X8}",
|
||||
CreationDate = DateHandlers.UnixToDateTime(efsSb.sb_time)
|
||||
};
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -38,8 +37,6 @@ namespace Aaru.Filesystems;
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public sealed partial class F2FS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.F2FS_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -77,7 +77,6 @@ public sealed partial class F2FS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = Encoding.Unicode;
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
|
||||
@@ -198,11 +198,11 @@ public sealed partial class FAT
|
||||
continue;
|
||||
|
||||
// Self
|
||||
if(Encoding.GetString(dirent.filename).TrimEnd() == ".")
|
||||
if(_encoding.GetString(dirent.filename).TrimEnd() == ".")
|
||||
continue;
|
||||
|
||||
// Parent
|
||||
if(Encoding.GetString(dirent.filename).TrimEnd() == "..")
|
||||
if(_encoding.GetString(dirent.filename).TrimEnd() == "..")
|
||||
continue;
|
||||
|
||||
// Deleted
|
||||
@@ -237,8 +237,8 @@ public sealed partial class FAT
|
||||
if(dirent.filename[0] == DIRENT_E5)
|
||||
dirent.filename[0] = DIRENT_DELETED;
|
||||
|
||||
string name = Encoding.GetString(dirent.filename).TrimEnd();
|
||||
string extension = Encoding.GetString(dirent.extension).TrimEnd();
|
||||
string name = _encoding.GetString(dirent.filename).TrimEnd();
|
||||
string extension = _encoding.GetString(dirent.extension).TrimEnd();
|
||||
|
||||
if(name == "" &&
|
||||
extension == "")
|
||||
@@ -288,9 +288,9 @@ public sealed partial class FAT
|
||||
|
||||
completeEntry.HumanDirent = humanEntry;
|
||||
|
||||
name = StringHandlers.CToString(humanEntry.name1, Encoding).TrimEnd();
|
||||
extension = StringHandlers.CToString(humanEntry.extension, Encoding).TrimEnd();
|
||||
string name2 = StringHandlers.CToString(humanEntry.name2, Encoding).TrimEnd();
|
||||
name = StringHandlers.CToString(humanEntry.name1, _encoding).TrimEnd();
|
||||
extension = StringHandlers.CToString(humanEntry.extension, _encoding).TrimEnd();
|
||||
string name2 = StringHandlers.CToString(humanEntry.name2, _encoding).TrimEnd();
|
||||
|
||||
if(extension != "")
|
||||
filename = name + name2 + "." + extension;
|
||||
@@ -340,7 +340,7 @@ public sealed partial class FAT
|
||||
|
||||
Array.Copy(longnameEa, 4, longnameBytes, 0, longnameSize);
|
||||
|
||||
string longname = StringHandlers.CToString(longnameBytes, Encoding);
|
||||
string longname = StringHandlers.CToString(longnameBytes, _encoding);
|
||||
|
||||
if(string.IsNullOrWhiteSpace(longname))
|
||||
continue;
|
||||
|
||||
@@ -62,9 +62,8 @@ public sealed partial class FAT : IReadOnlyFilesystem
|
||||
uint _sectorsPerFat;
|
||||
FileSystemInfo _statfs;
|
||||
bool _useFirstFat;
|
||||
Encoding _encoding;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public FileSystem Metadata { get; private set; }
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -424,8 +424,8 @@ public sealed partial class FAT
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("IBM437");
|
||||
information = "";
|
||||
encoding ??= Encoding.GetEncoding("IBM437");
|
||||
information = "";
|
||||
|
||||
var sb = new StringBuilder();
|
||||
metadata = new FileSystem();
|
||||
@@ -574,7 +574,7 @@ public sealed partial class FAT
|
||||
|
||||
if(fat32Bpb.signature == 0x29)
|
||||
{
|
||||
metadata.VolumeName = StringHandlers.SpacePaddedToString(fat32Bpb.volume_label, Encoding);
|
||||
metadata.VolumeName = StringHandlers.SpacePaddedToString(fat32Bpb.volume_label, encoding);
|
||||
metadata.VolumeName = metadata.VolumeName?.Replace("\0", "");
|
||||
|
||||
sb.AppendFormat(Localization.Filesystem_type_0, Encoding.ASCII.GetString(fat32Bpb.fs_type)).
|
||||
@@ -859,7 +859,7 @@ public sealed partial class FAT
|
||||
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 => StringHandlers.CToString(fakeBpb.oem_name, Encoding,
|
||||
fakeBpb.oem_name[7] <= 0x7F => StringHandlers.CToString(fakeBpb.oem_name, encoding,
|
||||
start: 1),
|
||||
_ => metadata.SystemIdentifier
|
||||
};
|
||||
@@ -929,7 +929,7 @@ public sealed partial class FAT
|
||||
|
||||
if(fakeBpb.signature == 0x29 || andosOemCorrect)
|
||||
{
|
||||
metadata.VolumeName = StringHandlers.SpacePaddedToString(fakeBpb.volume_label, Encoding);
|
||||
metadata.VolumeName = StringHandlers.SpacePaddedToString(fakeBpb.volume_label, encoding);
|
||||
metadata.VolumeName = metadata.VolumeName?.Replace("\0", "");
|
||||
|
||||
sb.AppendFormat(Localization.Filesystem_type_0, Encoding.ASCII.GetString(fakeBpb.fs_type)).
|
||||
@@ -1018,7 +1018,7 @@ public sealed partial class FAT
|
||||
byte[] fullname = new byte[11];
|
||||
Array.Copy(entry.filename, 0, fullname, 0, 8);
|
||||
Array.Copy(entry.extension, 0, fullname, 8, 3);
|
||||
string volname = Encoding.GetString(fullname).Trim();
|
||||
string volname = encoding.GetString(fullname).Trim();
|
||||
|
||||
if(!string.IsNullOrEmpty(volname))
|
||||
metadata.VolumeName = entry.caseinfo.HasFlag(CaseInfo.AllLowerCase) ? volname.ToLower() : volname;
|
||||
|
||||
@@ -128,8 +128,8 @@ public sealed partial class FAT
|
||||
uint sectorsForRootDirectory = 0;
|
||||
uint rootDirectoryCluster = 0;
|
||||
|
||||
Encoding = encoding ?? (bpbKind == BpbKind.Human ? Encoding.GetEncoding("shift_jis")
|
||||
: Encoding.GetEncoding("IBM437"));
|
||||
_encoding = encoding ?? (bpbKind == BpbKind.Human ? Encoding.GetEncoding("shift_jis")
|
||||
: Encoding.GetEncoding("IBM437"));
|
||||
|
||||
switch(bpbKind)
|
||||
{
|
||||
@@ -197,7 +197,7 @@ public sealed partial class FAT
|
||||
|
||||
if(fat32Bpb.signature == 0x29)
|
||||
{
|
||||
Metadata.VolumeName = StringHandlers.SpacePaddedToString(fat32Bpb.volume_label, Encoding);
|
||||
Metadata.VolumeName = StringHandlers.SpacePaddedToString(fat32Bpb.volume_label, _encoding);
|
||||
Metadata.VolumeName = Metadata.VolumeName?.Replace("\0", "");
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ public sealed partial class FAT
|
||||
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 => StringHandlers.CToString(fakeBpb.oem_name, Encoding,
|
||||
fakeBpb.oem_name[7] <= 0x7F => StringHandlers.CToString(fakeBpb.oem_name, _encoding,
|
||||
start: 1),
|
||||
_ => Metadata.SystemIdentifier
|
||||
};
|
||||
@@ -454,7 +454,7 @@ public sealed partial class FAT
|
||||
|
||||
if(fakeBpb.signature == 0x29 || andosOemCorrect)
|
||||
{
|
||||
Metadata.VolumeName = StringHandlers.SpacePaddedToString(fakeBpb.volume_label, Encoding);
|
||||
Metadata.VolumeName = StringHandlers.SpacePaddedToString(fakeBpb.volume_label, _encoding);
|
||||
Metadata.VolumeName = Metadata.VolumeName?.Replace("\0", "");
|
||||
}
|
||||
}
|
||||
@@ -609,11 +609,11 @@ public sealed partial class FAT
|
||||
continue;
|
||||
|
||||
// Self
|
||||
if(Encoding.GetString(entry.filename).TrimEnd() == ".")
|
||||
if(_encoding.GetString(entry.filename).TrimEnd() == ".")
|
||||
continue;
|
||||
|
||||
// Parent
|
||||
if(Encoding.GetString(entry.filename).TrimEnd() == "..")
|
||||
if(_encoding.GetString(entry.filename).TrimEnd() == "..")
|
||||
continue;
|
||||
|
||||
// Deleted
|
||||
@@ -627,7 +627,7 @@ public sealed partial class FAT
|
||||
byte[] fullname = new byte[11];
|
||||
Array.Copy(entry.filename, 0, fullname, 0, 8);
|
||||
Array.Copy(entry.extension, 0, fullname, 8, 3);
|
||||
string volname = Encoding.GetString(fullname).Trim();
|
||||
string volname = _encoding.GetString(fullname).Trim();
|
||||
|
||||
if(!string.IsNullOrEmpty(volname))
|
||||
Metadata.VolumeName = entry.caseinfo.HasFlag(CaseInfo.AllLowerCase) && _namespace == Namespace.Nt
|
||||
@@ -674,8 +674,8 @@ public sealed partial class FAT
|
||||
if(entry.filename[0] == DIRENT_E5)
|
||||
entry.filename[0] = DIRENT_DELETED;
|
||||
|
||||
string name = Encoding.GetString(entry.filename).TrimEnd();
|
||||
string extension = Encoding.GetString(entry.extension).TrimEnd();
|
||||
string name = _encoding.GetString(entry.filename).TrimEnd();
|
||||
string extension = _encoding.GetString(entry.extension).TrimEnd();
|
||||
|
||||
if(_namespace == Namespace.Nt)
|
||||
{
|
||||
@@ -730,9 +730,9 @@ public sealed partial class FAT
|
||||
|
||||
completeEntry.HumanDirent = humanEntry;
|
||||
|
||||
name = StringHandlers.CToString(humanEntry.name1, Encoding).TrimEnd();
|
||||
extension = StringHandlers.CToString(humanEntry.extension, Encoding).TrimEnd();
|
||||
string name2 = StringHandlers.CToString(humanEntry.name2, Encoding).TrimEnd();
|
||||
name = StringHandlers.CToString(humanEntry.name1, _encoding).TrimEnd();
|
||||
extension = StringHandlers.CToString(humanEntry.extension, _encoding).TrimEnd();
|
||||
string name2 = StringHandlers.CToString(humanEntry.name2, _encoding).TrimEnd();
|
||||
|
||||
if(extension != "")
|
||||
filename = name + name2 + "." + extension;
|
||||
@@ -922,7 +922,7 @@ public sealed partial class FAT
|
||||
|
||||
Array.Copy(longnameEa, 4, longnameBytes, 0, longnameSize);
|
||||
|
||||
string longname = StringHandlers.CToString(longnameBytes, Encoding);
|
||||
string longname = StringHandlers.CToString(longnameBytes, _encoding);
|
||||
|
||||
if(string.IsNullOrWhiteSpace(longname))
|
||||
continue;
|
||||
|
||||
@@ -134,7 +134,7 @@ public sealed partial class XboxFatPlugin
|
||||
if(dirent.filenameSize is DELETED_DIRENTRY or > MAX_FILENAME)
|
||||
continue;
|
||||
|
||||
string filename = Encoding.GetString(dirent.filename, 0, dirent.filenameSize);
|
||||
string filename = _encoding.GetString(dirent.filename, 0, dirent.filenameSize);
|
||||
|
||||
currentDirectory.Add(filename, dirent);
|
||||
}
|
||||
|
||||
@@ -45,6 +45,7 @@ public sealed partial class XboxFatPlugin : IReadOnlyFilesystem
|
||||
CultureInfo _cultureInfo;
|
||||
bool _debug;
|
||||
Dictionary<string, Dictionary<string, DirectoryEntry>> _directoryCache;
|
||||
Encoding _encoding;
|
||||
ushort[] _fat16;
|
||||
uint[] _fat32;
|
||||
ulong _fatStartSector;
|
||||
@@ -57,8 +58,6 @@ public sealed partial class XboxFatPlugin : IReadOnlyFilesystem
|
||||
FileSystemInfo _statfs;
|
||||
Superblock _superblock;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public FileSystem Metadata { get; private set; }
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -57,7 +57,6 @@ public sealed partial class XboxFatPlugin
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = Encoding.UTF8;
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ public sealed partial class XboxFatPlugin
|
||||
public ErrorNumber Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding,
|
||||
Dictionary<string, string> options, string @namespace)
|
||||
{
|
||||
Encoding = Encoding.GetEncoding("iso-8859-15");
|
||||
_encoding = Encoding.GetEncoding("iso-8859-15");
|
||||
_littleEndian = true;
|
||||
|
||||
options ??= GetDefaultOptions();
|
||||
@@ -251,7 +251,7 @@ public sealed partial class XboxFatPlugin
|
||||
if(entry.filenameSize is DELETED_DIRENTRY or > MAX_FILENAME)
|
||||
continue;
|
||||
|
||||
string filename = Encoding.GetString(entry.filename, 0, entry.filenameSize);
|
||||
string filename = _encoding.GetString(entry.filename, 0, entry.filenameSize);
|
||||
|
||||
_rootDirectory.Add(filename, entry);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using time_t = System.Int32;
|
||||
using ufs_daddr_t = System.Int32;
|
||||
@@ -41,8 +40,6 @@ namespace Aaru.Filesystems;
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public sealed partial class FFSPlugin : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.FFSPlugin_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -96,7 +96,6 @@ public sealed partial class FFSPlugin
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
var sbInformation = new StringBuilder();
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -36,8 +35,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection for the Plan-9 Fossil on-disk filesystem</summary>
|
||||
public sealed partial class Fossil : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.Fossil_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -65,7 +65,7 @@ public sealed partial class Fossil
|
||||
out FileSystem metadata)
|
||||
{
|
||||
// Technically everything on Plan 9 from Bell Labs is in UTF-8
|
||||
Encoding = Encoding.UTF8;
|
||||
encoding = Encoding.UTF8;
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
@@ -117,8 +117,8 @@ public sealed partial class Fossil
|
||||
sb.AppendFormat(Localization.Active_root_block_0, fsb.active).AppendLine();
|
||||
sb.AppendFormat(Localization.Next_root_block_0, fsb.next).AppendLine();
|
||||
sb.AppendFormat(Localization.Current_root_block_0, fsb.current).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_label_0, StringHandlers.CToString(fsb.name, Encoding)).AppendLine();
|
||||
metadata.VolumeName = StringHandlers.CToString(fsb.name, Encoding);
|
||||
sb.AppendFormat(Localization.Volume_label_0, StringHandlers.CToString(fsb.name, encoding)).AppendLine();
|
||||
metadata.VolumeName = StringHandlers.CToString(fsb.name, encoding);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using hammer_crc_t = System.UInt32;
|
||||
using hammer_off_t = System.UInt64;
|
||||
@@ -41,8 +40,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection for the HAMMER filesystem</summary>
|
||||
public sealed partial class HAMMER : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.HAMMER_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -70,9 +70,9 @@ public sealed partial class HAMMER
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
@@ -99,7 +99,7 @@ public sealed partial class HAMMER
|
||||
sb.AppendFormat(Localization.Volume_0_of_1_on_this_filesystem, superBlock.vol_no + 1, superBlock.vol_count).
|
||||
AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(superBlock.vol_label, Encoding)).
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(superBlock.vol_label, encoding)).
|
||||
AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Volume_serial_0, superBlock.vol_fsid).AppendLine();
|
||||
@@ -115,7 +115,7 @@ public sealed partial class HAMMER
|
||||
ClusterSize = HAMMER_BIGBLOCK_SIZE,
|
||||
Dirty = false,
|
||||
Type = FS_TYPE,
|
||||
VolumeName = StringHandlers.CToString(superBlock.vol_label, Encoding),
|
||||
VolumeName = StringHandlers.CToString(superBlock.vol_label, encoding),
|
||||
VolumeSerial = superBlock.vol_fsid.ToString()
|
||||
};
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -41,8 +40,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of IBM's High Performance File System (HPFS)</summary>
|
||||
public sealed partial class HPFS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.HPFS_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -69,9 +69,9 @@ public sealed partial class HPFS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("ibm850");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= Encoding.GetEncoding("ibm850");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
@@ -137,7 +137,7 @@ public sealed partial class HPFS
|
||||
sb.AppendFormat(Localization.NT_Flags_0, bpb.nt_flags).AppendLine();
|
||||
sb.AppendFormat(Localization.Signature_0, bpb.signature).AppendLine();
|
||||
sb.AppendFormat(Localization.Serial_number_0, bpb.serial_no).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_label_0, StringHandlers.CToString(bpb.volume_label, Encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_label_0, StringHandlers.CToString(bpb.volume_label, encoding)).AppendLine();
|
||||
|
||||
// sb.AppendFormat("Filesystem type: \"{0}\"", hpfs_bpb.fs_type).AppendLine();
|
||||
|
||||
@@ -243,7 +243,7 @@ public sealed partial class HPFS
|
||||
metadata.Clusters = hpfsSb.sectors;
|
||||
metadata.ClusterSize = bpb.bps;
|
||||
metadata.Type = FS_TYPE;
|
||||
metadata.VolumeName = StringHandlers.CToString(bpb.volume_label, Encoding);
|
||||
metadata.VolumeName = StringHandlers.CToString(bpb.volume_label, encoding);
|
||||
metadata.VolumeSerial = $"{bpb.serial_no:X8}";
|
||||
metadata.SystemIdentifier = StringHandlers.CToString(bpb.oem_name);
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -38,8 +37,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements identification of IBM's High Performance Optical File System</summary>
|
||||
public sealed partial class HPOFS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.HPOFS_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -69,9 +69,9 @@ public sealed partial class HPOFS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("ibm850");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= Encoding.GetEncoding("ibm850");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
@@ -193,13 +193,13 @@ public sealed partial class HPOFS
|
||||
sb.AppendFormat(Localization.BIOS_drive_number_0, bpb.drive_no).AppendLine();
|
||||
sb.AppendFormat(Localization.Serial_number_0, mib.serial).AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Volume_label_0, StringHandlers.SpacePaddedToString(mib.volumeLabel, Encoding)).
|
||||
sb.AppendFormat(Localization.Volume_label_0, StringHandlers.SpacePaddedToString(mib.volumeLabel, encoding)).
|
||||
AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Volume_comment_0, StringHandlers.SpacePaddedToString(mib.comment, Encoding)).
|
||||
sb.AppendFormat(Localization.Volume_comment_0, StringHandlers.SpacePaddedToString(mib.comment, encoding)).
|
||||
AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Volume_owner_0, StringHandlers.SpacePaddedToString(vib.owner, Encoding)).
|
||||
sb.AppendFormat(Localization.Volume_owner_0, StringHandlers.SpacePaddedToString(vib.owner, encoding)).
|
||||
AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Volume_created_on_0,
|
||||
@@ -219,9 +219,9 @@ public sealed partial class HPOFS
|
||||
Clusters = mib.sectors / bpb.spc,
|
||||
ClusterSize = (uint)(bpb.bps * bpb.spc),
|
||||
CreationDate = DateHandlers.DosToDateTime(mib.creationDate, mib.creationTime),
|
||||
DataPreparerIdentifier = StringHandlers.SpacePaddedToString(vib.owner, Encoding),
|
||||
DataPreparerIdentifier = StringHandlers.SpacePaddedToString(vib.owner, encoding),
|
||||
Type = FS_TYPE,
|
||||
VolumeName = StringHandlers.SpacePaddedToString(mib.volumeLabel, Encoding),
|
||||
VolumeName = StringHandlers.SpacePaddedToString(mib.volumeLabel, encoding),
|
||||
VolumeSerial = $"{mib.serial:X8}",
|
||||
SystemIdentifier = StringHandlers.SpacePaddedToString(bpb.oem_name)
|
||||
};
|
||||
|
||||
@@ -57,9 +57,8 @@ public sealed partial class ISO9660 : IReadOnlyFilesystem
|
||||
bool _usePathTable;
|
||||
bool _useTransTbl;
|
||||
ushort _blockSize;
|
||||
Encoding Encoding;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public FileSystem Metadata { get; private set; }
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -87,9 +87,9 @@ public sealed partial class ISO9660
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.ASCII;
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= Encoding.ASCII;
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
var isoMetadata = new StringBuilder();
|
||||
byte[] vdMagic = new byte[5]; // Volume Descriptor magic "CD001"
|
||||
byte[] hsMagic = new byte[5]; // Volume Descriptor magic "CDROM"
|
||||
@@ -120,7 +120,7 @@ public sealed partial class ISO9660
|
||||
|
||||
int xaOff = vdSector.Length == 2336 ? 8 : 0;
|
||||
Array.Copy(vdSector, 0x009 + xaOff, hsMagic, 0, 5);
|
||||
bool highSierraInfo = Encoding.GetString(hsMagic) == HIGH_SIERRA_MAGIC;
|
||||
bool highSierraInfo = encoding.GetString(hsMagic) == HIGH_SIERRA_MAGIC;
|
||||
int hsOff = 0;
|
||||
|
||||
if(highSierraInfo)
|
||||
@@ -158,9 +158,9 @@ public sealed partial class ISO9660
|
||||
Array.Copy(vdSector, 0x001, vdMagic, 0, 5);
|
||||
Array.Copy(vdSector, 0x009, hsMagic, 0, 5);
|
||||
|
||||
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(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;
|
||||
@@ -168,7 +168,7 @@ public sealed partial class ISO9660
|
||||
break;
|
||||
}
|
||||
|
||||
cdiInfo |= Encoding.GetString(vdMagic) == CDI_MAGIC;
|
||||
cdiInfo |= encoding.GetString(vdMagic) == CDI_MAGIC;
|
||||
|
||||
switch(vdType)
|
||||
{
|
||||
@@ -178,7 +178,7 @@ public sealed partial class ISO9660
|
||||
|
||||
bootSpec = Localization.Unknown_specification;
|
||||
|
||||
if(Encoding.GetString(bvd.Value.system_id)[..23] == "EL TORITO SPECIFICATION")
|
||||
if(encoding.GetString(bvd.Value.system_id)[..23] == "EL TORITO SPECIFICATION")
|
||||
{
|
||||
bootSpec = "El Torito";
|
||||
|
||||
@@ -520,11 +520,11 @@ public sealed partial class ISO9660
|
||||
foreach(byte[] erb in refareas)
|
||||
{
|
||||
ReferenceArea er = Marshal.ByteArrayToStructureBigEndian<ReferenceArea>(erb);
|
||||
string extId = Encoding.GetString(erb, Marshal.SizeOf<ReferenceArea>(), er.id_len);
|
||||
string extId = encoding.GetString(erb, Marshal.SizeOf<ReferenceArea>(), er.id_len);
|
||||
|
||||
string extDes = Encoding.GetString(erb, Marshal.SizeOf<ReferenceArea>() + er.id_len, er.des_len);
|
||||
string extDes = encoding.GetString(erb, Marshal.SizeOf<ReferenceArea>() + er.id_len, er.des_len);
|
||||
|
||||
string extSrc = Encoding.GetString(erb, Marshal.SizeOf<ReferenceArea>() + er.id_len + er.des_len,
|
||||
string extSrc = encoding.GetString(erb, Marshal.SizeOf<ReferenceArea>() + er.id_len + er.des_len,
|
||||
er.src_len);
|
||||
|
||||
suspInformation.AppendFormat(Localization.Extension_0, counter).AppendLine();
|
||||
@@ -730,7 +730,7 @@ public sealed partial class ISO9660
|
||||
|
||||
isoMetadata.AppendLine(Localization.Initial_entry);
|
||||
|
||||
isoMetadata.AppendFormat("\t" + Localization.Developer_ID_0, Encoding.GetString(valentry.developer_id)).
|
||||
isoMetadata.AppendFormat("\t" + Localization.Developer_ID_0, encoding.GetString(valentry.developer_id)).
|
||||
AppendLine();
|
||||
|
||||
if(initialEntry.bootable == ElToritoIndicator.Bootable)
|
||||
@@ -799,7 +799,7 @@ public sealed partial class ISO9660
|
||||
isoMetadata.AppendFormat(Localization.Boot_section_0, sectionCounter);
|
||||
|
||||
isoMetadata.
|
||||
AppendFormat("\t" + Localization.Section_ID_0, Encoding.GetString(sectionHeader.identifier)).
|
||||
AppendFormat("\t" + Localization.Section_ID_0, encoding.GetString(sectionHeader.identifier)).
|
||||
AppendLine();
|
||||
|
||||
for(int entryCounter = 1; entryCounter <= sectionHeader.entries && toritoOff < vdSector.Length;
|
||||
|
||||
@@ -66,9 +66,9 @@ public sealed partial class JFS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
var sb = new StringBuilder();
|
||||
uint bootSectors = JFS_BOOT_BLOCKS_SIZE / imagePlugin.Info.SectorSize;
|
||||
ErrorNumber errno = imagePlugin.ReadSector(partition.Start + bootSectors, out byte[] sector);
|
||||
@@ -162,9 +162,9 @@ public sealed partial class JFS
|
||||
DateHandlers.UnixUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec)).AppendLine();
|
||||
|
||||
if(jfsSb.s_version == 1)
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(jfsSb.s_fpack, Encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(jfsSb.s_fpack, encoding)).AppendLine();
|
||||
else
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(jfsSb.s_label, Encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(jfsSb.s_label, encoding)).AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Volume_UUID_0, jfsSb.s_uuid).AppendLine();
|
||||
|
||||
@@ -174,7 +174,7 @@ public sealed partial class JFS
|
||||
Clusters = jfsSb.s_size,
|
||||
ClusterSize = jfsSb.s_bsize,
|
||||
Bootable = true,
|
||||
VolumeName = StringHandlers.CToString(jfsSb.s_version == 1 ? jfsSb.s_fpack : jfsSb.s_label, Encoding),
|
||||
VolumeName = StringHandlers.CToString(jfsSb.s_version == 1 ? jfsSb.s_fpack : jfsSb.s_label, encoding),
|
||||
VolumeSerial = $"{jfsSb.s_uuid}",
|
||||
ModificationDate = DateHandlers.UnixUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec)
|
||||
};
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
// ReSharper disable UnusedMember.Local
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -38,8 +37,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of IBM's Journaled File System</summary>
|
||||
public sealed partial class JFS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.JFS_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -62,9 +62,9 @@ public sealed partial class LIF
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
if(imagePlugin.Info.SectorSize < 256)
|
||||
return;
|
||||
@@ -91,7 +91,7 @@ public sealed partial class LIF
|
||||
sb.AppendFormat(Localization._0_tracks, lifSb.tracks).AppendLine();
|
||||
sb.AppendFormat(Localization._0_heads, lifSb.heads).AppendLine();
|
||||
sb.AppendFormat(Localization._0_sectors, lifSb.sectors).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(lifSb.volumeLabel, Encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(lifSb.volumeLabel, encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_created_on_0, DateHandlers.LifToDateTime(lifSb.creationDate)).AppendLine();
|
||||
|
||||
information = sb.ToString();
|
||||
@@ -102,7 +102,7 @@ public sealed partial class LIF
|
||||
ClusterSize = 256,
|
||||
Clusters = partition.Size / 256,
|
||||
CreationDate = DateHandlers.LifToDateTime(lifSb.creationDate),
|
||||
VolumeName = StringHandlers.CToString(lifSb.volumeLabel, Encoding)
|
||||
VolumeName = StringHandlers.CToString(lifSb.volumeLabel, encoding)
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -27,7 +27,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -37,8 +36,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of the LIF filesystem</summary>
|
||||
public sealed partial class LIF : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.LIF_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -92,7 +92,7 @@ public sealed partial class LisaFS
|
||||
// Do same trick as Mac OS X, replace filesystem '/' with '-',
|
||||
// as '-' is the path separator in Lisa OS
|
||||
contents = (from entry in _catalogCache where entry.parentID == dirId
|
||||
select StringHandlers.CToString(entry.filename, Encoding).Replace('/', '-')).ToList();
|
||||
select StringHandlers.CToString(entry.filename, _encoding).Replace('/', '-')).ToList();
|
||||
|
||||
/// <summary>Reads, interprets and caches the Catalog File</summary>
|
||||
ErrorNumber ReadCatalog()
|
||||
|
||||
@@ -217,7 +217,7 @@ public sealed partial class LisaFS
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filenameLen = {1}", fileId, file.filenameLen);
|
||||
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].filename = {1}", fileId,
|
||||
StringHandlers.CToString(file.filename, Encoding));
|
||||
StringHandlers.CToString(file.filename, _encoding));
|
||||
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown1 = 0x{1:X4}", fileId, file.unknown1);
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].file_uid = 0x{1:X16}", fileId, file.file_uid);
|
||||
@@ -257,7 +257,7 @@ public sealed partial class LisaFS
|
||||
file.password_valid > 0);
|
||||
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].password = {1}", fileId,
|
||||
Encoding.GetString(file.password));
|
||||
_encoding.GetString(file.password));
|
||||
|
||||
AaruConsole.DebugWriteLine("LisaFS plugin", "ExtentFile[{0}].unknown7 = 0x{1:X2}{2:X2}{3:X2}", fileId,
|
||||
file.unknown7[0], file.unknown7[1], file.unknown7[2]);
|
||||
|
||||
@@ -523,7 +523,7 @@ public sealed partial class LisaFS
|
||||
|
||||
foreach(CatalogEntry entry in _catalogCache)
|
||||
{
|
||||
string filename = StringHandlers.CToString(entry.filename, Encoding);
|
||||
string filename = StringHandlers.CToString(entry.filename, _encoding);
|
||||
|
||||
// LisaOS is case insensitive
|
||||
if(string.Compare(wantedFilename, filename, StringComparison.InvariantCultureIgnoreCase) != 0 ||
|
||||
|
||||
@@ -129,7 +129,7 @@ public sealed partial class LisaFS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = new LisaRoman();
|
||||
_encoding = new LisaRoman();
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
var sb = new StringBuilder();
|
||||
@@ -174,12 +174,12 @@ public sealed partial class 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, Encoding);
|
||||
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, Encoding) : "";
|
||||
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);
|
||||
|
||||
@@ -47,6 +47,7 @@ public sealed partial class LisaFS : IReadOnlyFilesystem
|
||||
bool _mounted;
|
||||
SRecord[] _srecords;
|
||||
ulong _volumePrefix;
|
||||
Encoding _encoding;
|
||||
|
||||
/// <inheritdoc />
|
||||
public string Name => "Apple Lisa File System";
|
||||
@@ -55,8 +56,6 @@ public sealed partial class LisaFS : IReadOnlyFilesystem
|
||||
/// <inheritdoc />
|
||||
public Guid Id => new("7E6034D1-D823-4248-A54D-239742B28391");
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
// TODO: Implement Lisa 7/7 namespace (needs decoding {!CATALOG} file)
|
||||
|
||||
@@ -49,8 +49,8 @@ public sealed partial class LisaFS
|
||||
{
|
||||
try
|
||||
{
|
||||
_device = imagePlugin;
|
||||
Encoding = new LisaRoman();
|
||||
_device = imagePlugin;
|
||||
_encoding = new LisaRoman();
|
||||
|
||||
// Lisa OS is unable to work on disks without tags.
|
||||
// This code is designed like that.
|
||||
@@ -105,12 +105,12 @@ public sealed partial class 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, Encoding);
|
||||
_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, Encoding) : "";
|
||||
_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);
|
||||
|
||||
@@ -103,9 +103,9 @@ public sealed partial class Locus
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
if(imagePlugin.Info.SectorSize < 512)
|
||||
return;
|
||||
@@ -156,10 +156,10 @@ public sealed partial class Locus
|
||||
int blockSize = locusSb.s_version == Version.SB_SB4096 ? 4096 : 1024;
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
string s_fsmnt = StringHandlers.CToString(locusSb.s_fsmnt, Encoding);
|
||||
string s_fsmnt = StringHandlers.CToString(locusSb.s_fsmnt, encoding);
|
||||
|
||||
// ReSharper disable once InconsistentNaming
|
||||
string s_fpack = StringHandlers.CToString(locusSb.s_fpack, Encoding);
|
||||
string s_fpack = StringHandlers.CToString(locusSb.s_fpack, encoding);
|
||||
|
||||
AaruConsole.DebugWriteLine("Locus plugin", "LocusSb.s_magic = 0x{0:X8}", locusSb.s_magic);
|
||||
AaruConsole.DebugWriteLine("Locus plugin", "LocusSb.s_gfs = {0}", locusSb.s_gfs);
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
// Commit count
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using commitcnt_t = System.Int32;
|
||||
|
||||
@@ -60,8 +59,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of the Locus filesystem</summary>
|
||||
public sealed partial class Locus : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.Locus_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -68,7 +68,6 @@ public sealed partial class MicroDOS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("koi8-r");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
// ReSharper disable UnusedMember.Local
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -42,8 +41,6 @@ namespace Aaru.Filesystems;
|
||||
/// </summary>
|
||||
public sealed partial class MicroDOS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.MicroDOS_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -84,7 +84,6 @@ public sealed partial class MinixFS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -37,8 +36,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of the MINIX filesystem</summary>
|
||||
public sealed partial class MinixFS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.MinixFS_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -77,9 +77,9 @@ public sealed partial class NILFS2
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.UTF8;
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= Encoding.UTF8;
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
if(imagePlugin.Info.SectorSize < 512)
|
||||
return;
|
||||
@@ -124,7 +124,7 @@ public sealed partial class NILFS2
|
||||
sb.AppendFormat(Localization._0_bytes_per_inode, nilfsSb.inode_size).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_UUID_0, nilfsSb.uuid).AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(nilfsSb.volume_name, Encoding)).
|
||||
sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(nilfsSb.volume_name, encoding)).
|
||||
AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Volume_created_on_0, DateHandlers.UnixUnsignedToDateTime(nilfsSb.ctime)).
|
||||
@@ -142,7 +142,7 @@ public sealed partial class NILFS2
|
||||
{
|
||||
Type = FS_TYPE,
|
||||
ClusterSize = (uint)(1 << (int)(nilfsSb.log_block_size + 10)),
|
||||
VolumeName = StringHandlers.CToString(nilfsSb.volume_name, Encoding),
|
||||
VolumeName = StringHandlers.CToString(nilfsSb.volume_name, encoding),
|
||||
VolumeSerial = nilfsSb.uuid.ToString(),
|
||||
CreationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.ctime),
|
||||
ModificationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.wtime)
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
// ReSharper disable UnusedMember.Local
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -38,8 +37,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of the New Implementation of a Log-structured File System v2</summary>
|
||||
public sealed partial class NILFS2 : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.NILFS2_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -78,7 +78,6 @@ public sealed partial class NTFS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = Encoding.Unicode;
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -37,8 +36,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of the New Technology File System (NTFS)</summary>
|
||||
public sealed partial class NTFS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.NTFS_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -65,7 +65,7 @@ public sealed partial class NintendoPlugin
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("shift_jis");
|
||||
encoding ??= Encoding.GetEncoding("shift_jis");
|
||||
var sbInformation = new StringBuilder();
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
@@ -98,7 +98,7 @@ public sealed partial class NintendoPlugin
|
||||
fields.StreamBufferSize = header[9];
|
||||
byte[] temp = new byte[64];
|
||||
Array.Copy(header, 0x20, temp, 0, 64);
|
||||
fields.Title = StringHandlers.CToString(temp, Encoding);
|
||||
fields.Title = StringHandlers.CToString(temp, encoding);
|
||||
|
||||
if(!wii)
|
||||
{
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -36,8 +35,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of the filesystem used by Nintendo Gamecube and Wii discs</summary>
|
||||
public sealed partial class NintendoPlugin : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.NintendoPlugin_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -101,9 +101,9 @@ public sealed partial class ODS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= Encoding.GetEncoding("iso-8859-1");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
var sb = new StringBuilder();
|
||||
|
||||
@@ -147,7 +147,7 @@ public sealed partial class ODS
|
||||
sb.AppendLine(Localization.This_volume_may_be_corrupted);
|
||||
|
||||
sb.AppendFormat(Localization.Volume_format_is_0,
|
||||
StringHandlers.SpacePaddedToString(homeblock.format, Encoding)).AppendLine();
|
||||
StringHandlers.SpacePaddedToString(homeblock.format, encoding)).AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Volume_is_Level_0_revision_1, (homeblock.struclev & 0xFF00) >> 8,
|
||||
homeblock.struclev & 0xFF).AppendLine();
|
||||
@@ -182,13 +182,13 @@ public sealed partial class ODS
|
||||
if(homeblock is { rvn: > 0, setcount: > 0 } &&
|
||||
StringHandlers.CToString(homeblock.strucname) != " ")
|
||||
sb.AppendFormat(Localization.Volume_is_0_of_1_in_set_2, homeblock.rvn, homeblock.setcount,
|
||||
StringHandlers.SpacePaddedToString(homeblock.strucname, Encoding)).AppendLine();
|
||||
StringHandlers.SpacePaddedToString(homeblock.strucname, encoding)).AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Volume_owner_is_0_ID_1,
|
||||
StringHandlers.SpacePaddedToString(homeblock.ownername, Encoding), homeblock.volowner).
|
||||
StringHandlers.SpacePaddedToString(homeblock.ownername, encoding), homeblock.volowner).
|
||||
AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Volume_label_0, StringHandlers.SpacePaddedToString(homeblock.volname, Encoding)).
|
||||
sb.AppendFormat(Localization.Volume_label_0, StringHandlers.SpacePaddedToString(homeblock.volname, encoding)).
|
||||
AppendLine();
|
||||
|
||||
sb.AppendFormat(Localization.Drive_serial_number_0, homeblock.serialnum).AppendLine();
|
||||
@@ -264,7 +264,7 @@ public sealed partial class ODS
|
||||
Type = FS_TYPE,
|
||||
ClusterSize = (uint)(homeblock.cluster * 512),
|
||||
Clusters = partition.Size / (ulong)(homeblock.cluster * 512),
|
||||
VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, Encoding),
|
||||
VolumeName = StringHandlers.SpacePaddedToString(homeblock.volname, encoding),
|
||||
VolumeSerial = $"{homeblock.serialnum:X8}"
|
||||
};
|
||||
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -49,8 +48,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of DEC's On-Disk Structure, aka the ODS filesystem</summary>
|
||||
public sealed partial class ODS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.ODS_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -136,7 +136,7 @@ public sealed partial class OperaFS
|
||||
while(off + _directoryEntrySize < data.Length)
|
||||
{
|
||||
entry = Marshal.ByteArrayToStructureBigEndian<DirectoryEntry>(data, off, _directoryEntrySize);
|
||||
string name = StringHandlers.CToString(entry.name, Encoding);
|
||||
string name = StringHandlers.CToString(entry.name, _encoding);
|
||||
|
||||
var entryWithPointers = new DirectoryEntryWithPointers
|
||||
{
|
||||
|
||||
@@ -67,7 +67,7 @@ public sealed partial class OperaFS
|
||||
out FileSystem metadata)
|
||||
{
|
||||
// TODO: Find correct default encoding
|
||||
Encoding = Encoding.ASCII;
|
||||
encoding = Encoding.ASCII;
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
var superBlockmetadata = new StringBuilder();
|
||||
@@ -88,14 +88,14 @@ public sealed partial class OperaFS
|
||||
|
||||
superBlockmetadata.AppendFormat(Localization.Opera_filesystem_disc).AppendLine();
|
||||
|
||||
if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_label, Encoding)))
|
||||
if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_label, encoding)))
|
||||
superBlockmetadata.
|
||||
AppendFormat(Localization.Volume_label_0, StringHandlers.CToString(sb.volume_label, Encoding)).
|
||||
AppendFormat(Localization.Volume_label_0, StringHandlers.CToString(sb.volume_label, encoding)).
|
||||
AppendLine();
|
||||
|
||||
if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_comment, Encoding)))
|
||||
if(!string.IsNullOrEmpty(StringHandlers.CToString(sb.volume_comment, encoding)))
|
||||
superBlockmetadata.
|
||||
AppendFormat(Localization.Volume_comment_0, StringHandlers.CToString(sb.volume_comment, Encoding)).
|
||||
AppendFormat(Localization.Volume_comment_0, StringHandlers.CToString(sb.volume_comment, encoding)).
|
||||
AppendLine();
|
||||
|
||||
superBlockmetadata.AppendFormat(Localization.Volume_identifier_0_X8, sb.volume_id).AppendLine();
|
||||
@@ -135,7 +135,7 @@ public sealed partial class OperaFS
|
||||
metadata = new FileSystem
|
||||
{
|
||||
Type = FS_TYPE,
|
||||
VolumeName = StringHandlers.CToString(sb.volume_label, Encoding),
|
||||
VolumeName = StringHandlers.CToString(sb.volume_label, encoding),
|
||||
ClusterSize = sb.block_size,
|
||||
Clusters = sb.block_count
|
||||
};
|
||||
|
||||
@@ -47,9 +47,8 @@ public sealed partial class OperaFS : IReadOnlyFilesystem
|
||||
Dictionary<string, DirectoryEntryWithPointers> _rootDirectoryCache;
|
||||
FileSystemInfo _statfs;
|
||||
uint _volumeBlockSizeRatio;
|
||||
Encoding _encoding;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public FileSystem Metadata { get; private set; }
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -44,7 +44,7 @@ public sealed partial class OperaFS
|
||||
Dictionary<string, string> options, string @namespace)
|
||||
{
|
||||
// TODO: Find correct default encoding
|
||||
Encoding = Encoding.ASCII;
|
||||
_encoding = Encoding.ASCII;
|
||||
|
||||
options ??= GetDefaultOptions();
|
||||
|
||||
@@ -73,7 +73,7 @@ public sealed partial class OperaFS
|
||||
Metadata = new FileSystem
|
||||
{
|
||||
Type = FS_TYPE,
|
||||
VolumeName = StringHandlers.CToString(sb.volume_label, Encoding),
|
||||
VolumeName = StringHandlers.CToString(sb.volume_label, _encoding),
|
||||
ClusterSize = sb.block_size,
|
||||
Clusters = sb.block_count,
|
||||
Bootable = true,
|
||||
|
||||
@@ -64,7 +64,6 @@ public sealed partial class PCEnginePlugin
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("shift_jis");
|
||||
information = "";
|
||||
|
||||
metadata = new FileSystem
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -40,8 +39,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of the PC-Engine CD file headers</summary>
|
||||
public sealed partial class PCEnginePlugin : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.PCEnginePlugin_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -67,7 +67,7 @@ public sealed partial class PCFX
|
||||
out FileSystem metadata)
|
||||
{
|
||||
// Always Shift-JIS
|
||||
Encoding = Encoding.GetEncoding("shift_jis");
|
||||
encoding = Encoding.GetEncoding("shift_jis");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
|
||||
@@ -83,7 +83,7 @@ public sealed partial class PCFX
|
||||
|
||||
try
|
||||
{
|
||||
date = Encoding.GetString(header.date);
|
||||
date = encoding.GetString(header.date);
|
||||
int year = int.Parse(date[..4]);
|
||||
int month = int.Parse(date.Substring(4, 2));
|
||||
int day = int.Parse(date.Substring(6, 2));
|
||||
@@ -96,11 +96,11 @@ public sealed partial class PCFX
|
||||
|
||||
var sb = new StringBuilder();
|
||||
sb.AppendLine(Localization.PC_FX_executable);
|
||||
sb.AppendFormat(Localization.Identifier_0, StringHandlers.CToString(header.signature, Encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Copyright_0, StringHandlers.CToString(header.copyright, Encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Title_0, StringHandlers.CToString(header.title, Encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Maker_ID_0, StringHandlers.CToString(header.makerId, Encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Maker_name_0, StringHandlers.CToString(header.makerName, Encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Identifier_0, StringHandlers.CToString(header.signature, encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Copyright_0, StringHandlers.CToString(header.copyright, encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Title_0, StringHandlers.CToString(header.title, encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Maker_ID_0, StringHandlers.CToString(header.makerId, encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Maker_name_0, StringHandlers.CToString(header.makerName, encoding)).AppendLine();
|
||||
sb.AppendFormat(Localization.Volume_number_0, header.volumeNumber).AppendLine();
|
||||
sb.AppendFormat(Localization.Country_code_0, header.country).AppendLine();
|
||||
sb.AppendFormat(Localization.Version_0_1, header.minorVersion, header.majorVersion).AppendLine();
|
||||
@@ -121,8 +121,8 @@ public sealed partial class PCFX
|
||||
ClusterSize = 2048,
|
||||
Bootable = true,
|
||||
CreationDate = date != null ? dateTime : null,
|
||||
PublisherIdentifier = StringHandlers.CToString(header.makerName, Encoding),
|
||||
VolumeName = StringHandlers.CToString(header.title, Encoding),
|
||||
PublisherIdentifier = StringHandlers.CToString(header.makerName, encoding),
|
||||
VolumeName = StringHandlers.CToString(header.title, encoding),
|
||||
SystemIdentifier = "PC-FX"
|
||||
};
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -41,8 +40,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of NEC PC-FX headers</summary>
|
||||
public sealed partial class PCFX : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.PCFX_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -61,9 +61,9 @@ public sealed partial class PFS
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
information = "";
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1");
|
||||
metadata = new FileSystem();
|
||||
information = "";
|
||||
encoding ??= Encoding.GetEncoding("iso-8859-1");
|
||||
metadata = new FileSystem();
|
||||
ErrorNumber errno = imagePlugin.ReadSector(2 + partition.Start, out byte[] rootBlockSector);
|
||||
|
||||
if(errno != ErrorNumber.NoError)
|
||||
@@ -101,7 +101,7 @@ public sealed partial class PFS
|
||||
sbInformation.AppendLine();
|
||||
|
||||
sbInformation.
|
||||
AppendFormat(Localization.Volume_name_0, StringHandlers.PascalToString(rootBlock.diskname, Encoding)).
|
||||
AppendFormat(Localization.Volume_name_0, StringHandlers.PascalToString(rootBlock.diskname, encoding)).
|
||||
AppendLine();
|
||||
|
||||
sbInformation.
|
||||
@@ -124,6 +124,6 @@ public sealed partial class PFS
|
||||
metadata.FreeClusters = rootBlock.blocksfree;
|
||||
metadata.Clusters = rootBlock.diskSize;
|
||||
metadata.ClusterSize = imagePlugin.Info.SectorSize;
|
||||
metadata.VolumeName = StringHandlers.PascalToString(rootBlock.diskname, Encoding);
|
||||
metadata.VolumeName = StringHandlers.PascalToString(rootBlock.diskname, encoding);
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,6 @@
|
||||
// ReSharper disable UnusedType.Local
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -38,8 +37,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of the Professional File System</summary>
|
||||
public sealed partial class PFS : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.PFS_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -131,9 +131,9 @@ public sealed partial class ProDOSPlugin
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? new Apple2c();
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
encoding ??= new Apple2c();
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
var sbInformation = new StringBuilder();
|
||||
uint multiplier = (uint)(imagePlugin.Info.SectorSize == 256 ? 2 : 1);
|
||||
|
||||
@@ -179,7 +179,7 @@ public sealed partial class ProDOSPlugin
|
||||
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 = Encoding.GetString(temporal);
|
||||
rootDirectoryKeyBlock.header.volume_name = encoding.GetString(temporal);
|
||||
rootDirectoryKeyBlock.header.reserved = BitConverter.ToUInt64(rootDirectoryKeyBlockBytes, 0x14);
|
||||
|
||||
ushort tempTimestampLeft = BitConverter.ToUInt16(rootDirectoryKeyBlockBytes, 0x1C);
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -41,8 +40,6 @@ namespace Aaru.Filesystems;
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local"), SuppressMessage("ReSharper", "UnusedType.Local")]
|
||||
public sealed partial class ProDOSPlugin : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.ProDOSPlugin_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -87,7 +87,6 @@ public sealed partial class QNX4
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
ErrorNumber errno = imagePlugin.ReadSector(partition.Start + 1, out byte[] sector);
|
||||
|
||||
@@ -28,7 +28,6 @@
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -38,8 +37,6 @@ namespace Aaru.Filesystems;
|
||||
[SuppressMessage("ReSharper", "UnusedType.Local")]
|
||||
public sealed partial class QNX4 : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.QNX4_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -72,7 +72,6 @@ public sealed partial class QNX6
|
||||
public void GetInformation(IMediaImage imagePlugin, Partition partition, Encoding encoding, out string information,
|
||||
out FileSystem metadata)
|
||||
{
|
||||
Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15");
|
||||
information = "";
|
||||
metadata = new FileSystem();
|
||||
var sb = new StringBuilder();
|
||||
|
||||
@@ -27,7 +27,6 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.Filesystems;
|
||||
@@ -36,8 +35,6 @@ namespace Aaru.Filesystems;
|
||||
/// <summary>Implements detection of QNX 6 filesystem</summary>
|
||||
public sealed partial class QNX6 : IFilesystem
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Encoding Encoding { get; private set; }
|
||||
/// <inheritdoc />
|
||||
public string Name => Localization.QNX6_Name;
|
||||
/// <inheritdoc />
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user