diff --git a/SabreTools.Library/Data/Flags.cs b/SabreTools.Library/Data/Flags.cs
index 857459bf..176dce83 100644
--- a/SabreTools.Library/Data/Flags.cs
+++ b/SabreTools.Library/Data/Flags.cs
@@ -2,326 +2,508 @@
namespace SabreTools.Library.Data
{
- #region Archival
+ #region Archival
- ///
- /// Determines the level to scan archives at
- ///
- [Flags]
- public enum ArchiveScanLevel
- {
- // 7zip
- SevenZipExternal = 0x00001,
- SevenZipInternal = 0x00002,
- SevenZipBoth = SevenZipExternal | SevenZipInternal,
+ ///
+ /// Determines the level to scan archives at
+ ///
+ [Flags]
+ public enum ArchiveScanLevel
+ {
+ // 7zip
+ SevenZipExternal = 1 << 0,
+ SevenZipInternal = 1 << 1,
+ SevenZipBoth = SevenZipExternal | SevenZipInternal,
- // GZip
- GZipExternal = 0x00010,
- GZipInternal = 0x00020,
- GZipBoth = GZipExternal | GZipInternal,
+ // GZip
+ GZipExternal = 1 << 2,
+ GZipInternal = 1 << 3,
+ GZipBoth = GZipExternal | GZipInternal,
- // RAR
- RarExternal = 0x00100,
- RarInternal = 0x00200,
- RarBoth = RarExternal | RarInternal,
+ // RAR
+ RarExternal = 1 << 4,
+ RarInternal = 1 << 5,
+ RarBoth = RarExternal | RarInternal,
- // Zip
- ZipExternal = 0x01000,
- ZipInternal = 0x02000,
- ZipBoth = ZipExternal | ZipInternal,
+ // Zip
+ ZipExternal = 1 << 6,
+ ZipInternal = 1 << 7,
+ ZipBoth = ZipExternal | ZipInternal,
- // Tar
- TarExternal = 0x10000,
- TarInternal = 0x20000,
- TarBoth = TarExternal | TarInternal,
- }
+ // Tar
+ TarExternal = 1 << 8,
+ TarInternal = 1 << 9,
+ TarBoth = TarExternal | TarInternal,
+ }
- ///
- /// Determines the archive general bit flags
- ///
- [Flags]
- public enum GeneralPurposeBitFlag : ushort
- {
- Encrypted = 0x0001,
- ZeroedCRCAndSize = 0x0008,
- CompressedPatchedData = 0x0020,
- StrongEncryption = 0x0040,
- LanguageEncodingFlag = 0x0800,
- EncryptedCentralDirectory = 0x2000,
+ ///
+ /// Determines the archive general bit flags
+ ///
+ [Flags]
+ public enum GeneralPurposeBitFlag : ushort
+ {
+ Encrypted = 1 << 0,
+ ZeroedCRCAndSize = 1 << 3,
+ CompressedPatchedData = 1 << 5,
+ StrongEncryption = 1 << 6,
+ LanguageEncodingFlag = 1 << 11,
+ EncryptedCentralDirectory = 1 << 13,
- // For Method 6 - Imploding
- Imploding8KSlidingDictionary = 0x0002,
- Imploding3ShannonFanoTrees = 0x0004,
+ // For Method 6 - Imploding
+ Imploding8KSlidingDictionary = 1 << 1,
+ Imploding3ShannonFanoTrees = 1 << 2,
- // For Methods 8 and 9 - Deflating
- DeflatingMaximumCompression = 0x0002,
- DeflatingFastCompression = 0x0004,
- DeflatingSuperFastCompression = 0x0006,
- EnhancedDeflating = 0x0010,
+ // For Methods 8 and 9 - Deflating
+ DeflatingMaximumCompression = 1 << 1,
+ DeflatingFastCompression = 1 << 2,
+ DeflatingSuperFastCompression = 1 << 1 | 1 << 2,
+ EnhancedDeflating = 1 << 4,
- // For Method 14 - LZMA
- LZMAEOSMarkerUsed = 0x0002,
+ // For Method 14 - LZMA
+ LZMAEOSMarkerUsed = 1 << 1,
- // Reserved and unused (SHOULD NOT BE USED)
- Bit7 = 0x0080,
- Bit8 = 0x0100,
- Bit9 = 0x0200,
- Bit10 = 0x0400,
- Bit12 = 0x1000, // Reserved by PKWARE for enhanced compression
- Bit14 = 0x4000, // Reserved by PKWARE
- Bit15 = 0x8000, // Reserved by PKWARE
- }
+ // Reserved and unused (SHOULD NOT BE USED)
+ Bit7 = 1 << 7,
+ Bit8 = 1 << 8,
+ Bit9 = 1 << 9,
+ Bit10 = 1 << 10,
+ Bit12 = 1 << 12, // Reserved by PKWARE for enhanced compression
+ Bit14 = 1 << 14, // Reserved by PKWARE
+ Bit15 = 1 << 15, // Reserved by PKWARE
+ }
- ///
- /// Internal file attributes used by archives
- ///
- [Flags]
- public enum InternalFileAttributes : ushort
- {
- ASCIIOrTextFile = 0x0001,
- RecordLengthControl = 0x0002,
+ ///
+ /// Internal file attributes used by archives
+ ///
+ [Flags]
+ public enum InternalFileAttributes : ushort
+ {
+ ASCIIOrTextFile = 1 << 0,
+ RecordLengthControl = 1 << 1,
- // Reserved and unused (SHOULD NOT BE USED)
- Bit1 = 0x0002,
- Bit2 = 0x0004,
- }
+ // Reserved and unused (SHOULD NOT BE USED)
+ Bit1 = 1 << 1,
+ Bit2 = 1 << 2,
+ }
- ///
- /// RAR archive flags
- ///
- [Flags]
- public enum RarArchiveFlags : uint
- {
- Volume = 0x0001, // Volume. Archive is a part of multivolume set.
- VolumeNumberField = 0x0002, // Volume number field is present. This flag is present in all volumes except first.
- Solid = 0x0004, // Solid archive.
- RecoveryRecordPresent = 0x0008, // Recovery record is present.
- Locked = 0x0010, // Locked archive.
- }
+ ///
+ /// RAR archive flags
+ ///
+ [Flags]
+ public enum RarArchiveFlags : uint
+ {
+ ///
+ /// Volume. Archive is a part of multivolume set.
+ ///
+ Volume = 1 << 0,
- ///
- /// RAR entry encryption flags
- ///
- [Flags]
- public enum RarEncryptionFlags : uint
- {
- PasswordCheckDataPresent = 0x0001,
- UseTweakedChecksums = 0x0002,
+ ///
+ /// Volume number field is present. This flag is present in all volumes except first.
+ ///
+ VolumeNumberField = 1 << 1,
- /*
- If flag 0x0002 is present, RAR transforms the checksum preserving file or service data integrity, so it becomes dependent on
- encryption key. It makes guessing file contents based on checksum impossible. It affects both data CRC32 in file header and
- checksums in file hash record in extra area.
- */
- }
+ ///
+ /// Solid archive.
+ ///
+ Solid = 1 << 2,
- ///
- /// RAR file flags
- ///
- [Flags]
- public enum RarFileFlags : uint
- {
- Directory = 0x0001, // Directory file system object (file header only)
- TimeInUnix = 0x0002, // Time field in Unix format is present
- CRCPresent = 0x0004, // CRC32 field is present
- UnpackedSizeUnknown = 0x0008, // Unpacked size is unknown
+ ///
+ /// Recovery record is present.
+ ///
+ RecoveryRecordPresent = 1 << 3,
- /*
- If flag 0x0008 is set, unpacked size field is still present, but must be ignored and extraction
- must be performed until reaching the end of compression stream. This flag can be set if actual
- file size is larger than reported by OS or if file size is unknown such as for all volumes except
- last when archiving from stdin to multivolume archive
- */
- }
+ ///
+ /// Locked archive.
+ ///
+ Locked = 1 << 4,
+ }
- ///
- /// RAR header flags
- ///
- [Flags]
- public enum RarHeaderFlags : uint
- {
- ExtraAreaPresent = 0x0001, // Extra area is present in the end of header
- DataAreaPresent = 0x0002, // Data area is present in the end of header
- BlocksWithUnknownType = 0x0004, // Blocks with unknown type and this flag must be skipped when updating an archive
- DataAreaContinuingFromPrevious = 0x0008, // Data area is continuing from previous volume
- DataAreaContinuingToNext = 0x0010, // Data area is continuing in next volume
- BlockDependsOnPreceding = 0x0020, // Block depends on preceding file block
- PreserveChildBlock = 0x0040, // Preserve a child block if host block is modified
- }
+ ///
+ /// RAR entry encryption flags
+ ///
+ [Flags]
+ public enum RarEncryptionFlags : uint
+ {
+ PasswordCheckDataPresent = 1 << 0,
+ UseTweakedChecksums = 1 << 1,
- [Flags]
- public enum RarUnixOwnerRecordFlags : uint
- {
- UserNameStringIsPresent = 0x0001,
- GroupNameStringIsPresent = 0x0002,
- NumericUserIdIsPresent = 0x0004,
- NumericGroupIdIsPresent = 0x0008,
- }
+ /*
+ If flag 0x0002 is present, RAR transforms the checksum preserving file or service data integrity, so it becomes dependent on
+ encryption key. It makes guessing file contents based on checksum impossible. It affects both data CRC32 in file header and
+ checksums in file hash record in extra area.
+ */
+ }
- ///
- /// RAR entry time flags
- ///
- [Flags]
- public enum RarTimeFlags : uint
- {
- TimeInUnixFormat = 0x0001,
- ModificationTimePresent = 0x0002,
- CreationTimePresent = 0x0004,
- LastAccessTimePresent = 0x0008,
- }
+ ///
+ /// RAR file flags
+ ///
+ [Flags]
+ public enum RarFileFlags : uint
+ {
+ ///
+ /// Directory file system object (file header only)
+ ///
+ Directory = 1 << 0,
- ///
- /// Zipfile special status
- ///
- /// https://github.com/gjefferyes/RomVault/blob/5a93500001f0d068f32cf77a048950717507f733/ROMVault2/SupportedFiles/ZipEnums.cs
- [Flags]
- public enum ZipStatus
- {
- None = 0x0,
- TorrentZip = 0x1,
- ExtraData = 0x2
- }
+ ///
+ /// Time field in Unix format is present
+ ///
+ TimeInUnix = 1 << 1,
+
+ ///
+ /// CRC32 field is present
+ ///
+ CRCPresent = 1 << 2,
+
+ ///
+ /// Unpacked size is unknown
+ ///
+ UnpackedSizeUnknown = 1 << 3,
+
+ /*
+ If flag 0x0008 is set, unpacked size field is still present, but must be ignored and extraction
+ must be performed until reaching the end of compression stream. This flag can be set if actual
+ file size is larger than reported by OS or if file size is unknown such as for all volumes except
+ last when archiving from stdin to multivolume archive
+ */
+ }
+
+ ///
+ /// RAR header flags
+ ///
+ [Flags]
+ public enum RarHeaderFlags : uint
+ {
+ ///
+ /// Extra area is present in the end of header
+ ///
+ ExtraAreaPresent = 1 << 0,
+
+ ///
+ /// Data area is present in the end of header
+ ///
+ DataAreaPresent = 1 << 1,
+
+ ///
+ /// Blocks with unknown type and this flag must be skipped when updating an archive
+ ///
+ BlocksWithUnknownType = 1 << 2,
+
+ ///
+ /// Data area is continuing from previous volume
+ ///
+ DataAreaContinuingFromPrevious = 1 << 3,
+
+ ///
+ /// Data area is continuing in next volume
+ ///
+ DataAreaContinuingToNext = 1 << 4,
+
+ ///
+ /// Block depends on preceding file block
+ ///
+ BlockDependsOnPreceding = 1 << 5,
+
+ ///
+ /// Preserve a child block if host block is modified
+ ///
+ PreserveChildBlock = 1 << 6,
+ }
+
+ [Flags]
+ public enum RarUnixOwnerRecordFlags : uint
+ {
+ UserNameStringIsPresent = 1 << 0,
+ GroupNameStringIsPresent = 1 << 1,
+ NumericUserIdIsPresent = 1 << 2,
+ NumericGroupIdIsPresent = 1 << 3,
+ }
+
+ ///
+ /// RAR entry time flags
+ ///
+ [Flags]
+ public enum RarTimeFlags : uint
+ {
+ TimeInUnixFormat = 1 << 0,
+ ModificationTimePresent = 1 << 1,
+ CreationTimePresent = 1 << 2,
+ LastAccessTimePresent = 1 << 3,
+ }
+
+ ///
+ /// Zipfile special status
+ ///
+ /// https://github.com/gjefferyes/RomVault/blob/5a93500001f0d068f32cf77a048950717507f733/ROMVault2/SupportedFiles/ZipEnums.cs
+ [Flags]
+ public enum ZipStatus
+ {
+ None = 0x00,
+ TorrentZip = 1 << 0,
+ ExtraData = 1 << 1
+ }
#endregion
#region DatFile related
///
- /// Determines the DAT output format
+ /// DAT output formats
///
[Flags]
public enum DatFormat
{
- // XML Formats
- Logiqx = 0x01,
- LogiqxDepreciated = Logiqx << 1, // Special internal type for "game" instead of "machine"
- SoftwareList = LogiqxDepreciated << 1,
- Listxml = SoftwareList << 1,
- OfflineList = Listxml << 1,
- SabreDat = OfflineList << 1,
- OpenMSX = SabreDat << 1,
+ #region XML Formats
- // Propietary Formats
- ClrMamePro = OpenMSX << 1,
- RomCenter = ClrMamePro << 1,
- DOSCenter = RomCenter << 1,
- AttractMode = DOSCenter << 1,
+ ///
+ /// Logiqx XML (using machine)
+ ///
+ Logiqx = 1 << 0,
- // Standardized Text Formats
- MissFile = AttractMode << 1,
- CSV = MissFile << 1, // Comma-separated
- SSV = CSV << 1, // Semicolon-separated
- TSV = SSV << 1, // Tab-separated
- Listrom = TSV << 1,
+ ///
+ /// Logiqx XML (using gmae)
+ ///
+ LogiqxDepreciated = 1 << 1,
- // SFV-similar Formats
- RedumpSFV = Listrom << 1,
- RedumpMD5 = RedumpSFV << 1,
- RedumpSHA1 = RedumpMD5 << 1,
- RedumpSHA256 = RedumpSHA1 << 1,
- RedumpSHA384 = RedumpSHA256 << 1,
- RedumpSHA512 = RedumpSHA384 << 1,
+ ///
+ /// MAME Softare List XML
+ ///
+ SoftwareList = 1 << 2,
- // Specialty combinations
- ALL = 0xFFFFFFF,
+ ///
+ /// MAME Listxml output
+ ///
+ Listxml = 1 << 3,
+
+ ///
+ /// OfflineList XML
+ ///
+ OfflineList = 1 << 4,
+
+ ///
+ /// SabreDat XML
+ ///
+ SabreDat = 1 << 5,
+
+ ///
+ /// OpenMSX Software List XML
+ ///
+ OpenMSX = 1 << 6,
+
+ #endregion
+
+ #region Propietary Formats
+
+ ///
+ /// ClrMamePro custom
+ ///
+ ClrMamePro = 1 << 7,
+
+ ///
+ /// RomCetner INI-based
+ ///
+ RomCenter = 1 << 8,
+
+ ///
+ /// DOSCenter custom
+ ///
+ DOSCenter = 1 << 9,
+
+ ///
+ /// AttractMode custom
+ ///
+ AttractMode = 1 << 10,
+
+ #endregion
+
+ #region Standardized Text Formats
+
+ ///
+ /// ClrMamePro missfile
+ ///
+ MissFile = 1 << 11,
+
+ ///
+ /// Comma-Separated Values (standardized)
+ ///
+ CSV = 1 << 12,
+
+ ///
+ /// Semicolon-Separated Values (standardized)
+ ///
+ SSV = 1 << 13,
+
+ ///
+ /// Tab-Separated Values (standardized)
+ ///
+ TSV = 1 << 14,
+
+ ///
+ /// MAME Listrom output
+ ///
+ Listrom = 1 << 15,
+
+ #endregion
+
+ #region SFV-similar Formats
+
+ ///
+ /// CRC32 hash list
+ ///
+ RedumpSFV = 1 << 16,
+
+ ///
+ /// MD5 hash list
+ ///
+ RedumpMD5 = 1 << 17,
+
+ ///
+ /// SHA-1 hash list
+ ///
+ RedumpSHA1 = 1 << 18,
+
+ ///
+ /// SHA-256 hash list
+ ///
+ RedumpSHA256 = 1 << 19,
+
+ ///
+ /// SHA-384 hash list
+ ///
+ RedumpSHA384 = 1 << 20,
+
+ ///
+ /// SHA-512 hash list
+ ///
+ RedumpSHA512 = 1 << 21,
+
+ #endregion
+
+ // Specialty combinations
+ ALL = Int32.MaxValue,
}
- ///
- /// Determine what hashes to strip from the DAT
- ///
- [Flags]
- public enum Hash
- {
- CRC = 0x0001,
- MD5 = CRC << 1,
- SHA1 = MD5 << 1,
- SHA256 = SHA1 << 1,
- SHA384 = SHA256 << 1,
- SHA512 = SHA384 << 1,
+ ///
+ /// Available hashing types
+ ///
+ [Flags]
+ public enum Hash
+ {
+ CRC = 1 << 0,
+ MD5 = 1 << 1,
+ SHA1 = 1 << 2,
+ SHA256 = 1 << 3,
+ SHA384 = 1 << 4,
+ SHA512 = 1 << 5,
- // Special combinations
- Standard = CRC | MD5 | SHA1,
- DeepHashes = SHA256 | SHA384 | SHA512,
- SecureHashes = MD5 | SHA1 | SHA256 | SHA384 | SHA512,
- }
+ // Special combinations
+ Standard = CRC | MD5 | SHA1,
+ DeepHashes = SHA256 | SHA384 | SHA512,
+ SecureHashes = MD5 | SHA1 | SHA256 | SHA384 | SHA512,
+ }
- ///
- /// Determine what to replace from base DATs
- ///
- [Flags]
- public enum ReplaceMode
- {
- None = 0x0,
+ ///
+ /// Determine what to replace from base DATs
+ ///
+ [Flags]
+ public enum ReplaceMode
+ {
+ None = 0x00,
- // Sorted by hash
- ItemName = 0x1,
- Hash = ItemName << 1,
+ // Sorted by hash
+ ItemName = 1 << 0,
+ Hash = 1 << 1,
- // Sorted by machine name
- Description = Hash << 1,
- MachineType = Description << 1,
- Year = MachineType << 1,
- Manufacturer = Year << 1,
- Parents = Manufacturer << 1,
- }
+ // Sorted by machine name
+ Description = 1 << 2,
+ MachineType = 1 << 3,
+ Year = 1 << 4,
+ Manufacturer = 1 << 5,
+ Parents = 1 << 6,
+ }
- ///
- /// Determine which format to output Stats to
- ///
- [Flags]
- public enum StatReportFormat
- {
- None = 0x0,
- Textfile = 0x01,
- HTML = Textfile << 1,
- CSV = HTML << 1,
- SSV = CSV << 1,
- TSV = SSV << 1,
+ ///
+ /// Determine which format to output Stats to
+ ///
+ [Flags]
+ public enum StatReportFormat
+ {
+ ///
+ /// Only output to the console
+ ///
+ None = 0x00,
- All = Textfile | HTML | CSV | SSV | TSV,
- }
+ ///
+ /// Console-formatted
+ ///
+ Textfile = 1 << 0,
- ///
- /// Determines how the DAT will be split on output
- ///
- [Flags]
- public enum SplittingMode
- {
- None = 0x0,
+ ///
+ /// ClrMamePro HTML
+ ///
+ HTML = 1 << 1,
- Extension = 0x01,
- Hash = Extension << 1,
- Level = Hash << 1,
- Type = Level << 1,
- Size = Type << 1,
- }
+ ///
+ /// Comma-Separated Values (Standardized)
+ ///
+ CSV = 1 << 2,
- ///
- /// Determines special update modes
- ///
- [Flags]
- public enum UpdateMode
- {
- None = 0x00,
+ ///
+ /// Semicolon-Separated Values (Standardized)
+ ///
+ SSV = 1 << 3,
- // Standard diffs
- DiffDupesOnly = 0x01,
- DiffNoDupesOnly = DiffDupesOnly << 1,
- DiffIndividualsOnly = DiffNoDupesOnly << 1,
- AllDiffs = DiffDupesOnly | DiffNoDupesOnly | DiffIndividualsOnly,
+ ///
+ /// Tab-Separated Values (Standardized)
+ ///
+ TSV = 1 << 4,
- // Cascaded diffs
- DiffCascade = DiffIndividualsOnly << 1,
- DiffReverseCascade = DiffCascade << 1,
+ All = Int32.MaxValue,
+ }
- // Base diffs
- DiffAgainst = DiffReverseCascade << 1,
+ ///
+ /// Determines how the DAT will be split on output
+ ///
+ [Flags]
+ public enum SplittingMode
+ {
+ None = 0x00,
- // Special update modes
- Merge = DiffAgainst << 1,
- BaseReplace = Merge << 1,
- ReverseBaseReplace = BaseReplace << 1,
- }
+ Extension = 1 << 0,
+ Hash = 1 << 2,
+ Level = 1 << 3,
+ Type = 1 << 4,
+ Size = 1 << 5,
+ }
+
+ ///
+ /// Determines special update modes
+ ///
+ [Flags]
+ public enum UpdateMode
+ {
+ None = 0x00,
+
+ // Standard diffs
+ DiffDupesOnly = 1 << 0,
+ DiffNoDupesOnly = 1 << 1,
+ DiffIndividualsOnly = 1 << 2,
+
+ // Cascaded diffs
+ DiffCascade = 1 << 3,
+ DiffReverseCascade = 1 << 4,
+
+ // Base diffs
+ DiffAgainst = 1 << 5,
+
+ // Special update modes
+ Merge = 1 << 6,
+ BaseReplace = 1 << 7,
+ ReverseBaseReplace = 1 << 8,
+
+ // Combinations
+ AllDiffs = DiffDupesOnly | DiffNoDupesOnly | DiffIndividualsOnly,
+ }
#endregion
@@ -331,43 +513,51 @@ namespace SabreTools.Library.Data
/// Determines which type of duplicate a file is
///
[Flags]
- public enum DupeType
- {
- // Type of match
- Hash = 0x01,
- All = 0x02,
+ public enum DupeType
+ {
+ // Type of match
+ Hash = 1 << 0,
+ All = 1 << 1,
- // Location of match
- Internal = 0x10,
- External = 0x20,
- }
+ // Location of match
+ Internal = 1 << 2,
+ External = 1 << 3,
+ }
- ///
- /// Determine the status of the item
- ///
- [Flags]
- public enum ItemStatus
- {
- NULL = 0x00, // This is a fake flag that is used for filter only
- None = 0x01,
- Good = 0x02,
- BadDump = 0x04,
- Nodump = 0x08,
- Verified = 0x10,
- }
+ ///
+ /// Determine the status of the item
+ ///
+ [Flags]
+ public enum ItemStatus
+ {
+ ///
+ /// This is a fake flag that is used for filter only
+ ///
+ NULL = 0x00,
- ///
- /// Determine what type of machine it is
- ///
- [Flags]
- public enum MachineType
- {
- NULL = 0x00, // This is a fake flag used for filter only
- None = 0x01,
- Bios = 0x02,
- Device = 0x04,
- Mechanical = 0x08,
- }
+ None = 1 << 0,
+ Good = 1 << 1,
+ BadDump = 1 << 2,
+ Nodump = 1 << 3,
+ Verified = 1 << 4,
+ }
- #endregion
+ ///
+ /// Determine what type of machine it is
+ ///
+ [Flags]
+ public enum MachineType
+ {
+ ///
+ /// This is a fake flag that is used for filter only
+ ///
+ NULL = 0x00,
+
+ None = 1 << 0,
+ Bios = 1 << 1,
+ Device = 1 << 2,
+ Mechanical = 1 << 3,
+ }
+
+ #endregion
}