Merge pull request #4618 from BrzVlad/feature-par-nrs
[mono.git] / mcs / class / System / System.Net / DnsPermission.cs
index 6fae96b801a9aaef33cac30f11c6858a806b7815..0f36111187a946bc91484106816dac1211be73d5 100644 (file)
@@ -3,46 +3,46 @@
 //\r
 // Authors:\r
 //     Lawrence Pit (loz@cable.a2000.nl)\r
-//     Sebastien Pouliot  <sebastien@ximian.com>
+//     Sebastien Pouliot  <sebastien@ximian.com>\r
+//\r
+// Copyright (C) 2004 Novell, Inc (http://www.novell.com)\r
+//\r
+// Permission is hereby granted, free of charge, to any person obtaining\r
+// a copy of this software and associated documentation files (the\r
+// "Software"), to deal in the Software without restriction, including\r
+// without limitation the rights to use, copy, modify, merge, publish,\r
+// distribute, sublicense, and/or sell copies of the Software, and to\r
+// permit persons to whom the Software is furnished to do so, subject to\r
+// the following conditions:\r
+// \r
+// The above copyright notice and this permission notice shall be\r
+// included in all copies or substantial portions of the Software.\r
+// \r
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,\r
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\r
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\r
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\r
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\r
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\r
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\r
 //\r
-// 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.
-//
 \r
 using System.Collections;\r
 using System.Security;\r
 using System.Security.Permissions;\r
 \r
-namespace System.Net {
+namespace System.Net {\r
 \r
        [Serializable]\r
-       public sealed class DnsPermission : CodeAccessPermission, IUnrestrictedPermission {
-
-               private const int version = 1;
+       public sealed class DnsPermission : CodeAccessPermission, IUnrestrictedPermission {\r
+\r
+               private const int version = 1;\r
 \r
                // Fields\r
                bool m_noRestriction;\r
                \r
                // Constructors\r
-               public DnsPermission (PermissionState state)
+               public DnsPermission (PermissionState state)\r
                        : base () \r
                {                                               \r
                        m_noRestriction = (state == PermissionState.Unrestricted);\r
@@ -57,21 +57,21 @@ namespace System.Net {
                \r
                public override IPermission Intersect (IPermission target)\r
                {\r
-                       DnsPermission dp = Cast (target);
-                       if (dp == null)
-                               return null;
-                       if (IsUnrestricted () && dp.IsUnrestricted ())
-                               return new DnsPermission (PermissionState.Unrestricted);
+                       DnsPermission dp = Cast (target);\r
+                       if (dp == null)\r
+                               return null;\r
+                       if (IsUnrestricted () && dp.IsUnrestricted ())\r
+                               return new DnsPermission (PermissionState.Unrestricted);\r
                        return null;\r
                }\r
                \r
                public override bool IsSubsetOf (IPermission target) \r
                {\r
-                       DnsPermission dp = Cast (target);
-                       if (dp == null)
-                               return IsEmpty ();
-
-                       return (dp.IsUnrestricted () || (m_noRestriction == dp.m_noRestriction));
+                       DnsPermission dp = Cast (target);\r
+                       if (dp == null)\r
+                               return IsEmpty ();\r
+\r
+                       return (dp.IsUnrestricted () || (m_noRestriction == dp.m_noRestriction));\r
                }\r
 \r
                public bool IsUnrestricted () \r
@@ -81,15 +81,15 @@ namespace System.Net {
 \r
                public override SecurityElement ToXml ()\r
                {\r
-                       SecurityElement se = PermissionHelper.Element (typeof (DnsPermission), version);
+                       SecurityElement se = PermissionHelper.Element (typeof (DnsPermission), version);\r
                        if (m_noRestriction)\r
                                se.AddAttribute ("Unrestricted", "true");                               \r
                        return se;\r
                }\r
                \r
                public override void FromXml (SecurityElement securityElement)\r
-               {
-                       PermissionHelper.CheckSecurityElement (securityElement, "securityElement", version, version);
+               {\r
+                       PermissionHelper.CheckSecurityElement (securityElement, "securityElement", version, version);\r
                \r
                        // LAMESPEC: it says to throw an ArgumentNullException in this case                             \r
                        if (securityElement.Tag != "IPermission")\r
@@ -99,34 +99,34 @@ namespace System.Net {
                }               \r
                \r
                public override IPermission Union (IPermission target) \r
-               {
-                       DnsPermission dp = Cast (target);
-                       if (dp == null)
-                               return Copy ();
-                       if (IsUnrestricted () || dp.IsUnrestricted ())
-                               return new DnsPermission (PermissionState.Unrestricted);
-                       else
-                               return new DnsPermission (PermissionState.None);
+               {\r
+                       DnsPermission dp = Cast (target);\r
+                       if (dp == null)\r
+                               return Copy ();\r
+                       if (IsUnrestricted () || dp.IsUnrestricted ())\r
+                               return new DnsPermission (PermissionState.Unrestricted);\r
+                       else\r
+                               return new DnsPermission (PermissionState.None);\r
+               }\r
+\r
+               // Internal helpers methods\r
+\r
+               private bool IsEmpty ()\r
+               {\r
+                       return !m_noRestriction;\r
+               }\r
+\r
+               private DnsPermission Cast (IPermission target)\r
+               {\r
+                       if (target == null)\r
+                               return null;\r
+\r
+                       DnsPermission dp = (target as DnsPermission);\r
+                       if (dp == null) {\r
+                               PermissionHelper.ThrowInvalidPermission (target, typeof (DnsPermission));\r
+                       }\r
+\r
+                       return dp;\r
                }\r
-
-               // Internal helpers methods
-
-               private bool IsEmpty ()
-               {
-                       return !m_noRestriction;
-               }
-
-               private DnsPermission Cast (IPermission target)
-               {
-                       if (target == null)
-                               return null;
-
-                       DnsPermission dp = (target as DnsPermission);
-                       if (dp == null) {
-                               PermissionHelper.ThrowInvalidPermission (target, typeof (DnsPermission));
-                       }
-
-                       return dp;
-               }
        }\r
 }\r