[Flags] Code formatting

This commit is contained in:
Matt Nadareski
2018-10-12 15:08:07 -07:00
parent c9e413afc0
commit 5fcd075d0a

View File

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