mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Refactor] Use collection expression.
This commit is contained in:
@@ -53,6 +53,13 @@ public sealed partial class AppleDOS : IReadOnlyFilesystem
|
||||
uint _usedSectors;
|
||||
Vtoc _vtoc;
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -68,21 +75,13 @@ public sealed partial class AppleDOS : IReadOnlyFilesystem
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
||||
Array.Empty<(string name, Type type, string description)>();
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions => [];
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, string> Namespaces => null;
|
||||
|
||||
#endregion
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
|
||||
#region Caches
|
||||
|
||||
/// <summary>Caches track/sector lists</summary>
|
||||
|
||||
@@ -42,11 +42,7 @@ public sealed partial class AppleDOS
|
||||
{
|
||||
ErrorNumber CacheFile(string path)
|
||||
{
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
@@ -148,11 +144,7 @@ public sealed partial class AppleDOS
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
@@ -180,11 +172,7 @@ public sealed partial class AppleDOS
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
@@ -269,11 +257,7 @@ public sealed partial class AppleDOS
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
|
||||
@@ -47,11 +47,7 @@ public sealed partial class AppleDOS
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
@@ -82,11 +78,7 @@ public sealed partial class AppleDOS
|
||||
{
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
|
||||
@@ -60,6 +60,13 @@ public sealed partial class AppleMFS : IReadOnlyFilesystem
|
||||
int _sectorsPerBlock;
|
||||
MasterDirectoryBlock _volMdb;
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -76,18 +83,10 @@ public sealed partial class AppleMFS : IReadOnlyFilesystem
|
||||
|
||||
// TODO: Implement Finder namespace (requires decoding Desktop database)
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
||||
Array.Empty<(string name, Type type, string description)>();
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions => [];
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, string> Namespaces => null;
|
||||
|
||||
#endregion
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -46,11 +46,7 @@ public sealed partial class AppleMFS
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
@@ -157,11 +153,7 @@ public sealed partial class AppleMFS
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
@@ -292,11 +284,7 @@ public sealed partial class AppleMFS
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
|
||||
@@ -50,11 +50,7 @@ public sealed partial class AppleMFS
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
@@ -103,11 +99,7 @@ public sealed partial class AppleMFS
|
||||
{
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
|
||||
@@ -48,6 +48,22 @@ public sealed partial class CBM : IReadOnlyFilesystem
|
||||
byte[] _root;
|
||||
FileSystemInfo _statfs;
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
|
||||
ulong CbmChsToLba(byte track, byte sector, bool is1581)
|
||||
{
|
||||
if(track is 0 or > 40) return 0;
|
||||
|
||||
if(is1581) return (ulong)((track - 1) * 40 + sector - 1);
|
||||
|
||||
return trackStartingLbas[track - 1] + sector;
|
||||
}
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -82,27 +98,10 @@ public sealed partial class CBM : IReadOnlyFilesystem
|
||||
public FileSystem Metadata { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
||||
Array.Empty<(string name, Type type, string description)>();
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions => [];
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, string> Namespaces => null;
|
||||
|
||||
#endregion
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
|
||||
ulong CbmChsToLba(byte track, byte sector, bool is1581)
|
||||
{
|
||||
if(track is 0 or > 40) return 0;
|
||||
|
||||
if(is1581) return (ulong)((track - 1) * 40 + sector - 1);
|
||||
|
||||
return trackStartingLbas[track - 1] + sector;
|
||||
}
|
||||
}
|
||||
@@ -47,11 +47,7 @@ public sealed partial class CBM
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
@@ -71,11 +67,7 @@ public sealed partial class CBM
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
@@ -105,11 +97,7 @@ public sealed partial class CBM
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
|
||||
@@ -99,8 +99,7 @@ public sealed partial class CPM : IReadOnlyFilesystem
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
||||
Array.Empty<(string name, Type type, string description)>();
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions => [];
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, string> Namespaces => null;
|
||||
|
||||
@@ -46,11 +46,7 @@ public sealed partial class CPM
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
@@ -78,11 +74,7 @@ public sealed partial class CPM
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
@@ -148,11 +140,7 @@ public sealed partial class CPM
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
|
||||
@@ -45,19 +45,16 @@ public sealed partial class CPM
|
||||
{
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
if(!_fileCache.ContainsKey(pathElements[0].ToUpperInvariant())) return ErrorNumber.NoSuchFile;
|
||||
|
||||
if(string.Compare(xattr, "com.caldera.cpm.password", StringComparison.InvariantCulture) == 0)
|
||||
if(!_passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf))
|
||||
return ErrorNumber.NoError;
|
||||
{
|
||||
if(!_passwordCache.TryGetValue(pathElements[0].ToUpperInvariant(), out buf)) return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
if(string.Compare(xattr, "com.caldera.cpm.password.text", StringComparison.InvariantCulture) != 0)
|
||||
return ErrorNumber.NoSuchExtendedAttribute;
|
||||
@@ -74,11 +71,7 @@ public sealed partial class CPM
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
|
||||
@@ -88,11 +88,7 @@ public sealed partial class FAT
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
string[] pieces = cutPath.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pieces = cutPath.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
KeyValuePair<string, CompleteDirectoryEntry> entry =
|
||||
_rootDirectoryCache.FirstOrDefault(t => t.Key.ToLower(_cultureInfo) == pieces[0]);
|
||||
|
||||
@@ -67,6 +67,13 @@ public sealed partial class FAT : IReadOnlyFilesystem
|
||||
FileSystemInfo _statfs;
|
||||
bool _useFirstFat;
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -82,8 +89,7 @@ public sealed partial class FAT : IReadOnlyFilesystem
|
||||
public string Author => Authors.NataliaPortillo;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
||||
Array.Empty<(string name, Type type, string description)>();
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions => [];
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, string> Namespaces => new()
|
||||
@@ -106,11 +112,4 @@ public sealed partial class FAT : IReadOnlyFilesystem
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -111,11 +111,7 @@ public sealed partial class FAT
|
||||
|
||||
string cutPath = path.StartsWith('/') ? path[1..].ToLower(_cultureInfo) : path.ToLower(_cultureInfo);
|
||||
|
||||
string[] pieces = cutPath.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pieces = cutPath.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pieces.Length == 0) return ErrorNumber.InvalidArgument;
|
||||
|
||||
|
||||
@@ -72,11 +72,7 @@ public sealed partial class XboxFatPlugin
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
string[] pieces = cutPath.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pieces = cutPath.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
KeyValuePair<string, DirectoryEntry> entry =
|
||||
_rootDirectory.FirstOrDefault(t => t.Key.ToLower(_cultureInfo) == pieces[0]);
|
||||
|
||||
@@ -59,6 +59,13 @@ public sealed partial class XboxFatPlugin : IReadOnlyFilesystem
|
||||
FileSystemInfo _statfs;
|
||||
Superblock _superblock;
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -93,18 +100,10 @@ public sealed partial class XboxFatPlugin : IReadOnlyFilesystem
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
||||
Array.Empty<(string name, Type type, string description)>();
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions => [];
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, string> Namespaces => null;
|
||||
|
||||
#endregion
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -80,11 +80,7 @@ public sealed partial class XboxFatPlugin
|
||||
|
||||
string cutPath = path.StartsWith('/') ? path[1..].ToLower(_cultureInfo) : path.ToLower(_cultureInfo);
|
||||
|
||||
string[] pieces = cutPath.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pieces = cutPath.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pieces.Length == 0) return ErrorNumber.InvalidArgument;
|
||||
|
||||
|
||||
@@ -951,11 +951,7 @@ public sealed partial class ISO9660
|
||||
? path[1..].ToLower(CultureInfo.CurrentUICulture)
|
||||
: path.ToLower(CultureInfo.CurrentUICulture);
|
||||
|
||||
string[] pieces = cutPath.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pieces = cutPath.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
var currentParent = 1;
|
||||
var currentPiece = 0;
|
||||
@@ -1151,11 +1147,7 @@ public sealed partial class ISO9660
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
string[] pieces = cutPath.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pieces = cutPath.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
KeyValuePair<string, DecodedDirectoryEntry> entry =
|
||||
_rootDirectoryCache.FirstOrDefault(t => t.Key.Equals(pieces[0], StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
@@ -52,11 +52,7 @@ public sealed partial class ISO9660
|
||||
? path[1..].ToLower(CultureInfo.CurrentUICulture)
|
||||
: path.ToLower(CultureInfo.CurrentUICulture);
|
||||
|
||||
string[] pieces = cutPath.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pieces = cutPath.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pieces.Length == 0) return ErrorNumber.InvalidArgument;
|
||||
|
||||
|
||||
@@ -76,13 +76,12 @@ public sealed partial class ISO9660 : IReadOnlyFilesystem
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
||||
new (string name, Type type, string description)[]
|
||||
{
|
||||
("use_path_table", typeof(bool), "Use path table for directory traversal"),
|
||||
("use_trans_tbl", typeof(bool), "Use TRANS.TBL for filenames"),
|
||||
("use_evd", typeof(bool),
|
||||
"If present, use Enhanced Volume Descriptor with specified encoding (overrides namespace)")
|
||||
};
|
||||
[
|
||||
("use_path_table", typeof(bool), "Use path table for directory traversal"),
|
||||
("use_trans_tbl", typeof(bool), "Use TRANS.TBL for filenames"),
|
||||
("use_evd", typeof(bool),
|
||||
"If present, use Enhanced Volume Descriptor with specified encoding (overrides namespace)")
|
||||
];
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, string> Namespaces => new()
|
||||
|
||||
@@ -105,9 +105,8 @@ public sealed partial class LisaFS
|
||||
if(!_mounted || !_debug) return ErrorNumber.AccessDenied;
|
||||
|
||||
if(fileId is > 4 or <= 0)
|
||||
{
|
||||
if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED) return ErrorNumber.InvalidArgument;
|
||||
}
|
||||
if(fileId != FILEID_BOOT_SIGNED && fileId != FILEID_LOADER_SIGNED)
|
||||
return ErrorNumber.InvalidArgument;
|
||||
|
||||
if(_systemFileCache.TryGetValue(fileId, out buf) && !tags) return ErrorNumber.NoError;
|
||||
|
||||
@@ -330,9 +329,8 @@ public sealed partial class LisaFS
|
||||
if(!tags)
|
||||
{
|
||||
if(_fileSizeCache.TryGetValue(fileId, out int realSize))
|
||||
{
|
||||
if(realSize > temp.Length) AaruLogging.Error(Localization.File_0_gets_truncated, fileId);
|
||||
}
|
||||
if(realSize > temp.Length)
|
||||
AaruLogging.Error(Localization.File_0_gets_truncated, fileId);
|
||||
|
||||
buf = temp;
|
||||
|
||||
@@ -351,11 +349,7 @@ public sealed partial class LisaFS
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
switch(pathElements.Length)
|
||||
{
|
||||
|
||||
@@ -50,6 +50,13 @@ public sealed partial class LisaFS : IReadOnlyFilesystem
|
||||
SRecord[] _srecords;
|
||||
ulong _volumePrefix;
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -66,8 +73,7 @@ public sealed partial class LisaFS : IReadOnlyFilesystem
|
||||
|
||||
// TODO: Implement Lisa 7/7 namespace (needs decoding {!CATALOG} file)
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
||||
Array.Empty<(string name, Type type, string description)>();
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions => [];
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, string> Namespaces => new()
|
||||
@@ -82,13 +88,6 @@ public sealed partial class LisaFS : IReadOnlyFilesystem
|
||||
|
||||
#endregion
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
|
||||
#region Caches
|
||||
|
||||
/// <summary>Caches Extents Files</summary>
|
||||
|
||||
@@ -132,11 +132,7 @@ public sealed partial class OperaFS
|
||||
return ErrorNumber.NoError;
|
||||
}
|
||||
|
||||
string[] pieces = cutPath.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pieces = cutPath.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
KeyValuePair<string, DirectoryEntryWithPointers> entry =
|
||||
_rootDirectoryCache.FirstOrDefault(t => t.Key.Equals(pieces[0], StringComparison.CurrentCultureIgnoreCase));
|
||||
|
||||
@@ -47,11 +47,7 @@ public sealed partial class OperaFS
|
||||
? path[1..].ToLower(CultureInfo.CurrentUICulture)
|
||||
: path.ToLower(CultureInfo.CurrentUICulture);
|
||||
|
||||
string[] pieces = cutPath.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pieces = cutPath.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pieces.Length == 0) return ErrorNumber.InvalidArgument;
|
||||
|
||||
|
||||
@@ -49,6 +49,13 @@ public sealed partial class OperaFS : IReadOnlyFilesystem
|
||||
FileSystemInfo _statfs;
|
||||
uint _volumeBlockSizeRatio;
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -83,18 +90,10 @@ public sealed partial class OperaFS : IReadOnlyFilesystem
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
||||
Array.Empty<(string name, Type type, string description)>();
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions => [];
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, string> Namespaces => null;
|
||||
|
||||
#endregion
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -68,11 +68,7 @@ public sealed partial class PascalPlugin
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
@@ -92,11 +88,7 @@ public sealed partial class PascalPlugin
|
||||
|
||||
if(!_mounted) return ErrorNumber.AccessDenied;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
@@ -175,11 +167,7 @@ public sealed partial class PascalPlugin
|
||||
{
|
||||
stat = null;
|
||||
|
||||
string[] pathElements = path.Split(new[]
|
||||
{
|
||||
'/'
|
||||
},
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
string[] pathElements = path.Split(['/'], StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
if(pathElements.Length != 1) return ErrorNumber.NotSupported;
|
||||
|
||||
|
||||
@@ -56,6 +56,13 @@ public sealed partial class PascalPlugin : IReadOnlyFilesystem
|
||||
/// <summary>Apple II disks use 256 bytes / sector, but filesystem assumes it's 512 bytes / sector</summary>
|
||||
uint _multiplier;
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
|
||||
#region IReadOnlyFilesystem Members
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -90,18 +97,10 @@ public sealed partial class PascalPlugin : IReadOnlyFilesystem
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions =>
|
||||
Array.Empty<(string name, Type type, string description)>();
|
||||
public IEnumerable<(string name, Type type, string description)> SupportedOptions => [];
|
||||
|
||||
/// <inheritdoc />
|
||||
public Dictionary<string, string> Namespaces => null;
|
||||
|
||||
#endregion
|
||||
|
||||
static Dictionary<string, string> GetDefaultOptions() => new()
|
||||
{
|
||||
{
|
||||
"debug", false.ToString()
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user