mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Do not raise InvalidOperationException in AppleDouble and PCExchange filters
when the parent path is null.
This commit is contained in:
@@ -131,9 +131,11 @@ namespace DiscImageChef.Filters
|
||||
string filenameNoExt = Path.GetFileNameWithoutExtension(path);
|
||||
string parentFolder = Path.GetDirectoryName(path);
|
||||
|
||||
parentFolder = parentFolder ?? "";
|
||||
if(filename is null || filenameNoExt is null) return false;
|
||||
|
||||
// Prepend data fork name with "R."
|
||||
string ProDosAppleDouble =
|
||||
Path.Combine(parentFolder ?? throw new InvalidOperationException(), "R." + filename);
|
||||
string ProDosAppleDouble = Path.Combine(parentFolder, "R." + filename);
|
||||
// Prepend data fork name with '%'
|
||||
string UNIXAppleDouble = Path.Combine(parentFolder, "%" + filename);
|
||||
// Change file extension to ADF
|
||||
@@ -141,8 +143,7 @@ namespace DiscImageChef.Filters
|
||||
// Change file extension to adf
|
||||
string DOSAppleDoubleLower = Path.Combine(parentFolder, filenameNoExt + ".adf");
|
||||
// Store AppleDouble header file in ".AppleDouble" folder with same name
|
||||
string NetatalkAppleDouble =
|
||||
Path.Combine(parentFolder, ".AppleDouble", filename ?? throw new InvalidOperationException());
|
||||
string NetatalkAppleDouble = Path.Combine(parentFolder, ".AppleDouble", filename);
|
||||
// Store AppleDouble header file in "resource.frk" folder with same name
|
||||
string DAVEAppleDouble = Path.Combine(parentFolder, "resource.frk", filename);
|
||||
// Prepend data fork name with "._"
|
||||
@@ -289,9 +290,11 @@ namespace DiscImageChef.Filters
|
||||
string filenameNoExt = Path.GetFileNameWithoutExtension(path);
|
||||
string parentFolder = Path.GetDirectoryName(path);
|
||||
|
||||
parentFolder = parentFolder ?? "";
|
||||
if(filename is null || filenameNoExt is null) throw new ArgumentNullException(nameof(path));
|
||||
|
||||
// Prepend data fork name with "R."
|
||||
string ProDosAppleDouble =
|
||||
Path.Combine(parentFolder ?? throw new InvalidOperationException(), "R." + filename);
|
||||
string ProDosAppleDouble = Path.Combine(parentFolder, "R." + filename);
|
||||
// Prepend data fork name with '%'
|
||||
string UNIXAppleDouble = Path.Combine(parentFolder, "%" + filename);
|
||||
// Change file extension to ADF
|
||||
@@ -299,8 +302,7 @@ namespace DiscImageChef.Filters
|
||||
// Change file extension to adf
|
||||
string DOSAppleDoubleLower = Path.Combine(parentFolder, filenameNoExt + ".adf");
|
||||
// Store AppleDouble header file in ".AppleDouble" folder with same name
|
||||
string NetatalkAppleDouble =
|
||||
Path.Combine(parentFolder, ".AppleDouble", filename ?? throw new InvalidOperationException());
|
||||
string NetatalkAppleDouble = Path.Combine(parentFolder, ".AppleDouble", filename);
|
||||
// Store AppleDouble header file in "resource.frk" folder with same name
|
||||
string DAVEAppleDouble = Path.Combine(parentFolder, "resource.frk", filename);
|
||||
// Prepend data fork name with "._"
|
||||
@@ -543,64 +545,64 @@ namespace DiscImageChef.Filters
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct AppleDoubleHeader
|
||||
{
|
||||
public uint magic;
|
||||
public uint version;
|
||||
public readonly uint magic;
|
||||
public readonly uint version;
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
|
||||
public byte[] homeFilesystem;
|
||||
public ushort entries;
|
||||
public readonly byte[] homeFilesystem;
|
||||
public readonly ushort entries;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct AppleDoubleEntry
|
||||
{
|
||||
public uint id;
|
||||
public uint offset;
|
||||
public uint length;
|
||||
public uint id;
|
||||
public readonly uint offset;
|
||||
public uint length;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct AppleDoubleFileDates
|
||||
{
|
||||
public uint creationDate;
|
||||
public uint modificationDate;
|
||||
public uint backupDate;
|
||||
public uint accessDate;
|
||||
public readonly uint creationDate;
|
||||
public readonly uint modificationDate;
|
||||
public readonly uint backupDate;
|
||||
public readonly uint accessDate;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct AppleDoubleMacFileInfo
|
||||
{
|
||||
public uint creationDate;
|
||||
public uint modificationDate;
|
||||
public uint backupDate;
|
||||
public uint accessDate;
|
||||
public readonly uint creationDate;
|
||||
public readonly uint modificationDate;
|
||||
public readonly uint backupDate;
|
||||
public readonly uint accessDate;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct AppleDoubleUNIXFileInfo
|
||||
{
|
||||
public uint creationDate;
|
||||
public uint accessDate;
|
||||
public uint modificationDate;
|
||||
public readonly uint creationDate;
|
||||
public readonly uint accessDate;
|
||||
public readonly uint modificationDate;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct AppleDoubleDOSFileInfo
|
||||
{
|
||||
public ushort modificationDate;
|
||||
public ushort modificationTime;
|
||||
public ushort attributes;
|
||||
public readonly ushort modificationDate;
|
||||
public readonly ushort modificationTime;
|
||||
public readonly ushort attributes;
|
||||
}
|
||||
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct AppleDoubleProDOSFileInfo
|
||||
{
|
||||
public uint creationDate;
|
||||
public uint modificationDate;
|
||||
public uint backupDate;
|
||||
public ushort access;
|
||||
public ushort fileType;
|
||||
public uint auxType;
|
||||
public readonly uint creationDate;
|
||||
public readonly uint modificationDate;
|
||||
public readonly uint backupDate;
|
||||
public readonly ushort access;
|
||||
public readonly ushort fileType;
|
||||
public readonly uint auxType;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -99,8 +99,9 @@ namespace DiscImageChef.Filters
|
||||
{
|
||||
string parentFolder = Path.GetDirectoryName(path);
|
||||
|
||||
if(!File.Exists(Path.Combine(parentFolder ?? throw new InvalidOperationException(), FINDER_INFO)))
|
||||
return false;
|
||||
parentFolder = parentFolder ?? "";
|
||||
|
||||
if(!File.Exists(Path.Combine(parentFolder, FINDER_INFO))) return false;
|
||||
|
||||
if(!Directory.Exists(Path.Combine(parentFolder, RESOURCES))) return false;
|
||||
|
||||
@@ -164,9 +165,10 @@ namespace DiscImageChef.Filters
|
||||
string parentFolder = Path.GetDirectoryName(path);
|
||||
string baseFilename = Path.GetFileName(path);
|
||||
|
||||
parentFolder = parentFolder ?? "";
|
||||
|
||||
FileStream finderDatStream =
|
||||
new FileStream(Path.Combine(parentFolder ?? throw new InvalidOperationException(), FINDER_INFO),
|
||||
FileMode.Open, FileAccess.Read);
|
||||
new FileStream(Path.Combine(parentFolder, FINDER_INFO), FileMode.Open, FileAccess.Read);
|
||||
|
||||
while(finderDatStream.Position + 0x5C <= finderDatStream.Length)
|
||||
{
|
||||
@@ -223,59 +225,59 @@ namespace DiscImageChef.Filters
|
||||
/// Illegal characters for FAT get substituted with '_' both here and in FAT's LFN entry.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)]
|
||||
public byte[] macName;
|
||||
public readonly byte[] macName;
|
||||
/// <summary>
|
||||
/// File type
|
||||
/// </summary>
|
||||
public uint type;
|
||||
public readonly uint type;
|
||||
/// <summary>
|
||||
/// File creator
|
||||
/// </summary>
|
||||
public uint creator;
|
||||
public readonly uint creator;
|
||||
/// <summary>
|
||||
/// Finder flags
|
||||
/// </summary>
|
||||
public ushort fdFlags;
|
||||
public readonly ushort fdFlags;
|
||||
/// <summary>
|
||||
/// File's icon vertical position within its window
|
||||
/// </summary>
|
||||
public ushort verticalPosition;
|
||||
public readonly ushort verticalPosition;
|
||||
/// <summary>
|
||||
/// File's icon horizontal position within its window
|
||||
/// </summary>
|
||||
public ushort horizontalPosition;
|
||||
public readonly ushort horizontalPosition;
|
||||
/// <summary>
|
||||
/// Unknown, all bytes are empty but last, except in volume's label entry
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 18)]
|
||||
public byte[] unknown1;
|
||||
public readonly byte[] unknown1;
|
||||
/// <summary>
|
||||
/// File's creation date
|
||||
/// </summary>
|
||||
public uint creationDate;
|
||||
public readonly uint creationDate;
|
||||
/// <summary>
|
||||
/// File's modification date
|
||||
/// </summary>
|
||||
public uint modificationDate;
|
||||
public readonly uint modificationDate;
|
||||
/// <summary>
|
||||
/// File's last backup date
|
||||
/// </summary>
|
||||
public uint backupDate;
|
||||
public readonly uint backupDate;
|
||||
/// <summary>
|
||||
/// Unknown, but is unique, starts 0x7FFFFFFF and counts in reverse.
|
||||
/// Probably file ID for alias look up?
|
||||
/// </summary>
|
||||
public uint unknown2;
|
||||
public readonly uint unknown2;
|
||||
/// <summary>
|
||||
/// Name as in FAT entry (not LFN).
|
||||
/// Resource fork file is always using this name, never LFN.
|
||||
/// </summary>
|
||||
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
|
||||
public byte[] dosName;
|
||||
public readonly byte[] dosName;
|
||||
/// <summary>
|
||||
/// Unknown, flags?
|
||||
/// </summary>
|
||||
public byte unknown3;
|
||||
public readonly byte unknown3;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user