Fix CA1305

This commit is contained in:
RoosterDragon
2023-03-12 15:08:23 +00:00
committed by Matthias Mailänder
parent 486a07602b
commit d83e579dfe
71 changed files with 287 additions and 219 deletions

View File

@@ -74,7 +74,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
}
}
var output = string.Format(HtmlTemplate.JoinWith("\n"), zoom, Convert.ToBase64String(modData.ModFiles.Open(image).ReadAllBytes()), "[" + regions.JoinWith(",") + "]");
var output = HtmlTemplate.JoinWith("\n").FormatInvariant(zoom, Convert.ToBase64String(modData.ModFiles.Open(image).ReadAllBytes()), "[" + regions.JoinWith(",") + "]");
var outputPath = Path.ChangeExtension(image, ".html");
File.WriteAllLines(outputPath, new[] { output });
Console.WriteLine("Saved {0}", outputPath);

View File

@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using OpenRA.Scripting;
@@ -162,7 +163,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
Console.WriteLine(enumType.Name + " = {");
foreach (var value in Enum.GetValues(enumType))
Console.WriteLine($" {value} = {Convert.ChangeType(value, typeof(int))},");
Console.WriteLine($" {value} = {Convert.ChangeType(value, typeof(int), NumberFormatInfo.InvariantInfo)},");
Console.WriteLine("}");
Console.WriteLine();

View File

@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using Newtonsoft.Json;
@@ -96,7 +97,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
type.Name,
Values = Enum.GetNames(type).Select(x => new
{
Key = Convert.ToInt32(Enum.Parse(type, x)),
Key = Convert.ToInt32(Enum.Parse(type, x), NumberFormatInfo.InvariantInfo),
Value = x
})
});

View File

@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Newtonsoft.Json;
using OpenRA.Primitives;
@@ -102,7 +103,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
type.Name,
Values = Enum.GetNames(type).Select(x => new
{
Key = Convert.ToInt32(Enum.Parse(type, x)),
Key = Convert.ToInt32(Enum.Parse(type, x), NumberFormatInfo.InvariantInfo),
Value = x
})
});

View File

@@ -11,6 +11,7 @@
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using Newtonsoft.Json;
using OpenRA.GameRules;
@@ -105,7 +106,7 @@ namespace OpenRA.Mods.Common.UtilityCommands
type.Name,
Values = Enum.GetNames(type).Select(x => new
{
Key = Convert.ToInt32(Enum.Parse(type, x)),
Key = Convert.ToInt32(Enum.Parse(type, x), NumberFormatInfo.InvariantInfo),
Value = x
})
});

View File

@@ -81,16 +81,16 @@ namespace OpenRA.Mods.Common.UtilityCommands
if (parts.Length == 3)
{
foreach (var c in parts)
Console.Write(byte.Parse(c).ToString("X2"));
Console.Write(Exts.ParseByteInvariant(c).ToStringInvariant("X2"));
}
else
{
Console.Write(byte.Parse(parts[0]).ToString("X2"));
Console.Write(byte.Parse(parts[1]).ToString("X2"));
Console.Write(byte.Parse(parts[2]).ToString("X2"));
var alpha = byte.Parse(parts[3]);
Console.Write(Exts.ParseByteInvariant(parts[0]).ToStringInvariant("X2"));
Console.Write(Exts.ParseByteInvariant(parts[1]).ToStringInvariant("X2"));
Console.Write(Exts.ParseByteInvariant(parts[2]).ToStringInvariant("X2"));
var alpha = Exts.ParseByteInvariant(parts[3]);
if (alpha < 255)
Console.Write(alpha.ToString("X2"));
Console.Write(alpha.ToStringInvariant("X2"));
}
if (++i != args.Length)
@@ -186,16 +186,16 @@ namespace OpenRA.Mods.Common.UtilityCommands
if (parts.Length == 3)
{
foreach (var c in parts)
Console.Write(byte.Parse(c).ToString("X2"));
Console.Write(Exts.ParseByteInvariant(c).ToStringInvariant("X2"));
}
else
{
Console.Write(byte.Parse(parts[1]).ToString("X2"));
Console.Write(byte.Parse(parts[2]).ToString("X2"));
Console.Write(byte.Parse(parts[3]).ToString("X2"));
var alpha = byte.Parse(parts[0]);
Console.Write(Exts.ParseByteInvariant(parts[1]).ToStringInvariant("X2"));
Console.Write(Exts.ParseByteInvariant(parts[2]).ToStringInvariant("X2"));
Console.Write(Exts.ParseByteInvariant(parts[3]).ToStringInvariant("X2"));
var alpha = Exts.ParseByteInvariant(parts[0]);
if (alpha < 255)
Console.Write(alpha.ToString("X2"));
Console.Write(alpha.ToStringInvariant("X2"));
}
if (++i != args.Length)