Пример #1
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");
            }
        }
Пример #2
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");
        }