You've already forked linux-packaging-mono
Imported Upstream version 4.2.0.179
Former-commit-id: 0a113cb3a6feb7873f632839b1307cc6033cd595
This commit is contained in:
committed by
Jo Shields
parent
183bba2c9a
commit
6992685b86
@@ -40,7 +40,13 @@ namespace Microsoft.Win32.SafeHandles {
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
override protected bool ReleaseHandle()
|
||||
{
|
||||
#if MONO
|
||||
System.IO.MonoIOError error;
|
||||
System.IO.MonoIO.Close (handle, out error);
|
||||
return error == System.IO.MonoIOError.ERROR_SUCCESS;
|
||||
#else
|
||||
return Win32Native.CloseHandle(handle);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -11,7 +11,7 @@
|
||||
// Implements Microsoft.Win32.SafeHandles.SafeRegistryHandle
|
||||
//
|
||||
// ======================================================================================
|
||||
#if !FEATURE_PAL
|
||||
#if !FEATURE_PAL || MONO
|
||||
namespace Microsoft.Win32.SafeHandles {
|
||||
using System;
|
||||
using System.Security;
|
||||
|
@@ -60,6 +60,10 @@ namespace Microsoft.Win32.SafeHandles {
|
||||
[ResourceConsumption(ResourceScope.Machine)]
|
||||
override protected bool ReleaseHandle()
|
||||
{
|
||||
#if MONO
|
||||
NativeEventCalls.CloseEvent_internal (handle);
|
||||
return true;
|
||||
#else
|
||||
#if !FEATURE_CORECLR
|
||||
if (!bIsMutex || Environment.HasShutdownStarted)
|
||||
return Win32Native.CloseHandle(handle);
|
||||
@@ -82,6 +86,7 @@ namespace Microsoft.Win32.SafeHandles {
|
||||
return bReturn;
|
||||
#else
|
||||
return Win32Native.CloseHandle(handle);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@@ -14,63 +14,63 @@ namespace System {
|
||||
// Action/Func delegates first shipped with .NET Framework 3.5 in System.Core.dll as part of LINQ
|
||||
// These were type forwarded to mscorlib.dll in .NET Framework 4.0 and in Silverlight 5.0
|
||||
|
||||
#if FEATURE_CORECLR
|
||||
#if FEATURE_CORECLR || MOBILE
|
||||
[TypeForwardedFrom("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
|
||||
#else
|
||||
[TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
|
||||
#endif
|
||||
public delegate void Action();
|
||||
|
||||
#if FEATURE_CORECLR
|
||||
#if FEATURE_CORECLR || MOBILE
|
||||
[TypeForwardedFrom("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
|
||||
#else
|
||||
[TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
|
||||
#endif
|
||||
public delegate void Action<in T1,in T2>(T1 arg1, T2 arg2);
|
||||
|
||||
#if FEATURE_CORECLR
|
||||
#if FEATURE_CORECLR || MOBILE
|
||||
[TypeForwardedFrom("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
|
||||
#else
|
||||
[TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
|
||||
#endif
|
||||
public delegate void Action<in T1,in T2,in T3>(T1 arg1, T2 arg2, T3 arg3);
|
||||
|
||||
#if FEATURE_CORECLR
|
||||
#if FEATURE_CORECLR || MOBILE
|
||||
[TypeForwardedFrom("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
|
||||
#else
|
||||
[TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
|
||||
#endif
|
||||
public delegate void Action<in T1,in T2,in T3,in T4>(T1 arg1, T2 arg2, T3 arg3, T4 arg4);
|
||||
|
||||
#if FEATURE_CORECLR
|
||||
#if FEATURE_CORECLR || MOBILE
|
||||
[TypeForwardedFrom("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
|
||||
#else
|
||||
[TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
|
||||
#endif
|
||||
public delegate TResult Func<out TResult>();
|
||||
|
||||
#if FEATURE_CORECLR
|
||||
#if FEATURE_CORECLR || MOBILE
|
||||
[TypeForwardedFrom("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
|
||||
#else
|
||||
[TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
|
||||
#endif
|
||||
public delegate TResult Func<in T, out TResult>(T arg);
|
||||
|
||||
#if FEATURE_CORECLR
|
||||
#if FEATURE_CORECLR || MOBILE
|
||||
[TypeForwardedFrom("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
|
||||
#else
|
||||
[TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
|
||||
#endif
|
||||
public delegate TResult Func<in T1, in T2, out TResult>(T1 arg1, T2 arg2);
|
||||
|
||||
#if FEATURE_CORECLR
|
||||
#if FEATURE_CORECLR || MOBILE
|
||||
[TypeForwardedFrom("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
|
||||
#else
|
||||
[TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
|
||||
#endif
|
||||
public delegate TResult Func<in T1, in T2, in T3, out TResult>(T1 arg1, T2 arg2, T3 arg3);
|
||||
|
||||
#if FEATURE_CORECLR
|
||||
#if FEATURE_CORECLR || MOBILE
|
||||
[TypeForwardedFrom("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
|
||||
#else
|
||||
[TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
|
||||
|
@@ -626,9 +626,9 @@ namespace System {
|
||||
activationAttributes,
|
||||
null);
|
||||
}
|
||||
#if FEATURE_COMINTEROP || MONO_COM
|
||||
#if FEATURE_COMINTEROP || MONO_COM || MOBILE_LEGACY
|
||||
|
||||
#if FEATURE_CLICKONCE
|
||||
#if FEATURE_CLICKONCE || MOBILE_LEGACY
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
public static ObjectHandle CreateInstance (ActivationContext activationContext) {
|
||||
AppDomainManager domainManager = AppDomain.CurrentDomain.DomainManager;
|
||||
@@ -700,7 +700,7 @@ namespace System {
|
||||
}
|
||||
#endif // FEATURE_COMINTEROP
|
||||
|
||||
#if FEATURE_REMOTING
|
||||
#if FEATURE_REMOTING || MOBILE_LEGACY
|
||||
// This method is a helper method and delegates to the remoting
|
||||
// services to do the actual work.
|
||||
[System.Security.SecurityCritical] // auto-generated_required
|
||||
|
@@ -17,10 +17,15 @@ namespace System {
|
||||
|
||||
[Serializable]
|
||||
[AttributeUsageAttribute(AttributeTargets.All, Inherited = true, AllowMultiple=false)]
|
||||
#if !MOBILE
|
||||
[ClassInterface(ClassInterfaceType.None)]
|
||||
[ComDefaultInterface(typeof(_Attribute))]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
public abstract partial class Attribute : _Attribute
|
||||
#endif
|
||||
public abstract partial class Attribute
|
||||
#if !MOBILE
|
||||
: _Attribute
|
||||
#endif
|
||||
{
|
||||
#region Private Statics
|
||||
#if MONO
|
||||
@@ -42,15 +47,15 @@ namespace System {
|
||||
var method = (MethodInfo) parameter.Member;
|
||||
var definition = method.GetBaseDefinition ();
|
||||
|
||||
if (attributeType == null)
|
||||
attributeType = typeof (Attribute);
|
||||
|
||||
if (method == definition)
|
||||
return (Attribute []) parameter.GetCustomAttributes (typeof(Attribute), inherit);
|
||||
return (Attribute []) parameter.GetCustomAttributes (attributeType, inherit);
|
||||
|
||||
var types = new List<Type> ();
|
||||
var custom_attributes = new List<Attribute> ();
|
||||
|
||||
if (attributeType == null)
|
||||
attributeType = typeof (Attribute);
|
||||
|
||||
while (true) {
|
||||
var param = method.GetParametersInternal () [parameter.Position];
|
||||
var param_attributes = (Attribute []) param.GetCustomAttributes (attributeType, false);
|
||||
@@ -1012,7 +1017,7 @@ namespace System {
|
||||
#region Public Members
|
||||
public virtual bool IsDefaultAttribute() { return false; }
|
||||
#endregion
|
||||
|
||||
#if !MOBILE
|
||||
void _Attribute.GetTypeInfoCount(out uint pcTInfo)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
@@ -1032,5 +1037,6 @@ namespace System {
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -16,8 +16,9 @@ namespace System {
|
||||
using System.Security;
|
||||
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
public static class Buffer
|
||||
public static partial class Buffer
|
||||
{
|
||||
#if !MONO
|
||||
// Copies from one primitive array to another primitive array without
|
||||
// respecting types. This calls memmove internally. The count and
|
||||
// offset parameters here are in bytes. If you want to use traditional
|
||||
@@ -27,7 +28,7 @@ namespace System {
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
public static extern void BlockCopy(Array src, int srcOffset,
|
||||
Array dst, int dstOffset, int count);
|
||||
|
||||
#endif
|
||||
// A very simple and efficient memmove that assumes all of the
|
||||
// parameter validation has already been done. The count and offset
|
||||
// parameters here are in bytes. If you want to use traditional
|
||||
@@ -35,7 +36,7 @@ namespace System {
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
internal static extern void InternalBlockCopy(Array src, int srcOffsetBytes,
|
||||
internal static extern bool InternalBlockCopy(Array src, int srcOffsetBytes,
|
||||
Array dst, int dstOffsetBytes, int byteCount);
|
||||
|
||||
// This is ported from the optimized CRT assembly in memchr.asm. The JIT generates
|
||||
@@ -115,14 +116,14 @@ namespace System {
|
||||
// If we don't have a match return -1;
|
||||
return -1;
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
// Returns a bool to indicate if the array is of primitive data types
|
||||
// or not.
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private static extern bool IsPrimitiveTypeArray(Array array);
|
||||
|
||||
#endif
|
||||
// Gets a particular byte out of the array. The array must be an
|
||||
// array of primitives.
|
||||
//
|
||||
@@ -133,7 +134,7 @@ namespace System {
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private static extern byte _GetByte(Array array, int index);
|
||||
|
||||
#if !MONO
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
public static byte GetByte(Array array, int index)
|
||||
{
|
||||
@@ -151,7 +152,7 @@ namespace System {
|
||||
|
||||
return _GetByte(array, index);
|
||||
}
|
||||
|
||||
#endif
|
||||
// Sets a particular byte in an the array. The array must be an
|
||||
// array of primitives.
|
||||
//
|
||||
@@ -162,7 +163,7 @@ namespace System {
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private static extern void _SetByte(Array array, int index, byte value);
|
||||
|
||||
#if !MONO
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
public static void SetByte(Array array, int index, byte value)
|
||||
{
|
||||
@@ -181,7 +182,7 @@ namespace System {
|
||||
// Make the FCall to do the work
|
||||
_SetByte(array, index, value);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// Gets a particular byte out of the array. The array must be an
|
||||
// array of primitives.
|
||||
@@ -193,7 +194,7 @@ namespace System {
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[MethodImplAttribute(MethodImplOptions.InternalCall)]
|
||||
private static extern int _ByteLength(Array array);
|
||||
|
||||
#if !MONO
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
public static int ByteLength(Array array)
|
||||
{
|
||||
@@ -207,7 +208,7 @@ namespace System {
|
||||
|
||||
return _ByteLength(array);
|
||||
}
|
||||
|
||||
#endif
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
internal unsafe static void ZeroMemory(byte* src, long len)
|
||||
{
|
||||
@@ -249,7 +250,7 @@ namespace System {
|
||||
Memcpy(pDest + destIndex, pSrc + srcIndex, len);
|
||||
}
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
// This is tricky to get right AND fast, so lets make it useful for the whole Fx.
|
||||
// E.g. System.Runtime.WindowsRuntime!WindowsRuntimeBufferExtensions.MemCopy uses it.
|
||||
[FriendAccessAllowed]
|
||||
@@ -491,5 +492,6 @@ namespace System {
|
||||
[ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
|
||||
extern private unsafe static void __Memcpy(byte* dest, byte* src, int len);
|
||||
#endif // ARM
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -63,14 +63,22 @@ namespace System.Collections.Generic
|
||||
else
|
||||
#endif
|
||||
if (typeof(IComparable<T>).IsAssignableFrom(t)) {
|
||||
#if MONO
|
||||
return (Comparer<T>)RuntimeType.CreateInstanceForAnotherGenericParameter (typeof(GenericComparer<>), t);
|
||||
#else
|
||||
return (Comparer<T>)RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter((RuntimeType)typeof(GenericComparer<int>), t);
|
||||
#endif
|
||||
}
|
||||
|
||||
// If T is a Nullable<U> where U implements IComparable<U> return a NullableComparer<U>
|
||||
if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>)) {
|
||||
RuntimeType u = (RuntimeType)t.GetGenericArguments()[0];
|
||||
if (typeof(IComparable<>).MakeGenericType(u).IsAssignableFrom(u)) {
|
||||
#if MONO
|
||||
return (Comparer<T>)RuntimeType.CreateInstanceForAnotherGenericParameter (typeof(NullableComparer<>), u);
|
||||
#else
|
||||
return (Comparer<T>)RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter((RuntimeType)typeof(NullableComparer<int>), u);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// Otherwise return an ObjectComparer<T>
|
||||
|
@@ -53,22 +53,41 @@ namespace System.Collections.Generic
|
||||
if (t == typeof(byte)) {
|
||||
return (EqualityComparer<T>)(object)(new ByteEqualityComparer());
|
||||
}
|
||||
|
||||
#if MOBILE
|
||||
// Breaks .net serialization compatibility
|
||||
if (t == typeof (string))
|
||||
return (EqualityComparer<T>)(object)new InternalStringComparer ();
|
||||
#endif
|
||||
|
||||
// If T implements IEquatable<T> return a GenericEqualityComparer<T>
|
||||
if (typeof(IEquatable<T>).IsAssignableFrom(t)) {
|
||||
#if MONO
|
||||
return (EqualityComparer<T>)RuntimeType.CreateInstanceForAnotherGenericParameter (typeof(GenericEqualityComparer<>), t);
|
||||
#else
|
||||
return (EqualityComparer<T>)RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter((RuntimeType)typeof(GenericEqualityComparer<int>), t);
|
||||
#endif
|
||||
}
|
||||
// If T is a Nullable<U> where U implements IEquatable<U> return a NullableEqualityComparer<U>
|
||||
if (t.IsGenericType && t.GetGenericTypeDefinition() == typeof(Nullable<>)) {
|
||||
RuntimeType u = (RuntimeType)t.GetGenericArguments()[0];
|
||||
if (typeof(IEquatable<>).MakeGenericType(u).IsAssignableFrom(u)) {
|
||||
#if MONO
|
||||
return (EqualityComparer<T>)RuntimeType.CreateInstanceForAnotherGenericParameter (typeof(NullableEqualityComparer<>), u);
|
||||
#else
|
||||
return (EqualityComparer<T>)RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter((RuntimeType)typeof(NullableEqualityComparer<int>), u);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// If T is an int-based Enum, return an EnumEqualityComparer<T>
|
||||
// See the METHOD__JIT_HELPERS__UNSAFE_ENUM_CAST and METHOD__JIT_HELPERS__UNSAFE_ENUM_CAST_LONG cases in getILIntrinsicImplementation
|
||||
if (t.IsEnum && Enum.GetUnderlyingType(t) == typeof(int))
|
||||
{
|
||||
#if MONO
|
||||
return (EqualityComparer<T>)RuntimeType.CreateInstanceForAnotherGenericParameter (typeof(EnumEqualityComparer<>), t);
|
||||
#else
|
||||
return (EqualityComparer<T>)RuntimeTypeHandle.CreateInstanceForAnotherGenericParameter((RuntimeType)typeof(EnumEqualityComparer<int>), t);
|
||||
#endif
|
||||
}
|
||||
// Otherwise return an ObjectEqualityComparer<T>
|
||||
return new ObjectEqualityComparer<T>();
|
||||
@@ -404,6 +423,39 @@ namespace System.Collections.Generic
|
||||
}
|
||||
}
|
||||
|
||||
[Serializable]
|
||||
sealed class InternalStringComparer : EqualityComparer<string> {
|
||||
|
||||
public override int GetHashCode (string obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return 0;
|
||||
return obj.GetHashCode ();
|
||||
}
|
||||
|
||||
public override bool Equals (string x, string y)
|
||||
{
|
||||
if (x == null)
|
||||
return y == null;
|
||||
|
||||
if ((object) x == (object) y)
|
||||
return true;
|
||||
|
||||
return x.Equals (y);
|
||||
}
|
||||
|
||||
internal override int IndexOf (string[] array, string value, int startIndex, int count)
|
||||
{
|
||||
int endIndex = startIndex + count;
|
||||
for (int i = startIndex; i < endIndex; ++i) {
|
||||
if (Array.UnsafeLoad (array, i) == value)
|
||||
return i;
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
#if FEATURE_RANDOMIZED_STRING_HASHING
|
||||
// This type is not serializeable by design. It does not exist in previous versions and will be removed
|
||||
// Once we move the framework to using secure hashing by default.
|
||||
|
@@ -348,7 +348,12 @@ namespace System {
|
||||
// Returns the DateTime resulting from adding a fractional number of
|
||||
// time units to this DateTime.
|
||||
private DateTime Add(double value, int scale) {
|
||||
long millis = (long)(value * scale + (value >= 0? 0.5: -0.5));
|
||||
long millis;
|
||||
try {
|
||||
millis = checked((long)(value * scale + (value >= 0? 0.5: -0.5)));
|
||||
} catch (OverflowException) {
|
||||
throw new ArgumentOutOfRangeException("value", Environment.GetResourceString("ArgumentOutOfRange_AddValue"));
|
||||
}
|
||||
if (millis <= -MaxMillis || millis >= MaxMillis)
|
||||
throw new ArgumentOutOfRangeException("value", Environment.GetResourceString("ArgumentOutOfRange_AddValue"));
|
||||
return AddTicks(millis * TicksPerMillisecond);
|
||||
|
@@ -71,7 +71,7 @@ namespace System.Globalization {
|
||||
[Serializable]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
|
||||
public class CompareInfo
|
||||
public partial class CompareInfo
|
||||
#if FEATURE_SERIALIZATION
|
||||
: IDeserializationCallback
|
||||
#endif
|
||||
@@ -122,7 +122,7 @@ namespace System.Globalization {
|
||||
this.m_name = culture.m_name;
|
||||
this.m_sortName = culture.SortName;
|
||||
|
||||
#if !FEATURE_CORECLR
|
||||
#if !FEATURE_CORECLR && !MONO
|
||||
IntPtr handleOrigin;
|
||||
this.m_dataHandle = InternalInitSortHandle(m_sortName, out handleOrigin);
|
||||
this.m_handleOrigin = handleOrigin;
|
||||
@@ -243,10 +243,13 @@ namespace System.Globalization {
|
||||
// A zero length string is not invalid, but it is also not sortable.
|
||||
return(false);
|
||||
}
|
||||
|
||||
#if MONO
|
||||
return Mono.Globalization.Unicode.MSCompatUnicodeTable.IsSortable (text);
|
||||
#else
|
||||
CompareInfo c = CultureInfo.InvariantCulture.CompareInfo;
|
||||
|
||||
return (InternalIsSortable(c.m_dataHandle, c.m_handleOrigin, c.m_sortName, text, text.Length));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +257,7 @@ namespace System.Globalization {
|
||||
#region Serialization
|
||||
// the following fields are defined to keep the compatibility with Whidbey.
|
||||
// don't change/remove the names/types of these fields.
|
||||
#if FEATURE_USE_LCID
|
||||
#if FEATURE_USE_LCID || MONO
|
||||
[OptionalField(VersionAdded = 1)]
|
||||
private int win32LCID; // mapped sort culture id of this instance
|
||||
private int culture; // the culture ID used to create this instance.
|
||||
@@ -280,7 +283,7 @@ namespace System.Globalization {
|
||||
ci = CultureInfo.GetCultureInfo(m_name);
|
||||
}
|
||||
this.m_sortName = ci.SortName;
|
||||
#if !FEATURE_CORECLR
|
||||
#if !FEATURE_CORECLR && !MONO
|
||||
IntPtr handleOrigin;
|
||||
this.m_dataHandle = InternalInitSortHandle(m_sortName, out handleOrigin);
|
||||
this.m_handleOrigin = handleOrigin;
|
||||
@@ -441,7 +444,11 @@ namespace System.Globalization {
|
||||
return (1); // non-null > null
|
||||
}
|
||||
|
||||
#if MONO
|
||||
return internal_compare_switch (string1, 0, string1.Length, string2, 0, string2.Length, options);
|
||||
#else
|
||||
return InternalCompareString(m_dataHandle, m_handleOrigin, m_sortName, string1, 0, string1.Length, string2, 0, string2.Length, GetNativeCompareFlags(options));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -539,10 +546,14 @@ namespace System.Globalization {
|
||||
return CompareOrdinal(string1, offset1, length1,
|
||||
string2, offset2, length2);
|
||||
}
|
||||
#if MONO
|
||||
return internal_compare_switch (string1, offset1, length1, string2, offset2, length2, options);
|
||||
#else
|
||||
return InternalCompareString(this.m_dataHandle, this.m_handleOrigin, this.m_sortName,
|
||||
string1, offset1, length1,
|
||||
string2, offset2, length2,
|
||||
GetNativeCompareFlags(options));
|
||||
#endif
|
||||
}
|
||||
|
||||
[System.Security.SecurityCritical]
|
||||
@@ -596,7 +607,14 @@ namespace System.Globalization {
|
||||
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag"), "options");
|
||||
}
|
||||
|
||||
#if MONO
|
||||
if (UseManagedCollation)
|
||||
return GetCollator ().IsPrefix (source, prefix, options);
|
||||
|
||||
if(source.Length < prefix.Length)
|
||||
return false;
|
||||
return Compare (source, 0, prefix.Length, prefix, 0, prefix.Length, options) == 0;
|
||||
#else
|
||||
// to let the sorting DLL do the call optimization in case of Ascii strings, we check if the strings are in Ascii and then send the flag RESERVED_FIND_ASCII_STRING to
|
||||
// the sorting DLL API SortFindString so sorting DLL don't have to check if the string is Ascii with every call to SortFindString.
|
||||
|
||||
@@ -604,6 +622,7 @@ namespace System.Globalization {
|
||||
m_dataHandle, m_handleOrigin, m_sortName,
|
||||
GetNativeCompareFlags(options) | Win32Native.FIND_STARTSWITH | ((source.IsAscii() && prefix.IsAscii()) ? RESERVED_FIND_ASCII_STRING : 0),
|
||||
source, source.Length, 0, prefix, prefix.Length) > -1);
|
||||
#endif
|
||||
}
|
||||
|
||||
public virtual bool IsPrefix(String source, String prefix)
|
||||
@@ -649,12 +668,23 @@ namespace System.Globalization {
|
||||
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag"), "options");
|
||||
}
|
||||
|
||||
#if MONO
|
||||
if (UseManagedCollation)
|
||||
return GetCollator ().IsSuffix (source, suffix, options);
|
||||
|
||||
if (source.Length < suffix.Length)
|
||||
return false;
|
||||
|
||||
return Compare (source, source.Length - suffix.Length, suffix.Length, suffix, 0, suffix.Length, options) == 0;
|
||||
#else
|
||||
|
||||
// to let the sorting DLL do the call optimization in case of Ascii strings, we check if the strings are in Ascii and then send the flag RESERVED_FIND_ASCII_STRING to
|
||||
// the sorting DLL API SortFindString so sorting DLL don't have to check if the string is Ascii with every call to SortFindString.
|
||||
return InternalFindNLSStringEx(
|
||||
m_dataHandle, m_handleOrigin, m_sortName,
|
||||
GetNativeCompareFlags(options) | Win32Native.FIND_ENDSWITH | ((source.IsAscii() && suffix.IsAscii()) ? RESERVED_FIND_ASCII_STRING : 0),
|
||||
source, source.Length, source.Length - 1, suffix, suffix.Length) >= 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -795,12 +825,16 @@ namespace System.Globalization {
|
||||
if ((options & ValidIndexMaskOffFlags) != 0 && (options != CompareOptions.Ordinal))
|
||||
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag"), "options");
|
||||
|
||||
#if MONO
|
||||
return internal_index_switch (source, startIndex, count, value, options, true);
|
||||
#else
|
||||
// to let the sorting DLL do the call optimization in case of Ascii strings, we check if the strings are in Ascii and then send the flag RESERVED_FIND_ASCII_STRING to
|
||||
// the sorting DLL API SortFindString so sorting DLL don't have to check if the string is Ascii with every call to SortFindString.
|
||||
return InternalFindNLSStringEx(
|
||||
m_dataHandle, m_handleOrigin, m_sortName,
|
||||
GetNativeCompareFlags(options) | Win32Native.FIND_FROMSTART | ((source.IsAscii() && (value <= '\x007f')) ? RESERVED_FIND_ASCII_STRING : 0),
|
||||
source, count, startIndex, new String(value, 1), 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -848,12 +882,16 @@ namespace System.Globalization {
|
||||
if ((options & ValidIndexMaskOffFlags) != 0 && (options != CompareOptions.Ordinal))
|
||||
throw new ArgumentException(Environment.GetResourceString("Argument_InvalidFlag"), "options");
|
||||
|
||||
#if MONO
|
||||
return internal_index_switch (source, startIndex, count, value, options, true);
|
||||
#else
|
||||
// to let the sorting DLL do the call optimization in case of Ascii strings, we check if the strings are in Ascii and then send the flag RESERVED_FIND_ASCII_STRING to
|
||||
// the sorting DLL API SortFindString so sorting DLL don't have to check if the string is Ascii with every call to SortFindString.
|
||||
return InternalFindNLSStringEx(
|
||||
m_dataHandle, m_handleOrigin, m_sortName,
|
||||
GetNativeCompareFlags(options) | Win32Native.FIND_FROMSTART | ((source.IsAscii() && value.IsAscii()) ? RESERVED_FIND_ASCII_STRING : 0),
|
||||
source, count, startIndex, value, value.Length);
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -996,12 +1034,16 @@ namespace System.Globalization {
|
||||
return source.LastIndexOf(value.ToString(), startIndex, count, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
#if MONO
|
||||
return internal_index_switch (source, startIndex, count, value, options, false);
|
||||
#else
|
||||
// to let the sorting DLL do the call optimization in case of Ascii strings, we check if the strings are in Ascii and then send the flag RESERVED_FIND_ASCII_STRING to
|
||||
// the sorting DLL API SortFindString so sorting DLL don't have to check if the string is Ascii with every call to SortFindString.
|
||||
return InternalFindNLSStringEx(
|
||||
m_dataHandle, m_handleOrigin, m_sortName,
|
||||
GetNativeCompareFlags(options) | Win32Native.FIND_FROMEND | ((source.IsAscii() && (value <= '\x007f')) ? RESERVED_FIND_ASCII_STRING : 0),
|
||||
source, count, startIndex, new String(value, 1), 1);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1051,12 +1093,16 @@ namespace System.Globalization {
|
||||
return source.LastIndexOf(value, startIndex, count, StringComparison.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
#if MONO
|
||||
return internal_index_switch (source, startIndex, count, value, options, false);
|
||||
#else
|
||||
// to let the sorting DLL do the call optimization in case of Ascii strings, we check if the strings are in Ascii and then send the flag RESERVED_FIND_ASCII_STRING to
|
||||
// the sorting DLL API SortFindString so sorting DLL don't have to check if the string is Ascii with every call to SortFindString.
|
||||
return InternalFindNLSStringEx(
|
||||
m_dataHandle, m_handleOrigin, m_sortName,
|
||||
GetNativeCompareFlags(options) | Win32Native.FIND_FROMEND | ((source.IsAscii() && value.IsAscii()) ? RESERVED_FIND_ASCII_STRING : 0),
|
||||
source, count, startIndex, value, value.Length);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -1067,7 +1113,7 @@ namespace System.Globalization {
|
||||
// Gets the SortKey for the given string with the given options.
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
#if !FEATURE_PAL
|
||||
#if !FEATURE_PAL || MONO
|
||||
public unsafe virtual SortKey GetSortKey(String source, CompareOptions options)
|
||||
{
|
||||
return CreateSortKey(source, options);
|
||||
@@ -1106,7 +1152,9 @@ namespace System.Globalization {
|
||||
// Fake value to test though so we can verify our flags
|
||||
source = "\x0000";
|
||||
}
|
||||
|
||||
#if MONO
|
||||
return CreateSortKeyCore (source, options);
|
||||
#else
|
||||
int flags = GetNativeCompareFlags(options);
|
||||
|
||||
// Go ahead and call the OS
|
||||
@@ -1134,6 +1182,7 @@ namespace System.Globalization {
|
||||
}
|
||||
|
||||
return new SortKey(Name, source, options, keyData);
|
||||
#endif
|
||||
}
|
||||
|
||||
#endif // !FEATURE_PAL
|
||||
@@ -1230,9 +1279,13 @@ namespace System.Globalization {
|
||||
return(0);
|
||||
}
|
||||
|
||||
#if MONO
|
||||
return GetSortKey (source, options).GetHashCode ();
|
||||
#else
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
return (InternalGetGlobalizedHashCode(m_dataHandle, m_handleOrigin, this.m_sortName, source, source.Length, GetNativeCompareFlags(options), forceRandomizedHashing, additionalEntropy));
|
||||
#endif
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@@ -1260,7 +1313,7 @@ namespace System.Globalization {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !FEATURE_CORECLR
|
||||
#if !FEATURE_CORECLR && !MONO
|
||||
[System.Security.SecuritySafeCritical]
|
||||
internal static IntPtr InternalInitSortHandle(String localeName, out IntPtr handleOrigin)
|
||||
{
|
||||
@@ -1326,7 +1379,7 @@ namespace System.Globalization {
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
private static extern IntPtr NativeInternalInitSortHandle(String localeName, out IntPtr handleOrigin);
|
||||
#endif
|
||||
|
||||
#if !MONO
|
||||
// Get a locale sensitive sort hash code from native code -- COMNlsInfo::InternalGetGlobalizedHashCode
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
@@ -1364,5 +1417,6 @@ namespace System.Globalization {
|
||||
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
private static extern int InternalGetSortKey(IntPtr handle, IntPtr handleOrigin, String localeName, int flags, String source, int sourceCount, byte[] target, int targetCount);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -1 +1 @@
|
||||
ee1a96998291d6ef2eb7539a917754849bbafa61
|
||||
cc6bc05d4d040352118265e0dea3270c9253a790
|
@@ -118,7 +118,11 @@ namespace System.Globalization
|
||||
for (i = 0; i < lastCodePageItem; i++)
|
||||
{
|
||||
arrayEncodingInfo[i] = new EncodingInfo(codePageDataPtr[i].codePage, CodePageDataItem.CreateString(codePageDataPtr[i].Names, 0),
|
||||
#if MONO
|
||||
Environment.GetResourceStringEncodingName(codePageDataPtr[i].codePage));
|
||||
#else
|
||||
Environment.GetResourceString("Globalization.cp_" + codePageDataPtr[i].codePage));
|
||||
#endif
|
||||
}
|
||||
|
||||
return arrayEncodingInfo;
|
||||
|
@@ -164,6 +164,9 @@ namespace System.Globalization
|
||||
[System.Security.SecuritySafeCritical]
|
||||
private String GetAsciiUsingOS(String unicode)
|
||||
{
|
||||
#if MONO
|
||||
throw new NotSupportedException ();
|
||||
#else
|
||||
if (unicode.Length == 0)
|
||||
{
|
||||
throw new ArgumentException(Environment.GetResourceString(
|
||||
@@ -208,6 +211,7 @@ namespace System.Globalization
|
||||
}
|
||||
|
||||
return new String(output, 0, length);
|
||||
#endif
|
||||
}
|
||||
|
||||
// Gets Unicode version of the string. Normalized and limited to IDNA characters.
|
||||
@@ -267,6 +271,9 @@ namespace System.Globalization
|
||||
[System.Security.SecuritySafeCritical]
|
||||
private string GetUnicodeUsingOS(string ascii)
|
||||
{
|
||||
#if MONO
|
||||
throw new NotSupportedException ();
|
||||
#else
|
||||
uint flags = (uint)((AllowUnassigned ? IDN_ALLOW_UNASSIGNED : 0) | (UseStd3AsciiRules ? IDN_USE_STD3_ASCII_RULES : 0));
|
||||
int length = IdnToUnicode(flags, ascii, ascii.Length, null, 0);
|
||||
int lastError;
|
||||
@@ -297,6 +304,7 @@ namespace System.Globalization
|
||||
}
|
||||
|
||||
return new String(output, 0, length);
|
||||
#endif
|
||||
}
|
||||
|
||||
public override bool Equals(Object obj)
|
||||
@@ -1118,8 +1126,7 @@ namespace System.Globalization
|
||||
HEREIN WILL NOT INFRINGE ANY RIGHTS OR ANY IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
*/
|
||||
|
||||
|
||||
#if !MONO
|
||||
private const int IDN_ALLOW_UNASSIGNED = 0x1;
|
||||
private const int IDN_USE_STD3_ASCII_RULES = 0x2;
|
||||
|
||||
@@ -1136,7 +1143,8 @@ namespace System.Globalization
|
||||
[MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
|
||||
String lpUnicodeCharStr,
|
||||
int cchUnicodeChar,
|
||||
[System.Runtime.InteropServices.OutAttribute()]
|
||||
[System.Runtime.InteropServices.OutAttribute()]
|
||||
|
||||
char [] lpASCIICharStr,
|
||||
int cchASCIIChar);
|
||||
|
||||
@@ -1150,9 +1158,11 @@ namespace System.Globalization
|
||||
[MarshalAsAttribute(System.Runtime.InteropServices.UnmanagedType.LPWStr)]
|
||||
string lpASCIICharStr,
|
||||
int cchASCIIChar,
|
||||
int cchASCIIChar,
|
||||
[System.Runtime.InteropServices.OutAttribute()]
|
||||
|
||||
char [] lpUnicodeCharStr,
|
||||
int cchUnicodeChar);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -32,7 +32,7 @@ namespace System.Globalization {
|
||||
|
||||
[Serializable]
|
||||
[System.Runtime.InteropServices.ComVisible(true)]
|
||||
public class TextInfo : ICloneable, IDeserializationCallback
|
||||
public partial class TextInfo : ICloneable, IDeserializationCallback
|
||||
{
|
||||
//--------------------------------------------------------------------//
|
||||
// Internal Information //
|
||||
@@ -73,8 +73,10 @@ namespace System.Globalization {
|
||||
private String m_cultureName; // Name of the culture that created this text info
|
||||
[NonSerialized]private CultureData m_cultureData; // Data record for the culture that made us, not for this textinfo
|
||||
[NonSerialized]private String m_textInfoName; // Name of the text info we're using (ie: m_cultureData.STEXTINFO)
|
||||
#if !MONO
|
||||
[NonSerialized]private IntPtr m_dataHandle; // Sort handle
|
||||
[NonSerialized]private IntPtr m_handleOrigin;
|
||||
#endif
|
||||
[NonSerialized]private bool? m_IsAsciiCasingSameAsInvariant;
|
||||
|
||||
|
||||
@@ -103,7 +105,7 @@ namespace System.Globalization {
|
||||
this.m_cultureData = cultureData;
|
||||
this.m_cultureName = this.m_cultureData.CultureName;
|
||||
this.m_textInfoName = this.m_cultureData.STEXTINFO;
|
||||
#if !FEATURE_CORECLR
|
||||
#if !FEATURE_CORECLR && !MONO
|
||||
IntPtr handleOrigin;
|
||||
this.m_dataHandle = CompareInfo.InternalInitSortHandle(m_textInfoName, out handleOrigin);
|
||||
this.m_handleOrigin = handleOrigin;
|
||||
@@ -178,7 +180,7 @@ namespace System.Globalization {
|
||||
// Get the text info name belonging to that culture
|
||||
this.m_cultureData = CultureInfo.GetCultureInfo(m_cultureName).m_cultureData;
|
||||
this.m_textInfoName = this.m_cultureData.STEXTINFO;
|
||||
#if !FEATURE_CORECLR
|
||||
#if !FEATURE_CORECLR && !MONO
|
||||
IntPtr handleOrigin;
|
||||
this.m_dataHandle = CompareInfo.InternalInitSortHandle(m_textInfoName, out handleOrigin);
|
||||
this.m_handleOrigin = handleOrigin;
|
||||
@@ -231,7 +233,7 @@ namespace System.Globalization {
|
||||
// (not necessarily true for sorting, but OK for casing & then we apply normal hash code rules)
|
||||
return (Invariant.GetCaseInsensitiveHashCode(s, forceRandomizedHashing, additionalEntropy));
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
[System.Security.SecuritySafeCritical]
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[ResourceConsumption(ResourceScope.Process, ResourceScope.Process)]
|
||||
@@ -239,7 +241,7 @@ namespace System.Globalization {
|
||||
{
|
||||
return InternalTryFindStringOrdinalIgnoreCase(searchFlags, source, count, startIndex, value, value.Length, ref foundIndex);
|
||||
}
|
||||
|
||||
#endif
|
||||
// This function doesn't check arguments. Please do check in the caller.
|
||||
// The underlying unmanaged code will assert the sanity of arguments.
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
@@ -294,9 +296,11 @@ namespace System.Globalization {
|
||||
string valueUpper = value.ToUpper(CultureInfo.InvariantCulture);
|
||||
#else
|
||||
// fast path
|
||||
#if !MONO
|
||||
int ret = -1;
|
||||
if (TryFastFindStringOrdinalIgnoreCase(Microsoft.Win32.Win32Native.FIND_FROMSTART, source, startIndex, value, count, ref ret))
|
||||
return ret;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// the search space within [source] starts at offset [startIndex] inclusive and includes
|
||||
@@ -364,9 +368,11 @@ namespace System.Globalization {
|
||||
string valueUpper = value.ToUpper(CultureInfo.InvariantCulture);
|
||||
#else
|
||||
// fast path
|
||||
#if !MONO
|
||||
int ret = -1;
|
||||
if (TryFastFindStringOrdinalIgnoreCase(Microsoft.Win32.Win32Native.FIND_FROMEND, source, startIndex, value, count, ref ret))
|
||||
return ret;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// the search space within [source] ends at offset [startIndex] inclusive
|
||||
@@ -592,7 +598,11 @@ namespace System.Globalization {
|
||||
{
|
||||
return ToLowerAsciiInvariant(c);
|
||||
}
|
||||
#if MONO
|
||||
return ToLowerInternal (c);
|
||||
#else
|
||||
return (InternalChangeCaseChar(this.m_dataHandle, this.m_handleOrigin, this.m_textInfoName, c, false));
|
||||
#endif
|
||||
}
|
||||
|
||||
[System.Security.SecuritySafeCritical] // auto-generated
|
||||
@@ -601,6 +611,9 @@ namespace System.Globalization {
|
||||
if (str == null) { throw new ArgumentNullException("str"); }
|
||||
Contract.EndContractBlock();
|
||||
|
||||
#if MONO
|
||||
return ToLowerInternal (str);
|
||||
#else
|
||||
String toLower = InternalChangeCaseString(this.m_dataHandle, this.m_handleOrigin, this.m_textInfoName, str, false);
|
||||
#if __APPLE__
|
||||
//
|
||||
@@ -624,7 +637,7 @@ namespace System.Globalization {
|
||||
}
|
||||
#endif
|
||||
return toLower;
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
static private Char ToLowerAsciiInvariant(Char c)
|
||||
@@ -655,7 +668,12 @@ namespace System.Globalization {
|
||||
{
|
||||
return ToUpperAsciiInvariant(c);
|
||||
}
|
||||
|
||||
#if MONO
|
||||
return ToUpperInternal (c);
|
||||
#else
|
||||
return (InternalChangeCaseChar(this.m_dataHandle, this.m_handleOrigin, this.m_textInfoName, c, true));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -664,6 +682,10 @@ namespace System.Globalization {
|
||||
{
|
||||
if (str == null) { throw new ArgumentNullException("str"); }
|
||||
Contract.EndContractBlock();
|
||||
|
||||
#if MONO
|
||||
return ToUpperInternal (str);
|
||||
#else
|
||||
String toUpper = InternalChangeCaseString(this.m_dataHandle, this.m_handleOrigin, this.m_textInfoName, str, true);
|
||||
#if __APPLE__
|
||||
//
|
||||
@@ -687,6 +709,7 @@ namespace System.Globalization {
|
||||
}
|
||||
#endif
|
||||
return toUpper;
|
||||
#endif
|
||||
}
|
||||
|
||||
static private Char ToUpperAsciiInvariant(Char c)
|
||||
@@ -709,10 +732,14 @@ namespace System.Globalization {
|
||||
{
|
||||
if (m_IsAsciiCasingSameAsInvariant == null)
|
||||
{
|
||||
#if MONO
|
||||
m_IsAsciiCasingSameAsInvariant = !(m_cultureData.SISO639LANGNAME == "az" || m_cultureData.SISO639LANGNAME == "tr");
|
||||
#else
|
||||
m_IsAsciiCasingSameAsInvariant =
|
||||
CultureInfo.GetCultureInfo(m_textInfoName).CompareInfo.Compare("abcdefghijklmnopqrstuvwxyz",
|
||||
"ABCDEFGHIJKLMNOPQRSTUVWXYZ",
|
||||
CompareOptions.IgnoreCase) == 0;
|
||||
#endif
|
||||
}
|
||||
return (bool)m_IsAsciiCasingSameAsInvariant;
|
||||
}
|
||||
@@ -1044,10 +1071,14 @@ namespace System.Globalization {
|
||||
}
|
||||
Contract.EndContractBlock();
|
||||
|
||||
#if MONO
|
||||
return StringComparer.CurrentCultureIgnoreCase.GetHashCode (str);
|
||||
#else
|
||||
// Return our result
|
||||
return (InternalGetCaseInsHash(this.m_dataHandle, this.m_handleOrigin, this.m_textInfoName, str, forceRandomizedHashing, additionalEntropy));
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
// Change case (ToUpper/ToLower) -- COMNlsInfo::InternalChangeCaseChar
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
@@ -1083,6 +1114,7 @@ namespace System.Globalization {
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
[return: MarshalAs(UnmanagedType.Bool)]
|
||||
private static unsafe extern bool InternalTryFindStringOrdinalIgnoreCase(int searchFlags, String source, int sourceCount, int startIndex, String target, int targetCount, ref int foundIndex);
|
||||
#endif
|
||||
}
|
||||
|
||||
}
|
||||
|
@@ -23,14 +23,15 @@ namespace System {
|
||||
using System.Security.Principal;
|
||||
using System.Security.Policy;
|
||||
using System.Security;
|
||||
using System.Security.Util;
|
||||
using System.Collections;
|
||||
using System.Text;
|
||||
using System.Configuration.Assemblies;
|
||||
using System.Threading;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Remoting;
|
||||
#if !FULL_AOT_RUNTIME
|
||||
using System.Reflection.Emit;
|
||||
#endif
|
||||
using CultureInfo = System.Globalization.CultureInfo;
|
||||
using System.IO;
|
||||
using System.Runtime.Versioning;
|
||||
@@ -57,7 +58,7 @@ namespace System {
|
||||
|
||||
Type GetType ();
|
||||
|
||||
#if FEATURE_REMOTING
|
||||
#if FEATURE_REMOTING || MOBILE_LEGACY
|
||||
[System.Security.SecurityCritical] // auto-generated_required
|
||||
Object InitializeLifetimeService ();
|
||||
|
||||
@@ -65,7 +66,7 @@ namespace System {
|
||||
Object GetLifetimeService ();
|
||||
#endif // FEATURE_REMOTING
|
||||
|
||||
#if FEATURE_CAS_POLICY
|
||||
#if FEATURE_CAS_POLICY || MOBILE_LEGACY
|
||||
Evidence Evidence { get; }
|
||||
#endif // FEATURE_CAS_POLICY
|
||||
event EventHandler DomainUnload;
|
||||
@@ -86,7 +87,7 @@ namespace System {
|
||||
|
||||
[method:System.Security.SecurityCritical]
|
||||
event UnhandledExceptionEventHandler UnhandledException;
|
||||
|
||||
#if !FULL_AOT_RUNTIME
|
||||
AssemblyBuilder DefineDynamicAssembly(AssemblyName name,
|
||||
AssemblyBuilderAccess access);
|
||||
|
||||
@@ -139,7 +140,7 @@ namespace System {
|
||||
PermissionSet optionalPermissions,
|
||||
PermissionSet refusedPermissions,
|
||||
bool isSynchronized);
|
||||
|
||||
#endif
|
||||
ObjectHandle CreateInstance(String assemblyName,
|
||||
String typeName);
|
||||
|
||||
@@ -247,18 +248,18 @@ namespace System {
|
||||
#endif
|
||||
Object GetData(string name);
|
||||
|
||||
#if FEATURE_CAS_POLICY
|
||||
#if FEATURE_CAS_POLICY || MOBILE_LEGACY
|
||||
[System.Security.SecurityCritical] // auto-generated_required
|
||||
void SetAppDomainPolicy(PolicyLevel domainPolicy);
|
||||
|
||||
#if FEATURE_IMPERSONATION
|
||||
#if FEATURE_IMPERSONATION || MOBILE_LEGACY
|
||||
void SetThreadPrincipal(IPrincipal principal);
|
||||
#endif // FEATURE_IMPERSONATION
|
||||
|
||||
void SetPrincipalPolicy(PrincipalPolicy policy);
|
||||
#endif
|
||||
|
||||
#if FEATURE_REMOTING
|
||||
#if FEATURE_REMOTING || MOBILE_LEGACY
|
||||
void DoCallBack(CrossAppDomainDelegate theDelegate);
|
||||
#endif
|
||||
|
||||
|
@@ -10,7 +10,11 @@ namespace System {
|
||||
|
||||
[Serializable]
|
||||
[System.Security.Permissions.HostProtection(MayLeakOnAbort = true)]
|
||||
#if MOBILE
|
||||
[TypeForwardedFrom("System.Core, Version=2.0.5.0, Culture=Neutral, PublicKeyToken=7cec85d7bea7798e")]
|
||||
#else
|
||||
[TypeForwardedFrom("System.Core, Version=3.5.0.0, Culture=Neutral, PublicKeyToken=b77a5c561934e089")]
|
||||
#endif
|
||||
public class InvalidTimeZoneException : Exception {
|
||||
public InvalidTimeZoneException(String message)
|
||||
: base(message) { }
|
||||
|
@@ -98,6 +98,9 @@ namespace System.IO {
|
||||
if (!isFullyQualified && !isInvalidPath)
|
||||
return path;
|
||||
|
||||
#if DISABLE_CAS_USE
|
||||
bool safeToReturn = !isInvalidPath;
|
||||
#else
|
||||
bool safeToReturn = false;
|
||||
try {
|
||||
if (!isInvalidPath) {
|
||||
@@ -118,7 +121,7 @@ namespace System.IO {
|
||||
// from Security.Util.StringExpressionSet.CanonicalizePath when ':' is found in the path
|
||||
// beyond string index position 1.
|
||||
}
|
||||
|
||||
#endif // DISABLE_CAS_USE
|
||||
if (!safeToReturn) {
|
||||
if (Path.IsDirectorySeparator(path[path.Length - 1]))
|
||||
path = Environment.GetResourceString("IO.IO_NoPermissionToDirectoryName");
|
||||
|
@@ -185,6 +185,9 @@ namespace System.IO {
|
||||
internal static String FormatFileLoadExceptionMessage(String fileName,
|
||||
int hResult)
|
||||
{
|
||||
#if MONO
|
||||
return string.Format (CultureInfo.InvariantCulture, "Could not load file or assembly '{0}' or one of its dependencies", fileName);
|
||||
#else
|
||||
string format = null;
|
||||
GetFileLoadExceptionMessage(hResult, JitHelpers.GetStringHandleOnStack(ref format));
|
||||
|
||||
@@ -192,8 +195,9 @@ namespace System.IO {
|
||||
GetMessageForHR(hResult, JitHelpers.GetStringHandleOnStack(ref message));
|
||||
|
||||
return String.Format(CultureInfo.CurrentCulture, format, fileName, message);
|
||||
#endif
|
||||
}
|
||||
|
||||
#if !MONO
|
||||
[System.Security.SecurityCritical] // auto-generated
|
||||
[ResourceExposure(ResourceScope.None)]
|
||||
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
|
||||
@@ -205,5 +209,6 @@ namespace System.IO {
|
||||
[DllImport(JitHelpers.QCall, CharSet = CharSet.Unicode)]
|
||||
[SuppressUnmanagedCodeSecurity]
|
||||
private static extern void GetMessageForHR(int hresult, StringHandleOnStack retString);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
@@ -23,7 +23,7 @@ using System.Security;
|
||||
using System.Security.Permissions;
|
||||
using System.Threading;
|
||||
using System.Diagnostics.Contracts;
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO || MONO
|
||||
using System.Threading.Tasks;
|
||||
#endif // !FEATURE_PAL && FEATURE_ASYNC_IO
|
||||
|
||||
@@ -102,7 +102,7 @@ namespace System.IO {
|
||||
private long _offset;
|
||||
private FileAccess _access;
|
||||
internal bool _isOpen;
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO || MONO
|
||||
[NonSerialized]
|
||||
private Task<Int32> _lastReadTask; // The last successful task returned from ReadAsync
|
||||
#endif // FEATURE_PAL && FEATURE_ASYNC_IO
|
||||
@@ -163,11 +163,13 @@ namespace System.IO {
|
||||
if (_isOpen) {
|
||||
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CalledTwice"));
|
||||
}
|
||||
#if !DISABLE_CAS_USE
|
||||
if (!skipSecurityCheck) {
|
||||
#pragma warning disable 618
|
||||
new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
|
||||
#pragma warning restore 618
|
||||
}
|
||||
#endif
|
||||
|
||||
// check for wraparound
|
||||
unsafe {
|
||||
@@ -242,11 +244,12 @@ namespace System.IO {
|
||||
if (_isOpen)
|
||||
throw new InvalidOperationException(Environment.GetResourceString("InvalidOperation_CalledTwice"));
|
||||
|
||||
#if !DISABLE_CAS_USE
|
||||
if (!skipSecurityCheck)
|
||||
#pragma warning disable 618
|
||||
new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
|
||||
#pragma warning restore 618
|
||||
|
||||
#endif
|
||||
_mem = pointer;
|
||||
_offset = 0;
|
||||
_length = length;
|
||||
@@ -295,7 +298,7 @@ namespace System.IO {
|
||||
if (!_isOpen) __Error.StreamIsClosed();
|
||||
}
|
||||
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO || MONO
|
||||
[HostProtection(ExternalThreading=true)]
|
||||
[ComVisible(false)]
|
||||
public override Task FlushAsync(CancellationToken cancellationToken) {
|
||||
@@ -457,7 +460,7 @@ namespace System.IO {
|
||||
return nInt;
|
||||
}
|
||||
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO || MONO
|
||||
[HostProtection(ExternalThreading = true)]
|
||||
[ComVisible(false)]
|
||||
public override Task<Int32> ReadAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) {
|
||||
@@ -653,7 +656,7 @@ namespace System.IO {
|
||||
return;
|
||||
}
|
||||
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO
|
||||
#if !FEATURE_PAL && FEATURE_ASYNC_IO || MONO
|
||||
[HostProtection(ExternalThreading = true)]
|
||||
[ComVisible(false)]
|
||||
public override Task WriteAsync(Byte[] buffer, Int32 offset, Int32 count, CancellationToken cancellationToken) {
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user