Example #1
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);
        }
Example #2
0
 public ClientSinkData(SinkProviderData configurationData, IChannelSender channel, string url, object remoteChannelData)
 {
     this.Channel           = channel;
     this.Url               = url;
     this.RemoteChannelData = remoteChannelData;
     this.ConfigurationData = configurationData;
 }
 public void CopyFrom(ProviderData other)
 {
     if (this.Ref == null)
     {
         this.Ref = other.Ref;
     }
     if (this.Id == null)
     {
         this.Id = other.Id;
     }
     if (this.Type == null)
     {
         this.Type = other.Type;
     }
     foreach (object obj in other.CustomProperties)
     {
         DictionaryEntry dictionaryEntry = (DictionaryEntry)obj;
         if (!this.CustomProperties.ContainsKey(dictionaryEntry.Key))
         {
             this.CustomProperties[dictionaryEntry.Key] = dictionaryEntry.Value;
         }
     }
     if (other.CustomData != null)
     {
         if (this.CustomData == null)
         {
             this.CustomData = new ArrayList();
         }
         foreach (object obj2 in other.CustomData)
         {
             SinkProviderData value = (SinkProviderData)obj2;
             this.CustomData.Add(value);
         }
     }
 }
Example #4
0
        public CustomClientSinkProvider(IDictionary properties, ICollection providerData)
        {
            // get custom sink type from configuration file
            string customSinkType = (string)properties["customSinkType"];

            if (customSinkType == null)
            {
                throw new CustomSinkException("no customSinkType property in the <provider> element.");
            }
            this.customSinkType = Type.GetType(customSinkType);
            if (this.customSinkType == null)
            {
                throw new CustomSinkException(
                          string.Format("Could not load type {0}", customSinkType));
            }

            // make sure the custom sink type inherits BaseCustomSink
            if (!this.customSinkType.IsSubclassOf(typeof(BaseCustomSink)))
            {
                throw new CustomSinkException("Custom sink type does not inherit from BaseCustomSink");
            }

            // see if there is a <customData> element in the provider data
            // and save it for passing it to the custom sink's constructor
            foreach (SinkProviderData data in providerData)
            {
                if (data.Name == "customData")
                {
                    this.data = data;
                    break;
                }
            }
        }
Example #5
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);
        }
        public EncryptClientSink(ClientSinkData creationData)
        {
            SinkProviderData usersListConfig = null;
            Uri sanjayuri = new Uri(creationData.Url);

            this.delta = 1;

            if (creationData.ConfigurationData.Properties["delta"] != null)
            {
                delta = byte.Parse(creationData.ConfigurationData.Properties["delta"].ToString());
            }

            foreach (SinkProviderData d in creationData.ConfigurationData.Children)
            {
                if (d.Name == "credentialsList")
                {
                    usersListConfig = d;
                    break;
                }
            }

            if (usersListConfig == null)
            {
                return;
            }


            string host;
            int    port;


            SinkProviderData credConfig = (SinkProviderData)usersListConfig.Children[0];


            if (credConfig.Name != "credentials")
            {
                return;
            }

            currentCredentials = new User(
                (string)credConfig.Properties["username"],
                (string)credConfig.Properties["password"]);
            currentCredentials.LoginDate = DateTime.Now;

            // retrieve host and port
            host = (string)credConfig.Properties["host"];
            port = credConfig.Properties["port"] != null?
                   int.Parse((string)credConfig.Properties["port"]) : -1;

            currentCredentials.AddressTable.Add(currentCredentials.Username, host + ":" + port.ToString());
        }
Example #7
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);
        }
Example #8
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);
        }
Example #9
0
 public ServerSinkData(SinkProviderData configurationData, IChannelReceiver channel)
 {
     this.Channel           = channel;
     this.ConfigurationData = configurationData;
 }