Use collection expressions

This commit is contained in:
Matt Nadareski
2024-11-12 12:23:47 -05:00
parent d3daa2c4aa
commit dd6b79a21b
24 changed files with 74 additions and 74 deletions

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.BFPK
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0x42, 0x46, 0x50, 0x4b };
public static readonly byte[] SignatureBytes = [0x42, 0x46, 0x50, 0x4b];
public const string SignatureString = "BFPK";

View File

@@ -4,7 +4,7 @@ namespace SabreTools.Models.CFB
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1 };
public static readonly byte[] SignatureBytes = [0xD0, 0xCF, 0x11, 0xE0, 0xA1, 0xB1, 0x1A, 0xE1];
public const ulong SignatureUInt64 = 0xE11AB1A1E011CFD0;
@@ -15,17 +15,17 @@ namespace SabreTools.Models.CFB
/// <summary>
/// Installer Package (msi), Merge Module (msm), Patch Creation Properties (pcp)
/// </summary>
public static readonly Guid InstallerPackage = new Guid("000c1084-0000-0000-c000-000000000046");
public static readonly Guid InstallerPackage = new("000c1084-0000-0000-c000-000000000046");
/// <summary>
/// Patch Package (msp)
/// </summary>
public static readonly Guid PatchPackage = new Guid("000C1086-0000-0000-C000-000000000046");
public static readonly Guid PatchPackage = new("000C1086-0000-0000-C000-000000000046");
/// <summary>
/// Transform (mst)
/// </summary>
public static readonly Guid Transform = new Guid("000C1082-0000-0000-C000-000000000046");
public static readonly Guid Transform = new("000C1082-0000-0000-C000-000000000046");
#endregion
@@ -35,17 +35,17 @@ namespace SabreTools.Models.CFB
/// <summary>
/// The Summary Information Property Set
/// </summary>
public static readonly Guid FMTID_SummaryInformation = new Guid("F29F85E0-4FF9-1068-AB91-08002B27B3D9");
public static readonly Guid FMTID_SummaryInformation = new("F29F85E0-4FF9-1068-AB91-08002B27B3D9");
/// <summary>
/// The DocumentSummaryInformation and UserDefined Property Sets
/// </summary>
public static readonly Guid FMTID_DocSummaryInformation = new Guid("D5CDD502-2E9C-101B-9397-08002B2CF9AE");
public static readonly Guid FMTID_DocSummaryInformation = new("D5CDD502-2E9C-101B-9397-08002B2CF9AE");
/// <summary>
/// The DocumentSummaryInformation and UserDefined Property Sets
/// </summary>
public static readonly Guid FMTID_UserDefinedProperties = new Guid("D5CDD505-2E9C-101B-9397-08002B2CF9AE");
public static readonly Guid FMTID_UserDefinedProperties = new("D5CDD505-2E9C-101B-9397-08002B2CF9AE");
#endregion
}

View File

@@ -8,7 +8,7 @@ namespace SabreTools.Models.Compression.LZ
public const int LZ_HEADER_LEN = 14;
public static readonly byte[] MagicBytes = new byte[] { 0x53, 0x5a, 0x44, 0x44, 0x88, 0xf0, 0x27, 0x33 };
public static readonly byte[] MagicBytes = [0x53, 0x5a, 0x44, 0x44, 0x88, 0xf0, 0x27, 0x33];
public static readonly string MagicString = System.Text.Encoding.ASCII.GetString(MagicBytes);

View File

@@ -33,56 +33,56 @@ namespace SabreTools.Models.Compression.MSZIP
/// <summary>
/// Order of the bit length code lengths
/// </summary>
public static readonly byte[] BitLengthOrder = new byte[]
{
public static readonly byte[] BitLengthOrder =
[
16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
};
];
/// <summary>
/// Copy lengths for literal codes 257..285
/// </summary>
public static readonly ushort[] CopyLengths = new ushort[]
{
public static readonly ushort[] CopyLengths =
[
3, 4, 5, 6, 7, 8, 9, 10, 11, 13, 15, 17, 19, 23, 27, 31, 35, 43, 51,
59, 67, 83, 99, 115, 131, 163, 195, 227, 258, 0, 0
};
];
/// <summary>
/// Extra bits for literal codes 257..285
/// </summary>
/// <remarks>99 == invalid</remarks>
public static readonly ushort[] LiteralExtraBits = new ushort[]
{
public static readonly ushort[] LiteralExtraBits =
[
0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3, 3, 4, 4, 4,
4, 5, 5, 5, 5, 0, 99, 99
};
];
/// <summary>
/// Copy offsets for distance codes 0..29
/// </summary>
public static readonly ushort[] CopyOffsets = new ushort[]
{
public static readonly ushort[] CopyOffsets =
[
1, 2, 3, 4, 5, 7, 9, 13, 17, 25, 33, 49, 65, 97, 129, 193, 257, 385,
513, 769, 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577
};
];
/// <summary>
/// Extra bits for distance codes
/// </summary>
public static readonly ushort[] DistanceExtraBits = new ushort[]
{
public static readonly ushort[] DistanceExtraBits =
[
0, 0, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10,
10, 11, 11, 12, 12, 13, 13
};
];
/// <summary>
/// And'ing with Zipmask[n] masks the lower n bits
/// </summary>
public static readonly ushort[] BitMasks = new ushort[17]
{
public static readonly ushort[] BitMasks =
[
0x0000, 0x0001, 0x0003, 0x0007, 0x000f, 0x001f, 0x003f, 0x007f, 0x00ff,
0x01ff, 0x03ff, 0x07ff, 0x0fff, 0x1fff, 0x3fff, 0x7fff, 0xffff
};
];
#endregion
}

View File

@@ -3,48 +3,48 @@ namespace SabreTools.Models.Compression.Quantum
/// <see href="www.russotto.net/quantumcomp.html"/>
public static class Constants
{
public static readonly int[] PositionSlot = new int[]
{
public static readonly int[] PositionSlot =
[
0x00000, 0x00001, 0x00002, 0x00003, 0x00004, 0x00006, 0x00008, 0x0000c,
0x00010, 0x00018, 0x00020, 0x00030, 0x00040, 0x00060, 0x00080, 0x000c0,
0x00100, 0x00180, 0x00200, 0x00300, 0x00400, 0x00600, 0x00800, 0x00c00,
0x01000, 0x01800, 0x02000, 0x03000, 0x04000, 0x06000, 0x08000, 0x0c000,
0x10000, 0x18000, 0x20000, 0x30000, 0x40000, 0x60000, 0x80000, 0xc0000,
0x100000, 0x180000
};
];
public static readonly int[] PositionExtraBits = new int[]
{
public static readonly int[] PositionExtraBits =
[
0, 0, 0, 0, 1, 1, 2, 2,
3, 3, 4, 4, 5, 5, 6, 6,
7, 7, 8, 8, 9, 9, 10, 10,
11, 11, 12, 12, 13, 13, 14, 14,
15, 15, 16, 16, 17, 17, 18, 18,
19, 19
};
];
public static readonly int[] LengthSlot = new int[]
{
public static readonly int[] LengthSlot =
[
0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x08,
0x0a, 0x0c, 0x0e, 0x12, 0x16, 0x1a, 0x1e, 0x26,
0x2e, 0x36, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, 0x9e,
0xbe, 0xde, 0xfe
};
];
public static readonly int[] LengthExtraBits = new int[]
{
public static readonly int[] LengthExtraBits =
[
0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 2, 2, 2, 2, 3, 3,
3, 3, 4, 4, 4, 4, 5, 5,
5, 5, 0
};
];
/// <summary>
/// Number of position slots for (tsize - 10)
/// </summary>
public static readonly int[] NumPositionSlots = new int[]
{
public static readonly int[] NumPositionSlots =
[
20, 22, 24, 26, 28, 30, 32, 34, 36, 38, 40, 42
};
];
}
}

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.InstallShieldCabinet
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0x49, 0x53, 0x63, 0x28 };
public static readonly byte[] SignatureBytes = [0x49, 0x53, 0x63, 0x28];
public const string SignatureString = "ISc(";

View File

@@ -2,17 +2,17 @@ namespace SabreTools.Models.LinearExecutable
{
public static class Constants
{
public static readonly byte[] DebugInformationSignatureBytes = new byte[] { 0x4e, 0x42, 0x30 };
public static readonly byte[] DebugInformationSignatureBytes = [0x4e, 0x42, 0x30];
public const string DebugInformationSignatureString = "NB0";
public static readonly byte[] LESignatureBytes = new byte[] { 0x4c, 0x45 };
public static readonly byte[] LESignatureBytes = [0x4c, 0x45];
public const string LESignatureString = "LE";
public const ushort LESignatureUInt16 = 0x454c;
public static readonly byte[] LXSignatureBytes = new byte[] { 0x4c, 0x58 };
public static readonly byte[] LXSignatureBytes = [0x4c, 0x58];
public const string LXSignatureString = "LX";

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.MSDOS
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0x4d, 0x5a };
public static readonly byte[] SignatureBytes = [0x4d, 0x5a];
public const string SignatureString = "MZ";

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.MicrosoftCabinet
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0x4d, 0x53, 0x43, 0x46 };
public static readonly byte[] SignatureBytes = [0x4d, 0x53, 0x43, 0x46];
public const string SignatureString = "MSCF";

View File

@@ -4,7 +4,7 @@ namespace SabreTools.Models.MoPaQ
{
#region Archive Header
public static readonly byte[] ArchiveHeaderSignatureBytes = new byte[] { 0x4d, 0x50, 0x51, 0x1a };
public static readonly byte[] ArchiveHeaderSignatureBytes = [0x4d, 0x50, 0x51, 0x1a];
public static readonly string ArchiveHeaderSignatureString = System.Text.Encoding.ASCII.GetString(ArchiveHeaderSignatureBytes);
@@ -14,7 +14,7 @@ namespace SabreTools.Models.MoPaQ
#region User Data
public static readonly byte[] UserDataSignatureBytes = new byte[] { 0x4d, 0x50, 0x51, 0x1b };
public static readonly byte[] UserDataSignatureBytes = [0x4d, 0x50, 0x51, 0x1b];
public static readonly string UserDataSignatureString = System.Text.Encoding.ASCII.GetString(UserDataSignatureBytes);
@@ -24,7 +24,7 @@ namespace SabreTools.Models.MoPaQ
#region HET Table
public static readonly byte[] HetTableSignatureBytes = new byte[] { 0x48, 0x45, 0x54, 0x1a };
public static readonly byte[] HetTableSignatureBytes = [0x48, 0x45, 0x54, 0x1a];
public static readonly string HetTableSignatureString = System.Text.Encoding.ASCII.GetString(HetTableSignatureBytes);
@@ -34,7 +34,7 @@ namespace SabreTools.Models.MoPaQ
#region BET Table
public static readonly byte[] BetTableSignatureBytes = new byte[] { 0x42, 0x45, 0x54, 0x1a };
public static readonly byte[] BetTableSignatureBytes = [0x42, 0x45, 0x54, 0x1a];
public static readonly string BetTableSignatureString = System.Text.Encoding.ASCII.GetString(BetTableSignatureBytes);

View File

@@ -3,7 +3,7 @@
public static class Constants
{
// ExeFS
public static readonly byte[] CodeSegmentName = new byte[] { 0x2e, 0x63, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00 }; // .code\0\0\0
public static readonly byte[] CodeSegmentName = [0x2e, 0x63, 0x6f, 0x64, 0x65, 0x00, 0x00, 0x00]; // .code\0\0\0
// NCCH
public const string NCCHMagicNumber = "NCCH";
@@ -16,9 +16,9 @@
public const uint RomFSSecondMagicNumber = 0x10000;
// Setup Keys and IVs
public static byte[] PlainCounter = new byte[] { 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
public static byte[] ExefsCounter = new byte[] { 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
public static byte[] RomfsCounter = new byte[] { 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
public static byte[] PlainCounter = [0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
public static byte[] ExefsCounter = [0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
public static byte[] RomfsCounter = [0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00];
public const int CXTExtendedDataHeaderLength = 0x800;
}

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.NewExecutable
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0x4e, 0x45 };
public static readonly byte[] SignatureBytes = [0x4e, 0x45];
public const string SignatureString = "NE";

View File

@@ -100,8 +100,8 @@ namespace SabreTools.Models.Nitro
#endregion
public static byte[] EncryptionData = new byte[]
{
public static byte[] EncryptionData =
[
0x99,0xD5,0x20,0x5F,0x57,0x44,0xF5,0xB9,0x6E,0x19,0xA4,0xD9,0x9E,0x6A,0x5A,0x94,
0xD8,0xAE,0xF1,0xEB,0x41,0x75,0xE2,0x3A,0x93,0x82,0xD0,0x32,0x33,0xEE,0x31,0xD5,
0xCC,0x57,0x61,0x9A,0x37,0x06,0xA2,0x1B,0x79,0x39,0x72,0xF5,0x55,0xAE,0xF6,0xBE,
@@ -363,6 +363,6 @@ namespace SabreTools.Models.Nitro
0x6B,0x3A,0xA6,0x6B,0x35,0xD2,0x2F,0x43,0xCD,0x02,0xFD,0xB5,0xE9,0xBC,0x5B,0xAA,
0xD8,0xA4,0x19,0x7E,0x0E,0x5D,0x94,0x81,0x9E,0x6F,0x77,0xAD,0xD6,0x0E,0x74,0x93,
0x96,0xE7,0xC4,0x18,0x5F,0xAD,0xF5,0x19,
};
];
}
}

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.PAK
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0x50, 0x41, 0x43, 0x4b };
public static readonly byte[] SignatureBytes = [0x50, 0x41, 0x43, 0x4b];
public const string SignatureString = "PACK";

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.PlayJ
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0xFF, 0x9D, 0x53, 0x4B };
public static readonly byte[] SignatureBytes = [0xFF, 0x9D, 0x53, 0x4B];
public const uint SignatureUInt32 = 0x4B539DFF;
}

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.PortableExecutable
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0x50, 0x45, 0x00, 0x00 };
public static readonly byte[] SignatureBytes = [0x50, 0x45, 0x00, 0x00];
public const string SignatureString = "PE\0\0";

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.Quantum
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0x44, 0x53 };
public static readonly byte[] SignatureBytes = [0x44, 0x53];
public const string SignatureString = "DS";

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.SFFS
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0x53, 0x46, 0x46, 0x53 };
public static readonly byte[] SignatureBytes = [0x53, 0x46, 0x46, 0x53];
public const string SignatureString = "SFFS";

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.SGA
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0x5f, 0x41, 0x52, 0x43, 0x48, 0x49, 0x56, 0x45 };
public static readonly byte[] SignatureBytes = [0x5f, 0x41, 0x52, 0x43, 0x48, 0x49, 0x56, 0x45];
public const string SignatureString = "_ARCHIVE";

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.VBSP
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0x56, 0x42, 0x53, 0x50 };
public static readonly byte[] SignatureBytes = [0x56, 0x42, 0x53, 0x50];
public const string SignatureString = "VBSP";

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.VPK
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0x34, 0x12, 0xaa, 0x55 };
public static readonly byte[] SignatureBytes = [0x34, 0x12, 0xaa, 0x55];
public static readonly string SignatureString = System.Text.Encoding.ASCII.GetString(SignatureBytes);

View File

@@ -2,7 +2,7 @@ namespace SabreTools.Models.WAD
{
public static class Constants
{
public static readonly byte[] SignatureBytes = new byte[] { 0x57, 0x41, 0x44, 0x33 };
public static readonly byte[] SignatureBytes = [0x57, 0x41, 0x44, 0x33];
public const string SignatureString = "WAD3";

View File

@@ -2,13 +2,13 @@ namespace SabreTools.Models.XZP
{
public static class Constants
{
public static readonly byte[] HeaderSignatureBytes = new byte[] { 0x70, 0x69, 0x5a, 0x78 };
public static readonly byte[] HeaderSignatureBytes = [0x70, 0x69, 0x5a, 0x78];
public const string HeaderSignatureString = "piZx";
public const uint HeaderSignatureUInt32 = 0x785a6970;
public static readonly byte[] FooterSignatureBytes = new byte[] { 0x74, 0x46, 0x7a, 0x58 };
public static readonly byte[] FooterSignatureBytes = [0x74, 0x46, 0x7a, 0x58];
public const string FooterSignatureString = "tFzX";

View File

@@ -10,7 +10,7 @@ namespace SabreTools.Models.Xbox
/// <summary>
/// Mapping of all Xbox 360 media subtypes to long names
/// </summary>
public static readonly Dictionary<char, string> MediaSubtypes = new Dictionary<char, string>
public static readonly Dictionary<char, string> MediaSubtypes = new()
{
{ 'F', "XGD3" },
{ 'X', "XGD2" },
@@ -20,7 +20,7 @@ namespace SabreTools.Models.Xbox
/// <summary>
/// Mapping of all publisher 2-letter codes to long names
/// </summary>
public static readonly Dictionary<string, string> Publishers = new Dictionary<string, string>
public static readonly Dictionary<string, string> Publishers = new()
{
{ "AB", "Ambush Reality" },
{ "AC", "Acclaim Entertainment" },
@@ -187,7 +187,7 @@ namespace SabreTools.Models.Xbox
/// <summary>
/// Mapping of all region 1-letter codes to long names
/// </summary>
public static readonly Dictionary<char, string> Regions = new Dictionary<char, string>
public static readonly Dictionary<char, string> Regions = new()
{
{ 'A', "USA" },
{ 'E', "Europe" },