Merge pull request #10337 from Youssef1313/enable-ca
build: Enable CA1305: Specify IFormatProvider
This commit is contained in:
Коммит
768d3ef773
|
@ -297,6 +297,13 @@ dotnet_diagnostic.CA1044.severity = error
|
|||
# CA1304: Specify CultureInfo
|
||||
dotnet_diagnostic.CA1304.severity = error
|
||||
|
||||
# CA1305: Specify IFormatProvider
|
||||
dotnet_diagnostic.CA1305.severity = error
|
||||
# When we have interpolated string handlers (.NET 6+), there is an overload that accepts IFormatProvider.
|
||||
# However, the same code is targeting older versions that only have `Append(string)` and no overload accepting IFormatProvider.
|
||||
# Fixing the warning in this case will require noisy `#if` directives. We exclude this overload for now and get no warning at all.
|
||||
dotnet_code_quality.CA1305.excluded_symbol_names = M:System.Text.StringBuilder.Append(System.Text.StringBuilder.AppendInterpolatedStringHandler@)|M:System.Text.StringBuilder.AppendLine(System.Text.StringBuilder.AppendInterpolatedStringHandler@)
|
||||
|
||||
# CA1805: Do not initialize unnecessarily
|
||||
dotnet_diagnostic.CA1805.severity = error
|
||||
|
||||
|
@ -380,9 +387,6 @@ dotnet_code_quality.CA1822.api_surface = private, internal
|
|||
# CA1303: Do not pass literals as localized parameters
|
||||
dotnet_diagnostic.CA1303.severity = none
|
||||
|
||||
# CA1305: Specify IFormatProvider
|
||||
dotnet_diagnostic.CA1305.severity = none
|
||||
|
||||
# CA1307: Specify StringComparison for clarity
|
||||
dotnet_diagnostic.CA1307.severity = none
|
||||
|
||||
|
|
|
@ -9,6 +9,8 @@ using Uno.Extensions;
|
|||
using System.Threading.Tasks;
|
||||
using Uno.Disposables;
|
||||
|
||||
#pragma warning disable CA1305 // Specify IFormatProvider
|
||||
|
||||
namespace Microsoft.Toolkit.Uwp.UI.Lottie
|
||||
{
|
||||
partial class LottieVisualSourceBase
|
||||
|
@ -44,7 +46,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Lottie
|
|||
if (_lastSource == null || !_lastSource.Equals(sourceUri))
|
||||
{
|
||||
_lastSource = sourceUri;
|
||||
|
||||
|
||||
if ((await TryLoadDownloadJson(sourceUri, ct)) is { } jsonStream)
|
||||
{
|
||||
var firstLoad = true;
|
||||
|
@ -87,7 +89,7 @@ namespace Microsoft.Toolkit.Uwp.UI.Lottie
|
|||
updatedJson,
|
||||
");"
|
||||
};
|
||||
|
||||
|
||||
ExecuteJs(js);
|
||||
|
||||
if (_playState != null && _domLoaded)
|
||||
|
|
|
@ -290,7 +290,7 @@ namespace System.Json
|
|||
case '/': sb.Append("\\/"); break;
|
||||
default:
|
||||
sb.Append("\\u");
|
||||
sb.Append(((int)src[i]).ToString("x04"));
|
||||
sb.Append(((int)src[i]).ToString("x04", CultureInfo.InvariantCulture));
|
||||
break;
|
||||
}
|
||||
start = i + 1;
|
||||
|
|
|
@ -24,6 +24,7 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Windows.Markup;
|
||||
using Uno.Xaml.Schema;
|
||||
|
@ -105,7 +106,7 @@ namespace System.Windows.Markup
|
|||
|
||||
if (invalid)
|
||||
{
|
||||
throw new InvalidOperationException (String.Format ("Item in the array must be an instance of '{0}'", Type));
|
||||
throw new InvalidOperationException (String.Format (CultureInfo.InvariantCulture, "Item in the array must be an instance of '{0}'", Type));
|
||||
}
|
||||
}
|
||||
Array a = Array.CreateInstance (Type, Items.Count);
|
||||
|
|
|
@ -68,21 +68,21 @@ namespace System.Windows.Markup
|
|||
DateTime dt = (DateTime) value;
|
||||
if (dt.Millisecond != 0)
|
||||
{
|
||||
return dt.ToString ("yyyy-MM-dd'T'HH:mm:ss.F");
|
||||
return dt.ToString ("yyyy-MM-dd'T'HH:mm:ss.F", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
if (dt.Second != 0)
|
||||
{
|
||||
return dt.ToString ("yyyy-MM-dd'T'HH:mm:ss");
|
||||
return dt.ToString ("yyyy-MM-dd'T'HH:mm:ss", CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
if (dt.Minute != 0)
|
||||
{
|
||||
return dt.ToString ("yyyy-MM-dd'T'HH:mm");
|
||||
return dt.ToString ("yyyy-MM-dd'T'HH:mm", CultureInfo.InvariantCulture);
|
||||
}
|
||||
else
|
||||
{
|
||||
return dt.ToString ("yyyy-MM-dd");
|
||||
return dt.ToString ("yyyy-MM-dd", CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using Uno.Xaml.Schema;
|
||||
|
||||
|
@ -71,7 +72,7 @@ namespace System.Windows.Markup
|
|||
// there might be some cases that it could still
|
||||
// resolve a static member without MemberType,
|
||||
// but we don't know any of such so far.
|
||||
throw new ArgumentException (String.Format ("Member '{0}' could not be resolved to a static member", Member));
|
||||
throw new ArgumentException (String.Format (CultureInfo.InvariantCulture, "Member '{0}' could not be resolved to a static member", Member));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using Uno.Xaml.Schema;
|
||||
|
||||
|
@ -89,7 +90,7 @@ namespace System.Windows.Markup
|
|||
var ret = p.Resolve (TypeName);
|
||||
if (ret == null)
|
||||
{
|
||||
throw new InvalidOperationException (String.Format ("Type '{0}' is not resolved as a valid type by the type resolver '{1}'.", TypeName, p.GetType ()));
|
||||
throw new InvalidOperationException (String.Format (CultureInfo.InvariantCulture, "Type '{0}' is not resolved as a valid type by the type resolver '{1}'.", TypeName, p.GetType ()));
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
|
|
@ -154,12 +154,12 @@ namespace System.Windows.Markup
|
|||
|
||||
protected Exception GetConvertFromException (object value)
|
||||
{
|
||||
return new NotSupportedException (String.Format ("Conversion from string '{0}' is not supported", value));
|
||||
return new NotSupportedException (String.Format (CultureInfo.InvariantCulture, "Conversion from string '{0}' is not supported", value));
|
||||
}
|
||||
|
||||
protected Exception GetConvertToException (object value, Type destinationType)
|
||||
{
|
||||
return new NotSupportedException (String.Format ("Conversion from '{0}' to {1} is not supported", value != null ? value.GetType ().Name : "(null)", destinationType));
|
||||
return new NotSupportedException (String.Format (CultureInfo.InvariantCulture, "Conversion from '{0}' to {1} is not supported", value != null ? value.GetType ().Name : "(null)", destinationType));
|
||||
}
|
||||
|
||||
public virtual IEnumerable<Type> TypeReferences (object value, IValueSerializerContext context)
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
|
||||
namespace Uno.Xaml.Schema
|
||||
|
@ -66,9 +67,9 @@ namespace Uno.Xaml.Schema
|
|||
if (instance == null)
|
||||
throw new ArgumentNullException ("instance");
|
||||
if (member is XamlDirective)
|
||||
throw new NotSupportedException (String.Format ("not supported operation on directive member {0}", member));
|
||||
throw new NotSupportedException (String.Format (CultureInfo.InvariantCulture, "not supported operation on directive member {0}", member));
|
||||
if (UnderlyingGetter == null)
|
||||
throw new NotSupportedException (String.Format ("Attempt to get value from write-only property or event {0}", member));
|
||||
throw new NotSupportedException (String.Format (CultureInfo.InvariantCulture, "Attempt to get value from write-only property or event {0}", member));
|
||||
return UnderlyingGetter.Invoke (instance, Array.Empty<object>());
|
||||
}
|
||||
public virtual void SetValue (object instance, object value)
|
||||
|
@ -77,9 +78,9 @@ namespace Uno.Xaml.Schema
|
|||
if (instance == null)
|
||||
throw new ArgumentNullException ("instance");
|
||||
if (member is XamlDirective)
|
||||
throw new NotSupportedException (String.Format ("not supported operation on directive member {0}", member));
|
||||
throw new NotSupportedException (String.Format (CultureInfo.InvariantCulture, "not supported operation on directive member {0}", member));
|
||||
if (UnderlyingSetter == null)
|
||||
throw new NotSupportedException (String.Format ("Attempt to set value from read-only property {0}", member));
|
||||
throw new NotSupportedException (String.Format (CultureInfo.InvariantCulture, "Attempt to set value from read-only property {0}", member));
|
||||
if (member.IsAttachable)
|
||||
UnderlyingSetter.Invoke (null, new object [] {instance, value});
|
||||
else
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Windows.Markup;
|
||||
|
||||
|
@ -52,7 +53,7 @@ namespace Uno.Xaml.Schema
|
|||
void ThrowIfUnknown ()
|
||||
{
|
||||
if (type == null || type.UnderlyingType == null)
|
||||
throw new NotSupportedException (String.Format ("Current operation is valid only when the underlying type on a XamlType is known, but it is unknown for '{0}'", type));
|
||||
throw new NotSupportedException (String.Format (CultureInfo.InvariantCulture, "Current operation is valid only when the underlying type on a XamlType is known, but it is unknown for '{0}'", type));
|
||||
}
|
||||
|
||||
public EventHandler<XamlSetMarkupExtensionEventArgs> SetMarkupExtensionHandler {
|
||||
|
@ -77,7 +78,7 @@ namespace Uno.Xaml.Schema
|
|||
// FIXME: this method lookup should be mostly based on GetAddMethod(). At least iface method lookup must be done there.
|
||||
if (type != null && type.UnderlyingType != null) {
|
||||
if (!xct.IsCollection) // not sure why this check is done only when UnderlyingType exists...
|
||||
throw new NotSupportedException (String.Format ("Non-collection type '{0}' does not support this operation", xct));
|
||||
throw new NotSupportedException (String.Format (CultureInfo.InvariantCulture, "Non-collection type '{0}' does not support this operation", xct));
|
||||
if (ct.IsAssignableFrom (type.UnderlyingType))
|
||||
mi = GetAddMethod (type.SchemaContext.GetXamlType (item.GetType ()));
|
||||
}
|
||||
|
@ -95,7 +96,7 @@ namespace Uno.Xaml.Schema
|
|||
}
|
||||
|
||||
if (mi == null)
|
||||
throw new InvalidOperationException (String.Format ("The collection type '{0}' does not have 'Add' method", ct));
|
||||
throw new InvalidOperationException (String.Format (CultureInfo.InvariantCulture, "The collection type '{0}' does not have 'Add' method", ct));
|
||||
|
||||
mi.Invoke (instance, new object [] {item});
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace Uno.Xaml.Schema
|
||||
|
@ -32,7 +33,7 @@ namespace Uno.Xaml.Schema
|
|||
{
|
||||
XamlTypeName n;
|
||||
if (!TryParse (typeName, namespaceResolver, out n))
|
||||
throw new FormatException (String.Format ("Invalid typeName: '{0}'", typeName));
|
||||
throw new FormatException (String.Format (CultureInfo.InvariantCulture, "Invalid typeName: '{0}'", typeName));
|
||||
return n;
|
||||
}
|
||||
|
||||
|
@ -99,7 +100,7 @@ namespace Uno.Xaml.Schema
|
|||
{
|
||||
IList<XamlTypeName> list;
|
||||
if (!TryParseList (typeNameList, namespaceResolver, out list))
|
||||
throw new FormatException (String.Format ("Invalid type name list: '{0}'", typeNameList));
|
||||
throw new FormatException (String.Format (CultureInfo.InvariantCulture, "Invalid type name list: '{0}'", typeNameList));
|
||||
return list;
|
||||
}
|
||||
|
||||
|
@ -245,7 +246,7 @@ namespace Uno.Xaml.Schema
|
|||
else {
|
||||
string p = prefixLookup.LookupPrefix (Namespace);
|
||||
if (p == null)
|
||||
throw new InvalidOperationException (String.Format ("Could not lookup prefix for namespace '{0}'", Namespace));
|
||||
throw new InvalidOperationException (String.Format (CultureInfo.InvariantCulture, "Could not lookup prefix for namespace '{0}'", Namespace));
|
||||
ret = p.Length == 0 ? Name : p + ":" + Name;
|
||||
}
|
||||
string arr = null;
|
||||
|
|
|
@ -43,13 +43,13 @@ namespace Uno.Xaml.Schema
|
|||
|
||||
public override Object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, Object value)
|
||||
{
|
||||
throw new NotSupportedException (String.Format ("Conversion from type {0} is not supported", value != null ? value.GetType () : null));
|
||||
throw new NotSupportedException (String.Format (CultureInfo.InvariantCulture, "Conversion from type {0} is not supported", value != null ? value.GetType () : null));
|
||||
}
|
||||
|
||||
public override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
||||
{
|
||||
if (!CanConvertTo (context, destinationType))
|
||||
throw new NotSupportedException (String.Format ("Conversion to type {0} is not supported", destinationType));
|
||||
throw new NotSupportedException (String.Format (CultureInfo.InvariantCulture, "Conversion to type {0} is not supported", destinationType));
|
||||
|
||||
var vctx = (IValueSerializerContext) context;
|
||||
var lookup = vctx != null ? (INamespacePrefixLookup) vctx.GetService (typeof (INamespacePrefixLookup)) : null;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Uno.Xaml.Schema
|
||||
{
|
||||
|
@ -88,7 +89,7 @@ namespace Uno.Xaml.Schema
|
|||
return null;
|
||||
|
||||
if (!typeof (TConverterBase).IsAssignableFrom (ConverterType))
|
||||
throw new XamlSchemaException (String.Format ("ConverterType '{0}' is not derived from '{1}' type", ConverterType, typeof (TConverterBase)));
|
||||
throw new XamlSchemaException (String.Format (CultureInfo.InvariantCulture, "ConverterType '{0}' is not derived from '{1}' type", ConverterType, typeof (TConverterBase)));
|
||||
|
||||
if (TargetType != null && TargetType.UnderlyingType != null) {
|
||||
// special case: Enum
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
|
@ -189,7 +190,7 @@ namespace Uno.Xaml
|
|||
|
||||
static Exception Error(string format, params object[] args)
|
||||
{
|
||||
return new XamlParseException(String.Format(format, args));
|
||||
return new XamlParseException(String.Format(CultureInfo.InvariantCulture, format, args));
|
||||
}
|
||||
|
||||
internal static IEnumerable<string> SliceParameters(string vargs, string raw)
|
||||
|
|
|
@ -116,7 +116,7 @@ namespace Uno.Xaml
|
|||
return (string) tc.ConvertTo (vsctx, CultureInfo.InvariantCulture, obj, typeof (string));
|
||||
if (obj is string || obj == null)
|
||||
return (string) obj;
|
||||
throw new InvalidCastException (String.Format ("Cannot cast object '{0}' to string", obj.GetType ()));
|
||||
throw new InvalidCastException (String.Format (CultureInfo.InvariantCulture, "Cannot cast object '{0}' to string", obj.GetType ()));
|
||||
}
|
||||
|
||||
public static TypeConverter GetTypeConverter (this Type type)
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Uno.Xaml
|
||||
|
@ -36,7 +37,7 @@ namespace Uno.Xaml
|
|||
}
|
||||
|
||||
public XamlDuplicateMemberException (XamlMember member, XamlType type)
|
||||
: this (String.Format ("duplicate member '{0}' in type '{1}'", member, type))
|
||||
: this (String.Format (CultureInfo.InvariantCulture, "duplicate member '{0}' in type '{1}'", member, type))
|
||||
{
|
||||
DuplicateMember = member;
|
||||
ParentType = type;
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace Uno.Xaml
|
||||
|
@ -50,8 +51,8 @@ namespace Uno.Xaml
|
|||
if (lineNumber <= 0)
|
||||
return message;
|
||||
if (linePosition <= 0)
|
||||
return String.Format ("{0} at line {1}", message, lineNumber);
|
||||
return String.Format ("{0} at line {1}, position {2}", message, lineNumber, linePosition);
|
||||
return String.Format (CultureInfo.InvariantCulture, "{0} at line {1}", message, lineNumber);
|
||||
return String.Format (CultureInfo.InvariantCulture, "{0} at line {1}, position {2}", message, lineNumber, linePosition);
|
||||
}
|
||||
|
||||
public XamlException (string message, Exception innerException, int lineNumber, int linePosition)
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Reflection;
|
||||
using System.Windows.Markup;
|
||||
using Uno.Xaml.Schema;
|
||||
|
@ -462,7 +463,7 @@ namespace Uno.Xaml
|
|||
if (method == null)
|
||||
return;
|
||||
if (method.GetParameters ().Length != 1 || method.ReturnType == typeof (void))
|
||||
throw new ArgumentException (String.Format ("Property getter for {0} must have exactly one argument and must have non-void return type.", Name));
|
||||
throw new ArgumentException (String.Format (CultureInfo.InvariantCulture, "Property getter for {0} must have exactly one argument and must have non-void return type.", Name));
|
||||
}
|
||||
|
||||
void VerifyAdderSetter (MethodInfo method)
|
||||
|
@ -470,7 +471,7 @@ namespace Uno.Xaml
|
|||
if (method == null)
|
||||
return;
|
||||
if (method.GetParameters ().Length != 2)
|
||||
throw new ArgumentException (String.Format ("Property getter or event adder for {0} must have exactly one argument and must have non-void return type.", Name));
|
||||
throw new ArgumentException (String.Format (CultureInfo.InvariantCulture, "Property getter or event adder for {0} must have exactly one argument and must have non-void return type.", Name));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@ using Uno.Xaml;
|
|||
using Uno.Xaml.Schema;
|
||||
using System.Xml;
|
||||
using System.Xml.Serialization;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Uno.Xaml
|
||||
{
|
||||
|
@ -175,7 +176,7 @@ namespace Uno.Xaml
|
|||
// The object appeared in the xaml tree for the first time. So we store the reference with a unique name so that it could be referenced later.
|
||||
refName = GetReferenceName (xobj);
|
||||
if (NameResolver.IsCollectingReferences && NameResolver.Contains (refName))
|
||||
throw new InvalidOperationException (String.Format ("There is already an object of type {0} named as '{1}'. Object names must be unique.", val.GetType (), refName));
|
||||
throw new InvalidOperationException (String.Format (CultureInfo.InvariantCulture, "There is already an object of type {0} named as '{1}'. Object names must be unique.", val.GetType (), refName));
|
||||
NameResolver.SetNamedObject (refName, val, true); // probably fullyInitialized is always true here.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ using System;
|
|||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Windows.Markup;
|
||||
using Uno.Xaml;
|
||||
|
@ -92,10 +93,10 @@ namespace Uno.Xaml
|
|||
if (instance != null) {
|
||||
var type = new InstanceContext (instance).GetRawValue ().GetType ();
|
||||
if (!type.IsPublic)
|
||||
throw new XamlObjectReaderException (String.Format ("instance type '{0}' must be public and non-nested.", type));
|
||||
throw new XamlObjectReaderException (String.Format (CultureInfo.InvariantCulture, "instance type '{0}' must be public and non-nested.", type));
|
||||
var xt = SchemaContext.GetXamlType (type);
|
||||
if (xt.ConstructionRequiresArguments && !xt.GetConstructorArguments ().Any () && xt.TypeConverter == null)
|
||||
throw new XamlObjectReaderException (String.Format ("instance type '{0}' has no default constructor.", type));
|
||||
throw new XamlObjectReaderException (String.Format (CultureInfo.InvariantCulture, "instance type '{0}' has no default constructor.", type));
|
||||
}
|
||||
|
||||
value_serializer_context = new ValueSerializerContext (new PrefixLookup (sctx), sctx, null);
|
||||
|
|
|
@ -235,12 +235,12 @@ namespace Uno.Xaml
|
|||
if (object_states.Count > 0) {
|
||||
var pstate = object_states.Peek ();
|
||||
if (CurrentMemberState.Value != null)
|
||||
throw new XamlDuplicateMemberException (String.Format ("Member '{0}' is already written to current type '{1}'", CurrentMember, pstate.Type));
|
||||
throw new XamlDuplicateMemberException (String.Format (CultureInfo.InvariantCulture, "Member '{0}' is already written to current type '{1}'", CurrentMember, pstate.Type));
|
||||
} else {
|
||||
var obj = source.Settings.RootObjectInstance;
|
||||
if (obj != null) {
|
||||
if (state.Type.UnderlyingType != null && !state.Type.UnderlyingType.IsAssignableFrom (obj.GetType ()))
|
||||
throw new XamlObjectWriterException (String.Format ("RootObjectInstance type '{0}' is not assignable to '{1}'", obj.GetType (), state.Type));
|
||||
throw new XamlObjectWriterException (String.Format (CultureInfo.InvariantCulture, "RootObjectInstance type '{0}' is not assignable to '{1}'", obj.GetType (), state.Type));
|
||||
state.Value = obj;
|
||||
state.IsInstantiated = true;
|
||||
}
|
||||
|
@ -260,7 +260,7 @@ namespace Uno.Xaml
|
|||
var xm = CurrentMember;
|
||||
var instance = xm.Invoker.GetValue (object_states.Peek ().Value);
|
||||
if (instance == null)
|
||||
throw new XamlObjectWriterException (String.Format ("The value for '{0}' property is null", xm.Name));
|
||||
throw new XamlObjectWriterException (String.Format (CultureInfo.InvariantCulture, "The value for '{0}' property is null", xm.Name));
|
||||
state.Value = instance;
|
||||
state.IsInstantiated = true;
|
||||
object_states.Push (state);
|
||||
|
@ -345,7 +345,7 @@ namespace Uno.Xaml
|
|||
var contents = (List<object>) state.Value;
|
||||
var mi = state.Type.UnderlyingType.GetMethods (static_flags).FirstOrDefault (mii => mii.Name == state.FactoryMethod && mii.GetParameters ().Length == contents.Count);
|
||||
if (mi == null)
|
||||
throw new XamlObjectWriterException (String.Format ("Specified static factory method '{0}' for type '{1}' was not found", state.FactoryMethod, state.Type));
|
||||
throw new XamlObjectWriterException (String.Format (CultureInfo.InvariantCulture, "Specified static factory method '{0}' for type '{1}' was not found", state.FactoryMethod, state.Type));
|
||||
state.Value = mi.Invoke (null, contents.ToArray ());
|
||||
}
|
||||
else
|
||||
|
@ -368,14 +368,14 @@ namespace Uno.Xaml
|
|||
void SetEvent (XamlMember member, string value)
|
||||
{
|
||||
if (member.UnderlyingMember == null)
|
||||
throw new XamlObjectWriterException (String.Format ("Event {0} has no underlying member to attach event", member));
|
||||
throw new XamlObjectWriterException (String.Format (CultureInfo.InvariantCulture, "Event {0} has no underlying member to attach event", member));
|
||||
|
||||
int idx = value.LastIndexOf ('.');
|
||||
var xt = idx < 0 ? root_state.Type : ResolveTypeFromName (value.Substring (0, idx));
|
||||
if (xt == null)
|
||||
throw new XamlObjectWriterException (String.Format ("Referenced type {0} in event {1} was not found", value, member));
|
||||
throw new XamlObjectWriterException (String.Format (CultureInfo.InvariantCulture, "Referenced type {0} in event {1} was not found", value, member));
|
||||
if (xt.UnderlyingType == null)
|
||||
throw new XamlObjectWriterException (String.Format ("Referenced type {0} in event {1} has no underlying type", value, member));
|
||||
throw new XamlObjectWriterException (String.Format (CultureInfo.InvariantCulture, "Referenced type {0} in event {1} has no underlying type", value, member));
|
||||
string mn = idx < 0 ? value : value.Substring (idx + 1);
|
||||
var ev = (EventInfo) member.UnderlyingMember;
|
||||
// get an appropriate MethodInfo overload whose signature matches the event's handler type.
|
||||
|
@ -385,7 +385,7 @@ namespace Uno.Xaml
|
|||
var target = root_state.Value;
|
||||
var mi = target.GetType().GetMethod (mn, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public, null, (from pi in eventMethodParams select pi.ParameterType).ToArray (), null);
|
||||
if (mi == null)
|
||||
throw new XamlObjectWriterException (String.Format ("Referenced value method {0} in type {1} indicated by event {2} was not found", mn, value, member));
|
||||
throw new XamlObjectWriterException (String.Format (CultureInfo.InvariantCulture, "Referenced value method {0} in type {1} indicated by event {2} was not found", mn, value, member));
|
||||
var obj = object_states.Peek ().Value;
|
||||
ev.AddEventHandler (obj, Delegate.CreateDelegate (ev.EventHandlerType, target, mi));
|
||||
}
|
||||
|
@ -426,7 +426,7 @@ namespace Uno.Xaml
|
|||
protected override void OnWriteValue (object value)
|
||||
{
|
||||
if (CurrentMemberState.Value != null)
|
||||
throw new XamlDuplicateMemberException (String.Format ("Member '{0}' is already written to current type '{1}'", CurrentMember, object_states.Peek ().Type));
|
||||
throw new XamlDuplicateMemberException (String.Format (CultureInfo.InvariantCulture, "Member '{0}' is already written to current type '{1}'", CurrentMember, object_states.Peek ().Type));
|
||||
StoreAppropriatelyTypedValue (value, null);
|
||||
}
|
||||
|
||||
|
@ -494,7 +494,7 @@ namespace Uno.Xaml
|
|||
throw;
|
||||
} catch (Exception ex) {
|
||||
// For + ex.Message, the runtime should print InnerException message like .NET does.
|
||||
throw new XamlObjectWriterException (String.Format ("Could not convert object \'{0}' (of type {1}) to {2}: ", value, value != null ? (object) value.GetType () : "(null)", xt) + ex.Message, ex);
|
||||
throw new XamlObjectWriterException (String.Format (CultureInfo.InvariantCulture, "Could not convert object \'{0}' (of type {1}) to {2}: ", value, value != null ? (object) value.GetType () : "(null)", xt) + ex.Message, ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -540,7 +540,7 @@ namespace Uno.Xaml
|
|||
return value;
|
||||
}
|
||||
|
||||
throw new XamlObjectWriterException (String.Format ("Value '{0}' (of type {1}) is not of or convertible to type {0} (member {3})", value, value != null ? (object) value.GetType () : "(null)", xt, xm));
|
||||
throw new XamlObjectWriterException (String.Format (CultureInfo.InvariantCulture, "Value '{0}' (of type {1}) is not of or convertible to type {0} (member {3})", value, value != null ? (object) value.GetType () : "(null)", xt, xm));
|
||||
}
|
||||
|
||||
XamlType ResolveTypeFromName (string name)
|
||||
|
@ -598,7 +598,7 @@ namespace Uno.Xaml
|
|||
// FIXME: sort out relationship between name_scope and name_resolver. (unify to name_resolver, probably)
|
||||
var obj = name_scope.FindName (name) ?? name_resolver.Resolve (name, out isFullyInitialized);
|
||||
if (obj == null)
|
||||
throw new XamlObjectWriterException (String.Format ("Unresolved object reference '{0}' was found", name));
|
||||
throw new XamlObjectWriterException (String.Format (CultureInfo.InvariantCulture, "Unresolved object reference '{0}' was found", name));
|
||||
if (!AddToCollectionIfAppropriate (fixup.ParentType, fixup.ParentMember, fixup.ParentValue, obj, null)) // FIXME: is keyObj always null?
|
||||
SetValue (fixup.ParentMember, fixup.ParentValue, obj);
|
||||
}
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Windows.Markup;
|
||||
|
@ -395,7 +396,7 @@ namespace Uno.Xaml
|
|||
if (xt == null)
|
||||
xt = XamlLanguage.AllTypes.FirstOrDefault (t => t.Name == xmlLocalName);
|
||||
if (xt == null)
|
||||
throw new FormatException (string.Format ("There is no type '{0}' in XAML namespace", name));
|
||||
throw new FormatException (string.Format (CultureInfo.InvariantCulture, "There is no type '{0}' in XAML namespace", name));
|
||||
return xt.UnderlyingType;
|
||||
}
|
||||
else if (!ns.StartsWith ("clr-namespace:", StringComparison.Ordinal))
|
||||
|
@ -411,7 +412,7 @@ namespace Uno.Xaml
|
|||
// convert xml namespace to clr namespace and assembly
|
||||
string [] split = ns.Split (new char[] { ';' });
|
||||
if (split.Length != 2 || split [0].Length < clr_ns_len || split [1].Length <= clr_ass_len)
|
||||
throw new XamlParseException (string.Format ("Cannot resolve runtime namespace from XML namespace '{0}'", ns));
|
||||
throw new XamlParseException (string.Format (CultureInfo.InvariantCulture, "Cannot resolve runtime namespace from XML namespace '{0}'", ns));
|
||||
string tns = split [0].Substring (clr_ns_len);
|
||||
string aname = split [1].Substring (clr_ass_len);
|
||||
|
||||
|
@ -420,7 +421,7 @@ namespace Uno.Xaml
|
|||
// MarkupExtension type could omit "Extension" part in XML name.
|
||||
Type ret = ass == null ? null : ass.GetType (taqn) ?? ass.GetType (GetTypeName (tns, name + "Extension", genArgs));
|
||||
if (ret == null)
|
||||
throw new XamlParseException (string.Format ("Cannot resolve runtime type from XML namespace '{0}', local name '{1}' with {2} type arguments ({3})", ns, name, typeArguments !=null ? typeArguments.Count : 0, taqn));
|
||||
throw new XamlParseException (string.Format (CultureInfo.InvariantCulture, "Cannot resolve runtime type from XML namespace '{0}', local name '{1}' with {2} type arguments ({3})", ns, name, typeArguments !=null ? typeArguments.Count : 0, taqn));
|
||||
return genArgs == null ? ret : ret.MakeGenericType (genArgs);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,6 +29,7 @@ using System.Reflection;
|
|||
using System.Windows.Markup;
|
||||
using Uno.Xaml.Schema;
|
||||
using System.Xml.Serialization;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Uno.Xaml
|
||||
{
|
||||
|
@ -66,7 +67,7 @@ namespace Uno.Xaml
|
|||
PreferredXamlNamespace = XamlLanguage.Xaml2006Namespace;
|
||||
} else {
|
||||
Name = GetXamlName (type);
|
||||
PreferredXamlNamespace = schemaContext.GetXamlNamespace (type.Namespace) ?? String.Format ("clr-namespace:{0};assembly={1}", type.Namespace, type.Assembly.GetName ().Name);
|
||||
PreferredXamlNamespace = schemaContext.GetXamlNamespace (type.Namespace) ?? String.Format (CultureInfo.InvariantCulture, "clr-namespace:{0};assembly={1}", type.Namespace, type.Assembly.GetName ().Name);
|
||||
}
|
||||
if (type.IsGenericType) {
|
||||
TypeArguments = new List<XamlType> ();
|
||||
|
|
|
@ -192,7 +192,7 @@ namespace Uno.Xaml
|
|||
var state = object_states.Peek ();
|
||||
var wpl = state.WrittenProperties;
|
||||
if (wpl.Any (wp => wp.Member == property))
|
||||
throw new XamlDuplicateMemberException (String.Format ("Property '{0}' is already set to this '{1}' object", property, object_states.Peek ().Type));
|
||||
throw new XamlDuplicateMemberException (String.Format (CultureInfo.InvariantCulture, "Property '{0}' is already set to this '{1}' object", property, object_states.Peek ().Type));
|
||||
wpl.Add (new MemberAndValue (property));
|
||||
if (property == XamlLanguage.PositionalParameters)
|
||||
state.PositionalParameterIndex = 0;
|
||||
|
@ -249,7 +249,7 @@ namespace Uno.Xaml
|
|||
if (vs != null)
|
||||
return vs.ConverterInstance.ConvertToString (value, service_provider);
|
||||
else
|
||||
throw new XamlXmlWriterException (String.Format ("Value type is '{0}' but it must be either string or any type that is convertible to string indicated by TypeConverterAttribute.", value != null ? value.GetType () : null));
|
||||
throw new XamlXmlWriterException (String.Format (CultureInfo.InvariantCulture, "Value type is '{0}' but it must be either string or any type that is convertible to string indicated by TypeConverterAttribute.", value != null ? value.GetType () : null));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
|
@ -181,7 +182,7 @@ namespace Uno.Xaml
|
|||
public void Namespace ()
|
||||
{
|
||||
if (!allow_ns_at_value && (state == XamlWriteState.ValueWritten || state == XamlWriteState.ObjectStarted))
|
||||
throw CreateError (String.Format ("Namespace declarations cannot be written at {0} state", state));
|
||||
throw CreateError (String.Format (CultureInfo.InvariantCulture, "Namespace declarations cannot be written at {0} state", state));
|
||||
ns_pushed = true;
|
||||
}
|
||||
|
||||
|
@ -248,14 +249,14 @@ namespace Uno.Xaml
|
|||
}
|
||||
break;
|
||||
}
|
||||
throw CreateError (String.Format ("{0} is not allowed at current state {1}", next, state));
|
||||
throw CreateError (String.Format (CultureInfo.InvariantCulture, "{0} is not allowed at current state {1}", next, state));
|
||||
}
|
||||
|
||||
void RejectNamespaces (XamlNodeType next)
|
||||
{
|
||||
if (ns_pushed) {
|
||||
// strange, but on WriteEndMember it throws XamlXmlWriterException, while for other nodes it throws IOE.
|
||||
string msg = String.Format ("Namespace declarations cannot be written before {0}", next);
|
||||
string msg = String.Format (CultureInfo.InvariantCulture, "Namespace declarations cannot be written before {0}", next);
|
||||
if (next == XamlNodeType.EndMember)
|
||||
throw CreateError (msg);
|
||||
else
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
//
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Xml;
|
||||
|
@ -780,7 +781,7 @@ namespace Uno.Xaml
|
|||
yield return Node (XamlNodeType.EndObject, xm.Type);
|
||||
}
|
||||
else
|
||||
throw new XamlParseException (String.Format ("Read-only member '{0}' showed up in the source XML, and the xml contains element content that cannot be read.", xm.Name)) { LineNumber = this.LineNumber, LinePosition = this.LinePosition };
|
||||
throw new XamlParseException (String.Format (CultureInfo.InvariantCulture, "Read-only member '{0}' showed up in the source XML, and the xml contains element content that cannot be read.", xm.Name)) { LineNumber = this.LineNumber, LinePosition = this.LinePosition };
|
||||
} else {
|
||||
if (xm.Type.IsCollection || xm.Type.IsDictionary) {
|
||||
foreach (var ni in ReadCollectionItems (parentType, xm))
|
||||
|
|
|
@ -289,7 +289,7 @@ namespace Uno.Xaml
|
|||
var state = object_states.Pop ();
|
||||
|
||||
if (!CurrentMember.Type.IsCollection)
|
||||
throw new InvalidOperationException (String.Format ("WriteGetObject method can be invoked only when current member '{0}' is of collection type", CurrentMember));
|
||||
throw new InvalidOperationException (String.Format (CultureInfo.InvariantCulture, "WriteGetObject method can be invoked only when current member '{0}' is of collection type", CurrentMember));
|
||||
|
||||
object_states.Push (state);
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ namespace Uno.Xaml
|
|||
break;
|
||||
default:
|
||||
if (inside_toplevel_positional_parameter)
|
||||
throw new XamlXmlWriterException (String.Format ("The XAML reader input has more than one positional parameter values within a top-level object {0} because it tries to write all of the argument values as an attribute value of the first argument. While XamlObjectReader can read such an object, XamlXmlWriter cannot write such an object to XML.", state.Type));
|
||||
throw new XamlXmlWriterException (String.Format (CultureInfo.InvariantCulture, "The XAML reader input has more than one positional parameter values within a top-level object {0} because it tries to write all of the argument values as an attribute value of the first argument. While XamlObjectReader can read such an object, XamlXmlWriter cannot write such an object to XML.", state.Type));
|
||||
|
||||
state.PositionalParameterIndex++;
|
||||
w.WriteString (", ");
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using Microsoft.CodeAnalysis;
|
||||
|
||||
#if NETFRAMEWORK
|
||||
|
@ -25,7 +26,7 @@ public partial class DependencyObjectGenerator
|
|||
private static void ReportDiagnostic(GeneratorExecutionContext context, Diagnostic diagnostic)
|
||||
{
|
||||
#if NETFRAMEWORK
|
||||
throw new InvalidOperationException(diagnostic.GetMessage());
|
||||
throw new InvalidOperationException(diagnostic.GetMessage(CultureInfo.InvariantCulture));
|
||||
#else
|
||||
context.ReportDiagnostic(diagnostic);
|
||||
#endif
|
||||
|
|
|
@ -220,7 +220,7 @@ namespace Uno.UI.SourceGenerators.Telemetry.PersistenceChannel
|
|||
Interlocked.Add(ref _storageSize, temporaryFileSize);
|
||||
|
||||
// Creates a new file name
|
||||
string now = DateTime.UtcNow.ToString("yyyyMMddHHmmss");
|
||||
string now = DateTime.UtcNow.ToString("yyyyMMddHHmmss", CultureInfo.InvariantCulture);
|
||||
string newFileName = string.Format(CultureInfo.InvariantCulture, "{0}_{1}.trn", now, tempFileName);
|
||||
|
||||
// Renames the file
|
||||
|
@ -245,6 +245,7 @@ namespace Uno.UI.SourceGenerators.Telemetry.PersistenceChannel
|
|||
{
|
||||
string message =
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"Failed to save transmission to file. UnauthorizedAccessException. File path: {0}, FileName: {1}",
|
||||
StorageFolder, file);
|
||||
PersistenceChannelDebugLog.WriteLine(message);
|
||||
|
@ -267,6 +268,7 @@ namespace Uno.UI.SourceGenerators.Telemetry.PersistenceChannel
|
|||
{
|
||||
string message =
|
||||
string.Format(
|
||||
CultureInfo.InvariantCulture,
|
||||
"Failed to load transmission from file. File path: {0}, FileName: {1}, Exception: {2}",
|
||||
"storageFolderName", file, e);
|
||||
PersistenceChannelDebugLog.WriteLine(message);
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#nullable enable
|
||||
|
||||
using System.Globalization;
|
||||
|
||||
namespace Uno.UI.SourceGenerators.XamlGenerator
|
||||
{
|
||||
/// <summary>
|
||||
|
@ -16,7 +18,7 @@ namespace Uno.UI.SourceGenerators.XamlGenerator
|
|||
|
||||
public ResourceOwner()
|
||||
{
|
||||
Name = "__ResourceOwner_" + (_resourceOwners++).ToString();
|
||||
Name = "__ResourceOwner_" + (_resourceOwners++).ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -813,7 +813,7 @@ namespace Uno.UI.SourceGenerators.XamlGenerator
|
|||
// For Uno assembly, we expose WinUI resources using same uri as on Windows
|
||||
for (int fluentVersion = 1; fluentVersion <= XamlConstants.MaxFluentResourcesVersion; fluentVersion++)
|
||||
{
|
||||
RegisterForFile(string.Format(WinUIThemeResourcePathSuffixFormatString, fluentVersion), XamlFilePathHelper.GetWinUIThemeResourceUrl(fluentVersion));
|
||||
RegisterForFile(string.Format(CultureInfo.InvariantCulture, WinUIThemeResourcePathSuffixFormatString, fluentVersion), XamlFilePathHelper.GetWinUIThemeResourceUrl(fluentVersion));
|
||||
}
|
||||
RegisterForFile(WinUICompactPathSuffix, XamlFilePathHelper.WinUICompactURL);
|
||||
}
|
||||
|
|
|
@ -5072,7 +5072,7 @@ namespace Uno.UI.SourceGenerators.XamlGenerator
|
|||
|
||||
private static string ParseTimeSpan(string memberValue)
|
||||
{
|
||||
var value = TimeSpan.Parse(memberValue);
|
||||
var value = TimeSpan.Parse(memberValue, CultureInfo.InvariantCulture);
|
||||
|
||||
return $"global::System.TimeSpan.FromTicks({value.Ticks} /* {memberValue} */)";
|
||||
}
|
||||
|
@ -6014,13 +6014,13 @@ namespace Uno.UI.SourceGenerators.XamlGenerator
|
|||
var q = from element in EnumerateSubElements(xamlObjectDefinition.Owner)
|
||||
let phase = FindMember(element, "Phase")?.Value
|
||||
where phase != null
|
||||
select int.Parse(phase.ToString() ?? "");
|
||||
select int.Parse(phase.ToString() ?? "", CultureInfo.InvariantCulture);
|
||||
|
||||
var phases = q.Distinct().ToArray();
|
||||
|
||||
if (phases.Any())
|
||||
{
|
||||
var phasesValue = phases.OrderBy(i => i).Select(s => s.ToString()).JoinBy(",");
|
||||
var phasesValue = phases.OrderBy(i => i).Select(s => s.ToString(CultureInfo.InvariantCulture)).JoinBy(",");
|
||||
return $"global::Uno.UI.FrameworkElementHelper.SetDataTemplateRenderPhases({ownerVariable}, new []{{{phasesValue}}});";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Reflection;
|
|||
using Uno.Extensions;
|
||||
using Windows.UI.Xaml.Media;
|
||||
using Windows.Foundation;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Uno.Media
|
||||
{
|
||||
|
@ -27,22 +28,22 @@ namespace Uno.Media
|
|||
|
||||
public override void ArcTo(Point point, Size size, double rotationAngle, bool isLargeArc, SweepDirection sweepDirection, bool isStroked, bool isSmoothJoin)
|
||||
{
|
||||
_builder.AppendFormat("c.ArcTo({0}, {1}, {2}, {3}, {4}, true, false);" + CRLF, point.ToCode(), size.ToCode(), rotationAngle.ToCode(), isLargeArc.ToCode(), sweepDirection.ToCode());
|
||||
_builder.AppendFormat(CultureInfo.InvariantCulture, "c.ArcTo({0}, {1}, {2}, {3}, {4}, true, false);" + CRLF, point.ToCode(), size.ToCode(), rotationAngle.ToCode(), isLargeArc.ToCode(), sweepDirection.ToCode());
|
||||
}
|
||||
|
||||
public override void BeginFigure(Point startPoint, bool isFilled)
|
||||
{
|
||||
_builder.AppendFormat("c.BeginFigure({0}, true);" + CRLF, startPoint.ToCode());
|
||||
_builder.AppendFormat(CultureInfo.InvariantCulture, "c.BeginFigure({0}, true);" + CRLF, startPoint.ToCode());
|
||||
}
|
||||
|
||||
public override void BezierTo(Point point1, Point point2, Point point3, bool isStroked, bool isSmoothJoin)
|
||||
{
|
||||
_builder.AppendFormat("c.BezierTo({0}, {1}, {2}, true, false);" + CRLF, point1.ToCode(), point2.ToCode(), point3.ToCode());
|
||||
_builder.AppendFormat(CultureInfo.InvariantCulture, "c.BezierTo({0}, {1}, {2}, true, false);" + CRLF, point1.ToCode(), point2.ToCode(), point3.ToCode());
|
||||
}
|
||||
|
||||
public override void LineTo(Point point, bool isStroked, bool isSmoothJoin)
|
||||
{
|
||||
_builder.AppendFormat("c.LineTo({0}, true, false);" + CRLF, point.ToCode());
|
||||
_builder.AppendFormat(CultureInfo.InvariantCulture, "c.LineTo({0}, true, false);" + CRLF, point.ToCode());
|
||||
}
|
||||
|
||||
public override void PolyBezierTo(IList<Point> points, bool isStroked, bool isSmoothJoin)
|
||||
|
@ -62,12 +63,12 @@ namespace Uno.Media
|
|||
|
||||
public override void QuadraticBezierTo(Point point1, Point point2, bool isStroked, bool isSmoothJoin)
|
||||
{
|
||||
_builder.AppendFormat("c.BezierTo({0}, {1}, true, false);" + CRLF, point1.ToCode(), point2.ToCode());
|
||||
_builder.AppendFormat(CultureInfo.InvariantCulture, "c.BezierTo({0}, {1}, true, false);" + CRLF, point1.ToCode(), point2.ToCode());
|
||||
}
|
||||
|
||||
public override void SetClosedState(bool closed)
|
||||
{
|
||||
_builder.AppendFormat("c.SetClosedState({0});" + CRLF, closed.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLowerInvariant());
|
||||
_builder.AppendFormat(CultureInfo.InvariantCulture, "c.SetClosedState({0});" + CRLF, closed.ToString(System.Globalization.CultureInfo.InvariantCulture).ToLowerInvariant());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace Uno.Foundation.Logging
|
||||
|
@ -37,9 +38,9 @@ namespace Uno.Foundation.Logging
|
|||
public void Trace(IFormattable formattable) => Log(LogLevel.Trace, formattable.ToString());
|
||||
|
||||
public void LogDebug(string message) => Log(LogLevel.Debug, message);
|
||||
public void LogDebug(string message, params object?[] items) => Log(LogLevel.Debug, string.Format(message, items));
|
||||
public void LogDebug(string message, params object?[] items) => Log(LogLevel.Debug, string.Format(CultureInfo.InvariantCulture, message, items));
|
||||
public void DebugFormat(string message) => Log(LogLevel.Debug, message);
|
||||
public void DebugFormat(string message, params object?[] items) => Log(LogLevel.Debug, string.Format(message, items));
|
||||
public void DebugFormat(string message, params object?[] items) => Log(LogLevel.Debug, string.Format(CultureInfo.InvariantCulture, message, items));
|
||||
public void Debug(string message) => Log(LogLevel.Debug, message);
|
||||
public void Debug(IFormattable formattable) => Log(LogLevel.Debug, formattable.ToString());
|
||||
|
||||
|
@ -50,13 +51,13 @@ namespace Uno.Foundation.Logging
|
|||
public void Warn(string message, Exception ex) => Log(LogLevel.Warning, message);
|
||||
public void Warn(IFormattable formattable) => Log(LogLevel.Warning, formattable.ToString());
|
||||
|
||||
public void LogError(string message, params object?[] items) => Log(LogLevel.Error, string.Format(message, items));
|
||||
public void LogError(string message, params object?[] items) => Log(LogLevel.Error, string.Format(CultureInfo.InvariantCulture, message, items));
|
||||
public void LogError(string message) => Log(LogLevel.Error, message);
|
||||
public void LogError(string message, Exception ex) => Log(LogLevel.Error, message, ex);
|
||||
public void Error(string message) => Log(LogLevel.Error, message);
|
||||
public void Error(string message, Exception ex) => Log(LogLevel.Error, message, ex);
|
||||
public void ErrorFormat(string message, Exception ex) => Log(LogLevel.Error, message, ex);
|
||||
public void ErrorFormat(string message, params object[] items) => Log(LogLevel.Error, string.Format(message, items));
|
||||
public void ErrorFormat(string message, params object[] items) => Log(LogLevel.Error, string.Format(CultureInfo.InvariantCulture, message, items));
|
||||
public void Error(IFormattable formattable) => Log(LogLevel.Error, formattable.ToString());
|
||||
public void Error(IFormattable formattable, Exception ex) => Log(LogLevel.Error, formattable.ToString(), ex);
|
||||
|
||||
|
@ -65,7 +66,7 @@ namespace Uno.Foundation.Logging
|
|||
|
||||
public void LogInfo(string message) => Log(LogLevel.Information, message);
|
||||
public void LogInfo(string message, Exception ex) => Log(LogLevel.Information, message, ex);
|
||||
public void InfoFormat(string message, params object?[] items) => Log(LogLevel.Information, string.Format(message, items));
|
||||
public void InfoFormat(string message, params object?[] items) => Log(LogLevel.Information, string.Format(CultureInfo.InvariantCulture, message, items));
|
||||
public void Info(string message) => Log(LogLevel.Information, message);
|
||||
public void Info(string message, Exception ex) => Log(LogLevel.Information, message, ex);
|
||||
public void Info(IFormattable formattable) => Log(LogLevel.Information, formattable.ToString());
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
|
@ -11,8 +12,8 @@ namespace Uno.Foundation.Interop
|
|||
{
|
||||
private static readonly Func<string, IntPtr> _strToIntPtr =
|
||||
Marshal.SizeOf<IntPtr>() == 4
|
||||
? (s => (IntPtr)int.Parse(s))
|
||||
: (Func<string, IntPtr>)(s => (IntPtr)long.Parse(s));
|
||||
? (s => (IntPtr)int.Parse(s, CultureInfo.InvariantCulture))
|
||||
: (Func<string, IntPtr>)(s => (IntPtr)long.Parse(s, CultureInfo.InvariantCulture));
|
||||
|
||||
/// <summary>
|
||||
/// Used by javascript to dispatch a method call to the managed object at <paramref name="handlePtr"/>.
|
||||
|
|
|
@ -279,7 +279,7 @@ namespace Uno.Foundation
|
|||
string command;
|
||||
if (formattable.ArgumentCount == 0)
|
||||
{
|
||||
command = formattable.ToString();
|
||||
command = formattable.ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -472,7 +472,7 @@ namespace Uno.Foundation
|
|||
else
|
||||
{
|
||||
r.Append("\\u");
|
||||
r.Append(((ushort)c).ToString("X4"));
|
||||
r.Append(((ushort)c).ToString("X4", CultureInfo.InvariantCulture));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Runtime.CompilerServices;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using Android.Runtime;
|
||||
using System;
|
||||
|
@ -31,7 +32,7 @@ namespace Uno.Extensions
|
|||
if (instance.Log().IsEnabled(LogLevel.Warning))
|
||||
{
|
||||
instance.Log().Warn(
|
||||
string.Format("Native invocation discarded for {0} at {1}:{2} ({3}). The object may not have been disposed properly by its owner."
|
||||
string.Format(CultureInfo.InvariantCulture, "Native invocation discarded for {0} at {1}:{2} ({3}). The object may not have been disposed properly by its owner."
|
||||
, instance.GetType()
|
||||
, member
|
||||
, line
|
||||
|
|
|
@ -1,248 +0,0 @@
|
|||
// ******************************************************************
|
||||
// Copyright <20> 2015-2018 nventive inc. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
// ******************************************************************
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Uno.Extensions
|
||||
{
|
||||
internal static partial class StringExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Improves upon <see cref="string.Format(string, object[])"/> to allow a 4th and 5th
|
||||
/// group in numerical custom formats, for values 1 and -1. See <see cref="Format(IFormatProvider, string, object[])"/>
|
||||
/// for details.
|
||||
/// </summary>
|
||||
/// <param name="format"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
public static string Format(string format, params object[] args)
|
||||
{
|
||||
return Format(CultureInfo.CurrentUICulture, format, args);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Improves upon <see cref="string.Format(IFormatProvider, string, object[])"/> to allow a 4th and 5th
|
||||
/// group in numerical custom formats, for values 1 and -1. Just like the 3rd group, which applies to value 0,
|
||||
/// these groups will get used if the first group (positive) or second group (negative) would display the same
|
||||
/// string as if 1 or -1 was the argument. For example, given the en-US culture, the "{0:C;C;broke;a buck}"
|
||||
/// format would display "$1.42" for value 1.42, display "broke" for values 0, -0.004 or 0.003, and display
|
||||
/// "a buck" for values 0.995, 1 or 1.0025.
|
||||
/// </summary>
|
||||
/// <param name="provider"></param>
|
||||
/// <param name="format"></param>
|
||||
/// <param name="args"></param>
|
||||
/// <returns></returns>
|
||||
public static string Format(IFormatProvider provider, string format, params object[] args)
|
||||
{
|
||||
var finalBuilder = new StringBuilder();
|
||||
|
||||
var isEscaping = false;
|
||||
|
||||
// We build both the deconstructed parts of a group and the original.
|
||||
// The deconstructed version does not include the opening and closing accolades, nor the colon or semi-colon separators.
|
||||
var groupBuilders = new List<StringBuilder>();
|
||||
var currentGroupBuilder = default(StringBuilder);
|
||||
var originalGroupBuilder = new StringBuilder();
|
||||
|
||||
for (int position = 0; position < format.Length; position++)
|
||||
{
|
||||
var builder = (currentGroupBuilder == null) ? finalBuilder : originalGroupBuilder;
|
||||
|
||||
if (isEscaping)
|
||||
{
|
||||
builder.Append(format[position]);
|
||||
currentGroupBuilder?.Append(format[position]);
|
||||
|
||||
isEscaping = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (format[position])
|
||||
{
|
||||
case '\\':
|
||||
isEscaping = true;
|
||||
builder.Append('\\');
|
||||
currentGroupBuilder?.Append('\\');
|
||||
break;
|
||||
|
||||
case '{':
|
||||
if ((position < format.Length - 1) && (format[position + 1] == '{'))
|
||||
{
|
||||
// Escaped {{.
|
||||
isEscaping = true;
|
||||
builder.Append('{');
|
||||
currentGroupBuilder?.Append('{');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentGroupBuilder != null)
|
||||
{
|
||||
throw new ArgumentException("Invalid group format. Nested opening accolades.");
|
||||
}
|
||||
|
||||
// No { in deconstructed groups.
|
||||
groupBuilders.Add(currentGroupBuilder = new StringBuilder());
|
||||
originalGroupBuilder.Append('{');
|
||||
}
|
||||
break;
|
||||
|
||||
case '}':
|
||||
if ((position < format.Length - 1) && (format[position + 1] == '}'))
|
||||
{
|
||||
// Escaped }}.
|
||||
isEscaping = true;
|
||||
builder.Append('}');
|
||||
currentGroupBuilder?.Append('}');
|
||||
}
|
||||
else
|
||||
{
|
||||
if (currentGroupBuilder == null)
|
||||
{
|
||||
// string.Format does not tolerate this.
|
||||
throw new ArgumentException("Format string contains an orphan closing accolade.");
|
||||
}
|
||||
else
|
||||
{
|
||||
// No } in deconstructed groups.
|
||||
builder.Append('}');
|
||||
|
||||
// We're now ready to output that group.
|
||||
if (groupBuilders.Count > 4)
|
||||
{
|
||||
// We have the "1" or "-1" formatters.
|
||||
finalBuilder.Append(
|
||||
FormatGroup(
|
||||
provider,
|
||||
builder.ToString(),
|
||||
groupBuilders
|
||||
.Select(group => group.ToString())
|
||||
.ToArray(),
|
||||
args));
|
||||
}
|
||||
else
|
||||
{
|
||||
finalBuilder.Append(string.Format(provider, builder.ToString(), args));
|
||||
}
|
||||
}
|
||||
|
||||
originalGroupBuilder.Clear();
|
||||
groupBuilders.Clear();
|
||||
currentGroupBuilder = null;
|
||||
}
|
||||
break;
|
||||
|
||||
case ':':
|
||||
builder.Append(':');
|
||||
|
||||
if (currentGroupBuilder != null)
|
||||
{
|
||||
// We have a first section after the index placeholder.
|
||||
groupBuilders.Add(currentGroupBuilder = new StringBuilder());
|
||||
}
|
||||
break;
|
||||
|
||||
case ';':
|
||||
builder.Append(';');
|
||||
|
||||
if (currentGroupBuilder != null)
|
||||
{
|
||||
// We have a new section in the group.
|
||||
groupBuilders.Add(currentGroupBuilder = new StringBuilder());
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
builder.Append(format[position]);
|
||||
currentGroupBuilder?.Append(format[position]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (originalGroupBuilder.Length > 0)
|
||||
{
|
||||
// We let string.Format handle this situation. This ensures we throw the same exceptions,
|
||||
// if any, or return the same value.
|
||||
finalBuilder.Append(string.Format(provider, originalGroupBuilder.ToString(), args));
|
||||
}
|
||||
|
||||
return finalBuilder.ToString();
|
||||
}
|
||||
|
||||
private static string FormatGroup(IFormatProvider provider, string originalFormat, string[] deconstructedFormat, object[] args)
|
||||
{
|
||||
// deconstructedFormat[0] contains the index placeholder.
|
||||
// deconstructedFormat[1+] contain the sections.
|
||||
if (deconstructedFormat.Length < 5)
|
||||
{
|
||||
throw new ArgumentException("Do not call this method with formats that do not include a fourth or fifth section, for values 1 or -1.");
|
||||
}
|
||||
|
||||
// We let those two lines throw if they have to.
|
||||
var position = int.Parse(deconstructedFormat[0]);
|
||||
var value = args[position];
|
||||
|
||||
if (deconstructedFormat.Length >= 5)
|
||||
{
|
||||
// The 4th section is for "value == 1"
|
||||
if (IsOne(provider, $"{{0:{deconstructedFormat[1]}}}", value))
|
||||
{
|
||||
return string.Format(provider, $"{{0:{deconstructedFormat[4]}}}", value);
|
||||
}
|
||||
}
|
||||
|
||||
if (deconstructedFormat.Length >= 6)
|
||||
{
|
||||
// An empty 5th group reverts to using the 4th.
|
||||
if (deconstructedFormat[5].Length == 0)
|
||||
{
|
||||
deconstructedFormat[5] = deconstructedFormat[4];
|
||||
}
|
||||
|
||||
// The 5th section is for "value == -1".
|
||||
if (IsOne(provider, $"{{0:{deconstructedFormat[2]}}}", value, true))
|
||||
{
|
||||
return string.Format(provider, $"{{0:{deconstructedFormat[5]}}}", value);
|
||||
}
|
||||
}
|
||||
|
||||
// string.Format tolerates the presence of extra sections. That's why it's safe to use the original format.
|
||||
return string.Format(provider, originalFormat, args);
|
||||
}
|
||||
|
||||
private static bool IsOne(IFormatProvider provider, string format, object value, bool isNegative = false)
|
||||
{
|
||||
try
|
||||
{
|
||||
// Since groups can round items, we determine if we have one item by comparing the formatted value and formattting "1" or "-1".
|
||||
var formattedValue = string.Format(provider, format, value);
|
||||
var formattedOne = string.Format(provider, format, isNegative ? -1 : 1);
|
||||
|
||||
if (formattedOne.Equals(formattedValue, StringComparison.Ordinal))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
catch { }
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
|||
using Windows.Foundation;
|
||||
using Uno.Foundation.Logging;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Uno.UI.Dispatching
|
||||
{
|
||||
|
@ -212,7 +213,7 @@ namespace Uno.UI.Dispatching
|
|||
TraceProvider.CoreDispatcher_Schedule,
|
||||
EventOpcode.Send,
|
||||
new[] {
|
||||
((int)priority).ToString(),
|
||||
((int)priority).ToString(CultureInfo.InvariantCulture),
|
||||
handler.Method.DeclaringType?.FullName + "." + handler.Method.DeclaringType?.Name
|
||||
}
|
||||
);
|
||||
|
@ -363,7 +364,7 @@ namespace Uno.UI.Dispatching
|
|||
TraceProvider.CoreDispatcher_InvokeStart,
|
||||
TraceProvider.CoreDispatcher_InvokeStop,
|
||||
relatedActivity: operation.ScheduleEventActivity,
|
||||
payload: new[] { ((int)CurrentPriority).ToString(), operation.GetDiagnosticsName() }
|
||||
payload: new[] { ((int)CurrentPriority).ToString(CultureInfo.InvariantCulture), operation.GetDiagnosticsName() }
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reactive.Linq;
|
||||
|
@ -186,7 +187,7 @@ namespace Uno.UI.RemoteControl.Host.HotReload
|
|||
_reporter.Output("Unable to apply hot reload because of a rude edit. Rebuilding the app...");
|
||||
foreach (var diagnostic in hotReloadDiagnostics)
|
||||
{
|
||||
_reporter.Verbose(CSharpDiagnosticFormatter.Instance.Format(diagnostic));
|
||||
_reporter.Verbose(CSharpDiagnosticFormatter.Instance.Format(diagnostic, CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
// HotReloadEventSource.Log.HotReloadEnd(HotReloadEventSource.StartType.CompilationHandler);
|
||||
|
@ -261,7 +262,7 @@ namespace Uno.UI.RemoteControl.Host.HotReload
|
|||
{
|
||||
if (item.Severity == DiagnosticSeverity.Error)
|
||||
{
|
||||
var diagnostic = CSharpDiagnosticFormatter.Instance.Format(item);
|
||||
var diagnostic = CSharpDiagnosticFormatter.Instance.Format(item, CultureInfo.InvariantCulture);
|
||||
_reporter.Output(diagnostic);
|
||||
projectDiagnostics = projectDiagnostics.Add(diagnostic);
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using Windows.UI.Xaml;
|
||||
using Uno.UI.Xaml;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -15,7 +16,9 @@ namespace Windows.UI.Xaml
|
|||
/// </summary>
|
||||
public static string GetHtmlId(this UIElement element)
|
||||
{
|
||||
#pragma warning disable CA1305 // Specify IFormatProvider
|
||||
return element.HtmlId.ToString();
|
||||
#pragma warning restore CA1305 // Specify IFormatProvider
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
|
@ -956,7 +956,7 @@ namespace Uno.UI.DataBinding
|
|||
while (!s.IsEmpty)
|
||||
{
|
||||
var length = NextDoubleLength(s);
|
||||
list.Add(double.Parse(s.Slice(0, length).ToString(), NumberStyles.Float));
|
||||
list.Add(double.Parse(s.Slice(0, length).ToString(), NumberStyles.Float, CultureInfo.InvariantCulture));
|
||||
s = s.Slice(length);
|
||||
s = EatSeparator(s);
|
||||
}
|
||||
|
@ -971,7 +971,7 @@ namespace Uno.UI.DataBinding
|
|||
while (!s.IsEmpty)
|
||||
{
|
||||
var length = NextDoubleLength(s);
|
||||
list.Add(float.Parse(s.Slice(0, length).ToString(), NumberStyles.Float));
|
||||
list.Add(float.Parse(s.Slice(0, length).ToString(), NumberStyles.Float, CultureInfo.InvariantCulture));
|
||||
s = s.Slice(length);
|
||||
s = EatSeparator(s);
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Text;
|
|||
using Windows.UI.Xaml;
|
||||
using Uno.Extensions;
|
||||
using Uno.Foundation.Logging;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Uno.UI.Extensions
|
||||
{
|
||||
|
@ -88,7 +89,7 @@ namespace Uno.UI.Extensions
|
|||
var sb = new StringBuilder(depth * 4);
|
||||
for (var i = 0; i < depth - 1; i++)
|
||||
{
|
||||
sb.Append(' ', i.ToString().Length);
|
||||
sb.Append(' ', i.ToString(CultureInfo.InvariantCulture).Length);
|
||||
sb.Append('|');
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ namespace Uno.UI.Helpers.WinUI
|
|||
// the output string, as the C++ index is staring at 1.
|
||||
list.Insert(0, null);
|
||||
|
||||
return string.Format(CultureInfo.CurrentUICulture, dotnetFormat, list.ToArray());
|
||||
return string.Format(CultureInfo.CurrentCulture, dotnetFormat, list.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// MUX Reference ValueHelpers.cpp
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Uno.UI.Helpers.WinUI
|
||||
{
|
||||
|
@ -26,6 +27,6 @@ namespace Uno.UI.Helpers.WinUI
|
|||
type == typeof(string) ||
|
||||
type == typeof(Guid);
|
||||
|
||||
internal static string ConvertValueToString(object value, Type type) => Convert.ToString(value);
|
||||
internal static string ConvertValueToString(object value, Type type) => Convert.ToString(value, CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ using System;
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.ObjectModel;
|
||||
using System.Collections.Specialized;
|
||||
using System.Globalization;
|
||||
using System.Numerics;
|
||||
using Microsoft.UI.Xaml.Automation.Peers;
|
||||
using Microsoft.UI.Xaml.Controls.AnimatedVisuals;
|
||||
|
@ -4150,12 +4151,12 @@ namespace Microsoft.UI.Xaml.Controls
|
|||
|
||||
private double GetPaneToggleButtonWidth()
|
||||
{
|
||||
return Convert.ToDouble(SharedHelpers.FindInApplicationResources("PaneToggleButtonWidth", c_paneToggleButtonWidth));
|
||||
return Convert.ToDouble(SharedHelpers.FindInApplicationResources("PaneToggleButtonWidth", c_paneToggleButtonWidth), CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
private double GetPaneToggleButtonHeight()
|
||||
{
|
||||
return Convert.ToDouble(SharedHelpers.FindInApplicationResources("PaneToggleButtonHeight", c_paneToggleButtonHeight));
|
||||
return Convert.ToDouble(SharedHelpers.FindInApplicationResources("PaneToggleButtonHeight", c_paneToggleButtonHeight), CultureInfo.InvariantCulture);
|
||||
}
|
||||
|
||||
private void UpdateTopNavigationWidthCache()
|
||||
|
|
|
@ -21,6 +21,7 @@ using Windows.UI.Xaml.Input;
|
|||
using static Uno.UI.Helpers.WinUI.CppWinRTHelpers;
|
||||
|
||||
using ButtonVisibility = Microsoft.UI.Xaml.Controls.PipsPagerButtonVisibility;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Microsoft.UI.Xaml.Controls;
|
||||
|
||||
|
@ -415,7 +416,7 @@ public partial class PipsPager : Control
|
|||
var style = index == SelectedPageIndex ? SelectedPipStyle : NormalPipStyle;
|
||||
ApplyStyleToPipAndUpdateOrientation(element, style);
|
||||
|
||||
AutomationProperties.SetName(element, ResourceAccessor.GetLocalizedStringResource(ResourceAccessor.SR_PipsPagerPageText) + " " + (index + 1).ToString());
|
||||
AutomationProperties.SetName(element, ResourceAccessor.GetLocalizedStringResource(ResourceAccessor.SR_PipsPagerPageText) + " " + (index + 1).ToString(CultureInfo.InvariantCulture));
|
||||
AutomationProperties.SetPositionInSet(element, index + 1);
|
||||
AutomationProperties.SetSizeOfSet(element, NumberOfPages);
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
// Licensed under the MIT License. See LICENSE in the project root for license information.
|
||||
// MUX Reference RatingControlAutomationPeer.cpp, commit de78834
|
||||
|
||||
using System.Globalization;
|
||||
using Uno.UI.Helpers.WinUI;
|
||||
using Windows.Foundation;
|
||||
using Windows.Globalization.NumberFormatting;
|
||||
|
@ -197,7 +198,7 @@ public partial class RatingControlAutomationPeer : FrameworkElementAutomationPee
|
|||
SignificantDigitsNumberRounder rounder = new SignificantDigitsNumberRounder();
|
||||
formatter.NumberRounder = rounder;
|
||||
|
||||
string maxRatingString = GetRatingControl().MaxRating.ToString();
|
||||
string maxRatingString = GetRatingControl().MaxRating.ToString(CultureInfo.CurrentCulture);
|
||||
|
||||
int fractionDigits = DetermineFractionDigits(ratingValue);
|
||||
int sigDigits = DetermineSignificantDigits(ratingValue, fractionDigits);
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using DirectUI;
|
||||
using Uno.Disposables;
|
||||
|
@ -20,7 +21,7 @@ namespace Windows.UI.Xaml.Controls
|
|||
public partial class AppBarButton : Button, ICommandBarElement, ICommandBarElement2, ICommandBarElement3, ICommandBarOverflowElement, ICommandBarLabeledElement, ISubMenuOwner
|
||||
{
|
||||
// LabelOnRightStyle doesn't work in AppBarButton/AppBarToggleButton Reveal Style.
|
||||
// Animate the width to NaN if width is not overrided and right-aligned labels and no LabelOnRightStyle.
|
||||
// Animate the width to NaN if width is not overrided and right-aligned labels and no LabelOnRightStyle.
|
||||
Storyboard? m_widthAdjustmentsForLabelOnRightStyleStoryboard;
|
||||
|
||||
bool m_isWithToggleButtons;
|
||||
|
@ -794,7 +795,7 @@ namespace Windows.UI.Xaml.Controls
|
|||
|
||||
var toolTipFormatString = DXamlCore.Current.GetLocalizedResourceString("KEYBOARD_ACCELERATOR_TEXT_TOOLTIP");
|
||||
|
||||
this.SetValue(ToolTipService.ToolTipProperty, string.Format(toolTipFormatString, labelText, keyboardAcceleratorText));
|
||||
this.SetValue(ToolTipService.ToolTipProperty, string.Format(CultureInfo.CurrentCulture, toolTipFormatString, labelText, keyboardAcceleratorText));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -16,14 +16,14 @@ using Windows.UI.Xaml;
|
|||
using Windows.UI.Xaml.Controls;
|
||||
using AppBarToggleButtonAutomationPeer = Windows.UI.Xaml.Automation.Peers.AppBarToggleButtonAutomationPeer;
|
||||
using AppBarToggleButtonTemplateSettings = Windows.UI.Xaml.Controls.Primitives.AppBarToggleButtonTemplateSettings;
|
||||
|
||||
using System.Globalization;
|
||||
|
||||
namespace Windows.UI.Xaml.Controls
|
||||
{
|
||||
public partial class AppBarToggleButton : ToggleButton, ICommandBarElement, ICommandBarElement2, ICommandBarElement3, ICommandBarOverflowElement, ICommandBarLabeledElement
|
||||
{
|
||||
// LabelOnRightStyle doesn't work in AppBarButton/AppBarToggleButton Reveal Style.
|
||||
// Animate the width to NaN if width is not overrided and right-aligned labels and no LabelOnRightStyle.
|
||||
// Animate the width to NaN if width is not overrided and right-aligned labels and no LabelOnRightStyle.
|
||||
Storyboard? m_widthAdjustmentsForLabelOnRightStyleStoryboard;
|
||||
|
||||
CommandBarDefaultLabelPosition m_defaultLabelPosition;
|
||||
|
@ -336,7 +336,7 @@ namespace Windows.UI.Xaml.Controls
|
|||
{
|
||||
// If there are other buttons that have open sub-menus, then we should
|
||||
// close those on a delay, since they no longer have mouse-over.
|
||||
|
||||
|
||||
CommandBar.FindParentCommandBarForElement(this, out var parentCommandBar);
|
||||
|
||||
if (parentCommandBar is { })
|
||||
|
@ -491,7 +491,7 @@ namespace Windows.UI.Xaml.Controls
|
|||
|
||||
var toolTipFormatString = DXamlCore.Current.GetLocalizedResourceString("KEYBOARD_ACCELERATOR_TEXT_TOOLTIP");
|
||||
|
||||
SetValue(ToolTipService.ToolTipProperty, string.Format(toolTipFormatString, labelText, keyboardAcceleratorText));
|
||||
SetValue(ToolTipService.ToolTipProperty, string.Format(CultureInfo.CurrentCulture, toolTipFormatString, labelText, keyboardAcceleratorText));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
// MUX Reference PersonPicture.cpp, commit de78834
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Threading.Tasks;
|
||||
using Uno.UI.Helpers.WinUI;
|
||||
using Windows.ApplicationModel.Contacts;
|
||||
|
@ -292,7 +293,7 @@ namespace Windows.UI.Xaml.Controls
|
|||
|
||||
if (badgeNumber <= 99)
|
||||
{
|
||||
m_badgeNumberTextBlock.Text = badgeNumber.ToString();
|
||||
m_badgeNumberTextBlock.Text = badgeNumber.ToString(CultureInfo.CurrentCulture);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -661,7 +662,7 @@ namespace Windows.UI.Xaml.Controls
|
|||
if (m_badgingEllipse != null && m_badgingBackgroundEllipse != null && m_badgeNumberTextBlock != null && m_badgeGlyphIcon != null)
|
||||
{
|
||||
// Maintain badging circle and font size by enforcing the new size on both Width and Height.
|
||||
// Design guidelines have specified the font size to be 60% of the badging plate, and we want to keep
|
||||
// Design guidelines have specified the font size to be 60% of the badging plate, and we want to keep
|
||||
// badging plate to be about 50% of the control so that don't block the initial/profile picture.
|
||||
double newSize = (args.NewSize.Width < args.NewSize.Height) ? args.NewSize.Width : args.NewSize.Height;
|
||||
m_badgingEllipse.Height = newSize * 0.5;
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
// MUX reference Slider_Partial.cpp
|
||||
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using DirectUI;
|
||||
using Uno.Disposables;
|
||||
using Uno.UI;
|
||||
|
@ -794,7 +795,7 @@ public partial class Slider
|
|||
_tpElementVerticalThumb.SizeChanged += OnThumbSizeChanged;
|
||||
_elementVerticalThumbSizeChangedToken.Disposable = Disposable.Create(() => _tpElementVerticalThumb.SizeChanged -= OnThumbSizeChanged);
|
||||
}
|
||||
|
||||
|
||||
private void AttachHorizontalThumbSubscriptions()
|
||||
{
|
||||
_tpElementHorizontalThumb.DragStarted += OnThumbDragStarted;
|
||||
|
@ -806,7 +807,7 @@ public partial class Slider
|
|||
_tpElementHorizontalThumb.SizeChanged += OnThumbSizeChanged;
|
||||
_elementHorizontalThumbSizeChangedToken.Disposable = Disposable.Create(() => _tpElementHorizontalThumb.SizeChanged -= OnThumbSizeChanged);
|
||||
}
|
||||
|
||||
|
||||
private void AttachSliderContainerEvents()
|
||||
{
|
||||
FrameworkElement spSliderContainer = _tpSliderContainer ?? this;
|
||||
|
@ -1077,7 +1078,7 @@ public partial class Slider
|
|||
#if HAS_UNO
|
||||
isThumbToolTipEnabled &= FeatureConfiguration.ToolTip.UseToolTips;
|
||||
#endif
|
||||
|
||||
|
||||
maximum = Maximum;
|
||||
minimum = Minimum;
|
||||
currentValue = IntermediateValue;
|
||||
|
@ -1534,7 +1535,7 @@ public partial class Slider
|
|||
|
||||
roundedValue = DoubleUtil.Round(originalValue, numPlacesPastDecimalPoint);
|
||||
|
||||
return string.Format(szFormat, roundedValue);
|
||||
return string.Format(CultureInfo.CurrentCulture, szFormat, roundedValue);
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, string language) => throw new NotImplementedException();
|
||||
|
|
|
@ -200,13 +200,13 @@ namespace Windows.UI.Xaml.Controls
|
|||
public int SelectionStart
|
||||
{
|
||||
get => int.TryParse(GetProperty("selectionStart"), NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) ? result : 0;
|
||||
set => SetProperty("selectionStart", value.ToString());
|
||||
set => SetProperty("selectionStart", value.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
public int SelectionEnd
|
||||
{
|
||||
get => int.TryParse(GetProperty("selectionEnd"), NumberStyles.Integer, CultureInfo.InvariantCulture, out var result) ? result : 0;
|
||||
set => SetProperty("selectionEnd", value.ToString());
|
||||
set => SetProperty("selectionEnd", value.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
internal override bool IsViewHit() => true;
|
||||
|
|
|
@ -5,6 +5,7 @@ using Android.Views;
|
|||
using Android.Widget;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
|
||||
namespace Windows.UI.Xaml.Controls
|
||||
|
@ -88,7 +89,7 @@ namespace Windows.UI.Xaml.Controls
|
|||
minutePicker.Value = values.FindIndex(num => num == _minute);
|
||||
minutePicker.MinValue = 0;
|
||||
minutePicker.MaxValue = values.Count - 1;
|
||||
minutePicker.SetDisplayedValues(values.Select(num => num.ToString("00")).ToArray());
|
||||
minutePicker.SetDisplayedValues(values.Select(num => num.ToString("00", CultureInfo.CurrentCulture)).ToArray());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -15,6 +15,7 @@ using System.Diagnostics;
|
|||
using Windows.UI.Xaml.Data;
|
||||
using Uno.UI;
|
||||
using System.Collections;
|
||||
using System.Globalization;
|
||||
|
||||
#if XAMARIN_ANDROID
|
||||
using View = Android.Views.View;
|
||||
|
@ -1911,7 +1912,7 @@ namespace Windows.UI.Xaml
|
|||
{
|
||||
if (value?.GetType() != propertyDetails.Property.Type)
|
||||
{
|
||||
value = Convert.ChangeType(value, propertyDetails.Property.Type);
|
||||
value = Convert.ChangeType(value, propertyDetails.Property.Type, CultureInfo.CurrentCulture);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace Windows.UI.Xaml
|
|||
public TimeSpan TimeSpan { get; private set; }
|
||||
|
||||
public static implicit operator Duration(string timeSpan)
|
||||
=> timeSpan != null ? new Duration(TimeSpan.Parse(timeSpan)) : new Duration(TimeSpan.Zero);
|
||||
=> timeSpan != null ? new Duration(TimeSpan.Parse(timeSpan, CultureInfo.InvariantCulture)) : new Duration(TimeSpan.Zero);
|
||||
|
||||
public bool HasTimeSpan
|
||||
{
|
||||
|
|
|
@ -5,6 +5,7 @@ using Uno.UI;
|
|||
using Uno.UI.Controls;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
using System.ComponentModel;
|
||||
using System.Runtime.CompilerServices;
|
||||
|
@ -144,7 +145,7 @@ namespace Windows.UI.Xaml
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Notifies that this view has been removed from its parent. This method is only
|
||||
/// Notifies that this view has been removed from its parent. This method is only
|
||||
/// called when the parent is an UnoViewGroup.
|
||||
/// </summary>
|
||||
protected override void OnRemovedFromParent()
|
||||
|
@ -269,7 +270,7 @@ namespace Windows.UI.Xaml
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// Provides an implementation <see cref="ViewGroup.Layout(int, int, int, int)"/> in order
|
||||
/// Provides an implementation <see cref="ViewGroup.Layout(int, int, int, int)"/> in order
|
||||
/// to avoid the back and forth between Java and C#.
|
||||
/// </summary>
|
||||
internal void FastLayout(bool changed, int left, int top, int right, int bottom)
|
||||
|
@ -304,7 +305,7 @@ namespace Windows.UI.Xaml
|
|||
EventOpcode.Send,
|
||||
new[] {
|
||||
GetType().ToString(),
|
||||
this.GetDependencyObjectId().ToString()
|
||||
this.GetDependencyObjectId().ToString(CultureInfo.InvariantCulture)
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ namespace Windows.UI.Xaml
|
|||
|
||||
if (value is ValueType)
|
||||
{
|
||||
return GridLengthHelper.FromPixels(Convert.ToDouble(value));
|
||||
return GridLengthHelper.FromPixels(Convert.ToDouble(value, CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
return base.ConvertFrom(context, culture, value);
|
||||
|
@ -57,4 +57,4 @@ namespace Windows.UI.Xaml
|
|||
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Linq;
|
|||
using Uno.Diagnostics.Eventing;
|
||||
using Windows.UI.Core;
|
||||
using Uno.Foundation.Logging;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Windows.UI.Xaml.Media.Animation
|
||||
{
|
||||
|
@ -107,7 +108,7 @@ namespace Windows.UI.Xaml.Media.Animation
|
|||
|
||||
float IAnimation<float>.Add(float first, float second) => first + second;
|
||||
|
||||
float IAnimation<float>.Convert(object value) => Convert.ToSingle(value);
|
||||
float IAnimation<float>.Convert(object value) => Convert.ToSingle(value, CultureInfo.InvariantCulture);
|
||||
|
||||
float IAnimation<float>.Multiply(float multiplier, float t) => multiplier * t;
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Windows.UI.Xaml.Media.Animation
|
|||
=> new KeyTime() { TimeSpan = timeSpan };
|
||||
|
||||
public static implicit operator KeyTime(string timeSpan)
|
||||
=> FromTimeSpan(TimeSpan.Parse(timeSpan));
|
||||
=> FromTimeSpan(TimeSpan.Parse(timeSpan, CultureInfo.InvariantCulture));
|
||||
|
||||
public static implicit operator KeyTime(TimeSpan timeSpan)
|
||||
=> FromTimeSpan(timeSpan);
|
||||
|
|
|
@ -11,6 +11,7 @@ using System.Threading;
|
|||
using Windows.UI.Core;
|
||||
using Uno.Disposables;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Windows.UI.Xaml.Media.Animation
|
||||
{
|
||||
|
@ -98,7 +99,7 @@ namespace Windows.UI.Xaml.Media.Animation
|
|||
EventOpcode.Start,
|
||||
payload: new[] {
|
||||
this.GetParent()?.GetType().Name,
|
||||
this.GetParent()?.GetDependencyObjectId().ToString(),
|
||||
this.GetParent()?.GetDependencyObjectId().ToString(CultureInfo.InvariantCulture),
|
||||
}
|
||||
);
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@ using System.Linq;
|
|||
using Windows.UI.Core;
|
||||
using Windows.UI.Xaml.Data;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Windows.UI.Xaml.Media.Animation
|
||||
{
|
||||
|
@ -45,7 +46,7 @@ namespace Windows.UI.Xaml.Media.Animation
|
|||
{
|
||||
return new[] {
|
||||
this.GetParent()?.GetType().Name,
|
||||
this.GetParent()?.GetDependencyObjectId().ToString(),
|
||||
this.GetParent()?.GetDependencyObjectId().ToString(CultureInfo.InvariantCulture),
|
||||
Target?.GetType().ToString(),
|
||||
PropertyInfo?.Path
|
||||
};
|
||||
|
|
|
@ -240,8 +240,8 @@ namespace Windows.UI.Xaml.Media
|
|||
var imgElement = pattern.FindFirstChild();
|
||||
|
||||
imgElement?.SetAttribute(
|
||||
("width", naturalSize.Width.ToString()),
|
||||
("height", naturalSize.Height.ToString())
|
||||
("width", naturalSize.Width.ToString(CultureInfo.InvariantCulture)),
|
||||
("height", naturalSize.Height.ToString(CultureInfo.InvariantCulture))
|
||||
);
|
||||
|
||||
var width = (int)target.ActualWidth;
|
||||
|
|
|
@ -17,6 +17,7 @@ using Uno.UI.Xaml.Core;
|
|||
using Windows.UI.Xaml.Controls;
|
||||
using Windows.System;
|
||||
using Color = Windows.UI.Color;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Windows.UI.Xaml
|
||||
{
|
||||
|
@ -129,7 +130,7 @@ namespace Windows.UI.Xaml
|
|||
{
|
||||
var sizeString = WebAssemblyRuntime.InvokeJS("Uno.UI.WindowManager.current.getBoundingClientRect(" + HtmlId + ");");
|
||||
var sizeParts = sizeString.Split(';');
|
||||
return new Rect(double.Parse(sizeParts[0]), double.Parse(sizeParts[1]), double.Parse(sizeParts[2]), double.Parse(sizeParts[3]));
|
||||
return new Rect(double.Parse(sizeParts[0], CultureInfo.InvariantCulture), double.Parse(sizeParts[1], CultureInfo.InvariantCulture), double.Parse(sizeParts[2], CultureInfo.InvariantCulture), double.Parse(sizeParts[3], CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
protected internal void SetStyle(string name, string value)
|
||||
|
@ -240,7 +241,7 @@ namespace Windows.UI.Xaml
|
|||
#if DEBUG
|
||||
var count = ++_arrangeCount;
|
||||
|
||||
SetAttribute(("xamlArrangeCount", count.ToString()));
|
||||
SetAttribute(("xamlArrangeCount", count.ToString(CultureInfo.InvariantCulture)));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ using System.Text;
|
|||
using Uno.Extensions;
|
||||
using Uno.Foundation.Logging;
|
||||
using Uno.Diagnostics.Eventing;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Windows.UI.Xaml
|
||||
{
|
||||
|
@ -191,7 +192,7 @@ namespace Windows.UI.Xaml
|
|||
EventOpcode.Send,
|
||||
new[] {
|
||||
control.GetType()?.ToString(),
|
||||
control?.GetDependencyObjectId().ToString(),
|
||||
control?.GetDependencyObjectId().ToString(CultureInfo.InvariantCulture),
|
||||
state.Name,
|
||||
useTransitions ? "UseTransitions" : "NoTransitions"
|
||||
}
|
||||
|
|
|
@ -125,7 +125,7 @@ namespace Uno.UI.Xaml
|
|||
"classes:[" + classesParam + "]" +
|
||||
"});");
|
||||
|
||||
return int.Parse(ret);
|
||||
return int.Parse(ret, CultureInfo.InvariantCulture);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1142,7 +1142,7 @@ namespace Uno.UI.Xaml
|
|||
{
|
||||
var sizeString = WebAssemblyRuntime.InvokeJS("Uno.UI.WindowManager.current.getBBox(" + htmlId + ");");
|
||||
var sizeParts = sizeString.Split(';');
|
||||
return new Rect(double.Parse(sizeParts[0]), double.Parse(sizeParts[1]), double.Parse(sizeParts[2]), double.Parse(sizeParts[3]));
|
||||
return new Rect(double.Parse(sizeParts[0], CultureInfo.InvariantCulture), double.Parse(sizeParts[1], CultureInfo.InvariantCulture), double.Parse(sizeParts[2], CultureInfo.InvariantCulture), double.Parse(sizeParts[3], CultureInfo.InvariantCulture));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1298,8 +1298,8 @@ namespace Uno.UI.Xaml
|
|||
var sizeParts = sizeString.Split(';');
|
||||
|
||||
return (
|
||||
clientSize: new Size(double.Parse(sizeParts[0]), double.Parse(sizeParts[1])),
|
||||
offsetSize: new Size(double.Parse(sizeParts[2]), double.Parse(sizeParts[3]))
|
||||
clientSize: new Size(double.Parse(sizeParts[0], CultureInfo.InvariantCulture), double.Parse(sizeParts[1], CultureInfo.InvariantCulture)),
|
||||
offsetSize: new Size(double.Parse(sizeParts[2], CultureInfo.InvariantCulture), double.Parse(sizeParts[3], CultureInfo.InvariantCulture))
|
||||
);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Uno.Extensions;
|
||||
|
||||
namespace Uno.UI.Xaml
|
||||
|
@ -48,7 +45,7 @@ namespace Uno.UI.Xaml
|
|||
internal static bool IsAbsolutePath(string relativeTargetPath) => relativeTargetPath.StartsWith(AppXIdentifier, StringComparison.Ordinal)
|
||||
|| relativeTargetPath.StartsWith(MSResourceIdentifier, StringComparison.Ordinal);
|
||||
|
||||
internal static string GetWinUIThemeResourceUrl(int version) => string.Format(WinUIThemeResourceURLFormatString, version);
|
||||
internal static string GetWinUIThemeResourceUrl(int version) => string.Format(CultureInfo.InvariantCulture, WinUIThemeResourceURLFormatString, version);
|
||||
|
||||
private static string GetAbsolutePath(string originDirectory, string relativeTargetPath)
|
||||
{
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace Windows.Devices.Bluetooth
|
||||
|
@ -45,7 +46,7 @@ namespace Windows.Devices.Bluetooth
|
|||
|
||||
public static string GetDeviceSelectorFromBluetoothAddress( ulong bluetoothAddress)
|
||||
{
|
||||
string macAddr = string.Format("{0:x12}", bluetoothAddress);
|
||||
string macAddr = string.Format(CultureInfo.InvariantCulture, "{0:x12}", bluetoothAddress);
|
||||
return _deviceSelectorPrefix + "(System.DeviceInterface.Bluetooth.DeviceAddress:=\"" + macAddr + "\" OR " + _deviceSelectorIssueInquiry + "#True)";
|
||||
}
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace Windows.Devices.Bluetooth
|
||||
|
@ -63,7 +64,7 @@ namespace Windows.Devices.Bluetooth
|
|||
|
||||
public static string GetDeviceSelectorFromBluetoothAddress(ulong bluetoothAddress)
|
||||
{
|
||||
string macAddr = string.Format("{0:x12}", bluetoothAddress);
|
||||
string macAddr = string.Format(CultureInfo.InvariantCulture, "{0:x12}", bluetoothAddress);
|
||||
return _deviceSelectorPrefix + "(System.DeviceInterface.Bluetooth.DeviceAddress:=\"" + macAddr + "\" OR " + _deviceSelectorIssueInquiry + "#True)";
|
||||
}
|
||||
|
||||
|
@ -74,7 +75,7 @@ namespace Windows.Devices.Bluetooth
|
|||
return GetDeviceSelectorFromBluetoothAddress(bluetoothAddress);
|
||||
}
|
||||
|
||||
string macAddr = string.Format("{0:x12}", bluetoothAddress);
|
||||
string macAddr = string.Format(CultureInfo.InvariantCulture, "{0:x12}", bluetoothAddress);
|
||||
string selector = _deviceSelectorPrefix + "((System.DeviceInterface.Bluetooth.DeviceAddress:=\"" + macAddr + "\"" +
|
||||
"AND System.Devices.Aep.Bluetooth.Le.AddressType:=System.Devices.Aep.Bluetooth.Le.AddressType#";
|
||||
|
||||
|
@ -94,8 +95,8 @@ namespace Windows.Devices.Bluetooth
|
|||
public static string GetDeviceSelectorFromAppearance(BluetoothLEAppearance appearance)
|
||||
{
|
||||
return _deviceSelectorPrefix +
|
||||
"((System.Devices.Aep.Bluetooth.Le.Appearance.Category:=" + appearance.Category.ToString() +
|
||||
"AND System.Devices.Aep.Bluetooth.Le.Appearance.Subcategory:=" + appearance.SubCategory.ToString() +
|
||||
"((System.Devices.Aep.Bluetooth.Le.Appearance.Category:=" + appearance.Category.ToString(CultureInfo.InvariantCulture) +
|
||||
"AND System.Devices.Aep.Bluetooth.Le.Appearance.Subcategory:=" + appearance.SubCategory.ToString(CultureInfo.InvariantCulture) +
|
||||
_deviceSelectorIssueInquiry + "#True";
|
||||
}
|
||||
|
||||
|
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Android.Content;
|
||||
|
@ -101,8 +102,8 @@ namespace Uno.Devices.Enumeration.Internal.Providers.Midi
|
|||
private static (int id, int portNumber) ParseMidiDeviceId(string id)
|
||||
{
|
||||
var parts = id.Split("_");
|
||||
var intId = int.Parse(parts[0]);
|
||||
var portNumber = int.Parse(parts[1]);
|
||||
var intId = int.Parse(parts[0], CultureInfo.InvariantCulture);
|
||||
var portNumber = int.Parse(parts[1], CultureInfo.InvariantCulture);
|
||||
return (intId, portNumber);
|
||||
}
|
||||
|
||||
|
@ -124,7 +125,7 @@ namespace Uno.Devices.Enumeration.Internal.Providers.Midi
|
|||
private IEnumerable<MidiDeviceInfo.PortInfo> FilterMatchingPorts(IEnumerable<MidiDeviceInfo.PortInfo> port)
|
||||
{
|
||||
return port.Where(p => p.Type == _portType);
|
||||
}
|
||||
}
|
||||
|
||||
private void OnEnumerationCompleted(DeviceInformation lastDeviceInformation) =>
|
||||
WatchEnumerationCompleted?.Invoke(this, lastDeviceInformation);
|
||||
|
@ -179,8 +180,8 @@ namespace Uno.Devices.Enumeration.Internal.Providers.Midi
|
|||
|
||||
var deviceInformation = new DeviceInformation(deviceIdentifier, properties)
|
||||
{
|
||||
Name = name,
|
||||
};
|
||||
Name = name,
|
||||
};
|
||||
|
||||
return deviceInformation;
|
||||
}
|
||||
|
|
|
@ -136,7 +136,7 @@ public partial class Gamepad
|
|||
var connectedGamepadIds =
|
||||
serializedIds
|
||||
.Split(new[] { IdSeparator }, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Select(id => long.Parse(id))
|
||||
.Select(id => long.Parse(id, CultureInfo.InvariantCulture))
|
||||
.ToList();
|
||||
|
||||
lock (_gamepadCache)
|
||||
|
|
|
@ -4,6 +4,7 @@ using System.Threading;
|
|||
using System.Threading.Tasks;
|
||||
using Windows.Security.Authentication.Web;
|
||||
using Uno.Foundation;
|
||||
using System.Globalization;
|
||||
|
||||
namespace Uno.AuthenticationBroker
|
||||
{
|
||||
|
@ -35,7 +36,7 @@ namespace Uno.AuthenticationBroker
|
|||
var urlRedirect = WebAssemblyRuntime.EscapeJs(callbackUri.OriginalString);
|
||||
string js;
|
||||
|
||||
var timeout = ((long) Timeout.TotalMilliseconds).ToString();
|
||||
var timeout = ((long) Timeout.TotalMilliseconds).ToString(CultureInfo.InvariantCulture);
|
||||
|
||||
var useIframe =
|
||||
options.HasFlag(WebAuthenticationOptions.SilentMode) ||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
|
@ -64,7 +65,7 @@ namespace Windows.Storage.Pickers
|
|||
var intent = new Intent(action);
|
||||
intent.PutExtra(Intent.ExtraAllowMultiple, multiple);
|
||||
|
||||
var settingName = string.Format(StorageIdentifierFormatString, SettingsIdentifier);
|
||||
var settingName = string.Format(CultureInfo.InvariantCulture, StorageIdentifierFormatString, SettingsIdentifier);
|
||||
if (ApplicationData.Current.LocalSettings.Values.ContainsKey(settingName))
|
||||
{
|
||||
var uri = ApplicationData.Current.LocalSettings.Values[settingName].ToString();
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
@ -78,7 +79,7 @@ namespace Uno.Storage.Streams.Internal
|
|||
var pinnedData = handle.AddrOfPinnedObject();
|
||||
// TODO: Handle case of reading beyond end of file!
|
||||
var countReadString = await WebAssemblyRuntime.InvokeAsync($"{JsType}.readAsync('{_streamId}', {pinnedData}, {offset}, {count}, {Position})");
|
||||
var countRead = int.Parse(countReadString);
|
||||
var countRead = int.Parse(countReadString, CultureInfo.InvariantCulture);
|
||||
Position += countRead;
|
||||
return countRead;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using Android.OS;
|
||||
using Windows.System.Profile.Internal;
|
||||
|
||||
|
@ -18,7 +19,7 @@ public partial class AnalyticsVersionInfo
|
|||
}
|
||||
if (Version.TryParse(versionString, out var version))
|
||||
{
|
||||
DeviceFamilyVersion = VersionHelpers.ToLong(version).ToString();
|
||||
DeviceFamilyVersion = VersionHelpers.ToLong(version).ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using UIKit;
|
||||
using Windows.System.Profile.Internal;
|
||||
|
||||
|
@ -14,7 +15,7 @@ public partial class AnalyticsVersionInfo
|
|||
|
||||
if (Version.TryParse(UIDevice.CurrentDevice.SystemVersion, out var version))
|
||||
{
|
||||
DeviceFamilyVersion = VersionHelpers.ToLong(version).ToString();
|
||||
DeviceFamilyVersion = VersionHelpers.ToLong(version).ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System;
|
||||
using System.Globalization;
|
||||
using Foundation;
|
||||
using Windows.System.Profile.Internal;
|
||||
|
||||
|
@ -14,7 +15,7 @@ public partial class AnalyticsVersionInfo
|
|||
|
||||
if (Version.TryParse(NSProcessInfo.ProcessInfo.OperatingSystemVersionString, out var version))
|
||||
{
|
||||
DeviceFamilyVersion = VersionHelpers.ToLong(version).ToString();
|
||||
DeviceFamilyVersion = VersionHelpers.ToLong(version).ToString(CultureInfo.InvariantCulture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
@ -87,7 +88,7 @@ namespace Uno.UWPSyncGenerator
|
|||
_sb.AppendHorizontalRule();
|
||||
|
||||
_sb.AppendParagraph();
|
||||
_sb.AppendParagraph($"Last updated {DateTimeOffset.UtcNow.ToString("f")}.");
|
||||
_sb.AppendParagraph($"Last updated {DateTimeOffset.UtcNow.ToString("f", CultureInfo.InvariantCulture)}.");
|
||||
}
|
||||
using (var fileWriter = new StreamWriter(Path.Combine(DocPath, ImplementedViewsFileName)))
|
||||
{
|
||||
|
@ -158,7 +159,7 @@ namespace Uno.UWPSyncGenerator
|
|||
_sb.AppendHorizontalRule();
|
||||
|
||||
_sb.AppendParagraph();
|
||||
_sb.AppendParagraph($"Last updated {DateTimeOffset.UtcNow.ToString("f")}.");
|
||||
_sb.AppendParagraph($"Last updated {DateTimeOffset.UtcNow.ToString("f", CultureInfo.InvariantCulture)}.");
|
||||
|
||||
void AppendImplementedMembers<T>(string memberTypePlural, string memberTypeSingular, IEnumerable<PlatformSymbols<T>> members) where T : ISymbol
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче