internal DelayLoadClientChannelEntry(RemotingXmlConfigFileData.ChannelEntry entry, bool ensureSecurity)
 {
     this._entry = entry;
     this._channel = null;
     this._bRegistered = false;
     this._ensureSecurity = ensureSecurity;
 }
Example #2
0
        ProcessChannelsChannelNode(ConfigNode node, RemotingXmlConfigFileData configData,
                                   bool isTemplate)
        {
            String id = null;
            String typeName = null;
            String assemName = null;
            Hashtable properties = CreateCaseInsensitiveHashtable();

            bool delayLoad = false;
            
            RemotingXmlConfigFileData.ChannelEntry channelTemplate = null;

            // examine attributes
            foreach (DictionaryEntry entry in node.Attributes)
            {
                String keyStr = (String)entry.Key;
                switch (keyStr)
                {
                case "displayName": break; // displayName is ignored (used by config utility for labelling the application)
                
                case "id":
                {
                    if (!isTemplate)
                    {
                        ReportNonTemplateIdAttributeError(node, configData);
                    }
                    else
                        id = ((String)entry.Value).ToLower(CultureInfo.InvariantCulture);

                    break;
                } // case "id"
                
                case "ref":
                {
                    if (isTemplate)
                    {
                        ReportTemplateCannotReferenceTemplateError(node, configData);
                    }
                    else
                    {
                        channelTemplate =
                            (RemotingXmlConfigFileData.ChannelEntry)_channelTemplates[entry.Value];
                        if (channelTemplate == null)
                        {
                            ReportUnableToResolveTemplateReferenceError(
                                node, entry.Value.ToString(), configData);
                        }
                        else
                        {
                            // load template data
                            typeName = channelTemplate.TypeName;
                            assemName = channelTemplate.AssemblyName;

                            foreach (DictionaryEntry param in channelTemplate.Properties)
                            {
                                properties[param.Key] = param.Value;
                            }
                        }
                    }

                    break;
                } // case "ref"
                
                case "type":
                {
                    RemotingConfigHandler.ParseType((String)entry.Value, out typeName, out assemName);
                    break;
                } // case "type" 

                case "delayLoadAsClientChannel":
                {
                    delayLoad = Convert.ToBoolean((String)entry.Value, CultureInfo.InvariantCulture);
                    break;
                } // case "delayLoadAsClientChannel"

                default:
                    properties[keyStr] = entry.Value;
                    break;
                } // switch
            } // foreach attribute

            // check for errors        
            if ((typeName == null) || (assemName == null))
                ReportMissingTypeAttributeError(node, "type", configData);          

            RemotingXmlConfigFileData.ChannelEntry channelEntry =
                new RemotingXmlConfigFileData.ChannelEntry(typeName, assemName, properties);

            channelEntry.DelayLoad = delayLoad;                                                            


            // look for sink providers
            foreach (ConfigNode childNode in node.Children)
            {
                switch (childNode.Name)
                {
                case "clientProviders": 
                    ProcessSinkProviderNodes(childNode, channelEntry, configData, false); 
                    break;
                case "serverProviders": 
                    ProcessSinkProviderNodes(childNode, channelEntry, configData, true);
                    break;

                 default: break;
                } // switch              
            } // foreach

            // if we reference a template and didn't specify any sink providers, we
            //   should copy over the providers from the template
            if (channelTemplate != null)
            {                
                // <

                if (channelEntry.ClientSinkProviders.Count == 0)
                {
                    channelEntry.ClientSinkProviders = channelTemplate.ClientSinkProviders;
                }
                if (channelEntry.ServerSinkProviders.Count == 0)
                {
                    channelEntry.ServerSinkProviders = channelTemplate.ServerSinkProviders;
                }
            }
            

            if (isTemplate)
            {
                _channelTemplates[id] = channelEntry;
                return null;
            }
            else
            {
                return channelEntry;
            }
        } // ProcessChannelsChannelNode
Example #3
0
 internal DelayLoadClientChannelEntry(RemotingXmlConfigFileData.ChannelEntry entry)
 {
     _entry = entry;
     _channel = null;      
     _bRegistered = false;
 }
 private static RemotingXmlConfigFileData.ChannelEntry ProcessChannelsChannelNode(ConfigNode node, RemotingXmlConfigFileData configData, bool isTemplate)
 {
     string str = null;
     string typeName = null;
     string assemName = null;
     Hashtable properties = CreateCaseInsensitiveHashtable();
     bool flag = false;
     RemotingXmlConfigFileData.ChannelEntry entry = null;
     foreach (DictionaryEntry entry2 in node.Attributes)
     {
         string key = (string) entry2.Key;
         string str5 = key;
         if (str5 == null)
         {
             goto Label_019A;
         }
         if (str5 != "displayName")
         {
             if (!(str5 == "id"))
             {
                 if (str5 == "ref")
                 {
                     goto Label_00C4;
                 }
                 if (str5 == "type")
                 {
                     goto Label_0169;
                 }
                 if (str5 == "delayLoadAsClientChannel")
                 {
                     goto Label_0180;
                 }
                 goto Label_019A;
             }
             if (!isTemplate)
             {
                 ReportNonTemplateIdAttributeError(node, configData);
             }
             else
             {
                 str = ((string) entry2.Value).ToLower(CultureInfo.InvariantCulture);
             }
         }
         continue;
     Label_00C4:
         if (isTemplate)
         {
             ReportTemplateCannotReferenceTemplateError(node, configData);
         }
         else
         {
             entry = (RemotingXmlConfigFileData.ChannelEntry) _channelTemplates[entry2.Value];
             if (entry == null)
             {
                 ReportUnableToResolveTemplateReferenceError(node, entry2.Value.ToString(), configData);
             }
             else
             {
                 typeName = entry.TypeName;
                 assemName = entry.AssemblyName;
                 foreach (DictionaryEntry entry3 in entry.Properties)
                 {
                     properties[entry3.Key] = entry3.Value;
                 }
             }
         }
         continue;
     Label_0169:
         RemotingConfigHandler.ParseType((string) entry2.Value, out typeName, out assemName);
         continue;
     Label_0180:
         flag = Convert.ToBoolean((string) entry2.Value, CultureInfo.InvariantCulture);
         continue;
     Label_019A:
         properties[key] = entry2.Value;
     }
     if ((typeName == null) || (assemName == null))
     {
         ReportMissingTypeAttributeError(node, "type", configData);
     }
     RemotingXmlConfigFileData.ChannelEntry channelEntry = new RemotingXmlConfigFileData.ChannelEntry(typeName, assemName, properties) {
         DelayLoad = flag
     };
     foreach (ConfigNode node2 in node.Children)
     {
         string name = node2.Name;
         if (name != null)
         {
             if (!(name == "clientProviders"))
             {
                 if (name == "serverProviders")
                 {
                     goto Label_0239;
                 }
             }
             else
             {
                 ProcessSinkProviderNodes(node2, channelEntry, configData, false);
             }
         }
         continue;
     Label_0239:
         ProcessSinkProviderNodes(node2, channelEntry, configData, true);
     }
     if (entry != null)
     {
         if (channelEntry.ClientSinkProviders.Count == 0)
         {
             channelEntry.ClientSinkProviders = entry.ClientSinkProviders;
         }
         if (channelEntry.ServerSinkProviders.Count == 0)
         {
             channelEntry.ServerSinkProviders = entry.ServerSinkProviders;
         }
     }
     if (isTemplate)
     {
         _channelTemplates[str] = channelEntry;
         return null;
     }
     return channelEntry;
 }