Move common data structures for HFS and HFS+ to common class.

This commit is contained in:
2020-02-19 03:40:16 +00:00
parent 999657502b
commit 5bbac37a21
4 changed files with 64 additions and 66 deletions

View File

@@ -82,5 +82,18 @@ namespace DiscImageChef.Filesystems
{ {
fTrash = -3, fDesktop = -2, fDisk = 0 fTrash = -3, fDesktop = -2, fDisk = 0
} }
[Flags]
internal enum ExtendedFinderFlags : ushort
{
/// <summary>If set the other extended flags are ignored.</summary>
kExtendedFlagsAreInvalid = 0x8000,
/// <summary>Set if the file or folder has a badge resource.</summary>
kExtendedFlagHasCustomBadge = 0x0100,
/// <summary>Set if the object is marked as busy/incomplete.</summary>
kExtendedFlagObjectIsBusy = 0x0080,
/// <summary>Set if the file contains routing info resource.</summary>
kExtendedFlagHasRoutingInfo = 0x0004
}
} }
} }

View File

@@ -89,6 +89,14 @@ namespace DiscImageChef.Filesystems
public readonly uint bbSysHeapFract; public readonly uint bbSysHeapFract;
} }
internal struct Rect
{
public ushort top;
public ushort left;
public ushort bottom;
public ushort right;
}
internal struct Point internal struct Point
{ {
public ushort v; public ushort v;
@@ -108,5 +116,45 @@ namespace DiscImageChef.Filesystems
/// <summary>Folder file belongs to (used only in flat filesystems like MFS).</summary> /// <summary>Folder file belongs to (used only in flat filesystems like MFS).</summary>
public FinderFolder fdFldr; public FinderFolder fdFldr;
} }
internal struct FXInfo
{
/// <summary>Resource fork ID of file icon.</summary>
public ushort fdIconID;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[] fdUnused;
/// <summary>Extended flags. If high-bit is set, most significant byte is script code and least significant byte are flags.</summary>
public ExtendedFinderFlags fdXFlags;
/// <summary>Resource fork ID of directory comment if high bit is clear.</summary>
public ushort fdComment;
/// <summary>Put away folder ID.</summary>
public uint fdPutAway;
}
internal struct DInfo
{
/// <summary>Position and dimensions of the folder's window.</summary>
public Rect frRect;
/// <summary>Flags.</summary>
public FinderFlags frFlags;
/// <summary>Folder's location in the parent folder.</summary>
public Point frLocation;
/// <summary>Finder view selected for folder.</summary>
public ushort frView;
}
internal struct DXInfo
{
/// <summary>Scroll position for icon views.</summary>
public Point frScroll;
/// <summary>Directory ID chain of open folders.</summary>
public uint frOpenChain;
/// <summary>Extended flags. If high-bit is set, most significant byte is script code and least significant byte are flags.</summary>
public ExtendedFinderFlags frXFlags;
/// <summary>Resource fork ID of directory comment if high bit is clear.</summary>
public ushort frComment;
/// <summary>Put away folder ID.</summary>
public uint frPutAway;
}
} }
} }

View File

@@ -30,8 +30,6 @@
// Copyright © 2011-2020 Natalia Portillo // Copyright © 2011-2020 Natalia Portillo
// ****************************************************************************/ // ****************************************************************************/
using System;
namespace DiscImageChef.Filesystems namespace DiscImageChef.Filesystems
{ {
public partial class AppleHFS public partial class AppleHFS
@@ -64,18 +62,5 @@ namespace DiscImageChef.Filesystems
{ {
Data = 0, Resource = -1 Data = 0, Resource = -1
} }
[Flags]
internal enum ExtendedFinderFlags : ushort
{
/// <summary>If set the other extended flags are ignored.</summary>
kExtendedFlagsAreInvalid = 0x8000,
/// <summary>Set if the file or folder has a badge resource.</summary>
kExtendedFlagHasCustomBadge = 0x0100,
/// <summary>Set if the object is marked as busy/incomplete.</summary>
kExtendedFlagObjectIsBusy = 0x0080,
/// <summary>Set if the file contains routing info resource.</summary>
kExtendedFlagHasRoutingInfo = 0x0004
}
} }
} }

View File

@@ -215,9 +215,9 @@ namespace DiscImageChef.Filesystems
/// <summary>Date and time of last backup.</summary> /// <summary>Date and time of last backup.</summary>
public readonly uint dirBkDat; public readonly uint dirBkDat;
/// <summary>Finder information.</summary> /// <summary>Finder information.</summary>
public readonly DInfo dirUsrInfo; public readonly AppleCommon.DInfo dirUsrInfo;
/// <summary>Additional Finder information.</summary> /// <summary>Additional Finder information.</summary>
public readonly DXInfo dirFndrInfo; public readonly AppleCommon.DXInfo dirFndrInfo;
/// <summary>Reserved</summary> /// <summary>Reserved</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)]
public readonly uint[] dirResrv; public readonly uint[] dirResrv;
@@ -255,7 +255,7 @@ namespace DiscImageChef.Filesystems
/// <summary>Date and time of last backup.</summary> /// <summary>Date and time of last backup.</summary>
public readonly uint filBkDat; public readonly uint filBkDat;
/// <summary>Additional Finder information.</summary> /// <summary>Additional Finder information.</summary>
public readonly FXInfo filFndrInfo; public readonly AppleCommon.FXInfo filFndrInfo;
/// <summary>File clump size.</summary> /// <summary>File clump size.</summary>
public readonly ushort filClpSize; public readonly ushort filClpSize;
/// <summary>First data fork extent record.</summary> /// <summary>First data fork extent record.</summary>
@@ -327,53 +327,5 @@ namespace DiscImageChef.Filesystems
/// <summary>Starting file allocation block.</summary> /// <summary>Starting file allocation block.</summary>
public readonly ushort xkrFABN; public readonly ushort xkrFABN;
} }
struct Rect
{
public ushort top;
public ushort left;
public ushort bottom;
public ushort right;
}
struct FXInfo
{
/// <summary>Resource fork ID of file icon.</summary>
public ushort fdIconID;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 6)]
public byte[] fdUnused;
/// <summary>Extended flags. If high-bit is set, most significant byte is script code and least significant byte are flags.</summary>
public ExtendedFinderFlags fdXFlags;
/// <summary>Resource fork ID of directory comment if high bit is clear.</summary>
public ushort fdComment;
/// <summary>Put away folder ID.</summary>
public uint fdPutAway;
}
struct DInfo
{
/// <summary>Position and dimensions of the folder's window.</summary>
public Rect frRect;
/// <summary>Flags.</summary>
public AppleCommon.FinderFlags frFlags;
/// <summary>Folder's location in the parent folder.</summary>
public AppleCommon.Point frLocation;
/// <summary>Finder view selected for folder.</summary>
public ushort frView;
}
struct DXInfo
{
/// <summary>Scroll position for icon views.</summary>
public AppleCommon.Point frScroll;
/// <summary>Directory ID chain of open folders.</summary>
public uint frOpenChain;
/// <summary>Extended flags. If high-bit is set, most significant byte is script code and least significant byte are flags.</summary>
public ExtendedFinderFlags frXFlags;
/// <summary>Resource fork ID of directory comment if high bit is clear.</summary>
public ushort frComment;
/// <summary>Put away folder ID.</summary>
public uint frPutAway;
}
} }
} }