Imported Upstream version 5.0.0.42

Former-commit-id: fd56571888259555122d8a0f58c68838229cea2b
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-04-10 11:41:01 +00:00
parent 1190d13a04
commit 6bdd276d05
19939 changed files with 3099680 additions and 93811 deletions

View File

@@ -33,5 +33,3 @@ using System.Runtime.CompilerServices;
[assembly: AssemblyVersion ("4.0.1.0")]
[assembly: AssemblyInformationalVersion ("4.0.0.0")]
[assembly: AssemblyFileVersion ("4.0.0.0")]
[assembly: AssemblyDelaySign (true)]
[assembly: AssemblyKeyFile ("../../msfinal.pub")]

View File

@@ -1,98 +0,0 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
using System;
using System.Diagnostics;
using System.Diagnostics.Contracts;
namespace System.Globalization
{
public static class GlobalizationExtensions
{
public static StringComparer GetStringComparer(this CompareInfo compareInfo, CompareOptions options)
{
if (compareInfo == null)
{
throw new ArgumentNullException(nameof(compareInfo));
}
if (options == CompareOptions.Ordinal)
{
return StringComparer.Ordinal;
}
if (options == CompareOptions.OrdinalIgnoreCase)
{
return StringComparer.OrdinalIgnoreCase;
}
if ((options & CultureAwareComparer.ValidCompareMaskOffFlags) != 0)
{
throw new ArgumentException(SR.Argument_InvalidFlag, nameof(options));
}
return new CultureAwareComparer(compareInfo, options);
}
}
internal sealed class CultureAwareComparer : StringComparer
{
internal const CompareOptions ValidCompareMaskOffFlags =
~(CompareOptions.IgnoreCase | CompareOptions.IgnoreSymbols | CompareOptions.IgnoreNonSpace |
CompareOptions.IgnoreWidth | CompareOptions.IgnoreKanaType | CompareOptions.StringSort);
private readonly CompareInfo _compareInfo;
private readonly CompareOptions _options;
internal CultureAwareComparer(CompareInfo compareInfo, CompareOptions options)
{
Debug.Assert((options & ValidCompareMaskOffFlags) == 0);
_compareInfo = compareInfo;
_options = options;
}
public override int Compare(string x, string y)
{
if (Object.ReferenceEquals(x, y)) return 0;
if (x == null) return -1;
if (y == null) return 1;
return _compareInfo.Compare(x, y, _options);
}
public override bool Equals(string x, string y)
{
if (Object.ReferenceEquals(x, y)) return true;
if (x == null || y == null) return false;
return (_compareInfo.Compare(x, y, _options) == 0);
}
public override int GetHashCode(string obj)
{
if (obj == null)
{
throw new ArgumentNullException(nameof(obj));
}
Contract.EndContractBlock();
// StringSort used in compare operation and not with the hashing
return _compareInfo.GetHashCode(obj, _options & (~CompareOptions.StringSort));
}
// Equals method for the comparer itself.
public override bool Equals(object obj)
{
CultureAwareComparer comparer = obj as CultureAwareComparer;
return
comparer != null &&
_options == comparer._options &&
_compareInfo.Equals(comparer._compareInfo);
}
public override int GetHashCode()
{
return _compareInfo.GetHashCode() ^ ((int)_options & 0x7FFFFFFF);
}
}
}

View File

@@ -1,69 +0,0 @@
//
// StringNormalizationExtensions.cs
//
// Author:
// Alexander Köplinger (alexander.koeplinger@xamarin.com)
//
// (C) 2016 Xamarin, Inc.
//
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Text;
namespace System
{
public static class StringNormalizationExtensions
{
public static bool IsNormalized(this string value)
{
if (value == null)
throw new ArgumentNullException (nameof (value));
return value.IsNormalized ();
}
public static bool IsNormalized(this string value, NormalizationForm normalizationForm)
{
if (value == null)
throw new ArgumentNullException (nameof (value));
return value.IsNormalized (normalizationForm);
}
public static String Normalize(this string value)
{
if (value == null)
throw new ArgumentNullException (nameof (value));
return value.Normalize ();
}
public static String Normalize(this string value, NormalizationForm normalizationForm)
{
if (value == null)
throw new ArgumentNullException (nameof (value));
return value.Normalize (normalizationForm);
}
}
}

View File

@@ -1,7 +1,6 @@
TypeForwarders.cs
AssemblyInfo.cs
../../../build/common/MonoTODOAttribute.cs
SR.cs
GlobalizationExtensions.cs
StringNormalizationExtensions.cs
../../../../external/corefx/src/System.Runtime.Extensions/src/System/Globalization/Extensions.cs
../../../../external/corefx/src/System.Runtime.Extensions/src/System/StringNormalizationExtensions.cs