Imported Upstream version 4.0.0~alpha1

Former-commit-id: 806294f5ded97629b74c85c09952f2a74fe182d9
This commit is contained in:
Jo Shields
2015-04-07 09:35:12 +01:00
parent 283343f570
commit 3c1f479b9d
22469 changed files with 2931443 additions and 869343 deletions

View File

@@ -0,0 +1,103 @@
//
// SR.cs: Manually collected resource strings for ReferenceSources
//
// Authors:
// Marek Safar <marek.safar@gmail.com>
//
// Copyright (C) 2014 Xamarin Inc (http://www.xamarin.com)
//
// 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.
//
partial class SR
{
public const string MoreThanOneMatch = "MoreThanOneMatch";
public const string NoElements = "NoElements";
public const string PLINQ_CommonEnumerator_Current_NotStarted = "PLINQ_CommonEnumerator_Current_NotStarted";
public const string PLINQ_DisposeRequested = "PLINQ_DisposeRequested";
public const string PLINQ_EnumerationPreviouslyFailed = "PLINQ_EnumerationPreviouslyFailed";
public const string PLINQ_ExternalCancellationRequested = "PLINQ_ExternalCancellationRequested";
public const string ParallelEnumerable_BinaryOpMustUseAsParallel = "ParallelEnumerable_BinaryOpMustUseAsParallel";
public const string ParallelEnumerable_WithCancellation_TokenSourceDisposed = "ParallelEnumerable_WithCancellation_TokenSourceDisposed";
public const string ParallelEnumerable_WithMergeOptions_InvalidOptions = "ParallelEnumerable_WithMergeOptions_InvalidOptions";
public const string ParallelEnumerable_WithQueryExecutionMode_InvalidMode = "ParallelEnumerable_WithQueryExecutionMode_InvalidMode";
public const string ParallelPartitionable_IncorretElementCount = "ParallelPartitionable_IncorretElementCount";
public const string ParallelPartitionable_NullElement = "ParallelPartitionable_NullElement";
public const string ParallelPartitionable_NullReturn = "ParallelPartitionable_NullReturn";
public const string ParallelQuery_DuplicateDOP = "ParallelQuery_DuplicateDOP";
public const string ParallelQuery_DuplicateExecutionMode = "The WithExecutionMode operator may be used at most once in a query.";
public const string ParallelQuery_DuplicateMergeOptions = "ParallelQuery_DuplicateMergeOptions";
public const string ParallelQuery_DuplicateTaskScheduler = "ParallelQuery_DuplicateTaskScheduler";
public const string ParallelQuery_DuplicateWithCancellation = "ParallelQuery_DuplicateWithCancellation";
public const string ParallelQuery_InvalidAsOrderedCall = "AsOrdered may only be called on the result of AsParallel, ParallelEnumerable.Range, or ParallelEnumerable.Repeat.";
public const string ParallelQuery_InvalidNonGenericAsOrderedCall = "ParallelQuery_InvalidNonGenericAsOrderedCall";
public const string ParallelQuery_PartitionerNotOrderable = "ParallelQuery_PartitionerNotOrderable";
public const string PartitionerQueryOperator_NullPartition = "PartitionerQueryOperator_NullPartition";
public const string PartitionerQueryOperator_NullPartitionList = "PartitionerQueryOperator_NullPartitionList";
public const string PartitionerQueryOperator_WrongNumberOfPartitions = "PartitionerQueryOperator_WrongNumberOfPartitions";
public const string LockRecursionException_ReadAfterWriteNotAllowed = "LockRecursionException_ReadAfterWriteNotAllowed";
public const string LockRecursionException_RecursiveReadNotAllowed = "LockRecursionException_RecursiveReadNotAllowed";
public const string LockRecursionException_RecursiveUpgradeNotAllowed = "LockRecursionException_RecursiveUpgradeNotAllowed";
public const string LockRecursionException_RecursiveWriteNotAllowed = "LockRecursionException_RecursiveWriteNotAllowed";
public const string LockRecursionException_UpgradeAfterReadNotAllowed = "LockRecursionException_UpgradeAfterReadNotAllowed";
public const string LockRecursionException_UpgradeAfterWriteNotAllowed = "LockRecursionException_UpgradeAfterWriteNotAllowed";
public const string LockRecursionException_WriteAfterReadNotAllowed = "LockRecursionException_WriteAfterReadNotAllowed";
public const string SynchronizationLockException_IncorrectDispose = "SynchronizationLockException_IncorrectDispose";
public const string SynchronizationLockException_MisMatchedRead = "SynchronizationLockException_MisMatchedRead";
public const string SynchronizationLockException_MisMatchedUpgrade = "SynchronizationLockException_MisMatchedUpgrade";
public const string SynchronizationLockException_MisMatchedWrite = "SynchronizationLockException_MisMatchedWrite";
public const string Arg_ArrayPlusOffTooSmall = "Arg_ArrayPlusOffTooSmall";
public const string Arg_HSCapacityOverflow = "Arg_HSCapacityOverflow";
public const string ArgumentOutOfRange_NeedNonNegNum = "ArgumentOutOfRange_NeedNonNegNum";
public const string InvalidOperation_EnumFailedVersion = "InvalidOperation_EnumFailedVersion";
public const string InvalidOperation_EnumOpCantHappen = "InvalidOperation_EnumOpCantHappen";
public const string Serialization_MissingKeys = "Serialization_MissingKeys";
public const string Cryptography_ArgECDHKeySizeMismatch = "Cryptography_ArgECDHKeySizeMismatch";
public const string Cryptography_ArgECDHRequiresECDHKey = "Cryptography_ArgECDHRequiresECDHKey";
public const string Cryptography_ArgECDsaRequiresECDsaKey = "Cryptography_ArgECDsaRequiresECDsaKey";
public const string Cryptography_ArgExpectedECDiffieHellmanCngPublicKey = "Cryptography_ArgExpectedECDiffieHellmanCngPublicKey";
public const string Cryptography_DecryptWithNoKey = "Cryptography_DecryptWithNoKey";
public const string Cryptography_ECXmlSerializationFormatRequired = "Cryptography_ECXmlSerializationFormatRequired";
public const string Cryptography_InvalidAlgorithmGroup = "Cryptography_InvalidAlgorithmGroup";
public const string Cryptography_InvalidAlgorithmName = "Cryptography_InvalidAlgorithmName";
public const string Cryptography_InvalidCipherMode = "Cryptography_InvalidCipherMode";
public const string Cryptography_InvalidIVSize = "Cryptography_InvalidIVSize";
public const string Cryptography_InvalidKeyBlobFormat = "Cryptography_InvalidKeyBlobFormat";
public const string Cryptography_InvalidKeySize = "Cryptography_InvalidKeySize";
public const string Cryptography_InvalidPadding = "Cryptography_InvalidPadding";
public const string Cryptography_InvalidProviderName = "Cryptography_InvalidProviderName";
public const string Cryptography_MissingDomainParameters = "Cryptography_MissingDomainParameters";
public const string Cryptography_MissingIV = "Cryptography_MissingIV";
public const string Cryptography_MissingPublicKey = "Cryptography_MissingPublicKey";
public const string Cryptography_MustTransformWholeBlock = "Cryptography_MustTransformWholeBlock";
public const string Cryptography_NonCompliantFIPSAlgorithm = "Cryptography_NonCompliantFIPSAlgorithm";
public const string Cryptography_OpenEphemeralKeyHandleWithoutEphemeralFlag = "Cryptography_OpenEphemeralKeyHandleWithoutEphemeralFlag";
public const string Cryptography_OpenInvalidHandle = "Cryptography_OpenInvalidHandle";
public const string Cryptography_PartialBlock = "Cryptography_PartialBlock";
public const string Cryptography_PlatformNotSupported = "Cryptography_PlatformNotSupported";
public const string Cryptography_TlsRequiresLabelAndSeed = "Cryptography_TlsRequiresLabelAndSeed";
public const string Cryptography_TransformBeyondEndOfBuffer = "Cryptography_TransformBeyondEndOfBuffer";
public const string Cryptography_UnexpectedXmlNamespace = "Cryptography_UnexpectedXmlNamespace";
public const string Cryptography_UnknownEllipticCurve = "Cryptography_UnknownEllipticCurve";
public const string Cryptography_UnknownEllipticCurveAlgorithm = "Cryptography_UnknownEllipticCurveAlgorithm";
public const string Cryptography_UnknownPaddingMode = "Cryptography_UnknownPaddingMode";
}

View File

@@ -0,0 +1,113 @@
// Extracted from ../../../external/referencesource/System.Core/System/Linq/Enumerable.cs
using System;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
namespace System.Linq
{
internal class Set<TElement>
{
int[] buckets;
Slot[] slots;
int count;
int freeList;
IEqualityComparer<TElement> comparer;
public Set() : this(null) { }
public Set(IEqualityComparer<TElement> comparer) {
if (comparer == null) comparer = EqualityComparer<TElement>.Default;
this.comparer = comparer;
buckets = new int[7];
slots = new Slot[7];
freeList = -1;
}
// If value is not in set, add it and return true; otherwise return false
public bool Add(TElement value) {
return !Find(value, true);
}
// Check whether value is in set
public bool Contains(TElement value) {
return Find(value, false);
}
// If value is in set, remove it and return true; otherwise return false
public bool Remove(TElement value) {
int hashCode = InternalGetHashCode(value);
int bucket = hashCode % buckets.Length;
int last = -1;
for (int i = buckets[bucket] - 1; i >= 0; last = i, i = slots[i].next) {
if (slots[i].hashCode == hashCode && comparer.Equals(slots[i].value, value)) {
if (last < 0) {
buckets[bucket] = slots[i].next + 1;
}
else {
slots[last].next = slots[i].next;
}
slots[i].hashCode = -1;
slots[i].value = default(TElement);
slots[i].next = freeList;
freeList = i;
return true;
}
}
return false;
}
bool Find(TElement value, bool add) {
int hashCode = InternalGetHashCode(value);
for (int i = buckets[hashCode % buckets.Length] - 1; i >= 0; i = slots[i].next) {
if (slots[i].hashCode == hashCode && comparer.Equals(slots[i].value, value)) return true;
}
if (add) {
int index;
if (freeList >= 0) {
index = freeList;
freeList = slots[index].next;
}
else {
if (count == slots.Length) Resize();
index = count;
count++;
}
int bucket = hashCode % buckets.Length;
slots[index].hashCode = hashCode;
slots[index].value = value;
slots[index].next = buckets[bucket] - 1;
buckets[bucket] = index + 1;
}
return false;
}
void Resize() {
int newSize = checked(count * 2 + 1);
int[] newBuckets = new int[newSize];
Slot[] newSlots = new Slot[newSize];
Array.Copy(slots, 0, newSlots, 0, count);
for (int i = 0; i < count; i++) {
int bucket = newSlots[i].hashCode % newSize;
newSlots[i].next = newBuckets[bucket] - 1;
newBuckets[bucket] = i + 1;
}
buckets = newBuckets;
slots = newSlots;
}
internal int InternalGetHashCode(TElement value)
{
//[....] DevDivBugs 171937. work around comparer implementations that throw when passed null
return (value == null) ? 0 : comparer.GetHashCode(value) & 0x7FFFFFFF;
}
internal struct Slot
{
internal int hashCode;
internal TElement value;
internal int next;
}
}
}