예제 #1
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;
        }
예제 #2
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;
        }