You've already forked linux-packaging-mono
Imported Upstream version 5.18.0.142
Former-commit-id: 7467d4b717762eeaf652d77f1486dd11ffb1ff1f
This commit is contained in:
parent
e52655b4dc
commit
0abdbe5a7d
@@ -75,6 +75,8 @@ using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: InternalsVisibleTo ("System, PublicKey=" + AssemblyRef.FrameworkPublicKeyFull2)]
|
||||
[assembly: InternalsVisibleTo ("System.Core, PublicKey=" + AssemblyRef.FrameworkPublicKeyFull2)]
|
||||
[assembly: InternalsVisibleTo ("System.Security, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
|
||||
|
||||
|
||||
[assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime, PublicKey=00000000000000000400000000000000")]
|
||||
[assembly: InternalsVisibleTo ("System.Runtime.WindowsRuntime.UI.Xaml, PublicKey=00000000000000000400000000000000")]
|
||||
@@ -84,7 +86,6 @@ using System.Runtime.InteropServices;
|
||||
[assembly: InternalsVisibleTo ("Xamarin.TVOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
|
||||
#elif MONOTOUCH_WATCH
|
||||
[assembly: InternalsVisibleTo ("Xamarin.WatchOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
|
||||
[assembly: InternalsVisibleTo ("System.Security, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
|
||||
#else
|
||||
[assembly: InternalsVisibleTo ("monotouch, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
|
||||
[assembly: InternalsVisibleTo ("Xamarin.iOS, PublicKey=0024000004800000940000000602000000240000525341310004000011000000438ac2a5acfbf16cbd2b2b47a62762f273df9cb2795ceccdf77d10bf508e69e7a362ea7a45455bbf3ac955e1f2e2814f144e5d817efc4c6502cc012df310783348304e3ae38573c6d658c234025821fda87a0be8a0d504df564e2c93b2b878925f42503e9d54dfef9f9586d9e6f38a305769587b1de01f6c0410328b2c9733db")]
|
||||
|
@@ -101,13 +101,22 @@ namespace Crimson.CommonCrypto {
|
||||
|
||||
// size_t was changed to IntPtr for 32/64 bits size difference - even if mono is (moslty) used in 32bits only on OSX today
|
||||
[DllImport ("/System/Library/Frameworks/Security.framework/Security")]
|
||||
extern internal static /* int */ int SecRandomCopyBytes (/* SecRandomRef */ IntPtr rnd, /* size_t */ IntPtr count, /* uint8_t* */ byte[] bytes);
|
||||
unsafe extern internal static /* int */ int SecRandomCopyBytes (/* SecRandomRef */ IntPtr rnd, /* size_t */ IntPtr count, /* uint8_t* */ byte *data);
|
||||
|
||||
static internal void GetRandom (byte[] buffer)
|
||||
unsafe static internal void GetRandom (byte[] buffer)
|
||||
{
|
||||
if (SecRandomCopyBytes (IntPtr.Zero, (IntPtr) buffer.Length, buffer) != 0)
|
||||
fixed (byte* fixed_bytes = buffer) {
|
||||
if (SecRandomCopyBytes (IntPtr.Zero, (IntPtr)buffer.Length, fixed_bytes) != 0)
|
||||
throw new CryptographicException (Marshal.GetLastWin32Error ()); // errno
|
||||
}
|
||||
}
|
||||
|
||||
static internal unsafe void GetRandom (byte* data, IntPtr data_length)
|
||||
{
|
||||
if (SecRandomCopyBytes (IntPtr.Zero, data_length, data) != 0)
|
||||
throw new CryptographicException (Marshal.GetLastWin32Error ()); // errno
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#if !MONOTOUCH && !XAMMAC
|
||||
|
@@ -64,6 +64,11 @@ namespace System.Security.Cryptography {
|
||||
|
||||
Cryptor.GetRandom (data);
|
||||
}
|
||||
|
||||
unsafe internal void GetBytes (byte* data, IntPtr data_length)
|
||||
{
|
||||
Cryptor.GetRandom (data, data_length);
|
||||
}
|
||||
|
||||
public override void GetNonZeroBytes (byte[] data)
|
||||
{
|
||||
|
@@ -355,8 +355,6 @@
|
||||
|
||||
<!-- domain.c: mono_defaults.string_class -->
|
||||
<type fullname="System.String" preserve="fields">
|
||||
<!-- marshal.c mono_marshal_get_native_wrapper -->
|
||||
<method name="CreateString" />
|
||||
<!-- method-to-ir.c: mini_redirect_call -->
|
||||
<method name="InternalAllocateStr" />
|
||||
<!-- method-to-it.c: mini_emit_initobj -->
|
||||
|
@@ -26,26 +26,47 @@ ifeq ($(PROFILE),build)
|
||||
CSC_RUNTIME_FLAGS=--profile=aot:output=$(topdir)/class/lib/$(PROFILE_DIRECTORY)/csc.$(LIBRARY).aotprofile
|
||||
endif
|
||||
|
||||
RESX_EXTRA_ARGUMENTS = \
|
||||
--in=ReferenceSources/SR.cs \
|
||||
--in=ReferenceSources/SR2.cs
|
||||
|
||||
RESX_RESOURCE_STRING = \
|
||||
../../../external/corert/src/System.Private.CoreLib/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Collections.Concurrent/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Memory/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Threading.Tasks.Parallel/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Collections/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Collections.Concurrent/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Collections.NonGeneric/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Runtime.Extensions/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.ObjectModel/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.ComponentModel.TypeConverter/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Buffers/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.IO.FileSystem.Watcher/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.IO.Ports/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Memory/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Net.HttpListener/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Net.Requests/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Net.Http/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Numerics.Vectors/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Runtime.Numerics/src/Resources/Strings.resx
|
||||
../../../external/corefx/src/System.Runtime.Extensions/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Runtime.InteropServices.RuntimeInformation/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Runtime.Numerics/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Security.Cryptography.Encoding/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Security.Cryptography.Pkcs/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Security.Cryptography.ProtectedData/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Security.Cryptography.Xml/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Security.Cryptography.X509Certificates/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Text.RegularExpressions/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Threading.Tasks.Parallel/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.ObjectModel/src/Resources/Strings.resx \
|
||||
../../../external/corert/src/System.Private.CoreLib/src/Resources/Strings.resx \
|
||||
../../../external/corefx/src/System.Private.Uri/src/Resources/Strings.resx
|
||||
|
||||
|
||||
LIBRARY_COMPILE = $(BOOT_COMPILE)
|
||||
LIBRARY_INSTALL_DIR = $(mono_libdir)/mono/$(FRAMEWORK_VERSION)
|
||||
|
||||
ifneq ($(PROFILE),basic)
|
||||
RESOURCE_STRINGS = ../referencesource/mscorlib/mscorlib.txt
|
||||
include il/il.make
|
||||
|
||||
RESOURCE_STRINGS_FILES = --mscorlib-debug
|
||||
|
||||
ifneq ($(PROFILE),basic)
|
||||
RESOURCE_STRINGS = ../referencesource/mscorlib/mscorlib.txt
|
||||
MODULE_DEPS = $(IL_REPLACE)
|
||||
endif
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
//
|
||||
// INativeCertificateHelper.cs
|
||||
// CertificateImportFlags.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
@@ -23,13 +23,15 @@
|
||||
// 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.Cryptography.X509Certificates
|
||||
namespace Mono
|
||||
{
|
||||
internal interface INativeCertificateHelper
|
||||
[Flags]
|
||||
enum CertificateImportFlags
|
||||
{
|
||||
X509CertificateImpl Import (byte[] data, string password, X509KeyStorageFlags flags);
|
||||
|
||||
X509CertificateImpl Import (X509Certificate cert);
|
||||
None = 0,
|
||||
DisableNativeBackend = 1,
|
||||
DisableAutomaticFallback = 2
|
||||
}
|
||||
}
|
90
mcs/class/corlib/Mono/DependencyInjector.cs
Normal file
90
mcs/class/corlib/Mono/DependencyInjector.cs
Normal file
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// DependencyInjector.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <mabaul@microsoft.com>
|
||||
//
|
||||
// Copyright (c) 2018 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;
|
||||
#if !(MONOTOUCH || MONODROID)
|
||||
using System.Reflection;
|
||||
#endif
|
||||
|
||||
namespace Mono
|
||||
{
|
||||
static class DependencyInjector
|
||||
{
|
||||
/*
|
||||
* Allows us to use code from `System.dll` in `mscorlib.dll`.
|
||||
*
|
||||
*/
|
||||
internal static ISystemDependencyProvider SystemProvider {
|
||||
get {
|
||||
if (systemDependency != null)
|
||||
return systemDependency;
|
||||
|
||||
lock (locker) {
|
||||
if (systemDependency != null)
|
||||
return systemDependency;
|
||||
|
||||
// Not using `MOBILE` as a conditional here because we want to use this on full-aot.
|
||||
#if !(MONOTOUCH || MONODROID)
|
||||
// On Mobile, we initializes this during system startup.
|
||||
systemDependency = ReflectionLoad ();
|
||||
#endif
|
||||
if (systemDependency == null)
|
||||
throw new PlatformNotSupportedException ("Cannot get `ISystemDependencyProvider`.");
|
||||
|
||||
return systemDependency;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
internal static void Register (ISystemDependencyProvider provider)
|
||||
{
|
||||
lock (locker) {
|
||||
if (systemDependency != null && systemDependency != provider)
|
||||
throw new InvalidOperationException ();
|
||||
systemDependency = provider;
|
||||
}
|
||||
}
|
||||
|
||||
#if !(MONOTOUCH || MONODROID)
|
||||
const string TypeName = "Mono.SystemDependencyProvider, " + Consts.AssemblySystem;
|
||||
|
||||
static ISystemDependencyProvider ReflectionLoad ()
|
||||
{
|
||||
var type = Type.GetType (TypeName);
|
||||
if (type == null)
|
||||
return null;
|
||||
|
||||
var prop = type.GetProperty ("Instance", BindingFlags.Static | BindingFlags.Instance | BindingFlags.Public);
|
||||
if (prop == null)
|
||||
return null;
|
||||
|
||||
return (ISystemDependencyProvider)prop.GetValue (null);
|
||||
}
|
||||
#endif
|
||||
|
||||
static object locker = new object ();
|
||||
static ISystemDependencyProvider systemDependency;
|
||||
}
|
||||
}
|
43
mcs/class/corlib/Mono/ISystemCertificateProvider.cs
Normal file
43
mcs/class/corlib/Mono/ISystemCertificateProvider.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// ISystemCertificateProvider.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <martin.baulig@xamarin.com>
|
||||
//
|
||||
// Copyright (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;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace Mono
|
||||
{
|
||||
interface ISystemCertificateProvider
|
||||
{
|
||||
X509CertificateImpl Import (byte[] data,
|
||||
CertificateImportFlags importFlags = CertificateImportFlags.None);
|
||||
|
||||
X509CertificateImpl Import (byte[] data, SafePasswordHandle password, X509KeyStorageFlags keyStorageFlags,
|
||||
CertificateImportFlags importFlags = CertificateImportFlags.None);
|
||||
|
||||
X509CertificateImpl Import (X509Certificate cert,
|
||||
CertificateImportFlags importFlags = CertificateImportFlags.None);
|
||||
}
|
||||
}
|
34
mcs/class/corlib/Mono/ISystemDependencyProvider.cs
Normal file
34
mcs/class/corlib/Mono/ISystemDependencyProvider.cs
Normal file
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// ISystemDependencyProvider.cs
|
||||
//
|
||||
// Author:
|
||||
// Martin Baulig <mabaul@microsoft.com>
|
||||
//
|
||||
// Copyright (c) 2018 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.
|
||||
namespace Mono
|
||||
{
|
||||
interface ISystemDependencyProvider
|
||||
{
|
||||
ISystemCertificateProvider CertificateProvider {
|
||||
get;
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,426 +0,0 @@
|
||||
//
|
||||
// ParseNumbers.cs
|
||||
//
|
||||
// Authors:
|
||||
// Marek Safar <marek.safar@gmail.com>
|
||||
//
|
||||
// Copyright (C) 2015 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.
|
||||
//
|
||||
|
||||
using System.Globalization;
|
||||
using System.Text;
|
||||
|
||||
namespace System {
|
||||
|
||||
static class ParseNumbers
|
||||
{
|
||||
internal const int PrintAsI1=0x40;
|
||||
internal const int PrintAsI2=0x80;
|
||||
// internal const int PrintAsI4=0x100;
|
||||
internal const int TreatAsUnsigned=0x200;
|
||||
internal const int TreatAsI1=0x400;
|
||||
internal const int TreatAsI2=0x800;
|
||||
internal const int IsTight=0x1000;
|
||||
internal const int NoSpace=0x2000;
|
||||
|
||||
public static int StringToInt (string value, int fromBase, int flags)
|
||||
{
|
||||
unsafe {
|
||||
return StringToInt (value, fromBase, flags, null);
|
||||
}
|
||||
}
|
||||
|
||||
public unsafe static int StringToInt (string value, int fromBase, int flags, int* parsePos)
|
||||
{
|
||||
if ((flags & (IsTight | NoSpace)) == 0)
|
||||
throw new NotImplementedException (flags.ToString ());
|
||||
|
||||
if (value == null)
|
||||
return 0;
|
||||
|
||||
int chars = 0;
|
||||
uint result = 0;
|
||||
int digitValue;
|
||||
|
||||
int len = value.Length;
|
||||
bool negative = false;
|
||||
|
||||
if (len == 0) {
|
||||
// Mimic broken .net behaviour
|
||||
throw new ArgumentOutOfRangeException ("Empty string");
|
||||
}
|
||||
|
||||
int i = parsePos == null ? 0 : *parsePos;
|
||||
|
||||
//Check for a sign
|
||||
if (value [i] == '-') {
|
||||
if (fromBase != 10)
|
||||
throw new ArgumentException ("String cannot contain a minus sign if the base is not 10.");
|
||||
|
||||
if ((flags & TreatAsUnsigned) != 0)
|
||||
throw new OverflowException ("Negative number");
|
||||
|
||||
negative = true;
|
||||
i++;
|
||||
} else if (value [i] == '+') {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (fromBase == 16 && i + 1 < len && value [i] =='0' && (value [i + 1] == 'x' || value [i + 1] == 'X')) {
|
||||
i += 2;
|
||||
}
|
||||
|
||||
uint max_value;
|
||||
if ((flags & TreatAsI1) != 0) {
|
||||
max_value = Byte.MaxValue;
|
||||
} else if ((flags & TreatAsI2) != 0) {
|
||||
max_value = UInt16.MaxValue;
|
||||
} else {
|
||||
max_value = UInt32.MaxValue;
|
||||
}
|
||||
|
||||
while (i < len) {
|
||||
char c = value [i];
|
||||
if (Char.IsNumber (c)) {
|
||||
digitValue = c - '0';
|
||||
} else if (Char.IsLetter (c)) {
|
||||
digitValue = Char.ToLowerInvariant (c) - 'a' + 10;
|
||||
} else {
|
||||
if (i == 0)
|
||||
throw new FormatException ("Could not find any parsable digits.");
|
||||
|
||||
if ((flags & IsTight) != 0)
|
||||
throw new FormatException ("Additional unparsable characters are at the end of the string.");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (digitValue >= fromBase) {
|
||||
if (chars > 0) {
|
||||
throw new FormatException ("Additional unparsable characters are at the end of the string.");
|
||||
}
|
||||
|
||||
throw new FormatException ("Could not find any parsable digits.");
|
||||
}
|
||||
|
||||
long res = fromBase * result + digitValue;
|
||||
if (res > max_value)
|
||||
throw new OverflowException ();
|
||||
|
||||
result = (uint)res;
|
||||
chars++;
|
||||
++i;
|
||||
}
|
||||
|
||||
if (chars == 0)
|
||||
throw new FormatException ("Could not find any parsable digits.");
|
||||
|
||||
if (parsePos != null)
|
||||
*parsePos = i;
|
||||
|
||||
return negative ? -(int)result : (int)result;
|
||||
}
|
||||
|
||||
public static string LongToString (long value, int toBase, int width, char paddingChar, int flags)
|
||||
{
|
||||
if (value == 0)
|
||||
return "0";
|
||||
if (toBase == 10)
|
||||
return value.ToString ();
|
||||
|
||||
byte[] val = BitConverter.GetBytes (value);
|
||||
|
||||
switch (toBase) {
|
||||
case 2:
|
||||
return ConvertToBase2 (val).ToString ();
|
||||
case 8:
|
||||
return ConvertToBase8 (val).ToString ();
|
||||
case 16:
|
||||
return ConvertToBase16 (val).ToString ();
|
||||
default:
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
public static long StringToLong (string value, int fromBase, int flags)
|
||||
{
|
||||
unsafe {
|
||||
return StringToLong (value, fromBase, flags, null);
|
||||
}
|
||||
}
|
||||
|
||||
// Value from which a new base 16 digit can cause an overflow.
|
||||
const ulong base16MaxOverflowFreeValue = ulong.MaxValue / (16 * 16);
|
||||
|
||||
// From ulong we can only cast to positive long.
|
||||
// As |long.MinValue| > |long.MaxValue| we need to do this to avoid an overflow.
|
||||
const ulong longMinValue = ((ulong) long.MaxValue) + (ulong) -(long.MinValue + long.MaxValue);
|
||||
|
||||
public unsafe static long StringToLong (string value, int fromBase, int flags, int* parsePos)
|
||||
{
|
||||
if ((flags & (IsTight | NoSpace)) == 0)
|
||||
throw new NotImplementedException (flags.ToString ());
|
||||
|
||||
if (value == null)
|
||||
return 0;
|
||||
|
||||
int chars = 0;
|
||||
ulong fromBaseULong = (ulong) fromBase;
|
||||
ulong digitValue = 0;
|
||||
ulong result = 0;
|
||||
|
||||
int len = value.Length;
|
||||
bool negative = false;
|
||||
bool treatAsUnsigned = (flags & ParseNumbers.TreatAsUnsigned) != 0;
|
||||
|
||||
if (len == 0) {
|
||||
// Mimic broken .net behaviour
|
||||
throw new ArgumentOutOfRangeException ("Empty string");
|
||||
}
|
||||
|
||||
int i = parsePos == null ? 0 : *parsePos;
|
||||
|
||||
//Check for a sign
|
||||
if (value [i] == '-') {
|
||||
if (fromBase != 10)
|
||||
throw new ArgumentException ("String cannot contain a minus sign if the base is not 10.");
|
||||
|
||||
if (treatAsUnsigned)
|
||||
throw new OverflowException ("Negative number");
|
||||
|
||||
negative = true;
|
||||
i++;
|
||||
} else if (value [i] == '+') {
|
||||
i++;
|
||||
}
|
||||
|
||||
if (fromBase == 16 && i + 1 < len && value [i] =='0' && (value [i + 1] == 'x' || value [i + 1] == 'X')) {
|
||||
i += 2;
|
||||
}
|
||||
|
||||
while (i < len) {
|
||||
char c = value[i];
|
||||
if (Char.IsNumber (c)) {
|
||||
digitValue = (ulong) (c - '0');
|
||||
} else if (Char.IsLetter (c)) {
|
||||
digitValue = (ulong) (Char.ToLowerInvariant (c) - 'a' + 10);
|
||||
} else {
|
||||
if (i == 0)
|
||||
throw new FormatException ("Could not find any parsable digits.");
|
||||
|
||||
if ((flags & IsTight) != 0)
|
||||
throw new FormatException ("Additional unparsable characters are at the end of the string.");
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
if (digitValue >= fromBaseULong) {
|
||||
if (chars > 0) {
|
||||
throw new FormatException ("Additional unparsable "
|
||||
+ "characters are at the end of the string.");
|
||||
} else {
|
||||
throw new FormatException ("Could not find any parsable"
|
||||
+ " digits.");
|
||||
}
|
||||
}
|
||||
|
||||
if (result <= base16MaxOverflowFreeValue) {
|
||||
result = result * (ulong) fromBaseULong + digitValue;
|
||||
} else {
|
||||
// decompose 64 bit operation into 32 bit operations so we can check for overflows
|
||||
ulong a = (result >> 32) * fromBaseULong;
|
||||
ulong b = (result & uint.MaxValue) * fromBaseULong + digitValue;
|
||||
if (((b >> 32) + a) > uint.MaxValue)
|
||||
throw new OverflowException ();
|
||||
|
||||
result = (a << 32) + b;
|
||||
}
|
||||
|
||||
chars++;
|
||||
++i;
|
||||
}
|
||||
|
||||
if (chars == 0)
|
||||
throw new FormatException ("Could not find any parsable digits.");
|
||||
|
||||
if (parsePos != null)
|
||||
*parsePos = i;
|
||||
|
||||
if (treatAsUnsigned)
|
||||
return (long) result;
|
||||
|
||||
if (!negative) {
|
||||
if (fromBase == 10 && result > ((ulong) long.MaxValue))
|
||||
throw new OverflowException ();
|
||||
|
||||
return (long)result;
|
||||
}
|
||||
|
||||
if (result <= (ulong) long.MaxValue)
|
||||
return -((long) result);
|
||||
|
||||
if (result > longMinValue)
|
||||
throw new OverflowException ();
|
||||
|
||||
// Avoids overflow of -result when result > long.MaxValue
|
||||
return long.MinValue + (long) (longMinValue - result);
|
||||
}
|
||||
|
||||
public static string IntToString (int value, int toBase, int width, char paddingChar, int flags)
|
||||
{
|
||||
StringBuilder sb;
|
||||
|
||||
if (value == 0) {
|
||||
if (width <= 0)
|
||||
return "0";
|
||||
|
||||
sb = new StringBuilder ("0", width);
|
||||
} else if (toBase == 10)
|
||||
sb = new StringBuilder (value.ToString ());
|
||||
else {
|
||||
byte[] val;
|
||||
if ((flags & PrintAsI1) != 0) {
|
||||
val = BitConverter.GetBytes ((byte) value);
|
||||
} else if ((flags & PrintAsI2) != 0) {
|
||||
val = BitConverter.GetBytes ((short) value);
|
||||
} else {
|
||||
val = BitConverter.GetBytes (value);
|
||||
}
|
||||
|
||||
switch (toBase) {
|
||||
case 2:
|
||||
sb = ConvertToBase2 (val);
|
||||
break;
|
||||
case 8:
|
||||
sb = ConvertToBase8 (val);
|
||||
break;
|
||||
case 16:
|
||||
sb = ConvertToBase16 (val);
|
||||
break;
|
||||
default:
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
}
|
||||
|
||||
var padding = width - sb.Length;
|
||||
while (padding > 0) {
|
||||
sb.Insert (0, paddingChar);
|
||||
--padding;
|
||||
}
|
||||
|
||||
return sb.ToString ();
|
||||
}
|
||||
|
||||
static void EndianSwap (ref byte[] value)
|
||||
{
|
||||
byte[] buf = new byte[value.Length];
|
||||
for (int i = 0; i < value.Length; i++)
|
||||
buf[i] = value[value.Length-1-i];
|
||||
value = buf;
|
||||
}
|
||||
|
||||
static StringBuilder ConvertToBase2 (byte[] value)
|
||||
{
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
EndianSwap (ref value);
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
for (int i = value.Length - 1; i >= 0; i--) {
|
||||
byte b = value [i];
|
||||
for (int j = 0; j < 8; j++) {
|
||||
if ((b & 0x80) == 0x80) {
|
||||
sb.Append ('1');
|
||||
}
|
||||
else {
|
||||
if (sb.Length > 0)
|
||||
sb.Append ('0');
|
||||
}
|
||||
b <<= 1;
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
static StringBuilder ConvertToBase8 (byte[] value)
|
||||
{
|
||||
ulong l = 0;
|
||||
switch (value.Length) {
|
||||
case 1:
|
||||
l = (ulong) value [0];
|
||||
break;
|
||||
case 2:
|
||||
l = (ulong) BitConverter.ToUInt16 (value, 0);
|
||||
break;
|
||||
case 4:
|
||||
l = (ulong) BitConverter.ToUInt32 (value, 0);
|
||||
break;
|
||||
case 8:
|
||||
l = BitConverter.ToUInt64 (value, 0);
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException ("value");
|
||||
}
|
||||
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
for (int i = 21; i >= 0; i--) {
|
||||
// 3 bits at the time
|
||||
char val = (char) ((l >> i * 3) & 0x7);
|
||||
if ((val != 0) || (sb.Length > 0)) {
|
||||
val += '0';
|
||||
sb.Append (val);
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
static StringBuilder ConvertToBase16 (byte[] value)
|
||||
{
|
||||
if (!BitConverter.IsLittleEndian)
|
||||
EndianSwap (ref value);
|
||||
StringBuilder sb = new StringBuilder ();
|
||||
for (int i = value.Length - 1; i >= 0; i--) {
|
||||
char high = (char)((value[i] >> 4) & 0x0f);
|
||||
if ((high != 0) || (sb.Length > 0)) {
|
||||
if (high < 10)
|
||||
high += '0';
|
||||
else {
|
||||
high -= (char) 10;
|
||||
high += 'a';
|
||||
}
|
||||
sb.Append (high);
|
||||
}
|
||||
|
||||
char low = (char)(value[i] & 0x0f);
|
||||
if ((low != 0) || (sb.Length > 0)) {
|
||||
if (low < 10)
|
||||
low += '0';
|
||||
else {
|
||||
low -= (char) 10;
|
||||
low += 'a';
|
||||
}
|
||||
sb.Append (low);
|
||||
}
|
||||
}
|
||||
return sb;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
1
mcs/class/corlib/ReferenceSources/SR.cs.REMOVED.git-id
Normal file
1
mcs/class/corlib/ReferenceSources/SR.cs.REMOVED.git-id
Normal file
@@ -0,0 +1 @@
|
||||
ef52a767836e65a2d95397f2ff17fa3ca5124ea8
|
22
mcs/class/corlib/ReferenceSources/SR2.cs
Normal file
22
mcs/class/corlib/ReferenceSources/SR2.cs
Normal file
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Resource strings referenced by the code.
|
||||
//
|
||||
// Copyright 2014 Xamarin Inc
|
||||
//
|
||||
// Mono-specific additions, which are not in SR.cs or missing in referencesource
|
||||
//
|
||||
partial class SR
|
||||
{
|
||||
public const string mono_net_io_shutdown = "mono_net_io_shutdown";
|
||||
public const string mono_net_io_renegotiate = "mono_net_io_renegotiate";
|
||||
|
||||
public const string net_ssl_io_already_shutdown = "Write operations are not allowed after the channel was shutdown.";
|
||||
|
||||
public const string net_log_set_socketoption_reuseport_default_on = "net_log_set_socketoption_reuseport_default_on";
|
||||
public const string net_log_set_socketoption_reuseport_not_supported = "net_log_set_socketoption_reuseport_not_supported";
|
||||
public const string net_log_set_socketoption_reuseport = "net_log_set_socketoption_reuseport";
|
||||
|
||||
public const string net_ssl_app_protocols_invalid = "The application protocol list is invalid.";
|
||||
public const string net_ssl_app_protocol_invalid = "The application protocol value is invalid.";
|
||||
public const string net_conflicting_options = "The '{0}' option was already set in the SslStream constructor.";
|
||||
}
|
@@ -46,7 +46,7 @@ using System.Globalization;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Diagnostics.Private;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace System
|
||||
{
|
||||
@@ -59,6 +59,8 @@ namespace System
|
||||
|
||||
public static readonly String Empty;
|
||||
|
||||
public int Length => _stringLength;
|
||||
|
||||
internal unsafe int IndexOfUnchecked (string value, int startIndex, int count)
|
||||
{
|
||||
int valueLen = value.Length;
|
||||
|
@@ -1,12 +1,10 @@
|
||||
//
|
||||
// System.Reflection.PortableExecutableKinds flag
|
||||
// Debug.cs: Private corlib debug implememtation.
|
||||
//
|
||||
// Authors:
|
||||
// Sebastien Pouliot <sebastien@ximian.com>
|
||||
// Marek Safar <marek.safar@gmail.com>
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
// Copyright (C) 2012 Xamarin Inc (http://www.xamarin.com)
|
||||
// Copyright (C) 2018 Microsoft Corporation
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
@@ -15,10 +13,10 @@
|
||||
// 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
|
||||
@@ -28,20 +26,42 @@
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
namespace System.Diagnostics
|
||||
{
|
||||
//
|
||||
// The type is renamed to DebugInternal in the post processing to avoid conficts in IVT assemblies. The proper
|
||||
// solution is to have support for IVT for members
|
||||
//
|
||||
static class Debug
|
||||
{
|
||||
[ConditionalAttribute ("DEBUG")]
|
||||
public static void Assert (bool condition)
|
||||
{
|
||||
}
|
||||
|
||||
namespace System.Reflection {
|
||||
[ConditionalAttribute ("DEBUG")]
|
||||
public static void Assert (bool condition, string message)
|
||||
{
|
||||
}
|
||||
|
||||
[ComVisible (true)]
|
||||
[Flags]
|
||||
[Serializable]
|
||||
public enum PortableExecutableKinds {
|
||||
NotAPortableExecutableImage = 0,
|
||||
ILOnly = 1,
|
||||
Required32Bit = 2,
|
||||
PE32Plus = 4,
|
||||
Unmanaged32Bit = 8,
|
||||
Preferred32Bit = 16
|
||||
[ConditionalAttribute ("DEBUG")]
|
||||
public static void Assert (bool condition, string message, string detailMessage)
|
||||
{
|
||||
}
|
||||
|
||||
[ConditionalAttribute ("DEBUG")]
|
||||
public static void Assert (bool condition, string message, string detailMessageFormat, params object[] args)
|
||||
{
|
||||
}
|
||||
|
||||
[ConditionalAttribute ("DEBUG")]
|
||||
public static void Fail (string message)
|
||||
{
|
||||
}
|
||||
|
||||
[ConditionalAttribute ("DEBUG")]
|
||||
public static void Fail (string message, string detailMessage)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -140,10 +140,9 @@ namespace System.IO {
|
||||
}
|
||||
}
|
||||
|
||||
[MonoTODO("It always returns true")]
|
||||
public bool IsReady {
|
||||
get {
|
||||
return true;
|
||||
return Directory.Exists (Name);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -1,66 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
//
|
||||
// System.IO.FileAttributes.cs
|
||||
//
|
||||
// Copyright (C) 2001 Moonlight Enterprises, All Rights Reserved
|
||||
//
|
||||
// Author: Jim Richardson, develop@wtfo-guru.com
|
||||
// Created: Monday, August 13, 2001
|
||||
//
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
|
||||
//
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
[Flags]
|
||||
[Serializable]
|
||||
[ComVisible (true)]
|
||||
public enum FileAttributes
|
||||
{
|
||||
Archive = 0x00020,
|
||||
Compressed = 0x00800,
|
||||
Device = 0x00040, // Reserved for future use (NOT the w32 value).
|
||||
Directory = 0x00010,
|
||||
Encrypted = 0x04000, // NOT the w32 value
|
||||
Hidden = 0x00002,
|
||||
Normal = 0x00080,
|
||||
NotContentIndexed = 0x02000,
|
||||
Offline = 0x01000,
|
||||
ReadOnly = 0x00001,
|
||||
ReparsePoint = 0x00400,
|
||||
SparseFile = 0x00200,
|
||||
System = 0x00004,
|
||||
Temporary = 0x00100,
|
||||
IntegrityStream = 0x8000,
|
||||
NoScrubData = 0x20000,
|
||||
//
|
||||
// This flag is used internall by Mono to make it Executable
|
||||
//
|
||||
// Executable = 0x80000000
|
||||
}
|
||||
|
||||
}
|
@@ -64,6 +64,18 @@ namespace System.Reflection {
|
||||
this.lazyData.data_length = data_length;
|
||||
}
|
||||
|
||||
internal CustomAttributeData (ConstructorInfo ctorInfo)
|
||||
: this (ctorInfo, Array.Empty<CustomAttributeTypedArgument> (), Array.Empty<CustomAttributeNamedArgument> ())
|
||||
{
|
||||
}
|
||||
|
||||
internal CustomAttributeData (ConstructorInfo ctorInfo, IList<CustomAttributeTypedArgument> ctorArgs, IList<CustomAttributeNamedArgument> namedArgs)
|
||||
{
|
||||
this.ctorInfo = ctorInfo;
|
||||
this.ctorArgs = ctorArgs;
|
||||
this.namedArgs = namedArgs;
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
static extern void ResolveArgumentsInternal (ConstructorInfo ctor, Assembly assembly, IntPtr data, uint data_length, out object[] ctorArgs, out object[] namedArgs);
|
||||
|
||||
|
@@ -1,63 +0,0 @@
|
||||
//
|
||||
// System.Reflection.CustomAttributeFormatException.cs
|
||||
//
|
||||
// Author: Duncan Mak (duncan@ximian.com)
|
||||
//
|
||||
// (C) 2001 Ximian, Inc. http://www.ximian.com
|
||||
//
|
||||
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.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.
|
||||
//
|
||||
|
||||
using System.Globalization;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Reflection
|
||||
{
|
||||
[ComVisible (true)]
|
||||
[Serializable]
|
||||
public class CustomAttributeFormatException : FormatException
|
||||
{
|
||||
// Constructors
|
||||
public CustomAttributeFormatException ()
|
||||
: base (Locale.GetText ("The Binary format of the custom attribute is invalid."))
|
||||
{
|
||||
}
|
||||
public CustomAttributeFormatException (string message)
|
||||
: base (message)
|
||||
{
|
||||
}
|
||||
|
||||
public CustomAttributeFormatException (string message, Exception inner)
|
||||
: base (message, inner)
|
||||
{
|
||||
}
|
||||
|
||||
protected CustomAttributeFormatException (SerializationInfo info,
|
||||
StreamingContext context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -27,6 +27,7 @@
|
||||
// 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.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
@@ -222,6 +223,46 @@ namespace System.Reflection {
|
||||
return attrs;
|
||||
}
|
||||
|
||||
internal CustomAttributeData[] GetPseudoCustomAttributesData ()
|
||||
{
|
||||
int count = 0;
|
||||
|
||||
if (IsNotSerialized)
|
||||
count++;
|
||||
|
||||
if (DeclaringType.IsExplicitLayout)
|
||||
count++;
|
||||
|
||||
MarshalAsAttribute marshalAs = get_marshal_info ();
|
||||
if (marshalAs != null)
|
||||
count++;
|
||||
|
||||
if (count == 0)
|
||||
return null;
|
||||
CustomAttributeData[] attrsData = new CustomAttributeData [count];
|
||||
count = 0;
|
||||
|
||||
if (IsNotSerialized)
|
||||
attrsData [count++] = new CustomAttributeData ((typeof (NonSerializedAttribute)).GetConstructor (Type.EmptyTypes));
|
||||
if (DeclaringType.IsExplicitLayout) {
|
||||
var ctorArgs = new CustomAttributeTypedArgument[] { new CustomAttributeTypedArgument (typeof (int), GetFieldOffset ()) };
|
||||
attrsData [count++] = new CustomAttributeData (
|
||||
(typeof (FieldOffsetAttribute)).GetConstructor (new[] { typeof (int) }),
|
||||
ctorArgs,
|
||||
EmptyArray<CustomAttributeNamedArgument>.Value);
|
||||
}
|
||||
|
||||
if (marshalAs != null) {
|
||||
var ctorArgs = new CustomAttributeTypedArgument[] { new CustomAttributeTypedArgument (typeof (UnmanagedType), marshalAs.Value) };
|
||||
attrsData [count++] = new CustomAttributeData (
|
||||
(typeof (MarshalAsAttribute)).GetConstructor (new[] { typeof (UnmanagedType) }),
|
||||
ctorArgs,
|
||||
EmptyArray<CustomAttributeNamedArgument>.Value);//FIXME Get named params
|
||||
}
|
||||
|
||||
return attrsData;
|
||||
}
|
||||
|
||||
[MethodImplAttribute (MethodImplOptions.InternalCall)]
|
||||
extern Type[] GetTypeModifiers (bool optional);
|
||||
|
||||
|
@@ -1,43 +0,0 @@
|
||||
//
|
||||
// System.Reflection.ImageFileMachine enumeration
|
||||
//
|
||||
// Authors:
|
||||
// Sebastien Pouliot <sebastien@ximian.com>
|
||||
// Marek Safar <marek.safar@gmail.com>
|
||||
//
|
||||
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
|
||||
// Copyright (C) 2012 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.
|
||||
//
|
||||
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.Reflection {
|
||||
|
||||
[ComVisible (true)]
|
||||
[Serializable]
|
||||
public enum ImageFileMachine {
|
||||
I386 = 332,
|
||||
IA64 = 512,
|
||||
AMD64 = 34404,
|
||||
ARM = 452,
|
||||
}
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user