Bump corefx (#5167)
[mono.git] / mcs / class / System.Drawing / System.Drawing.Text / PrivateFontCollection.cs
index fa1e842784caea771c18a507c3831a745b2feeb9..bc8daea7471fb9c8ced842f511fe2cee706d5699 100644 (file)
 //
 
 using System.IO;
-using System.Security.Permissions;
 using System.Runtime.InteropServices;
 
 namespace System.Drawing.Text {
 
-#if !NET_2_0
-       [ComVisible(false)]
-#endif
        public sealed class PrivateFontCollection : FontCollection {
 
                // constructors
 
                public PrivateFontCollection ()
                {
-                       Status status = GDIPlus.GdipNewPrivateFontCollection (out nativeFontCollection);
+                       Status status = GDIPlus.GdipNewPrivateFontCollection (out _nativeFontCollection);
                        GDIPlus.CheckStatus (status);
                }
                
@@ -57,32 +53,31 @@ namespace System.Drawing.Text {
                        // this ensure the filename is valid (or throw the correct exception)
                        string fname = Path.GetFullPath (filename);
 
-                       if (!File.Exists(filename))
+                       if (!File.Exists (fname))
                                throw new FileNotFoundException ();
 
                        // note: MS throw the same exception FileNotFoundException if the file exists but isn't a valid font file
-                       Status status = GDIPlus.GdipPrivateAddFontFile (nativeFontCollection, filename);
+                       Status status = GDIPlus.GdipPrivateAddFontFile (_nativeFontCollection, fname);
                        GDIPlus.CheckStatus (status);                   
                }
 
-               [SecurityPermission (SecurityAction.Demand, UnmanagedCode = true)]
                public void AddMemoryFont (IntPtr memory, int length) 
                {
                        // note: MS throw FileNotFoundException if something is bad with the data (except for a null pointer)
-                       Status status = GDIPlus.GdipPrivateAddMemoryFont (nativeFontCollection, memory, length);
+                       Status status = GDIPlus.GdipPrivateAddMemoryFont (_nativeFontCollection, memory, length);
                        GDIPlus.CheckStatus (status);                                           
                }
                
                // methods      
                protected override void Dispose (bool disposing)
                {
-                       if (nativeFontCollection!=IntPtr.Zero) {
-                               GDIPlus.GdipDeletePrivateFontCollection (ref nativeFontCollection);                                                     
+                       if (_nativeFontCollection!=IntPtr.Zero) {
+                               GDIPlus.GdipDeletePrivateFontCollection (ref _nativeFontCollection);                                                    
 
                                // This must be zeroed out, otherwise our base will also call
                                // the GDI+ delete method on unix platforms. We're keeping the
                                // base.Dispose() call in case other cleanup ever gets added there
-                               nativeFontCollection = IntPtr.Zero;
+                               _nativeFontCollection = IntPtr.Zero;
                        }
                        
                        base.Dispose (disposing);