コード例 #1
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]);
                }
            }
        }
コード例 #2
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");
     }
 }
コード例 #3
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);
            }
        }
コード例 #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);
            }
        }
コード例 #5
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);
            }
        }
コード例 #6
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;
     }
 }
コード例 #7
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);
        }
コード例 #8
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);
        }
コード例 #9
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));
            }
        }
コード例 #10
0
        void ReadPreload(SmallXmlParser.IAttrList attrs)
        {
            string type = attrs.GetValue("type");
            string assm = attrs.GetValue("assembly");

            if (type != null && assm != null)
            {
                throw new RemotingException("Type and assembly attributes cannot be specified together");
            }

            if (type != null)
            {
                SoapServices.PreLoad(Type.GetType(type));
            }
            else if (assm != null)
            {
                SoapServices.PreLoad(Assembly.Load(assm));
            }
            else
            {
                throw new RemotingException("Either type or assembly attributes must be specified");
            }
        }
コード例 #11
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);
        }
コード例 #12
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);
            }
        }
コード例 #13
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));
            }
        }
コード例 #14
0
        public void ParseElement(string name, SmallXmlParser.IAttrList attrs)
        {
            if (currentProviderData != null)
            {
                ReadCustomProviderData(name, attrs);
                return;
            }

            switch (name)
            {
            case "application":
                ValidatePath(name, "system.runtime.remoting");
                if (attrs.Names.Length > 0)
                {
                    appName = attrs.Values[0];
                }
                break;

            case "lifetime":
                ValidatePath(name, "application");
                ReadLifetine(attrs);
                break;

            case "channels":
                ValidatePath(name, "system.runtime.remoting", "application");
                break;

            case "channel":
                ValidatePath(name, "channels");
                if (currentXmlPath.IndexOf("application") != -1)
                {
                    ReadChannel(attrs, false);
                }
                else
                {
                    ReadChannel(attrs, true);
                }
                break;

            case "serverProviders":
                ValidatePath(name, "channelSinkProviders", "channel");
                break;

            case "clientProviders":
                ValidatePath(name, "channelSinkProviders", "channel");
                break;

            case "provider":
            case "formatter":
                ProviderData prov;

                if (CheckPath("application/channels/channel/serverProviders") ||
                    CheckPath("channels/channel/serverProviders"))
                {
                    prov = ReadProvider(name, attrs, false);
                    currentChannel.ServerProviders.Add(prov);
                }
                else if (CheckPath("application/channels/channel/clientProviders") ||
                         CheckPath("channels/channel/clientProviders"))
                {
                    prov = ReadProvider(name, attrs, false);
                    currentChannel.ClientProviders.Add(prov);
                }
                else if (CheckPath("channelSinkProviders/serverProviders"))
                {
                    prov = ReadProvider(name, attrs, true);
                    RemotingConfiguration.RegisterServerProviderTemplate(prov);
                }
                else if (CheckPath("channelSinkProviders/clientProviders"))
                {
                    prov = ReadProvider(name, attrs, true);
                    RemotingConfiguration.RegisterClientProviderTemplate(prov);
                }
                else
                {
                    ValidatePath(name);
                }
                break;

            case "client":
                ValidatePath(name, "application");
                currentClientUrl = attrs.GetValue("url");
                break;

            case "service":
                ValidatePath(name, "application");
                break;

            case "wellknown":
                ValidatePath(name, "client", "service");
                if (CheckPath("client"))
                {
                    ReadClientWellKnown(attrs);
                }
                else
                {
                    ReadServiceWellKnown(attrs);
                }
                break;

            case "activated":
                ValidatePath(name, "client", "service");
                if (CheckPath("client"))
                {
                    ReadClientActivated(attrs);
                }
                else
                {
                    ReadServiceActivated(attrs);
                }
                break;

            case "soapInterop":
                ValidatePath(name, "application");
                break;

            case "interopXmlType":
                ValidatePath(name, "soapInterop");
                ReadInteropXml(attrs, false);
                break;

            case "interopXmlElement":
                ValidatePath(name, "soapInterop");
                ReadInteropXml(attrs, false);
                break;

            case "preLoad":
                ValidatePath(name, "soapInterop");
                ReadPreload(attrs);
                break;

            case "debug":
                ValidatePath(name, "system.runtime.remoting");
                break;

            case "channelSinkProviders":
                ValidatePath(name, "system.runtime.remoting");
                break;

            case "customErrors":
                ValidatePath(name, "system.runtime.remoting");
                RemotingConfiguration.SetCustomErrorsMode(attrs.GetValue("mode"));
                break;

            default:
                throw new RemotingException("Element '" + name + "' is not valid in system.remoting.configuration section");
            }
        }
コード例 #15
0
        public void ParseElement(string name, SmallXmlParser.IAttrList attrs)
        {
            if (this.currentProviderData != null)
            {
                this.ReadCustomProviderData(name, attrs);
                return;
            }
            if (name != null)
            {
                if (ConfigHandler.< > f__switch$map27 == null)
                {
                    ConfigHandler.< > f__switch$map27 = new Dictionary <string, int>(19)
                    {
                        {
                            "application",
                            0
                        },
                        {
                            "lifetime",
                            1
                        },
                        {
                            "channels",
                            2
                        },
                        {
                            "channel",
                            3
                        },
                        {
                            "serverProviders",
                            4
                        },
                        {
                            "clientProviders",
                            5
                        },
                        {
                            "provider",
                            6
                        },
                        {
                            "formatter",
                            6
                        },
                        {
                            "client",
                            7
                        },
                        {
                            "service",
                            8
                        },
                        {
                            "wellknown",
                            9
                        },
                        {
                            "activated",
                            10
                        },
                        {
                            "soapInterop",
                            11
                        },
                        {
                            "interopXmlType",
                            12
                        },
                        {
                            "interopXmlElement",
                            13
                        },
                        {
                            "preLoad",
                            14
                        },
                        {
                            "debug",
                            15
                        },
                        {
                            "channelSinkProviders",
                            16
                        },
                        {
                            "customErrors",
                            17
                        }
                    };
                }
                int num;
                if (ConfigHandler.< > f__switch$map27.TryGetValue(name, out num))
                {
                    switch (num)
                    {
                    case 0:
                        this.ValidatePath(name, new string[]
                        {
                            "system.runtime.remoting"
                        });
                        if (attrs.Names.Length > 0)
                        {
                            this.appName = attrs.Values[0];
                        }
                        break;

                    case 1:
                        this.ValidatePath(name, new string[]
                        {
                            "application"
                        });
                        this.ReadLifetine(attrs);
                        break;

                    case 2:
                        this.ValidatePath(name, new string[]
                        {
                            "system.runtime.remoting",
                            "application"
                        });
                        break;

                    case 3:
                        this.ValidatePath(name, new string[]
                        {
                            "channels"
                        });
                        if (this.currentXmlPath.IndexOf("application") != -1)
                        {
                            this.ReadChannel(attrs, false);
                        }
                        else
                        {
                            this.ReadChannel(attrs, true);
                        }
                        break;

                    case 4:
                        this.ValidatePath(name, new string[]
                        {
                            "channelSinkProviders",
                            "channel"
                        });
                        break;

                    case 5:
                        this.ValidatePath(name, new string[]
                        {
                            "channelSinkProviders",
                            "channel"
                        });
                        break;

                    case 6:
                        if (this.CheckPath("application/channels/channel/serverProviders") || this.CheckPath("channels/channel/serverProviders"))
                        {
                            ProviderData providerData = this.ReadProvider(name, attrs, false);
                            this.currentChannel.ServerProviders.Add(providerData);
                        }
                        else if (this.CheckPath("application/channels/channel/clientProviders") || this.CheckPath("channels/channel/clientProviders"))
                        {
                            ProviderData providerData = this.ReadProvider(name, attrs, false);
                            this.currentChannel.ClientProviders.Add(providerData);
                        }
                        else if (this.CheckPath("channelSinkProviders/serverProviders"))
                        {
                            ProviderData providerData = this.ReadProvider(name, attrs, true);
                            RemotingConfiguration.RegisterServerProviderTemplate(providerData);
                        }
                        else if (this.CheckPath("channelSinkProviders/clientProviders"))
                        {
                            ProviderData providerData = this.ReadProvider(name, attrs, true);
                            RemotingConfiguration.RegisterClientProviderTemplate(providerData);
                        }
                        else
                        {
                            this.ValidatePath(name, new string[0]);
                        }
                        break;

                    case 7:
                        this.ValidatePath(name, new string[]
                        {
                            "application"
                        });
                        this.currentClientUrl = attrs.GetValue("url");
                        break;

                    case 8:
                        this.ValidatePath(name, new string[]
                        {
                            "application"
                        });
                        break;

                    case 9:
                        this.ValidatePath(name, new string[]
                        {
                            "client",
                            "service"
                        });
                        if (this.CheckPath("client"))
                        {
                            this.ReadClientWellKnown(attrs);
                        }
                        else
                        {
                            this.ReadServiceWellKnown(attrs);
                        }
                        break;

                    case 10:
                        this.ValidatePath(name, new string[]
                        {
                            "client",
                            "service"
                        });
                        if (this.CheckPath("client"))
                        {
                            this.ReadClientActivated(attrs);
                        }
                        else
                        {
                            this.ReadServiceActivated(attrs);
                        }
                        break;

                    case 11:
                        this.ValidatePath(name, new string[]
                        {
                            "application"
                        });
                        break;

                    case 12:
                        this.ValidatePath(name, new string[]
                        {
                            "soapInterop"
                        });
                        this.ReadInteropXml(attrs, false);
                        break;

                    case 13:
                        this.ValidatePath(name, new string[]
                        {
                            "soapInterop"
                        });
                        this.ReadInteropXml(attrs, false);
                        break;

                    case 14:
                        this.ValidatePath(name, new string[]
                        {
                            "soapInterop"
                        });
                        this.ReadPreload(attrs);
                        break;

                    case 15:
                        this.ValidatePath(name, new string[]
                        {
                            "system.runtime.remoting"
                        });
                        break;

                    case 16:
                        this.ValidatePath(name, new string[]
                        {
                            "system.runtime.remoting"
                        });
                        break;

                    case 17:
                        this.ValidatePath(name, new string[]
                        {
                            "system.runtime.remoting"
                        });
                        RemotingConfiguration.SetCustomErrorsMode(attrs.GetValue("mode"));
                        break;

                    default:
                        goto IL_512;
                    }
                    return;
                }
            }
IL_512:
            throw new RemotingException("Element '" + name + "' is not valid in system.remoting.configuration section");
        }
コード例 #16
0
        private void ReadLifetine(SmallXmlParser.IAttrList attrs)
        {
            int i = 0;

            while (i < attrs.Names.Length)
            {
                string text = attrs.Names[i];
                if (text != null)
                {
                    if (ConfigHandler.< > f__switch$map28 == null)
                    {
                        ConfigHandler.< > f__switch$map28 = new Dictionary <string, int>(4)
                        {
                            {
                                "leaseTime",
                                0
                            },
                            {
                                "sponsorshipTimeout",
                                1
                            },
                            {
                                "renewOnCallTime",
                                2
                            },
                            {
                                "leaseManagerPollTime",
                                3
                            }
                        };
                    }
                    int num;
                    if (ConfigHandler.< > f__switch$map28.TryGetValue(text, out num))
                    {
                        switch (num)
                        {
                        case 0:
                            LifetimeServices.LeaseTime = this.ParseTime(attrs.GetValue(i));
                            break;

                        case 1:
                            LifetimeServices.SponsorshipTimeout = this.ParseTime(attrs.GetValue(i));
                            break;

                        case 2:
                            LifetimeServices.RenewOnCallTime = this.ParseTime(attrs.GetValue(i));
                            break;

                        case 3:
                            LifetimeServices.LeaseManagerPollTime = this.ParseTime(attrs.GetValue(i));
                            break;

                        default:
                            goto IL_E6;
                        }
                        i++;
                        continue;
                    }
                }
IL_E6:
                throw new RemotingException("Invalid attribute: " + attrs.Names[i]);
            }
        }