mirror of
https://github.com/microsoft/PowerToys.git
synced 2025-12-16 11:48:06 +01:00
invariants
This commit is contained in:
@@ -3,6 +3,7 @@
|
|||||||
// See the LICENSE file in the project root for more information.
|
// See the LICENSE file in the project root for more information.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
@@ -50,6 +51,7 @@ namespace FancyZonesEditor.Utils
|
|||||||
{
|
{
|
||||||
float dpi = Dpi != 0 ? Dpi : 96f;
|
float dpi = Dpi != 0 ? Dpi : 96f;
|
||||||
double scaleFactor = 96f / dpi;
|
double scaleFactor = 96f / dpi;
|
||||||
|
|
||||||
return Math.Round(coordinate * scaleFactor);
|
return Math.Round(coordinate * scaleFactor);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,23 +59,17 @@ namespace FancyZonesEditor.Utils
|
|||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
|
|
||||||
sb.Append("ID: ");
|
sb.AppendFormat(CultureInfo.InvariantCulture, "ID: {0}{1}", Id, Environment.NewLine);
|
||||||
sb.AppendLine(Id);
|
sb.AppendFormat(CultureInfo.InvariantCulture, "DPI: {0}{1}", Dpi, Environment.NewLine);
|
||||||
sb.Append("DPI: ");
|
sb.AppendFormat(CultureInfo.InvariantCulture, "Is primary: {0}{1}", Primary, Environment.NewLine);
|
||||||
sb.AppendLine(Dpi.ToString());
|
|
||||||
sb.Append("Is primary: ");
|
|
||||||
sb.AppendLine(Primary.ToString());
|
|
||||||
|
|
||||||
string workArea = string.Format("({0}, {1}, {2}, {3})", WorkAreaRect.X, WorkAreaRect.Y, WorkAreaRect.Width, WorkAreaRect.Height);
|
string workArea = string.Format(CultureInfo.InvariantCulture, "({0}, {1}, {2}, {3})", WorkAreaRect.X, WorkAreaRect.Y, WorkAreaRect.Width, WorkAreaRect.Height);
|
||||||
string bounds = string.Format("({0}, {1}, {2}, {3})", UnscaledBounds.X, UnscaledBounds.Y, UnscaledBounds.Width, UnscaledBounds.Height);
|
string bounds = string.Format(CultureInfo.InvariantCulture, "({0}, {1}, {2}, {3})", UnscaledBounds.X, UnscaledBounds.Y, UnscaledBounds.Width, UnscaledBounds.Height);
|
||||||
string scaledBounds = string.Format("({0}, {1}, {2}, {3})", ScaledBounds.X, ScaledBounds.Y, ScaledBounds.Width, ScaledBounds.Height);
|
string scaledBounds = string.Format(CultureInfo.InvariantCulture, "({0}, {1}, {2}, {3})", ScaledBounds.X, ScaledBounds.Y, ScaledBounds.Width, ScaledBounds.Height);
|
||||||
|
|
||||||
sb.Append("Work area: ");
|
sb.AppendFormat(CultureInfo.InvariantCulture, "Work area: {0}{1}", workArea, Environment.NewLine);
|
||||||
sb.AppendLine(workArea);
|
sb.AppendFormat(CultureInfo.InvariantCulture, "Unscaled bounds: {0}{1}", bounds, Environment.NewLine);
|
||||||
sb.Append("Unscaled bounds: ");
|
sb.AppendFormat(CultureInfo.InvariantCulture, "Scaled bounds: {0}{1}", scaledBounds, Environment.NewLine);
|
||||||
sb.AppendLine(bounds);
|
|
||||||
sb.Append("Scaled bounds: ");
|
|
||||||
sb.AppendLine(scaledBounds);
|
|
||||||
|
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ namespace FancyZonesEditor.Models
|
|||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return "{" + Guid.ToString().ToUpper() + "}";
|
return "{" + Guid.ToString().ToUpperInvariant() + "}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -378,7 +378,7 @@ namespace FancyZonesEditor
|
|||||||
{
|
{
|
||||||
foreach (LayoutModel model in MainWindowSettingsModel.CustomModels)
|
foreach (LayoutModel model in MainWindowSettingsModel.CustomModels)
|
||||||
{
|
{
|
||||||
if ("{" + model.Guid.ToString().ToUpper() + "}" == currentApplied.ZonesetUuid.ToUpper())
|
if ("{" + model.Guid.ToString().ToUpperInvariant() + "}" == currentApplied.ZonesetUuid.ToUpperInvariant())
|
||||||
{
|
{
|
||||||
// found match
|
// found match
|
||||||
foundModel = model;
|
foundModel = model;
|
||||||
|
|||||||
@@ -377,7 +377,7 @@ namespace FancyZonesEditor.Utils
|
|||||||
string uuid = current.GetProperty(UuidJsonTag).GetString();
|
string uuid = current.GetProperty(UuidJsonTag).GetString();
|
||||||
var info = current.GetProperty(InfoJsonTag);
|
var info = current.GetProperty(InfoJsonTag);
|
||||||
|
|
||||||
if (type.Equals(GridJsonTag))
|
if (type.Equals(GridJsonTag, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
bool error = false;
|
bool error = false;
|
||||||
|
|
||||||
@@ -449,13 +449,13 @@ namespace FancyZonesEditor.Utils
|
|||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
App.ShowExceptionMessageBox(string.Format(Properties.Resources.Error_Layout_Malformed_Data, name));
|
App.ShowExceptionMessageBox(string.Format(Properties.Resources.Error_Layout_Malformed_Data, name));
|
||||||
deleted.Add(Guid.Parse(uuid).ToString().ToUpper());
|
deleted.Add(Guid.Parse(uuid).ToString().ToUpperInvariant());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
custom.Add(new GridLayoutModel(uuid, name, LayoutType.Custom, rows, columns, rowsPercentage, columnsPercentage, cellChildMap));
|
custom.Add(new GridLayoutModel(uuid, name, LayoutType.Custom, rows, columns, rowsPercentage, columnsPercentage, cellChildMap));
|
||||||
}
|
}
|
||||||
else if (type.Equals(CanvasJsonTag))
|
else if (type.Equals(CanvasJsonTag, StringComparison.OrdinalIgnoreCase))
|
||||||
{
|
{
|
||||||
int workAreaWidth = info.GetProperty(RefWidthJsonTag).GetInt32();
|
int workAreaWidth = info.GetProperty(RefWidthJsonTag).GetInt32();
|
||||||
int workAreaHeight = info.GetProperty(RefHeightJsonTag).GetInt32();
|
int workAreaHeight = info.GetProperty(RefHeightJsonTag).GetInt32();
|
||||||
@@ -489,7 +489,7 @@ namespace FancyZonesEditor.Utils
|
|||||||
if (error)
|
if (error)
|
||||||
{
|
{
|
||||||
App.ShowExceptionMessageBox(string.Format(Properties.Resources.Error_Layout_Malformed_Data, name));
|
App.ShowExceptionMessageBox(string.Format(Properties.Resources.Error_Layout_Malformed_Data, name));
|
||||||
deleted.Add(Guid.Parse(uuid).ToString().ToUpper());
|
deleted.Add(Guid.Parse(uuid).ToString().ToUpperInvariant());
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user