Update LangVersion to C# 12.
Now that we have moved to net 8 from net 6, and with us no longer supporting the mono runtime, we can raise the C# version to match that supported by the net 8 runtime. This unlocks C# 10, C# 11 and C# 12 features previously unavailable to us. - https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-10 - https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-11 - https://learn.microsoft.com/en-us/dotnet/csharp/whats-new/csharp-version-history#c-version-12 A newer version of StyleCop is required to avoid rules tripping up on the new syntax. Enable a handful of style rules that don't have many violations.
This commit is contained in:
committed by
Gustas Kažukauskas
parent
39a7e477c6
commit
715d882456
@@ -10,6 +10,7 @@
|
||||
#endregion
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using OpenRA.Primitives;
|
||||
using OpenRA.Traits;
|
||||
|
||||
@@ -208,6 +209,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
{ 0x65, DamageState.Undamaged },
|
||||
};
|
||||
|
||||
[SuppressMessage("Style", "IDE0230:Use UTF-8 string literal", Justification = "False positive")]
|
||||
protected override Dictionary<byte, byte[]> ResourceFromOverlay { get; } = new()
|
||||
{
|
||||
// "tib" - Regular Tiberium
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@@ -63,8 +64,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
metadata.AppendLine("General:");
|
||||
|
||||
var name = args.Length > 3 ? args[3] : Path.GetFileNameWithoutExtension(args[2]);
|
||||
metadata.AppendLine($"\tName: {name}");
|
||||
metadata.AppendLine($"\tId: {name.ToUpperInvariant()}");
|
||||
metadata.AppendLine(CultureInfo.InvariantCulture, $"\tName: {name}");
|
||||
metadata.AppendLine(CultureInfo.InvariantCulture, $"\tId: {name.ToUpperInvariant()}");
|
||||
metadata.AppendLine("\tHeightDebugColors: 00000080, 00004480, 00008880, 0000CC80, 0000FF80, 4400CC80," +
|
||||
" 88008880, CC004480, FF110080, FF550080, FF990080, FFDD0080, DDFF0080, 99FF0080, 55FF0080, 11FF0080");
|
||||
|
||||
@@ -94,11 +95,11 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
|
||||
using (var s = modData.DefaultFileSystem.Open(templateFilename))
|
||||
{
|
||||
data.AppendLine($"\tTemplate@{templateIndex}:");
|
||||
data.AppendLine($"\t\tCategories: {sectionCategory}");
|
||||
data.AppendLine(CultureInfo.InvariantCulture, $"\tTemplate@{templateIndex}:");
|
||||
data.AppendLine(CultureInfo.InvariantCulture, $"\t\tCategories: {sectionCategory}");
|
||||
usedCategories.Add(sectionCategory);
|
||||
|
||||
data.AppendLine($"\t\tId: {templateIndex}");
|
||||
data.AppendLine(CultureInfo.InvariantCulture, $"\t\tId: {templateIndex}");
|
||||
|
||||
var images = new List<string>
|
||||
{
|
||||
@@ -111,7 +112,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
images.Add(variant);
|
||||
}
|
||||
|
||||
data.AppendLine($"\t\tImages: {images.JoinWith(", ")}");
|
||||
data.AppendLine(CultureInfo.InvariantCulture, $"\t\tImages: {images.JoinWith(", ")}");
|
||||
|
||||
var templateWidth = s.ReadUInt32();
|
||||
var templateHeight = s.ReadUInt32();
|
||||
@@ -121,7 +122,7 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
for (var j = 0; j < offsets.Length; j++)
|
||||
offsets[j] = s.ReadUInt32();
|
||||
|
||||
data.AppendLine($"\t\tSize: {templateWidth}, {templateHeight}");
|
||||
data.AppendLine(CultureInfo.InvariantCulture, $"\t\tSize: {templateWidth}, {templateHeight}");
|
||||
data.AppendLine("\t\tTiles:");
|
||||
|
||||
for (var j = 0; j < offsets.Length; j++)
|
||||
@@ -137,17 +138,17 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
if (terrainType >= terrainTypes.Length)
|
||||
throw new InvalidDataException($"Unknown terrain type {terrainType} in {templateFilename}");
|
||||
|
||||
data.AppendLine($"\t\t\t{j}: {terrainTypes[terrainType]}");
|
||||
data.AppendLine(CultureInfo.InvariantCulture, $"\t\t\t{j}: {terrainTypes[terrainType]}");
|
||||
if (height != 0)
|
||||
data.AppendLine($"\t\t\t\tHeight: {height}");
|
||||
data.AppendLine(CultureInfo.InvariantCulture, $"\t\t\t\tHeight: {height}");
|
||||
|
||||
if (rampType != 0)
|
||||
data.AppendLine($"\t\t\t\tRampType: {rampType}");
|
||||
data.AppendLine(CultureInfo.InvariantCulture, $"\t\t\t\tRampType: {rampType}");
|
||||
|
||||
data.AppendLine($"\t\t\t\tMinColor: {s.ReadUInt8():X2}{s.ReadUInt8():X2}{s.ReadUInt8():X2}");
|
||||
data.AppendLine($"\t\t\t\tMaxColor: {s.ReadUInt8():X2}{s.ReadUInt8():X2}{s.ReadUInt8():X2}");
|
||||
data.AppendLine(CultureInfo.InvariantCulture, $"\t\t\t\tMinColor: {s.ReadUInt8():X2}{s.ReadUInt8():X2}{s.ReadUInt8():X2}");
|
||||
data.AppendLine(CultureInfo.InvariantCulture, $"\t\t\t\tMaxColor: {s.ReadUInt8():X2}{s.ReadUInt8():X2}{s.ReadUInt8():X2}");
|
||||
var zOffset = -tileSize.Height / 2.0f;
|
||||
data.AppendLine($"\t\t\t\tZOffset: {zOffset}");
|
||||
data.AppendLine(CultureInfo.InvariantCulture, $"\t\t\t\tZOffset: {zOffset}");
|
||||
data.AppendLine("\t\t\t\tZRamp: 0");
|
||||
}
|
||||
}
|
||||
@@ -170,8 +171,8 @@ namespace OpenRA.Mods.Cnc.UtilityCommands
|
||||
metadata.AppendLine("Terrain:");
|
||||
foreach (var terrainType in terrainTypes.Distinct())
|
||||
{
|
||||
metadata.AppendLine($"\tTerrainType@{terrainType}:");
|
||||
metadata.AppendLine($"\t\tType: {terrainType}");
|
||||
metadata.AppendLine(CultureInfo.InvariantCulture, $"\tTerrainType@{terrainType}:");
|
||||
metadata.AppendLine(CultureInfo.InvariantCulture, $"\t\tType: {terrainType}");
|
||||
|
||||
if (terrainType == "Water")
|
||||
metadata.AppendLine("\t\tTargetTypes: Water");
|
||||
|
||||
Reference in New Issue
Block a user