Imported Upstream version 5.4.0.167

Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-08-21 15:34:15 +00:00
parent e49d6f06c0
commit 536cd135cc
12856 changed files with 563812 additions and 223249 deletions

View File

@ -205,13 +205,13 @@ namespace System.Drawing
return sb.ToString ();
} else if (destinationType == typeof (InstanceDescriptor)) {
if (color.IsEmpty) {
return new InstanceDescriptor (typeof (Color).GetField ("Empty"), null);
return new InstanceDescriptor (typeof (Color).GetTypeInfo ().GetField ("Empty"), null);
} else if (color.IsSystemColor) {
return new InstanceDescriptor (typeof (SystemColors).GetProperty (color.Name), null);
return new InstanceDescriptor (typeof (SystemColors).GetTypeInfo ().GetProperty (color.Name), null);
} else if (color.IsKnownColor){
return new InstanceDescriptor (typeof (Color).GetProperty (color.Name), null);
return new InstanceDescriptor (typeof (Color).GetTypeInfo ().GetProperty (color.Name), null);
} else {
MethodInfo met = typeof(Color).GetMethod ("FromArgb", new Type[] { typeof(int), typeof(int), typeof(int), typeof(int) } );
MethodInfo met = typeof(Color).GetTypeInfo ().GetMethod ("FromArgb", new Type[] { typeof(int), typeof(int), typeof(int), typeof(int) } );
return new InstanceDescriptor (met, new object[] {color.A, color.R, color.G, color.B });
}
}

View File

@ -123,7 +123,7 @@ namespace System.Drawing {
case KnownColor.Window:
case KnownColor.WindowFrame:
case KnownColor.WindowText:
return KnownColors.GetName (kc).ToLower (CultureInfo.InvariantCulture);
return KnownColors.GetName (kc).ToLowerInvariant ();
case KnownColor.ActiveCaptionText:
return "captiontext";

View File

@ -105,7 +105,7 @@ namespace System.Drawing
private static readonly Guid IID_IUnknown = new Guid("00000000-0000-0000-C000-000000000046");
private static readonly Guid IID_IStream = new Guid("0000000C-0000-0000-C000-000000000046");
private static readonly MethodInfo exceptionGetHResult = typeof(Exception).GetProperty("HResult", BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.ExactBinding, null, typeof(int), new Type[] {}, null).GetGetMethod(true);
private static readonly MethodInfo exceptionGetHResult = typeof(Exception).GetTypeInfo ().GetProperty("HResult", BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.DeclaredOnly | BindingFlags.ExactBinding, null, typeof(int), new Type[] {}, null).GetGetMethod(true);
// Keeps delegates alive while they are marshaled
private static readonly IStreamVtbl managedVtable;
private static IntPtr comVtable;

View File

@ -114,7 +114,7 @@ namespace System.Drawing
if ((destinationType == typeof (InstanceDescriptor)) && (value is Font)) {
Font font = (Font) value;
ConstructorInfo met = typeof(Font).GetConstructor (new Type[] {typeof(string), typeof(float), typeof(FontStyle), typeof(GraphicsUnit)});
ConstructorInfo met = typeof(Font).GetTypeInfo ().GetConstructor (new Type[] {typeof(string), typeof(float), typeof(FontStyle), typeof(GraphicsUnit)});
object[] args = new object[4];
args [0] = font.Name;
args [1] = font.Size;

View File

@ -82,9 +82,10 @@ namespace System.Drawing {
return "(none)";
else if (CanConvertTo (null, destinationType)) {
//came here means destType is byte array ;
MemoryStream ms = new MemoryStream ();
((Icon) value).Save (ms);
return ms.GetBuffer ();
using (MemoryStream ms = new MemoryStream ()) {
((Icon) value).Save (ms);
return ms.ToArray ();
}
}else
return new NotSupportedException ("IconConverter can not convert from " + value.GetType ());
}

View File

@ -85,9 +85,10 @@ namespace System.Drawing
return value.ToString ();
} else if (CanConvertTo (null, destinationType)) {
//came here means destinationType is byte array ;
MemoryStream ms = new MemoryStream ();
((Image)value).Save (ms, ((Image)value).RawFormat);
return ms.GetBuffer ();
using (MemoryStream ms = new MemoryStream ()) {
((Image)value).Save (ms, ((Image)value).RawFormat);
return ms.ToArray ();
}
}
}

View File

@ -99,25 +99,25 @@ namespace System.Drawing
return ImageFormat.Wmf;
} else {
// case #3, this is probably a short format
if (String.Compare (strFormat, "Bmp", true, CultureInfo.InvariantCulture) == 0)
if (String.Compare (strFormat, "Bmp", StringComparison.OrdinalIgnoreCase) == 0)
return ImageFormat.Bmp;
else if (String.Compare (strFormat, "Emf", true, CultureInfo.InvariantCulture) == 0)
else if (String.Compare (strFormat, "Emf", StringComparison.OrdinalIgnoreCase) == 0)
return ImageFormat.Emf;
else if (String.Compare (strFormat, "Exif", true, CultureInfo.InvariantCulture) == 0)
else if (String.Compare (strFormat, "Exif", StringComparison.OrdinalIgnoreCase) == 0)
return ImageFormat.Exif;
else if (String.Compare (strFormat, "Gif", true, CultureInfo.InvariantCulture) == 0)
else if (String.Compare (strFormat, "Gif", StringComparison.OrdinalIgnoreCase) == 0)
return ImageFormat.Gif;
else if (String.Compare (strFormat, "Icon", true, CultureInfo.InvariantCulture) == 0)
else if (String.Compare (strFormat, "Icon", StringComparison.OrdinalIgnoreCase) == 0)
return ImageFormat.Icon;
else if (String.Compare (strFormat, "Jpeg", true, CultureInfo.InvariantCulture) == 0)
else if (String.Compare (strFormat, "Jpeg", StringComparison.OrdinalIgnoreCase) == 0)
return ImageFormat.Jpeg;
else if (String.Compare (strFormat, "MemoryBmp", true, CultureInfo.InvariantCulture) == 0)
else if (String.Compare (strFormat, "MemoryBmp", StringComparison.OrdinalIgnoreCase) == 0)
return ImageFormat.MemoryBmp;
else if (String.Compare (strFormat, "Png", true, CultureInfo.InvariantCulture) == 0)
else if (String.Compare (strFormat, "Png", StringComparison.OrdinalIgnoreCase) == 0)
return ImageFormat.Png;
else if (String.Compare (strFormat, "Tiff", true, CultureInfo.InvariantCulture) == 0)
else if (String.Compare (strFormat, "Tiff", StringComparison.OrdinalIgnoreCase) == 0)
return ImageFormat.Tiff;
else if (String.Compare (strFormat, "Wmf", true, CultureInfo.InvariantCulture) == 0)
else if (String.Compare (strFormat, "Wmf", StringComparison.OrdinalIgnoreCase) == 0)
return ImageFormat.Wmf;
}
// last case, this is an unknown string
@ -154,9 +154,9 @@ namespace System.Drawing
return prop != null ? prop : c.ToString ();
} else if (destinationType == typeof (InstanceDescriptor)) {
if (prop != null){
return new InstanceDescriptor (typeof (ImageFormat).GetProperty (prop), null);
return new InstanceDescriptor (typeof (ImageFormat).GetTypeInfo ().GetProperty (prop), null);
} else {
ConstructorInfo ctor = typeof(ImageFormat).GetConstructor (new Type[] {typeof(Guid)} );
ConstructorInfo ctor = typeof(ImageFormat).GetTypeInfo ().GetConstructor (new Type[] {typeof(Guid)} );
return new InstanceDescriptor (ctor, new object[] {c.Guid});
}
}

View File

@ -33,6 +33,7 @@
//
using System;
using System.Reflection;
namespace System.Drawing
{
@ -116,7 +117,7 @@ namespace System.Drawing
imageName = t.Name + ".bmp";
try {
using (System.IO.Stream s = t.Assembly.GetManifestResourceStream (t.Namespace + "." + imageName)){
using (System.IO.Stream s = t.GetTypeInfo ().Assembly.GetManifestResourceStream (t.Namespace + "." + imageName)){
if (s == null) {
return null;
} else {

View File

@ -92,8 +92,14 @@ namespace System.Drawing
static GDIPlus ()
{
#if NETSTANDARD1_6
bool isUnix = !RuntimeInformation.IsOSPlatform (OSPlatform.Windows);
#else
int platform = (int) Environment.OSVersion.Platform;
if ((platform == 4) || (platform == 6) || (platform == 128)) {
bool isUnix = (platform == 4) || (platform == 6) || (platform == 128);
#endif
if (isUnix) {
if (Environment.GetEnvironmentVariable ("not_supported_MONO_MWF_USE_NEW_X11_BACKEND") != null || Environment.GetEnvironmentVariable ("MONO_MWF_MAC_FORCE_X11") != null) {
UseX11Drawable = true;
} else {
@ -127,7 +133,9 @@ namespace System.Drawing
}
// under MS 1.x this event is raised only for the default application domain
#if !NETSTANDARD1_6
AppDomain.CurrentDomain.ProcessExit += new EventHandler (ProcessExit);
#endif
}
static public bool RunningOnWindows ()
@ -1891,7 +1899,7 @@ namespace System.Drawing
public void StreamCloseImpl ()
{
stream.Close ();
stream.Dispose ();
}
public StreamCloseDelegate CloseDelegate {

View File

@ -48,14 +48,16 @@ namespace System.Drawing {
#endif
static MacSupport () {
#if !NETSTANDARD1_6
foreach (Assembly asm in AppDomain.CurrentDomain.GetAssemblies ()) {
if (String.Equals (asm.GetName ().Name, "System.Windows.Forms")) {
Type driver_type = asm.GetType ("System.Windows.Forms.XplatUICarbon");
if (driver_type != null) {
hwnd_delegate = (Delegate) driver_type.GetField ("HwndDelegate", BindingFlags.NonPublic | BindingFlags.Static).GetValue (null);
hwnd_delegate = (Delegate) driver_type.GetTypeInfo() .GetField ("HwndDelegate", BindingFlags.NonPublic | BindingFlags.Static).GetValue (null);
}
}
}
#endif
}
internal static CocoaContext GetCGContextForNSView (IntPtr handle) {