Use raw strings.

This commit is contained in:
2023-10-04 08:26:35 +01:00
parent b4835e0a7e
commit ef6be56f5f
3 changed files with 77 additions and 55 deletions

View File

@@ -58,7 +58,8 @@ public class PluginRegisterGenerator : ISourceGenerator
StringBuilder sb = new();
sb.AppendLine(@"// /***************************************************************************
sb.AppendLine("""
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
@@ -73,7 +74,7 @@ public class PluginRegisterGenerator : ISourceGenerator
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// ""Software""), to deal in the Software without restriction, including
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
@@ -82,7 +83,7 @@ public class PluginRegisterGenerator : ISourceGenerator
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED ""AS IS"", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
@@ -92,7 +93,8 @@ public class PluginRegisterGenerator : ISourceGenerator
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/");
// ****************************************************************************/
""");
sb.AppendLine();
sb.AppendLine("using System;");

View File

@@ -56,12 +56,16 @@ public sealed partial class Cdrdao
const string REGEX_DISCTYPE = @"^\s*(?<type>(CD_DA|CD_ROM_XA|CD_ROM|CD_I))";
const string REGEX_EMPHASIS = @"^\s*(?<no>NO)?\s*PRE_EMPHASIS";
const string REGEX_FILE_AUDIO =
@"^\s*(AUDIO)?FILE\s*""(?<filename>.+)""\s*(#(?<base_offset>\d+))?\s*((?<start>[\d]+:[\d]+:[\d]+)|(?<start_num>\d+))\s*(?<length>[\d]+:[\d]+:[\d]+)?";
"""^\s*(AUDIO)?FILE\s*"(?<filename>.+)"\s*(#(?<base_offset>\d+))?\s*((?<start>[\d]+:[\d]+:[\d]+)|(?<start_num>\d+))\s*(?<length>[\d]+:[\d]+:[\d]+)?""";
const string REGEX_FILE_DATA =
@"^\s*DATAFILE\s*""(?<filename>.+)""\s*(#(?<base_offset>\d+))?\s*(?<length>[\d]+:[\d]+:[\d]+)?";
"""^\s*DATAFILE\s*"(?<filename>.+)"\s*(#(?<base_offset>\d+))?\s*(?<length>[\d]+:[\d]+:[\d]+)?""";
const string REGEX_INDEX = @"^\s*INDEX\s*(?<address>\d+:\d+:\d+)";
const string REGEX_ISRC = @"^\s*ISRC\s*""(?<isrc>[A-Z0-9]{5,5}[0-9]{7,7})""";
const string REGEX_MCN = @"^\s*CATALOG\s*""(?<catalog>[\x21-\x7F]{13,13})""";
const string REGEX_ISRC = """
^\s*ISRC\s*"(?<isrc>[A-Z0-9]{5,5}[0-9]{7,7})"
""";
const string REGEX_MCN = """
^\s*CATALOG\s*"(?<catalog>[\x21-\x7F]{13,13})"
""";
const string REGEX_PREGAP = @"^\s*START\s*(?<address>\d+:\d+:\d+)?";
const string REGEX_STEREO = @"^\s*(?<num>(TWO|FOUR))_CHANNEL_AUDIO";
const string REGEX_TRACK =
@@ -71,14 +75,30 @@ public sealed partial class Cdrdao
const string REGEX_ZERO_PREGAP = @"^\s*PREGAP\s*(?<length>\d+:\d+:\d+)";
// CD-Text
const string REGEX_ARRANGER = @"^\s*ARRANGER\s*""(?<arranger>.+)""";
const string REGEX_COMPOSER = @"^\s*COMPOSER\s*""(?<composer>.+)""";
const string REGEX_DISC_ID = @"^\s*DISC_ID\s*""(?<discid>.+)""";
const string REGEX_MESSAGE = @"^\s*MESSAGE\s*""(?<message>.+)""";
const string REGEX_PERFORMER = @"^\s*PERFORMER\s*""(?<performer>.+)""";
const string REGEX_SONGWRITER = @"^\s*SONGWRITER\s*""(?<songwriter>.+)""";
const string REGEX_TITLE = @"^\s*TITLE\s*""(?<title>.+)""";
const string REGEX_UPC = @"^\s*UPC_EAN\s*""(?<catalog>[\d]{13,13})""";
const string REGEX_ARRANGER = """
^\s*ARRANGER\s*"(?<arranger>.+)"
""";
const string REGEX_COMPOSER = """
^\s*COMPOSER\s*"(?<composer>.+)"
""";
const string REGEX_DISC_ID = """
^\s*DISC_ID\s*"(?<discid>.+)"
""";
const string REGEX_MESSAGE = """
^\s*MESSAGE\s*"(?<message>.+)"
""";
const string REGEX_PERFORMER = """
^\s*PERFORMER\s*"(?<performer>.+)"
""";
const string REGEX_SONGWRITER = """
^\s*SONGWRITER\s*"(?<songwriter>.+)"
""";
const string REGEX_TITLE = """
^\s*TITLE\s*"(?<title>.+)"
""";
const string REGEX_UPC = """
^\s*UPC_EAN\s*"(?<catalog>[\d]{13,13})"
""";
// Unused
const string REGEX_CD_TEXT = @"^\s*CD_TEXT\s*\{";

View File

@@ -62,14 +62,14 @@ public sealed partial class VMware
const string REGEX_CID = @"^\s*CID\s*=\s*(?<cid>[0123456789abcdef]{8})$";
const string REGEX_CID_PARENT = @"^\s*parentCID\s*=\s*(?<cid>[0123456789abcdef]{8})$";
const string REGEX_TYPE =
@"^\s*createType\s*=\s*\""(?<type>custom|monolithicSparse|monolithicFlat|twoGbMaxExtentSparse|twoGbMaxExtentFlat|fullDevice|partitionedDevice|vmfs|vmfsPreallocated|vmfsEagerZeroedThick|vmfsThin|vmfsSparse|vmfsRDM|vmfsRawDeviceMap|vmfsRDMP|vmfsPassthroughRawDeviceMap|vmfsRaw|streamOptimized)\""$";
"""^\s*createType\s*=\s*\"(?<type>custom|monolithicSparse|monolithicFlat|twoGbMaxExtentSparse|twoGbMaxExtentFlat|fullDevice|partitionedDevice|vmfs|vmfsPreallocated|vmfsEagerZeroedThick|vmfsThin|vmfsSparse|vmfsRDM|vmfsRawDeviceMap|vmfsRDMP|vmfsPassthroughRawDeviceMap|vmfsRaw|streamOptimized)\"$""";
const string REGEX_EXTENT =
@"^\s*(?<access>(RW|RDONLY|NOACCESS))\s+(?<sectors>\d+)\s+(?<type>(FLAT|SPARSE|ZERO|VMFS|VMFSSPARSE|VMFSRDM|VMFSRAW))\s+\""(?<filename>.+)\""(\s*(?<offset>\d+))?$";
const string REGEX_DDB_TYPE = @"^\s*ddb\.adapterType\s*=\s*\""(?<type>ide|buslogic|lsilogic|legacyESX)\""$";
const string REGEX_DDB_SECTORS = @"^\s*ddb\.geometry\.sectors\s*=\s*\""(?<sectors>\d+)\""$";
const string REGEX_DDB_HEADS = @"^\s*ddb\.geometry\.heads\s*=\s*\""(?<heads>\d+)\""$";
const string REGEX_DDB_CYLINDERS = @"^\s*ddb\.geometry\.cylinders\s*=\s*\""(?<cylinders>\d+)\""$";
const string PARENT_REGEX = @"^\s*parentFileNameHint\s*=\s*\""(?<filename>.+)\""$";
"""^\s*(?<access>(RW|RDONLY|NOACCESS))\s+(?<sectors>\d+)\s+(?<type>(FLAT|SPARSE|ZERO|VMFS|VMFSSPARSE|VMFSRDM|VMFSRAW))\s+\"(?<filename>.+)\"(\s*(?<offset>\d+))?$""";
const string REGEX_DDB_TYPE = """^\s*ddb\.adapterType\s*=\s*\"(?<type>ide|buslogic|lsilogic|legacyESX)\"$""";
const string REGEX_DDB_SECTORS = """^\s*ddb\.geometry\.sectors\s*=\s*\"(?<sectors>\d+)\"$""";
const string REGEX_DDB_HEADS = """^\s*ddb\.geometry\.heads\s*=\s*\"(?<heads>\d+)\"$""";
const string REGEX_DDB_CYLINDERS = """^\s*ddb\.geometry\.cylinders\s*=\s*\"(?<cylinders>\d+)\"$""";
const string PARENT_REGEX = """^\s*parentFileNameHint\s*=\s*\"(?<filename>.+)\"$""";
const uint FLAGS_VALID_NEW_LINE = 0x01;
const uint FLAGS_USE_REDUNDANT_TABLE = 0x02;
const uint FLAGS_ZERO_GRAIN_GTE = 0x04;