Example #1
0
        // Convert this permissions object into an XML value.
        public override SecurityElement ToXml()
        {
            SecurityElement element;

            element = new SecurityElement("IPermission");
            element.AddAttribute
                ("class",
                SecurityElement.Escape(typeof(UIPermission).
                                       AssemblyQualifiedName));
            element.AddAttribute("version", "1");
            if (IsUnrestricted())
            {
                element.AddAttribute("Unrestricted", "true");
            }
            else
            {
                element.AddAttribute("Window", window.ToString());
                element.AddAttribute("Clipboard", clipboard.ToString());
            }
            return(element);
        }
Example #2
0
        public override SecurityElement ToXml()
        {
            SecurityElement e = Element(version);

            if (_window == UIPermissionWindow.AllWindows && _clipboard == UIPermissionClipboard.AllClipboard)
            {
                e.AddAttribute("Unrestricted", "true");
            }
            else
            {
                if (_window != UIPermissionWindow.NoWindows)
                {
                    e.AddAttribute("Window", _window.ToString());
                }

                if (_clipboard != UIPermissionClipboard.NoClipboard)
                {
                    e.AddAttribute("Clipboard", _clipboard.ToString());
                }
            }
            return(e);
        }