internal static void RegisterChannels(ArrayList channels, bool onlyDelayed) { foreach (ChannelData channel in channels) { if (onlyDelayed && channel.DelayLoadAsClientChannel != "true") { continue; } if (defaultDelayedConfigRead && channel.DelayLoadAsClientChannel == "true") { continue; } if (channel.Ref != null) { ChannelData template = (ChannelData)channelTemplates [channel.Ref]; if (template == null) { throw new RemotingException("Channel template '" + channel.Ref + "' not found"); } channel.CopyFrom(template); } foreach (ProviderData prov in channel.ServerProviders) { if (prov.Ref != null) { ProviderData template = (ProviderData)serverProviderTemplates [prov.Ref]; if (template == null) { throw new RemotingException("Provider template '" + prov.Ref + "' not found"); } prov.CopyFrom(template); } } foreach (ProviderData prov in channel.ClientProviders) { if (prov.Ref != null) { ProviderData template = (ProviderData)clientProviderTemplates [prov.Ref]; if (template == null) { throw new RemotingException("Provider template '" + prov.Ref + "' not found"); } prov.CopyFrom(template); } } #if !DISABLE_REMOTING ChannelServices.RegisterChannelConfig(channel); #endif } }
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; }
public void CopyFrom(ChannelData other) { if (Ref == null) { Ref = other.Ref; } if (Id == null) { Id = other.Id; } if (Type == null) { Type = other.Type; } if (DelayLoadAsClientChannel == null) { DelayLoadAsClientChannel = other.DelayLoadAsClientChannel; } if (other._customProperties != null) { foreach (DictionaryEntry entry in other._customProperties) { if (!CustomProperties.ContainsKey(entry.Key)) { CustomProperties [entry.Key] = entry.Value; } } } if (_serverProviders == null && other._serverProviders != null) { foreach (ProviderData prov in other._serverProviders) { ProviderData np = new ProviderData(); np.CopyFrom(prov); ServerProviders.Add(np); } } if (_clientProviders == null && other._clientProviders != null) { foreach (ProviderData prov in other._clientProviders) { ProviderData np = new ProviderData(); np.CopyFrom(prov); ClientProviders.Add(np); } } }
public void CopyFrom(ChannelData 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; } if (this.DelayLoadAsClientChannel == null) { this.DelayLoadAsClientChannel = other.DelayLoadAsClientChannel; } if (other._customProperties != null) { foreach (object obj in other._customProperties) { DictionaryEntry dictionaryEntry = (DictionaryEntry)obj; if (!this.CustomProperties.ContainsKey(dictionaryEntry.Key)) { this.CustomProperties[dictionaryEntry.Key] = dictionaryEntry.Value; } } } if (this._serverProviders == null && other._serverProviders != null) { foreach (object obj2 in other._serverProviders) { ProviderData other2 = (ProviderData)obj2; ProviderData providerData = new ProviderData(); providerData.CopyFrom(other2); this.ServerProviders.Add(providerData); } } if (this._clientProviders == null && other._clientProviders != null) { foreach (object obj3 in other._clientProviders) { ProviderData other3 = (ProviderData)obj3; ProviderData providerData2 = new ProviderData(); providerData2.CopyFrom(other3); this.ClientProviders.Add(providerData2); } } }
internal static void RegisterChannels(ArrayList channels, bool onlyDelayed) { foreach (object obj in channels) { ChannelData channelData = (ChannelData)obj; if (!onlyDelayed || !(channelData.DelayLoadAsClientChannel != "true")) { if (!RemotingConfiguration.defaultDelayedConfigRead || !(channelData.DelayLoadAsClientChannel == "true")) { if (channelData.Ref != null) { ChannelData channelData2 = (ChannelData)RemotingConfiguration.channelTemplates[channelData.Ref]; if (channelData2 == null) { throw new RemotingException("Channel template '" + channelData.Ref + "' not found"); } channelData.CopyFrom(channelData2); } foreach (object obj2 in channelData.ServerProviders) { ProviderData providerData = (ProviderData)obj2; if (providerData.Ref != null) { ProviderData providerData2 = (ProviderData)RemotingConfiguration.serverProviderTemplates[providerData.Ref]; if (providerData2 == null) { throw new RemotingException("Provider template '" + providerData.Ref + "' not found"); } providerData.CopyFrom(providerData2); } } foreach (object obj3 in channelData.ClientProviders) { ProviderData providerData3 = (ProviderData)obj3; if (providerData3.Ref != null) { ProviderData providerData4 = (ProviderData)RemotingConfiguration.clientProviderTemplates[providerData3.Ref]; if (providerData4 == null) { throw new RemotingException("Provider template '" + providerData3.Ref + "' not found"); } providerData3.CopyFrom(providerData4); } } ChannelServices.RegisterChannelConfig(channelData); } } } }
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; }
internal static void RegisterChannelConfig (ChannelData channel) { IServerChannelSinkProvider serverSinks = null; IClientChannelSinkProvider clientSinks = null; // Create server providers for (int n=channel.ServerProviders.Count-1; n>=0; n--) { ProviderData prov = channel.ServerProviders[n] as ProviderData; IServerChannelSinkProvider sinkp = (IServerChannelSinkProvider) CreateProvider (prov); sinkp.Next = serverSinks; serverSinks = sinkp; } // Create client providers for (int n=channel.ClientProviders.Count-1; n>=0; n--) { ProviderData prov = channel.ClientProviders[n] as ProviderData; IClientChannelSinkProvider sinkp = (IClientChannelSinkProvider) CreateProvider (prov); sinkp.Next = clientSinks; clientSinks = sinkp; } // Create the channel Type type = Type.GetType (channel.Type); if (type == null) throw new RemotingException ("Type '" + channel.Type + "' not found"); Object[] parms; Type[] signature; bool clienc = typeof (IChannelSender).IsAssignableFrom (type); bool serverc = typeof (IChannelReceiver).IsAssignableFrom (type); if (clienc && serverc) { signature = new Type [] {typeof(IDictionary), typeof(IClientChannelSinkProvider), typeof(IServerChannelSinkProvider)}; parms = new Object[] {channel.CustomProperties, clientSinks, serverSinks}; } else if (clienc) { signature = new Type [] {typeof(IDictionary), typeof(IClientChannelSinkProvider)}; parms = new Object[] {channel.CustomProperties, clientSinks}; } else if (serverc) { signature = new Type [] {typeof(IDictionary), typeof(IServerChannelSinkProvider)}; parms = new Object[] {channel.CustomProperties, serverSinks}; } else throw new RemotingException (type + " is not a valid channel type"); ConstructorInfo ctor = type.GetConstructor (signature); if (ctor == null) throw new RemotingException (type + " does not have a valid constructor"); IChannel ch; try { ch = (IChannel) ctor.Invoke (parms); } catch (TargetInvocationException ex) { throw ex.InnerException; } lock (registeredChannels.SyncRoot) { if (channel.DelayLoadAsClientChannel == "true" && !(ch is IChannelReceiver)) delayedClientChannels.Add (ch); else RegisterChannel (ch); } }
internal static void RegisterChannelTemplate(ChannelData channel) { channelTemplates [channel.Id] = channel; }
public void CopyFrom (ChannelData other) { if (Ref == null) Ref = other.Ref; if (Id == null) Id = other.Id; if (Type == null) Type = other.Type; if (DelayLoadAsClientChannel == null) DelayLoadAsClientChannel = other.DelayLoadAsClientChannel; if (other._customProperties != null) { foreach (DictionaryEntry entry in other._customProperties) if (!CustomProperties.ContainsKey (entry.Key)) CustomProperties [entry.Key] = entry.Value; } if (_serverProviders == null && other._serverProviders != null) { foreach (ProviderData prov in other._serverProviders) { ProviderData np = new ProviderData(); np.CopyFrom (prov); ServerProviders.Add (np); } } if (_clientProviders == null && other._clientProviders != null) { foreach (ProviderData prov in other._clientProviders) { ProviderData np = new ProviderData(); np.CopyFrom (prov); ClientProviders.Add (np); } } }
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; }
internal static void RegisterChannelTemplate (ChannelData channel) { channelTemplates [channel.Id] = channel; }
internal static void RegisterChannelTemplate(ChannelData channel) { RemotingConfiguration.channelTemplates[channel.Id] = channel; }