using System;
using System.IO;
using System.Runtime.InteropServices;
+#if NET_4_5
+using System.Threading;
+using System.Threading.Tasks;
+#endif
namespace System.IO
{
#if NET_4_0
SafeBuffer safebuffer;
#endif
+#if NET_4_5
+ Task<int> read_task;
+#endif
internal event EventHandler Closed;
return progress;
}
+#if NET_4_5
+ public override Task<int> ReadAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
+ {
+ if (buffer == null)
+ throw new ArgumentNullException("buffer");
+ if (offset < 0)
+ throw new ArgumentOutOfRangeException("offset", "Non-negative number required.");
+ if (count < 0)
+ throw new ArgumentOutOfRangeException("count", "Non-negative number required.");
+ if ((buffer.Length - offset) < count)
+ throw new ArgumentException("The length of the buffer array minus the offset parameter is less than the count parameter");
+
+ if (cancellationToken.IsCancellationRequested)
+ return TaskConstants<int>.Canceled;
+
+ try {
+ count = Read (buffer, offset, count);
+
+ // Try not to allocate a new task for every buffer read
+ if (read_task == null || read_task.Result != count)
+ read_task = Task<int>.FromResult (count);
+
+ return read_task;
+ } catch (Exception ex) {
+ return Task<int>.FromException (ex);
+ }
+ }
+
+#endif
+
public override int ReadByte ()
{
if (closed)
//This method performs no action for this class
//but is included as part of the Stream base class
}
+
+#if NET_4_5
+ public override Task FlushAsync (CancellationToken cancellationToken)
+ {
+ if (cancellationToken.IsCancellationRequested)
+ return TaskConstants.Canceled;
+
+ try {
+ Flush ();
+ return TaskConstants.Finished;
+ } catch (Exception ex) {
+ return Task<object>.FromException (ex);
+ }
+ }
+#endif
protected override void Dispose (bool disposing)
{
if (current_position > length)
length = current_position;
}
+
+#if NET_4_5
+ public override Task WriteAsync (byte[] buffer, int offset, int count, CancellationToken cancellationToken)
+ {
+ if (buffer == null)
+ throw new ArgumentNullException("The buffer parameter is a null reference");
+ if (offset < 0)
+ throw new ArgumentOutOfRangeException("offset", "Non-negative number required.");
+ if (count < 0)
+ throw new ArgumentOutOfRangeException("count", "Non-negative number required.");
+ if ((buffer.Length - offset) < count)
+ throw new ArgumentException("The length of the buffer array minus the offset parameter is less than the count parameter");
+ if (current_position > capacity - count)
+ throw new NotSupportedException ("Unable to expand length of this stream beyond its capacity.");
+
+ if (cancellationToken.IsCancellationRequested)
+ return TaskConstants.Canceled;
+
+ try {
+ Write (buffer, offset, count);
+ return TaskConstants.Finished;
+ } catch (Exception ex) {
+ return Task<object>.FromException (ex);
+ }
+ }
+#endif
public override void WriteByte (byte value)
{
using System.Runtime.InteropServices;
using System.Collections.Generic;
using System.Text;
+using System.Runtime.Serialization;
namespace System.Reflection
{
[Serializable]
[ClassInterfaceAttribute (ClassInterfaceType.None)]
[StructLayout (LayoutKind.Sequential)]
-#if MOBILE
- public partial class ParameterInfo : ICustomAttributeProvider {
-#else
- public partial class ParameterInfo : ICustomAttributeProvider, _ParameterInfo {
+ public partial class ParameterInfo : ICustomAttributeProvider
+
+#if !MOBILE
+ , _ParameterInfo
#endif
+#if NET_4_0
+ , IObjectReference
+#endif
+ {
protected Type ClassImpl;
protected object DefaultValueImpl;
protected MemberInfo MemberImpl;
return new object [0];
}
+ public object GetRealObject (StreamingContext context)
+ {
+ throw new NotImplementedException ();
+ }
+
public virtual bool IsDefined( Type attributeType, bool inherit) {
return false;
}
-#if NET_4_5
//
// InterfaceImplementedInVersionAttribute.cs
//
// 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;
+
+#if NET_4_5
using System.Runtime.CompilerServices;
namespace System.Runtime.InteropServices.WindowsRuntime
{
- [AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = false, Inherited = false)]
+ [AttributeUsageAttribute(AttributeTargets.Class|AttributeTargets.Interface, AllowMultiple = true, Inherited = false)]
public sealed class InterfaceImplementedInVersionAttribute : Attribute
{
public InterfaceImplementedInVersionAttribute (Type interfaceType, byte majorVersion, byte minorVersion,
namespace System.Runtime.Serialization
{
[System.Runtime.InteropServices.ComVisibleAttribute (true)]
- public sealed class FormatterServices
+#if NET_4_5
+ static
+#else
+ sealed
+#endif
+ public class FormatterServices
{
private const BindingFlags fieldFlags = BindingFlags.Public |
BindingFlags.Instance |
BindingFlags.NonPublic |
BindingFlags.DeclaredOnly;
+#if !NET_4_5
private FormatterServices ()
{
}
+#endif
public static object [] GetObjectData (object obj, MemberInfo [] members)
{
--- /dev/null
+//
+// CompatibilitySwitch.cs
+//
+// Authors:
+// Marek Safar (marek.safar@gmail.com)
+//
+// Copyright 2014 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.
+//
+
+#if NET_4_5
+
+namespace System.Runtime.Versioning {
+ public static class CompatibilitySwitch
+ {
+ public static bool IsEnabled (string compatibilitySwitchName)
+ {
+ return false;
+ }
+
+ public static string GetValue (string compatibilitySwitchName)
+ {
+ return null;
+ }
+ }
+}
+
+#endif
\ No newline at end of file
get { return false; }
}
- [MonoTODO ("Always returns GCLatencyMode.Interactive and ignores set (.NET 2.0 SP1 member)")]
+ [MonoTODO ("Always returns GCLatencyMode.Interactive and ignores set")]
public static GCLatencyMode LatencyMode {
[ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
get { return GCLatencyMode.Interactive; }
[ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
set { ; }
}
+
+#if NET_4_5
+ public static GCLargeObjectHeapCompactionMode LargeObjectHeapCompactionMode {
+ [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
+ get;
+ [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
+ set;
+ }
+#endif
}
}
+++ /dev/null
-//
-// Claim.cs
-//
-// Authors:
-// Miguel de Icaza (miguel@xamarin.com)
-//
-// Copyright 2014 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;
-
-namespace System.Security.Claims {
-
- public static class AuthenticationTypes {
- public const string Basic = "Basic";
- public const string Federation = "Federation";
- public const string Kerberos = "Kerberos";
- public const string Negotiate = "Negotiate";
- public const string Password = "Password";
- public const string Signature = "Signature";
- public const string Windows = "Windows";
- public const string X509 = "X509";
- }
-}
public const string AuthorizationDecision = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/authorizationdecision";
- public const string ClaimsType2005Namespace = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims";
-
- public const string ClaimsType2009Namespace = "http://schemas.xmlsoap.org/ws/2009/09/identity/claims";
-
- public const string ClaimsTypeNamespace = "http://schemas.microsoft.com/ws/2008/06/identity/claims";
-
public const string CookiePath = "http://schemas.microsoft.com/ws/2008/06/identity/claims/cookiepath";
public const string Country = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/country";
public const string DateOfBirth = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dateofbirth";
- public const string DenyOnlyPrimaryGroup = "http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlyprimarygroup";
+ public const string DenyOnlyPrimaryGroupSid = "http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlyprimarygroupsid";
public const string DenyOnlyPrimarySid = "http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlyprimarysid";
public const string DenyOnlySid = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/denyonlysid";
+ public const string DenyOnlyWindowsDeviceGroup = "http://schemas.microsoft.com/ws/2008/06/identity/claims/denyonlywindowsdevicegroup";
+
public const string Dns = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/dns";
public const string Dsa = "http://schemas.microsoft.com/ws/2008/06/identity/claims/dsa";
- public const string Email = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/email";
+ public const string Email = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/emailaddress";
public const string Expiration = "http://schemas.microsoft.com/ws/2008/06/identity/claims/expiration";
public const string PostalCode = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/postalcode";
- public const string PPID = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/privatepersonalidentifier";
-
public const string PrimaryGroupSid = "http://schemas.microsoft.com/ws/2008/06/identity/claims/primarygroupsid";
public const string PrimarySid = "http://schemas.microsoft.com/ws/2008/06/identity/claims/primarysid";
public const string WindowsAccountName = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsaccountname";
+ public const string WindowsDeviceClaim = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsdeviceclaim";
+
+ public const string WindowsDeviceGroup = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsdevicegroup";
+
+ public const string WindowsFqbnVersion = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsfqbnversion";
+
+ public const string WindowsSubAuthority = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowssubauthority";
+
+ public const string WindowsUserClaim = "http://schemas.microsoft.com/ws/2008/06/identity/claims/windowsuserclaim";
+
public const string X500DistinguishedName = "http://schemas.xmlsoap.org/ws/2005/05/identity/claims/x500distinguishedname";
}
}
//
using System.Runtime.InteropServices;
+using System.Collections.Generic;
#if NET_4_5
using System.Security.Claims;
#endif
{
}
+#if NET_4_5
+ protected GenericIdentity (GenericIdentity identity)
+ : base (identity)
+ {
+ }
+#endif
+
#if NET_4_5
override
#else
return (m_name.Length > 0);
}
}
+
+#if NET_4_5
+ public override IEnumerable<Claim> Claims {
+ get {
+ return base.Claims;
+ }
+ }
+#endif
}
}
//
using System.Runtime.InteropServices;
+#if NET_4_5
+using System.Security.Claims;
+#endif
namespace System.Security.Principal {
[Serializable]
[ComVisible (true)]
- public class GenericPrincipal : IPrincipal {
+ public class GenericPrincipal :
+#if NET_4_5
+ ClaimsPrincipal
+#else
+ IPrincipal
+#endif
+ {
// field names are serialization compatible with .net
private IIdentity m_identity;
get { return m_roles; }
}
- public virtual IIdentity Identity {
+#if NET_4_5
+ override
+#else
+ virtual
+#endif
+ public IIdentity Identity {
get { return m_identity; }
}
- public virtual bool IsInRole (string role)
+#if NET_4_5
+ override
+#else
+ virtual
+#endif
+ public bool IsInRole (string role)
{
if (m_roles == null)
return false;
static private IntPtr invalidWindows = IntPtr.Zero;
+#if NET_4_5
+ [NonSerialized]
+ public new const string DefaultIssuer = "AD AUTHORITY";
+#endif
+
[SecurityPermission (SecurityAction.Demand, ControlPrincipal=true)]
public WindowsIdentity (IntPtr userToken)
: this (userToken, null, WindowsAccountType.Normal, false)
using System.Collections;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
+#if NET_4_5
+using System.Security.Claims;
+#endif
namespace System.Security.Principal {
[Serializable]
[ComVisible (true)]
- public class WindowsPrincipal : IPrincipal {
-
+ public class WindowsPrincipal :
+#if NET_4_5
+ ClaimsPrincipal
+#else
+ IPrincipal
+#endif
+ {
private WindowsIdentity _identity;
// http://groups.google.ca/groups?q=WindowsPrincipal+m_roles&hl=en&lr=&ie=UTF-8&oe=UTF-8&selm=OghXf4OgCHA.4228%40tkmsftngp08&rnum=4
private string [] m_roles;
}
// properties
-
- public virtual IIdentity Identity {
+#if NET_4_5
+ override
+#else
+ virtual
+#endif
+ public IIdentity Identity {
get { return _identity; }
}
}
}
- public virtual bool IsInRole (string role)
+#if NET_4_5
+ override
+#else
+ virtual
+#endif
+ public bool IsInRole (string role)
{
if (role == null)
return false; // ArgumentNullException
public extern static float Read (ref float location);
[MethodImplAttribute (MethodImplOptions.InternalCall)]
+ [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
public extern static T Read<T> (ref T location) where T : class;
[MethodImplAttribute (MethodImplOptions.InternalCall)]
public extern static void Write (ref float location, float value);
[MethodImplAttribute (MethodImplOptions.InternalCall)]
+ [ReliabilityContract (Consistency.WillNotCorruptState, Cer.Success)]
public extern static void Write<T>(ref T location, T value) where T : class;
}
}
System.Runtime.Serialization.Formatters.Binary/ObjectReader.cs
System.Runtime.Serialization.Formatters.Binary/ObjectWriter.cs
System.Runtime.Serialization.Formatters.Binary/MessageFormatter.cs
+System.Runtime.Versioning/CompatibilitySwitch.cs
System.Runtime.Versioning/ComponentGuaranteesAttribute.cs
System.Runtime.Versioning/ComponentGuaranteesOptions.cs
System.Runtime.Versioning/ResourceConsumptionAttribute.cs