Exemplo n.º 1
0
        /// <summary>
        /// 构造方法,初始化模块和服务
        /// </summary>
        ///// <param name="username">账号(二维码登录留空)</param>
        ///// <param name="password">密码(二维码登录留空)</param>
        /// <param name="notifyListener">监听器</param>
        /// <param name="actorDispatcher">线程执行器</param>
        /// <param name="logger">日志记录器</param>
        public WebQQClient(QQNotifyListener notifyListener    = null,
                           IQQActorDispatcher actorDispatcher = null, IQQLogger logger = null)
        {
            _modules  = new Dictionary <QQModuleType, IQQModule>();
            _services = new Dictionary <QQServiceType, IQQService>();

            _modules.Add(QQModuleType.LOGIN, new LoginModule());
            _modules.Add(QQModuleType.PROC, new ProcModule());
            _modules.Add(QQModuleType.USER, new UserModule());
            _modules.Add(QQModuleType.BUDDY, new BuddyModule());
            _modules.Add(QQModuleType.CATEGORY, new CategoryModule());
            _modules.Add(QQModuleType.GROUP, new GroupModule());
            _modules.Add(QQModuleType.CHAT, new ChatModule());
            _modules.Add(QQModuleType.DISCUZ, new DiscuzModule());
            _modules.Add(QQModuleType.EMAIL, new EmailModule());
            _services.Add(QQServiceType.HTTP, new HttpService());

            Account = new QQAccount
            {
                Username = string.Empty,
                Password = string.Empty
            };
            Session          = new QQSession();
            Store            = new QQStore();
            NotifyListener   = notifyListener;
            _actorDispatcher = actorDispatcher ?? new SimpleActorDispatcher();
            Logger           = logger ?? new EmptyQQLogger();
            Logger.Context   = this;
            Init();
        }
Exemplo n.º 2
0
        /// <summary>
        /// 构造方法,初始化模块和服务
        /// </summary>
        /// <param name="username">账号</param>
        /// <param name="password">密码</param>
        /// <param name="notifyListener">监听器</param>
        /// <param name="actorDispatcher">线程执行器</param>
        public WebQQClient(string username, string password,
                           QQNotifyHandler notifyListener, IQQActorDispatcher actorDispatcher)
        {
            _modules  = new Dictionary <QQModuleType, IQQModule>();
            _services = new Dictionary <QQServiceType, IQQService>();

            _modules.Add(QQModuleType.LOGIN, new LoginModule());
            _modules.Add(QQModuleType.PROC, new ProcModule());
            _modules.Add(QQModuleType.USER, new UserModule());
            _modules.Add(QQModuleType.BUDDY, new BuddyModule());
            _modules.Add(QQModuleType.CATEGORY, new CategoryModule());
            _modules.Add(QQModuleType.GROUP, new GroupModule());
            _modules.Add(QQModuleType.CHAT, new ChatModule());
            _modules.Add(QQModuleType.DISCUZ, new DiscuzModule());
            _modules.Add(QQModuleType.EMAIL, new EmailModule());
            _services.Add(QQServiceType.HTTP, new HttpService());

            Account = new QQAccount
            {
                Username = username,
                Password = password
            };
            Session          = new QQSession();
            Store            = new QQStore();
            NotifyListener   = notifyListener;
            _actorDispatcher = actorDispatcher;

            Init();
        }