Audit culture bugs (#7707)

* Added comments and fixed CultureInfo /  StringComparison where appropriate

* Addressed comments

* Fixed comment
This commit is contained in:
Avneet Kaur
2020-10-30 16:43:09 -07:00
committed by GitHub
parent bd34127cd4
commit 2c5b9b4d52
54 changed files with 160 additions and 28 deletions

View File

@@ -66,6 +66,7 @@ namespace ColorPicker.Helpers
saturation = Math.Round(saturation * 100);
lightness = Math.Round(lightness * 100);
// Using InvariantCulture since this is used for color representation
return $"hsl({hue.ToString(CultureInfo.InvariantCulture)}"
+ $", {saturation.ToString(CultureInfo.InvariantCulture)}%"
+ $", {lightness.ToString(CultureInfo.InvariantCulture)}%)";
@@ -84,6 +85,7 @@ namespace ColorPicker.Helpers
saturation = Math.Round(saturation * 100);
value = Math.Round(value * 100);
// Using InvariantCulture since this is used for color representation
return $"hsv({hue.ToString(CultureInfo.InvariantCulture)}"
+ $", {saturation.ToString(CultureInfo.InvariantCulture)}%"
+ $", {value.ToString(CultureInfo.InvariantCulture)}%)";
@@ -103,6 +105,7 @@ namespace ColorPicker.Helpers
yellow = Math.Round(yellow * 100);
blackKey = Math.Round(blackKey * 100);
// Using InvariantCulture since this is used for color representation
return $"cmyk({cyan.ToString(CultureInfo.InvariantCulture)}%"
+ $", {magenta.ToString(CultureInfo.InvariantCulture)}%"
+ $", {yellow.ToString(CultureInfo.InvariantCulture)}%"

View File

@@ -20,7 +20,8 @@ namespace ColorPicker.Helpers
Directory.CreateDirectory(ApplicationLogPath);
}
var logFilePath = Path.Combine(ApplicationLogPath, "Log_" + DateTime.Now.ToString(@"yyyy-MM-dd", CultureInfo.CurrentCulture) + ".txt");
// Using InvariantCulture since this is used for a log file name
var logFilePath = Path.Combine(ApplicationLogPath, "Log_" + DateTime.Now.ToString(@"yyyy-MM-dd", CultureInfo.InvariantCulture) + ".txt");
Trace.Listeners.Add(new TextWriterTraceListener(logFilePath));