Move all localizable strings from Aaru.Filesystems project to resources.

This commit is contained in:
2022-11-28 02:59:53 +00:00
parent 119ceea01d
commit c67c6dcc8f
108 changed files with 13507 additions and 2025 deletions

View File

@@ -82,7 +82,7 @@ public sealed partial class FAT
if(useHumanBpb)
{
AaruConsole.DebugWriteLine("FAT plugin", "Using Human68k BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_Human68k_BPB);
fakeBpb.jump = humanBpb.jump;
fakeBpb.oem_name = humanBpb.oem_name;
@@ -190,7 +190,7 @@ public sealed partial class FAT
fat32Bpb is { spfat: 0, signature: 0x29 } &&
Encoding.ASCII.GetString(fat32Bpb.fs_type) == "FAT32 ")
{
AaruConsole.DebugWriteLine("FAT plugin", "Using FAT32 BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_FAT32_BPB);
minBootNearJump = 0x58;
return BpbKind.LongFat32;
@@ -200,7 +200,7 @@ public sealed partial class FAT
correctSpcFat32Short &&
shortFat32Bpb is { fats_no: <= 2, sectors: 0 } and { spfat: 0, signature: 0x28 })
{
AaruConsole.DebugWriteLine("FAT plugin", "Using short FAT32 BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_short_FAT32_BPB);
minBootNearJump = 0x57;
@@ -214,7 +214,7 @@ public sealed partial class FAT
msxBpb.spfat > 0 &&
Encoding.ASCII.GetString(msxBpb.vol_id) == "VOL_ID")
{
AaruConsole.DebugWriteLine("FAT plugin", "Using MSX BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_MSX_BPB);
useMsxBpb = true;
}
else if(bitsInBpsApricot == 1 &&
@@ -224,7 +224,7 @@ public sealed partial class FAT
apricotBpb.mainBPB.spfat > 0 &&
apricotBpb.partitionCount == 0)
{
AaruConsole.DebugWriteLine("FAT plugin", "Using Apricot BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_Apricot_BPB);
useApricotBpb = true;
}
else if(bitsInBpsDos40 == 1 &&
@@ -238,13 +238,13 @@ public sealed partial class FAT
if(ebpb.big_sectors <= partition.End - partition.Start + 1)
if(ebpb.signature == 0x29 || andosOemCorrect)
{
AaruConsole.DebugWriteLine("FAT plugin", "Using DOS 4.0 BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_DOS_4_0_BPB);
useExtendedBpb = true;
minBootNearJump = 0x3C;
}
else
{
AaruConsole.DebugWriteLine("FAT plugin", "Using DOS 3.4 BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_DOS_3_4_BPB);
userShortExtendedBpb = true;
minBootNearJump = 0x29;
}
@@ -252,13 +252,13 @@ public sealed partial class FAT
else if(ebpb.sectors <= partition.End - partition.Start + 1)
if(ebpb.signature == 0x29 || andosOemCorrect)
{
AaruConsole.DebugWriteLine("FAT plugin", "Using DOS 4.0 BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_DOS_4_0_BPB);
useExtendedBpb = true;
minBootNearJump = 0x3C;
}
else
{
AaruConsole.DebugWriteLine("FAT plugin", "Using DOS 3.4 BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_DOS_3_4_BPB);
userShortExtendedBpb = true;
minBootNearJump = 0x29;
}
@@ -273,7 +273,7 @@ public sealed partial class FAT
dos33Bpb.big_sectors > 0 &&
dos33Bpb.big_sectors <= partition.End - partition.Start + 1)
{
AaruConsole.DebugWriteLine("FAT plugin", "Using DOS 3.3 BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_DOS_3_3_BPB);
useDos33Bpb = true;
minBootNearJump = 0x22;
}
@@ -286,12 +286,12 @@ public sealed partial class FAT
Encoding.ASCII.GetString(dos33Bpb.oem_name) != "NEXT ") ||
partition.Type is "GEM" or "BGM")
{
AaruConsole.DebugWriteLine("FAT plugin", "Using Atari BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_Atari_BPB);
useAtariBpb = true;
}
else
{
AaruConsole.DebugWriteLine("FAT plugin", "Using DOS 3.3 BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_DOS_3_3_BPB);
useDos33Bpb = true;
minBootNearJump = 0x22;
}
@@ -300,7 +300,7 @@ public sealed partial class FAT
if(dos32Bpb.hsectors <= partition.Start &&
dos32Bpb.hsectors + dos32Bpb.sectors == dos32Bpb.total_sectors)
{
AaruConsole.DebugWriteLine("FAT plugin", "Using DOS 3.2 BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_DOS_3_2_BPB);
useDos32Bpb = true;
minBootNearJump = 0x1E;
}
@@ -310,12 +310,12 @@ public sealed partial class FAT
(atariBpb.jump[0] == 0xE9 && atariBpb.jump[1] == 0x00 &&
Encoding.ASCII.GetString(dos33Bpb.oem_name) != "NEXT "))
{
AaruConsole.DebugWriteLine("FAT plugin", "Using Atari BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_Atari_BPB);
useAtariBpb = true;
}
else
{
AaruConsole.DebugWriteLine("FAT plugin", "Using DOS 3.0 BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_DOS_3_0_BPB);
useDos3Bpb = true;
minBootNearJump = 0x1C;
}
@@ -325,12 +325,12 @@ public sealed partial class FAT
(atariBpb.jump[0] == 0xE9 && atariBpb.jump[1] == 0x00 &&
Encoding.ASCII.GetString(dos33Bpb.oem_name) != "NEXT "))
{
AaruConsole.DebugWriteLine("FAT plugin", "Using Atari BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_Atari_BPB);
useAtariBpb = true;
}
else
{
AaruConsole.DebugWriteLine("FAT plugin", "Using DOS 2.0 BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_DOS_2_0_BPB);
useDos2Bpb = true;
minBootNearJump = 0x16;
}
@@ -400,7 +400,7 @@ public sealed partial class FAT
fat1Sector0[1] == 0xFF &&
validRootDir)
{
AaruConsole.DebugWriteLine("FAT plugin", "Using DEC Rainbow hardcoded BPB.");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_DEC_Rainbow_hardcoded_BPB);
fakeBpb.bps = 512;
fakeBpb.spc = 1;
fakeBpb.rsectors = 20;
@@ -440,7 +440,7 @@ public sealed partial class FAT
case 0xE5:
if(imagePlugin.Info is { Sectors: 2002, SectorSize: 128 })
{
AaruConsole.DebugWriteLine("FAT plugin", "Using hardcoded BPB.");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_hardcoded_BPB);
fakeBpb.bps = 128;
fakeBpb.spc = 4;
fakeBpb.rsectors = 1;
@@ -459,7 +459,7 @@ public sealed partial class FAT
switch(imagePlugin.Info.Sectors)
{
case 4004 when imagePlugin.Info.SectorSize == 128:
AaruConsole.DebugWriteLine("FAT plugin", "Using hardcoded BPB.");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_hardcoded_BPB);
fakeBpb.bps = 128;
fakeBpb.spc = 4;
fakeBpb.rsectors = 4;
@@ -474,7 +474,7 @@ public sealed partial class FAT
break;
case 2002 when imagePlugin.Info.SectorSize == 128:
AaruConsole.DebugWriteLine("FAT plugin", "Using hardcoded BPB.");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_hardcoded_BPB);
fakeBpb.bps = 128;
fakeBpb.spc = 4;
fakeBpb.rsectors = 4;
@@ -495,7 +495,7 @@ public sealed partial class FAT
switch(imagePlugin.Info.Sectors)
{
case 320 when imagePlugin.Info.SectorSize == 512:
AaruConsole.DebugWriteLine("FAT plugin", "Using hardcoded BPB for 5.25\" SSDD.");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_hardcoded_BPB_for_5_25_SSDD);
fakeBpb.bps = 512;
fakeBpb.spc = 1;
fakeBpb.rsectors = 1;
@@ -510,7 +510,7 @@ public sealed partial class FAT
break;
case 2002 when imagePlugin.Info.SectorSize == 128:
AaruConsole.DebugWriteLine("FAT plugin", "Using hardcoded BPB.");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_hardcoded_BPB);
fakeBpb.bps = 128;
fakeBpb.spc = 4;
fakeBpb.rsectors = 1;
@@ -525,7 +525,7 @@ public sealed partial class FAT
break;
case 1232 when imagePlugin.Info.SectorSize == 1024:
AaruConsole.DebugWriteLine("FAT plugin", "Using hardcoded BPB.");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_hardcoded_BPB);
fakeBpb.bps = 1024;
fakeBpb.spc = 1;
fakeBpb.rsectors = 1;
@@ -540,7 +540,7 @@ public sealed partial class FAT
break;
case 616 when imagePlugin.Info.SectorSize == 1024:
AaruConsole.DebugWriteLine("FAT plugin", "Using hardcoded BPB.");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_hardcoded_BPB);
fakeBpb.bps = 1024;
fakeBpb.spc = 1;
fakeBpb.rsectors = 1;
@@ -554,7 +554,7 @@ public sealed partial class FAT
break;
case 720 when imagePlugin.Info.SectorSize == 128:
AaruConsole.DebugWriteLine("FAT plugin", "Using hardcoded BPB.");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_hardcoded_BPB);
fakeBpb.bps = 128;
fakeBpb.spc = 2;
fakeBpb.rsectors = 54;
@@ -569,7 +569,7 @@ public sealed partial class FAT
break;
case 640 when imagePlugin.Info.SectorSize == 512:
AaruConsole.DebugWriteLine("FAT plugin", "Using hardcoded BPB for 5.25\" DSDD.");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_hardcoded_BPB_for_5_25_DSDD);
fakeBpb.bps = 512;
fakeBpb.spc = 2;
fakeBpb.rsectors = 1;
@@ -589,7 +589,7 @@ public sealed partial class FAT
case 0xFF:
if(imagePlugin.Info is { Sectors: 640, SectorSize: 512 })
{
AaruConsole.DebugWriteLine("FAT plugin", "Using hardcoded BPB for 5.25\" DSDD.");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Using_hardcoded_BPB_for_5_25_DSDD);
fakeBpb.bps = 512;
fakeBpb.spc = 2;
fakeBpb.rsectors = 1;

View File

@@ -220,4 +220,9 @@ public sealed partial class FAT
/// <summary>FAT32.IFS &gt;= 0.97 indicator for critical EAs present</summary>
CriticalEa = 0x80
}
const string FS_TYPE_FAT_PLUS = "fatplus";
const string FS_TYPE_FAT32 = "fat32";
const string FS_TYPE_FAT16 = "fat16";
const string FS_TYPE_FAT12 = "fat12";
}

View File

@@ -247,7 +247,7 @@ public sealed partial class FAT
if(name == "" &&
extension == "")
{
AaruConsole.DebugWriteLine("FAT filesystem", "Found empty filename in {0}", path);
AaruConsole.DebugWriteLine("FAT filesystem", Localization.Found_empty_filename_in_0, path);
if(!_debug ||
dirent is { size: > 0, start_cluster: 0 })

View File

@@ -72,11 +72,11 @@ public sealed partial class FAT : IReadOnlyFilesystem
/// <inheritdoc />
public Encoding Encoding { get; private set; }
/// <inheritdoc />
public string Name => "Microsoft File Allocation Table";
public string Name => Localization.FAT_Name;
/// <inheritdoc />
public Guid Id => new("33513B2C-0D26-0D2D-32C3-79D8611158E0");
/// <inheritdoc />
public string Author => "Natalia Portillo";
public string Author => Authors.NataliaPortillo;
/// <inheritdoc />
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
@@ -86,19 +86,19 @@ public sealed partial class FAT : IReadOnlyFilesystem
public Dictionary<string, string> Namespaces => new()
{
{
"dos", "DOS (8.3 all uppercase)"
"dos", Localization.DOS_8_3_all_uppercase
},
{
"nt", "Windows NT (8.3 mixed case)"
"nt", Localization.Windows_NT_8_3_mixed_case
},
{
"os2", "OS/2 .LONGNAME extended attribute"
"os2", Localization.OS2_LONGNAME_extended_attribute
},
{
"ecs", "Use LFN when available with fallback to .LONGNAME (default)"
"ecs", Localization.Use_LFN_when_available_with_fallback_to_LONGNAME_default
},
{
"lfn", "Long file names"
"lfn", Localization.Long_file_names
}
};

View File

@@ -407,7 +407,7 @@ public sealed partial class FAT
fat2SectorNo == 0)
return false;
AaruConsole.DebugWriteLine("FAT plugin", "2nd fat starts at = {0}", fat2SectorNo);
AaruConsole.DebugWriteLine("FAT plugin", Localization.Second_fat_starts_at_0, fat2SectorNo);
errno = imagePlugin.ReadSector(fat2SectorNo, out byte[] fat2Sector);
@@ -489,95 +489,99 @@ public sealed partial class FAT
if(fat32Bpb.version != 0)
{
sb.AppendLine("FAT+");
XmlFsType.Type = "FAT+";
sb.AppendLine(Localization.FAT_Plus);
XmlFsType.Type = FS_TYPE_FAT_PLUS;
}
else
{
sb.AppendLine("Microsoft FAT32");
XmlFsType.Type = "FAT32";
sb.AppendLine(Localization.Microsoft_FAT32);
XmlFsType.Type = FS_TYPE_FAT32;
}
if(fat32Bpb.oem_name != null)
if(fat32Bpb.oem_name[5] == 0x49 &&
fat32Bpb.oem_name[6] == 0x48 &&
fat32Bpb.oem_name[7] == 0x43)
sb.AppendLine("Volume has been modified by Windows 9x/Me Volume Tracker.");
sb.AppendLine(Localization.Volume_has_been_modified_by_Windows_9x_Me_Volume_Tracker);
else
XmlFsType.SystemIdentifier = StringHandlers.CToString(fat32Bpb.oem_name);
if(!string.IsNullOrEmpty(XmlFsType.SystemIdentifier))
sb.AppendFormat("OEM Name: {0}", XmlFsType.SystemIdentifier.Trim()).AppendLine();
sb.AppendFormat(Localization.OEM_name_0, XmlFsType.SystemIdentifier.Trim()).AppendLine();
sb.AppendFormat("{0} bytes per sector.", fat32Bpb.bps).AppendLine();
sb.AppendFormat("{0} sectors per cluster.", fat32Bpb.spc).AppendLine();
sb.AppendFormat(Localization._0_bytes_per_sector, fat32Bpb.bps).AppendLine();
sb.AppendFormat(Localization._0_sectors_per_cluster, fat32Bpb.spc).AppendLine();
XmlFsType.ClusterSize = (uint)(fat32Bpb.bps * fat32Bpb.spc);
sb.AppendFormat("{0} sectors reserved between BPB and FAT.", fat32Bpb.rsectors).AppendLine();
sb.AppendFormat(Localization._0_sectors_reserved_between_BPB_and_FAT, fat32Bpb.rsectors).AppendLine();
if(fat32Bpb is { big_sectors: 0, signature: 0x28 })
{
sb.AppendFormat("{0} sectors on volume ({1} bytes).", shortFat32Bpb.huge_sectors,
sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes, shortFat32Bpb.huge_sectors,
shortFat32Bpb.huge_sectors * shortFat32Bpb.bps).AppendLine();
XmlFsType.Clusters = shortFat32Bpb.huge_sectors / shortFat32Bpb.spc;
}
else if(fat32Bpb.sectors == 0)
{
sb.AppendFormat("{0} sectors on volume ({1} bytes).", fat32Bpb.big_sectors,
sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes, fat32Bpb.big_sectors,
fat32Bpb.big_sectors * fat32Bpb.bps).AppendLine();
XmlFsType.Clusters = fat32Bpb.big_sectors / fat32Bpb.spc;
}
else
{
sb.AppendFormat("{0} sectors on volume ({1} bytes).", fat32Bpb.sectors,
sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes, fat32Bpb.sectors,
fat32Bpb.sectors * fat32Bpb.bps).AppendLine();
XmlFsType.Clusters = (ulong)(fat32Bpb.sectors / fat32Bpb.spc);
}
sb.AppendFormat("{0} clusters on volume.", XmlFsType.Clusters).AppendLine();
sb.AppendFormat("Media descriptor: 0x{0:X2}", fat32Bpb.media).AppendLine();
sb.AppendFormat("{0} sectors per FAT.", fat32Bpb.big_spfat).AppendLine();
sb.AppendFormat("{0} sectors per track.", fat32Bpb.sptrk).AppendLine();
sb.AppendFormat("{0} heads.", fat32Bpb.heads).AppendLine();
sb.AppendFormat("{0} hidden sectors before BPB.", fat32Bpb.hsectors).AppendLine();
sb.AppendFormat("Cluster of root directory: {0}", fat32Bpb.root_cluster).AppendLine();
sb.AppendFormat("Sector of FSINFO structure: {0}", fat32Bpb.fsinfo_sector).AppendLine();
sb.AppendFormat("Sector of backup FAT32 parameter block: {0}", fat32Bpb.backup_sector).AppendLine();
sb.AppendFormat("Drive number: 0x{0:X2}", fat32Bpb.drive_no).AppendLine();
sb.AppendFormat("Volume Serial Number: 0x{0:X8}", fat32Bpb.serial_no).AppendLine();
sb.AppendFormat(Localization._0_clusters_on_volume, XmlFsType.Clusters).AppendLine();
sb.AppendFormat(Localization.Media_descriptor_0, fat32Bpb.media).AppendLine();
sb.AppendFormat(Localization._0_sectors_per_FAT, fat32Bpb.big_spfat).AppendLine();
sb.AppendFormat(Localization._0_sectors_per_track, fat32Bpb.sptrk).AppendLine();
sb.AppendFormat(Localization._0_heads, fat32Bpb.heads).AppendLine();
sb.AppendFormat(Localization._0_hidden_sectors_before_BPB, fat32Bpb.hsectors).AppendLine();
sb.AppendFormat(Localization.Cluster_of_root_directory_0, fat32Bpb.root_cluster).AppendLine();
sb.AppendFormat(Localization.Sector_of_FSINFO_structure_0, fat32Bpb.fsinfo_sector).AppendLine();
sb.AppendFormat(Localization.Sector_of_backup_FAT32_parameter_block_0, fat32Bpb.backup_sector).
AppendLine();
sb.AppendFormat(Localization.Drive_number_0, fat32Bpb.drive_no).AppendLine();
sb.AppendFormat(Localization.Volume_Serial_Number_0, fat32Bpb.serial_no).AppendLine();
XmlFsType.VolumeSerial = $"{fat32Bpb.serial_no:X8}";
if((fat32Bpb.flags & 0xF8) == 0x00)
{
if((fat32Bpb.flags & 0x01) == 0x01)
{
sb.AppendLine("Volume should be checked on next mount.");
sb.AppendLine(Localization.Volume_should_be_checked_on_next_mount);
XmlFsType.Dirty = true;
}
if((fat32Bpb.flags & 0x02) == 0x02)
sb.AppendLine("Disk surface should be on next mount.");
sb.AppendLine(Localization.Disk_surface_should_be_on_next_mount);
}
if((fat32Bpb.mirror_flags & 0x80) == 0x80)
sb.AppendFormat("FATs are out of sync. FAT #{0} is in use.", fat32Bpb.mirror_flags & 0xF).
sb.AppendFormat(Localization.FATs_are_out_of_sync_FAT_0_is_in_use, fat32Bpb.mirror_flags & 0xF).
AppendLine();
else
sb.AppendLine("All copies of FAT are the same.");
sb.AppendLine(Localization.All_copies_of_FAT_are_the_same);
if((fat32Bpb.mirror_flags & 0x6F20) == 0x6F20)
sb.AppendLine("DR-DOS will boot this FAT32 using CHS.");
sb.AppendLine(Localization.DR_DOS_will_boot_this_FAT32_using_CHS);
else if((fat32Bpb.mirror_flags & 0x4F20) == 0x4F20)
sb.AppendLine("DR-DOS will boot this FAT32 using LBA.");
sb.AppendLine(Localization.DR_DOS_will_boot_this_FAT32_using_LBA);
if(fat32Bpb.signature == 0x29)
{
XmlFsType.VolumeName = StringHandlers.SpacePaddedToString(fat32Bpb.volume_label, Encoding);
XmlFsType.VolumeName = XmlFsType.VolumeName?.Replace("\0", "");
sb.AppendFormat("Filesystem type: {0}", Encoding.ASCII.GetString(fat32Bpb.fs_type)).AppendLine();
sb.AppendFormat(Localization.Filesystem_type_0, Encoding.ASCII.GetString(fat32Bpb.fs_type)).
AppendLine();
bootChk = Sha1Context.Data(fat32Bpb.boot_code, out _);
}
@@ -615,13 +619,13 @@ public sealed partial class FAT
{
if(fsInfo.free_clusters < 0xFFFFFFFF)
{
sb.AppendFormat("{0} free clusters", fsInfo.free_clusters).AppendLine();
sb.AppendFormat(Localization._0_free_clusters, fsInfo.free_clusters).AppendLine();
XmlFsType.FreeClusters = fsInfo.free_clusters;
XmlFsType.FreeClustersSpecified = true;
}
if(fsInfo.last_cluster is > 2 and < 0xFFFFFFFF)
sb.AppendFormat("Last allocated cluster {0}", fsInfo.last_cluster).AppendLine();
sb.AppendFormat(Localization.Last_allocated_cluster_0, fsInfo.last_cluster).AppendLine();
}
}
@@ -642,13 +646,13 @@ public sealed partial class FAT
XmlFsType.Bootable = true;
var atariSb = new StringBuilder();
atariSb.AppendFormat("cmdload will be loaded with value {0:X4}h",
atariSb.AppendFormat(Localization.cmdload_will_be_loaded_with_value_0,
BigEndianBitConverter.ToUInt16(bpbSector, 0x01E)).AppendLine();
atariSb.AppendFormat("Boot program will be loaded at address {0:X4}h", atariBpb.ldaaddr).
atariSb.AppendFormat(Localization.Boot_program_will_be_loaded_at_address_0, atariBpb.ldaaddr).
AppendLine();
atariSb.AppendFormat("FAT and directory will be cached at address {0:X4}h", atariBpb.fatbuf).
atariSb.AppendFormat(Localization.FAT_and_directory_will_be_cached_at_address_0, atariBpb.fatbuf).
AppendLine();
if(atariBpb.ldmode == 0)
@@ -666,10 +670,10 @@ public sealed partial class FAT
else
filename = fname + "." + extension;
atariSb.AppendFormat("Boot program resides in file \"{0}\"", filename).AppendLine();
atariSb.AppendFormat(Localization.Boot_program_resides_in_file_0, filename).AppendLine();
}
else
atariSb.AppendFormat("Boot program starts in sector {0} and is {1} sectors long ({2} bytes)",
atariSb.AppendFormat(Localization.Boot_program_starts_in_sector_0_and_is_1_sectors_long_2_bytes,
atariBpb.ssect, atariBpb.sectcnt, atariBpb.sectcnt * atariBpb.bps).
AppendLine();
@@ -785,35 +789,35 @@ public sealed partial class FAT
switch(bpbKind)
{
case BpbKind.Atari:
sb.AppendLine("Atari FAT12");
sb.AppendLine(Localization.Atari_FAT12);
break;
case BpbKind.Apricot:
sb.AppendLine("Apricot FAT12");
sb.AppendLine(Localization.Apricot_FAT12);
break;
case BpbKind.Human:
sb.AppendLine("Human68k FAT12");
sb.AppendLine(Localization.Human68k_FAT12);
break;
default:
sb.AppendLine("Microsoft FAT12");
sb.AppendLine(Localization.Microsoft_FAT12);
break;
}
XmlFsType.Type = "FAT12";
XmlFsType.Type = FS_TYPE_FAT12;
}
else if(isFat16)
{
sb.AppendLine(bpbKind switch
{
BpbKind.Atari => "Atari FAT16",
BpbKind.Human => "Human68k FAT16",
_ => "Microsoft FAT16"
BpbKind.Atari => Localization.Atari_FAT16,
BpbKind.Human => Localization.Human68k_FAT16,
_ => Localization.Microsoft_FAT16
});
XmlFsType.Type = "FAT16";
XmlFsType.Type = FS_TYPE_FAT12;
}
if(bpbKind == BpbKind.Atari)
@@ -821,7 +825,7 @@ public sealed partial class FAT
if(atariBpb.serial_no[0] == 0x49 &&
atariBpb.serial_no[1] == 0x48 &&
atariBpb.serial_no[2] == 0x43)
sb.AppendLine("Volume has been modified by Windows 9x/Me Volume Tracker.");
sb.AppendLine(Localization.Volume_has_been_modified_by_Windows_9x_Me_Volume_Tracker);
else
XmlFsType.VolumeSerial = $"{atariBpb.serial_no[0]:X2}{atariBpb.serial_no[1]:X2}{
atariBpb.serial_no[2]:X2}";
@@ -836,7 +840,7 @@ public sealed partial class FAT
if(fakeBpb.oem_name[5] == 0x49 &&
fakeBpb.oem_name[6] == 0x48 &&
fakeBpb.oem_name[7] == 0x43)
sb.AppendLine("Volume has been modified by Windows 9x/Me Volume Tracker.");
sb.AppendLine(Localization.Volume_has_been_modified_by_Windows_9x_Me_Volume_Tracker);
else
XmlFsType.SystemIdentifier = fakeBpb.oem_name[0] switch
{
@@ -868,74 +872,76 @@ public sealed partial class FAT
}
if(XmlFsType.SystemIdentifier != null)
sb.AppendFormat("OEM Name: {0}", XmlFsType.SystemIdentifier.Trim()).AppendLine();
sb.AppendFormat(Localization.OEM_name_0, XmlFsType.SystemIdentifier.Trim()).AppendLine();
sb.AppendFormat("{0} bytes per sector.", fakeBpb.bps).AppendLine();
sb.AppendFormat(Localization._0_bytes_per_sector, fakeBpb.bps).AppendLine();
if(bpbKind != BpbKind.Human)
if(fakeBpb.sectors == 0)
sb.AppendFormat("{0} sectors on volume ({1} bytes).", fakeBpb.big_sectors,
sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes, fakeBpb.big_sectors,
fakeBpb.big_sectors * fakeBpb.bps).AppendLine();
else
sb.AppendFormat("{0} sectors on volume ({1} bytes).", fakeBpb.sectors,
sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes, fakeBpb.sectors,
fakeBpb.sectors * fakeBpb.bps).AppendLine();
else
sb.AppendFormat("{0} sectors on volume ({1} bytes).",
sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes,
clusters * humanBpb.bpc / imagePlugin.Info.SectorSize, clusters * humanBpb.bpc).
AppendLine();
XmlFsType.Clusters = clusters;
sb.AppendFormat("{0} sectors per cluster.", fakeBpb.spc).AppendLine();
sb.AppendFormat("{0} clusters on volume.", XmlFsType.Clusters).AppendLine();
sb.AppendFormat(Localization._0_sectors_per_cluster, fakeBpb.spc).AppendLine();
sb.AppendFormat(Localization._0_clusters_on_volume, XmlFsType.Clusters).AppendLine();
XmlFsType.ClusterSize = (uint)(fakeBpb.bps * fakeBpb.spc);
sb.AppendFormat("{0} sectors reserved between BPB and FAT.", fakeBpb.rsectors).AppendLine();
sb.AppendFormat("{0} FATs.", fakeBpb.fats_no).AppendLine();
sb.AppendFormat("{0} entries on root directory.", fakeBpb.root_ent).AppendLine();
sb.AppendFormat(Localization._0_sectors_reserved_between_BPB_and_FAT, fakeBpb.rsectors).AppendLine();
sb.AppendFormat(Localization._0_FATs, fakeBpb.fats_no).AppendLine();
sb.AppendFormat(Localization._0_entries_on_root_directory, fakeBpb.root_ent).AppendLine();
if(fakeBpb.media > 0)
sb.AppendFormat("Media descriptor: 0x{0:X2}", fakeBpb.media).AppendLine();
sb.AppendFormat(Localization.Media_descriptor_0, fakeBpb.media).AppendLine();
sb.AppendFormat("{0} sectors per FAT.", fakeBpb.spfat).AppendLine();
sb.AppendFormat(Localization._0_sectors_per_FAT, fakeBpb.spfat).AppendLine();
if(fakeBpb.sptrk is > 0 and < 64 &&
fakeBpb.heads is > 0 and < 256)
{
sb.AppendFormat("{0} sectors per track.", fakeBpb.sptrk).AppendLine();
sb.AppendFormat("{0} heads.", fakeBpb.heads).AppendLine();
sb.AppendFormat(Localization._0_sectors_per_track, fakeBpb.sptrk).AppendLine();
sb.AppendFormat(Localization._0_heads, fakeBpb.heads).AppendLine();
}
if(fakeBpb.hsectors <= partition.Start)
sb.AppendFormat("{0} hidden sectors before BPB.", fakeBpb.hsectors).AppendLine();
sb.AppendFormat(Localization._0_hidden_sectors_before_BPB, fakeBpb.hsectors).AppendLine();
if(fakeBpb.signature is 0x28 or 0x29 || andosOemCorrect)
{
sb.AppendFormat("Drive number: 0x{0:X2}", fakeBpb.drive_no).AppendLine();
sb.AppendFormat(Localization.Drive_number_0, fakeBpb.drive_no).AppendLine();
if(XmlFsType.VolumeSerial != null)
sb.AppendFormat("Volume Serial Number: {0}", XmlFsType.VolumeSerial).AppendLine();
sb.AppendFormat(Localization.Volume_Serial_Number_0, XmlFsType.VolumeSerial).AppendLine();
if((fakeBpb.flags & 0xF8) == 0x00)
{
if((fakeBpb.flags & 0x01) == 0x01)
{
sb.AppendLine("Volume should be checked on next mount.");
sb.AppendLine(Localization.Volume_should_be_checked_on_next_mount);
XmlFsType.Dirty = true;
}
if((fakeBpb.flags & 0x02) == 0x02)
sb.AppendLine("Disk surface should be on next mount.");
sb.AppendLine(Localization.Disk_surface_should_be_on_next_mount);
}
if(fakeBpb.signature == 0x29 || andosOemCorrect)
{
XmlFsType.VolumeName = StringHandlers.SpacePaddedToString(fakeBpb.volume_label, Encoding);
XmlFsType.VolumeName = XmlFsType.VolumeName?.Replace("\0", "");
sb.AppendFormat("Filesystem type: {0}", Encoding.ASCII.GetString(fakeBpb.fs_type)).AppendLine();
sb.AppendFormat(Localization.Filesystem_type_0, Encoding.ASCII.GetString(fakeBpb.fs_type)).
AppendLine();
}
}
else if(bpbKind == BpbKind.Atari &&
XmlFsType.VolumeSerial != null)
sb.AppendFormat("Volume Serial Number: {0}", XmlFsType.VolumeSerial).AppendLine();
sb.AppendFormat(Localization.Volume_Serial_Number_0, XmlFsType.VolumeSerial).AppendLine();
bootChk = Sha1Context.Data(fakeBpb.boot_code, out _);
@@ -1028,26 +1034,26 @@ public sealed partial class FAT
XmlFsType.CreationDate = XmlFsType.CreationDate.AddMilliseconds(entry.ctime_ms * 10);
XmlFsType.CreationDateSpecified = true;
sb.AppendFormat("Volume created on {0}", XmlFsType.CreationDate).AppendLine();
sb.AppendFormat(Localization.Volume_created_on_0, XmlFsType.CreationDate).AppendLine();
}
if(entry is { mtime: > 0, mdate: > 0 })
{
XmlFsType.ModificationDate = DateHandlers.DosToDateTime(entry.mdate, entry.mtime);
XmlFsType.ModificationDateSpecified = true;
sb.AppendFormat("Volume last modified on {0}", XmlFsType.ModificationDate).AppendLine();
sb.AppendFormat(Localization.Volume_last_modified_on_0, XmlFsType.ModificationDate).AppendLine();
}
if(entry.adate > 0)
sb.AppendFormat("Volume last accessed on {0:d}", DateHandlers.DosToDateTime(entry.adate, 0)).
AppendLine();
sb.AppendFormat(Localization.Volume_last_accessed_on_0_d,
DateHandlers.DosToDateTime(entry.adate, 0)).AppendLine();
break;
}
}
if(!string.IsNullOrEmpty(XmlFsType.VolumeName))
sb.AppendFormat("Volume label: {0}", XmlFsType.VolumeName).AppendLine();
sb.AppendFormat(Localization.Volume_label_0, XmlFsType.VolumeName).AppendLine();
if(XmlFsType.Bootable)
{
@@ -1076,14 +1082,14 @@ public sealed partial class FAT
}
}
sb.AppendLine("Volume is bootable");
sb.AppendFormat("Boot code's SHA1: {0}", bootChk).AppendLine();
sb.AppendLine(Localization.Volume_is_bootable);
sb.AppendFormat(Localization.Boot_code_SHA1_0, bootChk).AppendLine();
string bootName = _knownBootHashes.FirstOrDefault(t => t.hash == bootChk).name;
if(string.IsNullOrWhiteSpace(bootName))
sb.AppendLine("Unknown boot code.");
sb.AppendLine(Localization.Unknown_boot_code);
else
sb.AppendFormat("Boot code corresponds to {0}", bootName).AppendLine();
sb.AppendFormat(Localization.Boot_code_corresponds_to_0, bootName).AppendLine();
}
information = sb.ToString();

View File

@@ -97,7 +97,7 @@ public sealed partial class FAT
default: return ErrorNumber.InvalidArgument;
}
AaruConsole.DebugWriteLine("FAT plugin", "Reading BPB");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Reading_BPB);
uint sectorsPerBpb = imagePlugin.Info.SectorSize < 512 ? 512 / imagePlugin.Info.SectorSize : 1;
@@ -166,7 +166,7 @@ public sealed partial class FAT
fat32Bpb.sptrk /= 4;
}
XmlFsType.Type = fat32Bpb.version != 0 ? "FAT+" : "FAT32";
XmlFsType.Type = fat32Bpb.version != 0 ? FS_TYPE_FAT_PLUS : FS_TYPE_FAT32;
if(fat32Bpb.oem_name != null &&
(fat32Bpb.oem_name[5] != 0x49 || fat32Bpb.oem_name[6] != 0x48 || fat32Bpb.oem_name[7] != 0x43))
@@ -377,9 +377,9 @@ public sealed partial class FAT
}
if(_fat12)
XmlFsType.Type = "FAT12";
XmlFsType.Type = FS_TYPE_FAT12;
else if(_fat16)
XmlFsType.Type = "FAT16";
XmlFsType.Type = FS_TYPE_FAT16;
if(bpbKind == BpbKind.Atari)
{
@@ -702,7 +702,7 @@ public sealed partial class FAT
if(name == "" &&
extension == "")
{
AaruConsole.DebugWriteLine("FAT filesystem", "Found empty filename in root directory");
AaruConsole.DebugWriteLine("FAT filesystem", Localization.Found_empty_filename_in_root_directory);
if(!_debug ||
entry is { size: > 0, start_cluster: 0 })
@@ -773,49 +773,15 @@ public sealed partial class FAT
switch(bpbKind)
{
case BpbKind.Hardcoded:
_statfs.Type = $"Microsoft FAT{(_fat16 ? "16" : "12")}";
break;
case BpbKind.Atari:
_statfs.Type = $"Atari FAT{(_fat16 ? "16" : "12")}";
break;
case BpbKind.Msx:
_statfs.Type = $"MSX FAT{(_fat16 ? "16" : "12")}";
break;
case BpbKind.Dos2:
case BpbKind.Dos3:
case BpbKind.Dos32:
case BpbKind.Dos33:
case BpbKind.ShortExtended:
case BpbKind.Extended:
_statfs.Type = $"Microsoft FAT{(_fat16 ? "16" : "12")}";
break;
case BpbKind.ShortFat32:
case BpbKind.LongFat32:
_statfs.Type = XmlFsType.Type == "FAT+" ? "FAT+" : "Microsoft FAT32";
_statfs.Type = XmlFsType.Type == FS_TYPE_FAT_PLUS ? FS_TYPE_FAT_PLUS : FS_TYPE_FAT32;
break;
case BpbKind.Andos:
_statfs.Type = $"ANDOS FAT{(_fat16 ? "16" : "12")}";
default:
_statfs.Type = _fat16 ? FS_TYPE_FAT16 : FS_TYPE_FAT12;
break;
case BpbKind.Apricot:
_statfs.Type = $"Apricot FAT{(_fat16 ? "16" : "12")}";
break;
case BpbKind.DecRainbow:
_statfs.Type = $"DEC FAT{(_fat16 ? "16" : "12")}";
break;
case BpbKind.Human:
_statfs.Type = $"Human68k FAT{(_fat16 ? "16" : "12")}";
break;
default: throw new ArgumentOutOfRangeException();
}
_bytesPerCluster = _sectorsPerCluster * imagePlugin.Info.SectorSize;
@@ -827,7 +793,7 @@ public sealed partial class FAT
if(_fat12)
{
AaruConsole.DebugWriteLine("FAT plugin", "Reading FAT12");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Reading_FAT12);
errno = imagePlugin.ReadSectors(_fatFirstSector, _sectorsPerFat, out byte[] fatBytes);
@@ -880,14 +846,14 @@ public sealed partial class FAT
}
else if(_fat16)
{
AaruConsole.DebugWriteLine("FAT plugin", "Reading FAT16");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Reading_FAT16);
errno = imagePlugin.ReadSectors(_fatFirstSector, _sectorsPerFat, out byte[] fatBytes);
if(errno != ErrorNumber.NoError)
return errno;
AaruConsole.DebugWriteLine("FAT plugin", "Casting FAT");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Casting_FAT);
firstFatEntries = MemoryMarshal.Cast<byte, ushort>(fatBytes).ToArray();
errno = imagePlugin.ReadSectors(_fatFirstSector + _sectorsPerFat, _sectorsPerFat, out fatBytes);
@@ -895,7 +861,7 @@ public sealed partial class FAT
if(errno != ErrorNumber.NoError)
return errno;
AaruConsole.DebugWriteLine("FAT plugin", "Casting FAT");
AaruConsole.DebugWriteLine("FAT plugin", Localization.Casting_FAT);
secondFatEntries = MemoryMarshal.Cast<byte, ushort>(fatBytes).ToArray();
if(firstFatEntries.Any(entry => entry < FAT16_RESERVED && entry > _statfs.Blocks))