Exemplo n.º 1
0
        public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
        {
            SecurityElement newel = new SecurityElement(name);

            if (root == null)
            {
                root    = newel;
                current = newel;
            }
            else
            {
                SecurityElement parent = (SecurityElement)stack.Peek();
                parent.AddChild(newel);
            }
            stack.Push(newel);
            current = newel;
            // attributes
            int n = attrs.Length;

            for (int i = 0; i < n; i++)
            {
                string attrName  = SecurityElement.Escape(attrs.GetName(i));
                string attrValue = SecurityElement.Escape(attrs.GetValue(i));
                current.AddAttribute(attrName, attrValue);
            }
        }
Exemplo n.º 2
0
        private void ReadServiceActivated(SmallXmlParser.IAttrList attrs)
        {
            string notNull      = this.GetNotNull(attrs, "type");
            string assemblyName = this.ExtractAssembly(ref notNull);

            this.typeEntries.Add(new ActivatedServiceTypeEntry(notNull, assemblyName));
        }
Exemplo n.º 3
0
        void ReadLifetine(SmallXmlParser.IAttrList attrs)
        {
            for (int i = 0; i < attrs.Names.Length; ++i)
            {
                switch (attrs.Names[i])
                {
                case "leaseTime":
                    LifetimeServices.LeaseTime = ParseTime(attrs.GetValue(i));
                    break;

                case "sponsorshipTimeout":
                    LifetimeServices.SponsorshipTimeout = ParseTime(attrs.GetValue(i));
                    break;

                case "renewOnCallTime":
                    LifetimeServices.RenewOnCallTime = ParseTime(attrs.GetValue(i));
                    break;

                case "leaseManagerPollTime":
                    LifetimeServices.LeaseManagerPollTime = ParseTime(attrs.GetValue(i));
                    break;

                default:
                    throw new RemotingException("Invalid attribute: " + attrs.Names[i]);
                }
            }
        }
Exemplo n.º 4
0
        public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
        {
            SecurityElement securityElement = new SecurityElement(name);

            if (this.root == null)
            {
                this.root    = securityElement;
                this.current = securityElement;
            }
            else
            {
                SecurityElement securityElement2 = (SecurityElement)this.stack.Peek();
                securityElement2.AddChild(securityElement);
            }
            this.stack.Push(securityElement);
            this.current = securityElement;
            int length = attrs.Length;

            for (int i = 0; i < length; i++)
            {
                string text  = SecurityElement.Escape(attrs.GetName(i));
                string text2 = SecurityElement.Escape(attrs.GetValue(i));
                this.current.AddAttribute(text, text2);
            }
        }
Exemplo n.º 5
0
        void ReadServiceActivated(SmallXmlParser.IAttrList attrs)
        {
            string type = GetNotNull(attrs, "type");
            string assm = ExtractAssembly(ref type);

            typeEntries.Add(new ActivatedServiceTypeEntry(type, assm));
        }
Exemplo n.º 6
0
 public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
 {
     if (_beginInvoke)
     {
         if (_beginArguments)
         {
             _arg = new Arg(name);
             //TODO: Check argument type
         }
         else
         {
             if (name != tagArguments)
             {
                 _hasErrors = true;
                 Error      = "No arguments";
                 return;
             }
             _beginArguments = true;
         }
     }
     else
     {
         if (name != tagInvoke)
         {
             _hasErrors = true;
             Error      = "Invalid request";
             return;
         }
         _beginInvoke = true;
         MethodName   = attrs.GetValue("name");
         ReturnType   = attrs.GetValue("returntype");
     }
 }
Exemplo n.º 7
0
        private ProviderData ReadProvider(string name, SmallXmlParser.IAttrList attrs, bool isTemplate)
        {
            ProviderData     providerData     = (!(name == "provider")) ? new FormatterData() : new ProviderData();
            SinkProviderData sinkProviderData = new SinkProviderData("root");

            providerData.CustomData  = sinkProviderData.Children;
            this.currentProviderData = new Stack();
            this.currentProviderData.Push(sinkProviderData);
            for (int i = 0; i < attrs.Names.Length; i++)
            {
                string text  = attrs.Names[i];
                string text2 = attrs.Values[i];
                if (text == "id" && isTemplate)
                {
                    providerData.Id = text2;
                }
                else if (text == "type")
                {
                    providerData.Type = text2;
                }
                else if (text == "ref" && !isTemplate)
                {
                    providerData.Ref = text2;
                }
                else
                {
                    providerData.CustomProperties.Add(text, text2);
                }
            }
            if (providerData.Id == null && isTemplate)
            {
                throw new RemotingException("id attribute is required");
            }
            return(providerData);
        }
Exemplo n.º 8
0
        public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
        {
            SecurityElement newel = new SecurityElement(name);

            if (root == null)
            {
                root    = newel;
                current = newel;
            }
            else
            {
                SecurityElement parent = (SecurityElement)stack.Peek();
                parent.AddChild(newel);
            }
            stack.Push(newel);
            current = newel;
            // attributes
            int n = attrs.Length;

            for (int i = 0; i < n; i++)
            {
                string tmpStr = attrs.GetValue(i);
                if (attrs.GetName(i) == "Consume_Info")
                {
                    tmpStr = tmpStr.Replace('"', '\'');
                }
                current.AddAttribute(attrs.GetName(i), tmpStr);
            }
        }
Exemplo n.º 9
0
            public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
            {
                switch (this.level)
                {
                case 0:
                    if (name == "configuration")
                    {
                        this.level++;
                    }
                    break;

                case 1:
                    if (name == "mscorlib")
                    {
                        this.level++;
                    }
                    break;

                case 2:
                    if (name == "cryptographySettings")
                    {
                        this.level++;
                    }
                    break;

                case 3:
                    if (name == "oidMap")
                    {
                        this.level++;
                    }
                    else if (name == "cryptoNameMapping")
                    {
                        this.level++;
                    }
                    break;

                case 4:
                    if (name == "oidEntry")
                    {
                        this.oid.Add(this.Get(attrs, "name"), this.Get(attrs, "OID"));
                    }
                    else if (name == "nameEntry")
                    {
                        this.names.Add(this.Get(attrs, "name"), this.Get(attrs, "class"));
                    }
                    else if (name == "cryptoClasses")
                    {
                        this.level++;
                    }
                    break;

                case 5:
                    if (name == "cryptoClass")
                    {
                        this.classnames.Add(attrs.Names[0], attrs.Values[0]);
                    }
                    break;
                }
            }
Exemplo n.º 10
0
            public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
            {
                switch (level)
                {
                case 0:
                    if (name == "configuration")
                    {
                        level++;
                    }
                    break;

                case 1:
                    if (name == "mscorlib")
                    {
                        level++;
                    }
                    break;

                case 2:
                    if (name == "cryptographySettings")
                    {
                        level++;
                    }
                    break;

                case 3:
                    if (name == "oidMap")
                    {
                        level++;
                    }
                    else if (name == "cryptoNameMapping")
                    {
                        level++;
                    }
                    break;

                case 4:
                    if (name == "oidEntry")
                    {
                        oid [Get(attrs, "name")] = Get(attrs, "OID");
                    }
                    else if (name == "nameEntry")
                    {
                        names [Get(attrs, "name")] = Get(attrs, "class");
                    }
                    else if (name == "cryptoClasses")
                    {
                        level++;
                    }
                    break;

                case 5:
                    if (name == "cryptoClass")
                    {
                        classnames [attrs.Names[0]] = attrs.Values[0];
                    }
                    break;
                }
            }
Exemplo n.º 11
0
        private void ReadClientWellKnown(SmallXmlParser.IAttrList attrs)
        {
            string notNull      = this.GetNotNull(attrs, "url");
            string notNull2     = this.GetNotNull(attrs, "type");
            string assemblyName = this.ExtractAssembly(ref notNull2);

            this.typeEntries.Add(new WellKnownClientTypeEntry(notNull2, assemblyName, notNull));
        }
Exemplo n.º 12
0
 public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
 {
     this._counted += name.Length;
     for (int i = 0; i < attrs.Length; i++)
     {
         this._counted += attrs.GetValue(i).Length;
     }
 }
Exemplo n.º 13
0
        void ReadClientWellKnown(SmallXmlParser.IAttrList attrs)
        {
            string url  = GetNotNull(attrs, "url");
            string type = GetNotNull(attrs, "type");
            string assm = ExtractAssembly(ref type);

            typeEntries.Add(new WellKnownClientTypeEntry(type, assm, url));
        }
Exemplo n.º 14
0
        string GetNotNull(SmallXmlParser.IAttrList attrs, string name)
        {
            string value = attrs.GetValue(name);

            if (value == null || value == "")
            {
                throw new RemotingException(name + " attribute is required");
            }
            return(value);
        }
Exemplo n.º 15
0
        private void ReadClientActivated(SmallXmlParser.IAttrList attrs)
        {
            string notNull      = this.GetNotNull(attrs, "type");
            string assemblyName = this.ExtractAssembly(ref notNull);

            if (this.currentClientUrl == null || this.currentClientUrl == string.Empty)
            {
                throw new RemotingException("url attribute is required in client element when it contains activated entries");
            }
            this.typeEntries.Add(new ActivatedClientTypeEntry(notNull, assemblyName, this.currentClientUrl));
        }
Exemplo n.º 16
0
 private string Get(SmallXmlParser.IAttrList attrs, string name)
 {
     for (int i = 0; i < attrs.Names.Length; i++)
     {
         if (attrs.Names[i] == name)
         {
             return(attrs.Values[i]);
         }
     }
     return(String.Empty);
 }
Exemplo n.º 17
0
        void ReadClientActivated(SmallXmlParser.IAttrList attrs)
        {
            string type = GetNotNull(attrs, "type");
            string assm = ExtractAssembly(ref type);

            if (currentClientUrl == null || currentClientUrl == "")
            {
                throw new RemotingException("url attribute is required in client element when it contains activated entries");
            }

            typeEntries.Add(new ActivatedClientTypeEntry(type, assm, currentClientUrl));
        }
Exemplo n.º 18
0
        private void ReadCustomProviderData(string name, SmallXmlParser.IAttrList attrs)
        {
            SinkProviderData sinkProviderData  = (SinkProviderData)this.currentProviderData.Peek();
            SinkProviderData sinkProviderData2 = new SinkProviderData(name);

            for (int i = 0; i < attrs.Names.Length; i++)
            {
                sinkProviderData2.Properties[attrs.Names[i]] = attrs.GetValue(i);
            }
            sinkProviderData.Children.Add(sinkProviderData2);
            this.currentProviderData.Push(sinkProviderData2);
        }
Exemplo n.º 19
0
        void ReadChannel(SmallXmlParser.IAttrList attrs, bool isTemplate)
        {
            ChannelData channel = new ChannelData();

            for (int i = 0; i < attrs.Names.Length; ++i)
            {
                string at  = attrs.Names[i];
                string val = attrs.Values[i];

                if (at == "ref" && !isTemplate)
                {
                    channel.Ref = val;
                }
                else if (at == "delayLoadAsClientChannel")
                {
                    channel.DelayLoadAsClientChannel = val;
                }
                else if (at == "id" && isTemplate)
                {
                    channel.Id = val;
                }
                else if (at == "type")
                {
                    channel.Type = val;
                }
                else
                {
                    channel.CustomProperties.Add(at, val);
                }
            }

            if (isTemplate)
            {
                if (channel.Id == null)
                {
                    throw new RemotingException("id attribute is required");
                }
                if (channel.Type == null)
                {
                    throw new RemotingException("id attribute is required");
                }
                RemotingConfiguration.RegisterChannelTemplate(channel);
            }
            else
            {
                channelInstances.Add(channel);
            }

            currentChannel = channel;
        }
Exemplo n.º 20
0
        void ReadCustomProviderData(string name, SmallXmlParser.IAttrList attrs)
        {
            SinkProviderData parent = (SinkProviderData)currentProviderData.Peek();

            SinkProviderData data = new SinkProviderData(name);

            for (int i = 0; i < attrs.Names.Length; ++i)
            {
                data.Properties [attrs.Names[i]] = attrs.GetValue(i);
            }

            parent.Children.Add(data);
            currentProviderData.Push(data);
        }
Exemplo n.º 21
0
 public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
 {
     try
     {
         if (this.currentXmlPath.StartsWith("/configuration/system.runtime.remoting"))
         {
             this.ParseElement(name, attrs);
         }
         this.currentXmlPath = this.currentXmlPath + "/" + name;
     }
     catch (Exception ex)
     {
         throw new RemotingException("Error in element " + name + ": " + ex.Message, ex);
     }
 }
Exemplo n.º 22
0
        private void ReadChannel(SmallXmlParser.IAttrList attrs, bool isTemplate)
        {
            ChannelData channelData = new ChannelData();

            for (int i = 0; i < attrs.Names.Length; i++)
            {
                string text  = attrs.Names[i];
                string text2 = attrs.Values[i];
                if (text == "ref" && !isTemplate)
                {
                    channelData.Ref = text2;
                }
                else if (text == "delayLoadAsClientChannel")
                {
                    channelData.DelayLoadAsClientChannel = text2;
                }
                else if (text == "id" && isTemplate)
                {
                    channelData.Id = text2;
                }
                else if (text == "type")
                {
                    channelData.Type = text2;
                }
                else
                {
                    channelData.CustomProperties.Add(text, text2);
                }
            }
            if (isTemplate)
            {
                if (channelData.Id == null)
                {
                    throw new RemotingException("id attribute is required");
                }
                if (channelData.Type == null)
                {
                    throw new RemotingException("id attribute is required");
                }
                RemotingConfiguration.RegisterChannelTemplate(channelData);
            }
            else
            {
                this.channelInstances.Add(channelData);
            }
            this.currentChannel = channelData;
        }
Exemplo n.º 23
0
        void ReadInteropXml(SmallXmlParser.IAttrList attrs, bool isElement)
        {
            Type t = Type.GetType(GetNotNull(attrs, "clr"));

            string[] xmlName   = GetNotNull(attrs, "xml").Split(',');
            string   localName = xmlName [0].Trim();
            string   ns        = xmlName.Length > 0 ? xmlName[1].Trim() : null;

            if (isElement)
            {
                SoapServices.RegisterInteropXmlElement(localName, ns, t);
            }
            else
            {
                SoapServices.RegisterInteropXmlType(localName, ns, t);
            }
        }
Exemplo n.º 24
0
            public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
            {
                XmlElement element = new XmlElement(name);

                for (int i = 0; i < attrs.Length; i++)
                {
                    element.SetAttributeValue(attrs.Names[i], attrs.Values[i]);
                }

                if (_Stack.Count > 0)
                {
                    _Stack.Peek().AppendChild(element);
                }
                else
                {
                    _Document.AppendChild(element);
                }

                _Stack.Push(element);
            }
Exemplo n.º 25
0
        private void ReadInteropXml(SmallXmlParser.IAttrList attrs, bool isElement)
        {
            Type type = Type.GetType(this.GetNotNull(attrs, "clr"));

            string[] array = this.GetNotNull(attrs, "xml").Split(new char[]
            {
                ','
            });
            string text  = array[0].Trim();
            string text2 = (array.Length <= 0) ? null : array[1].Trim();

            if (isElement)
            {
                SoapServices.RegisterInteropXmlElement(text, text2, type);
            }
            else
            {
                SoapServices.RegisterInteropXmlType(text, text2, type);
            }
        }
Exemplo n.º 26
0
        public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
        {
            if (root == null)
            {
                root    = new XMLSection(name);
                current = root;
            }
            else
            {
                XMLSection parent = (XMLSection)stack.Peek();
                current = parent.createSection(name);
            }
            stack.Push(current);
            // attributes
            int n = attrs.Length;

            for (int i = 0; i < n; i++)
            {
                current.attrs[attrs.GetName(i)] = attrs.GetValue(i);
            }
        }
Exemplo n.º 27
0
        private void ReadServiceWellKnown(SmallXmlParser.IAttrList attrs)
        {
            string notNull      = this.GetNotNull(attrs, "objectUri");
            string notNull2     = this.GetNotNull(attrs, "mode");
            string notNull3     = this.GetNotNull(attrs, "type");
            string assemblyName = this.ExtractAssembly(ref notNull3);
            WellKnownObjectMode mode;

            if (notNull2 == "SingleCall")
            {
                mode = WellKnownObjectMode.SingleCall;
            }
            else
            {
                if (!(notNull2 == "Singleton"))
                {
                    throw new RemotingException("wellknown object mode '" + notNull2 + "' is invalid");
                }
                mode = WellKnownObjectMode.Singleton;
            }
            this.typeEntries.Add(new WellKnownServiceTypeEntry(notNull3, assemblyName, notNull, mode));
        }
Exemplo n.º 28
0
        ProviderData ReadProvider(string name, SmallXmlParser.IAttrList attrs, bool isTemplate)
        {
            ProviderData     prov = (name == "provider") ? new ProviderData() : new FormatterData();
            SinkProviderData data = new SinkProviderData("root");

            prov.CustomData = data.Children;

            currentProviderData = new Stack();
            currentProviderData.Push(data);

            for (int i = 0; i < attrs.Names.Length; ++i)
            {
                string at  = attrs.Names[i];
                string val = attrs.Values[i];

                if (at == "id" && isTemplate)
                {
                    prov.Id = val;
                }
                else if (at == "type")
                {
                    prov.Type = val;
                }
                else if (at == "ref" && !isTemplate)
                {
                    prov.Ref = val;
                }
                else
                {
                    prov.CustomProperties.Add(at, val);
                }
            }

            if (prov.Id == null && isTemplate)
            {
                throw new RemotingException("id attribute is required");
            }
            return(prov);
        }
Exemplo n.º 29
0
        private void ReadPreload(SmallXmlParser.IAttrList attrs)
        {
            string value  = attrs.GetValue("type");
            string value2 = attrs.GetValue("assembly");

            if (value != null && value2 != null)
            {
                throw new RemotingException("Type and assembly attributes cannot be specified together");
            }
            if (value != null)
            {
                SoapServices.PreLoad(Type.GetType(value));
            }
            else
            {
                if (value2 == null)
                {
                    throw new RemotingException("Either type or assembly attributes must be specified");
                }
                SoapServices.PreLoad(Assembly.Load(value2));
            }
        }
Exemplo n.º 30
0
        public void OnStartElement(string name, SmallXmlParser.IAttrList attrs)
        {
            SecurityElement child = new SecurityElement(name);

            if (this.root == null)
            {
                this.root    = child;
                this.current = child;
            }
            else
            {
                ((SecurityElement)this.stack.Peek()).AddChild(child);
            }
            this.stack.Push(child);
            this.current = child;
            int length = attrs.Length;

            for (int i = 0; i < length; i++)
            {
                this.current.AddAttribute(attrs.GetName(i), attrs.GetValue(i));
            }
        }