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

@@ -12,6 +12,7 @@
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Threading;
using System.Threading.Channels;
@@ -110,7 +111,7 @@ namespace OpenRA
writer.WriteLine(item.Text);
else
{
var timestamp = DateTime.Now.ToString(Game.Settings.Server.TimestampFormat);
var timestamp = DateTime.Now.ToString(Game.Settings.Server.TimestampFormat, CultureInfo.CurrentCulture);
writer.WriteLine("[{0}] {1}", timestamp, item.Text);
}
}

View File

@@ -68,10 +68,10 @@ namespace OpenRA.Support
Log.Write("perf", GetHeader(Indentation, name));
foreach (var child in children)
child.Write();
Log.Write("perf", string.Format(FormatString, ElapsedMs, GetFooter(Indentation)));
Log.Write("perf", FormatString.FormatInvariant(ElapsedMs, GetFooter(Indentation)));
}
else if (ticks >= thresholdTicks)
Log.Write("perf", string.Format(FormatString, ElapsedMs, Indentation + name));
Log.Write("perf", FormatString.FormatInvariant(ElapsedMs, Indentation + name));
}
public static long MillisToTicks(float millis)
@@ -85,7 +85,7 @@ namespace OpenRA.Support
{
var type = item.GetType();
var label = type == typeof(string) || type.IsGenericType ? item.ToString() : type.Name;
Log.Write("perf", string.Format(FormatStringLongTick,
Log.Write("perf", FormatStringLongTick.FormatInvariant(
1000f * (endStopwatchTicks - startStopwatchTicks) / Stopwatch.Frequency,
Game.LocalTick,
name,

View File

@@ -354,7 +354,7 @@ namespace OpenRA.Support
if (cc != CharClass.Digit)
{
if (cc != CharClass.Whitespace && cc != CharClass.Operator && cc != CharClass.Mixed)
throw new InvalidDataException($"Number {int.Parse(expression[start..i])} and variable merged at index {start}");
throw new InvalidDataException($"Number {Exts.ParseInt32Invariant(expression[start..i])} and variable merged at index {start}");
return true;
}
@@ -571,7 +571,7 @@ namespace OpenRA.Support
public NumberToken(int index, string symbol)
: base(TokenType.Number, index)
{
Value = int.Parse(symbol);
Value = Exts.ParseInt32Invariant(symbol);
this.symbol = symbol;
}
}