Merge pull request #733 from amoiseev-softheme/bugfix/monofix
[mono.git] / mcs / class / corlib / System.Security.Permissions / PermissionSetAttribute.cs
index 9022f9e4ce41765f6b47656301be00f2025368f5..3e8381721bbd402d34e6a8be541733dbaa13473b 100644 (file)
@@ -38,9 +38,7 @@ using Mono.Xml;
 
 namespace System.Security.Permissions {
 
-#if NET_2_0
        [ComVisible (true)]
-#endif
        [AttributeUsage (AttributeTargets.Assembly | AttributeTargets.Class |
                         AttributeTargets.Struct | AttributeTargets.Constructor |
                         AttributeTargets.Method, AllowMultiple=true, Inherited=false)]
@@ -52,9 +50,7 @@ namespace System.Security.Permissions {
                private string name;
                private bool isUnicodeEncoded;
                private string xml;
-#if NET_2_0
                private string hex;
-#endif
                
                // Constructor
                public PermissionSetAttribute (SecurityAction action)
@@ -67,12 +63,10 @@ namespace System.Security.Permissions {
                        get { return file; }
                        set { file = value; }
                }
-#if NET_2_0
                public string Hex {
                        get { return hex; }
                        set { hex = value; }
                }
-#endif
                public string Name {
                        get { return name; }
                        set { name = value; }
@@ -96,6 +90,7 @@ namespace System.Security.Permissions {
 
                private PermissionSet CreateFromXml (string xml) 
                {
+#if !NET_2_1
                        SecurityParser sp = new SecurityParser ();
                        try {
                                sp.LoadXml (xml);
@@ -123,12 +118,14 @@ namespace System.Security.Permissions {
                                ps.FromXml (se);
                                return ps;
                        }
+#endif
                        return null;
                }
 
                public PermissionSet CreatePermissionSet ()
                {
                        PermissionSet pset = null;
+#if !NET_2_1
                        if (this.Unrestricted)
                                pset = new PermissionSet (PermissionState.Unrestricted);
                        else {
@@ -145,7 +142,6 @@ namespace System.Security.Permissions {
                                else if (xml != null) {
                                        pset = CreateFromXml (xml);
                                }
-#if NET_2_0
                                else if (hex != null) {
                                        // Unicode isn't supported
                                        //Encoding e = ((isUnicodeEncoded) ? System.Text.Encoding.Unicode : System.Text.Encoding.ASCII);
@@ -153,8 +149,8 @@ namespace System.Security.Permissions {
                                        byte[] bin = CryptoConvert.FromHex (hex);
                                        pset = CreateFromXml (e.GetString (bin, 0, bin.Length));
                                }
-#endif
                        }
+#endif
                        return pset;
                }
        }