public IProtocolManager CreateProtocolManager(ProtocolManagerInfoModel info, Session session)
        {
            if (info == null) {
                throw new ArgumentNullException("info");
            }
            if (session == null) {
                throw new ArgumentNullException("session");
            }

            Type type = _ProtocolManagerTypes[info];
            return (IProtocolManager) Activator.CreateInstance(type, session);
        }
        public IProtocolManager CreateProtocolManager(ProtocolManagerInfoModel info, Session session)
        {
            if (info == null)
            {
                throw new ArgumentNullException("info");
            }
            if (session == null)
            {
                throw new ArgumentNullException("session");
            }

            Type type = _ProtocolManagerTypes[info];

            return((IProtocolManager)Activator.CreateInstance(type, session));
        }
        public void LoadProtocolManager(string filename)
        {
            Trace.Call(filename);

            Assembly asm = Assembly.LoadFile(filename);

            Type[] types = asm.GetTypes();

            foreach (Type type in types)
            {
                if (type.IsAbstract)
                {
                    continue;
                }

                Type   foundType      = null;
                Type[] interfaceTypes = type.GetInterfaces();
                foreach (Type interfaceType in interfaceTypes)
                {
                    if (interfaceType == typeof(IProtocolManager))
                    {
#if LOG4NET
                        _Logger.Debug("LoadProtocolManager(): found " + type);
#endif
                        foundType = type;
                        break;
                    }
                }

                if (foundType == null)
                {
                    continue;
                }

                // let's get the info attribute
                object[] attrs = foundType.GetCustomAttributes(typeof(ProtocolManagerInfoAttribute), true);
                if (attrs == null || attrs.Length == 0)
                {
                    throw new ArgumentException("Assembly contains IProtocolManager but misses ProtocolManagerInfoAttribute", "filename");
                    //continue;
                }

                ProtocolManagerInfoAttribute attr = (ProtocolManagerInfoAttribute)attrs[0];
                ProtocolManagerInfoModel     info = new ProtocolManagerInfoModel(attr.Name, attr.Description, attr.Alias);

                _ProtocolManagerTypes.Add(info, foundType);
            }
        }
        public void LoadProtocolManager(string filename)
        {
            Trace.Call(filename);

            Assembly asm = Assembly.LoadFile(filename);
            Type[] types = asm.GetTypes();

            foreach (Type type in types) {
                if (type.IsAbstract) {
                    continue;
                }

                Type foundType = null;
                Type[] interfaceTypes = type.GetInterfaces();
                foreach (Type interfaceType in interfaceTypes) {
                    if (interfaceType == typeof(IProtocolManager)) {
            #if LOG4NET
                        _Logger.Debug("LoadProtocolManager(): found " + type);
            #endif
                        foundType = type;
                        break;
                    }
                }

                if (foundType == null) {
                    continue;
                }

                // let's get the info attribute
                object[] attrs = foundType.GetCustomAttributes(typeof(ProtocolManagerInfoAttribute), true);
                if (attrs == null || attrs.Length == 0) {
                    throw new ArgumentException("Assembly contains IProtocolManager but misses ProtocolManagerInfoAttribute", "filename");
                    //continue;
                }

                ProtocolManagerInfoAttribute attr = (ProtocolManagerInfoAttribute) attrs[0];
                ProtocolManagerInfoModel info = new ProtocolManagerInfoModel(attr.Name, attr.Description, attr.Alias);

                _ProtocolManagerTypes.Add(info, foundType);
            }
        }