Exemplo n.º 1
0
        /// <summary>
        /// 初始化所有对象,并初始化类
        /// </summary>
        public void Init()
        {
            Client       = new UDPThread(_client);                                //文本网络对象
            LivedHost    = new OnlineHost(this.Config);                           //主机列表
            MessageProxy = new MessageTranslator(Client, this.Config, LivedHost); //文本信息翻译层对象

            //自动查询主机客户端版本
            LivedHost.HostOnline += (s, e) =>
            {
                if (Config.AutoDetectVersion)
                {
                    this.GetVersion(e.Host);
                }
            };

            //文件传输
            FileTaskManager = new FileTaskManager(this.Config);
            FileTaskManager.FileReceiveTaskDiscarded += (s, e) => this.SendReleaseFilesSignal(e.TaskInfo.RemoteHost, e.TaskInfo.PackageID);
            FileTaskModule = new FSLib.IPMessager.Network.TCPThread(_client)
            {
                TaskManager = FileTaskManager
            };


            //与接收消息进行挂钩
            MessageProxy.MessageReceived += MessageProxy_MessageReceived;
        }
Exemplo n.º 2
0
        private void ProcessCommand_ReleaseFiles(Message message, Host host)
        {
            if (host == null)
            {
                return;
            }

            //释放文件
            ulong pkgid = 0;

            if (!ulong.TryParse(message.NormalMsg, out pkgid) || pkgid == 0)
            {
                return;
            }

            FileTaskManager.ReleaseFile(pkgid);
        }
Exemplo n.º 3
0
		/// <summary>
		/// 初始化所有对象,并初始化类
		/// </summary>
		public void Init()
		{
			Client = new UDPThread(_client);			//文本网络对象
			LivedHost = new OnlineHost(this.Config);								//主机列表
			MessageProxy = new MessageTranslator(Client, this.Config, LivedHost);	//文本信息翻译层对象

			//自动查询主机客户端版本
			LivedHost.HostOnline += (s, e) =>
			{
				if (Config.AutoDetectVersion) this.GetVersion(e.Host);
			};

			//文件传输
			FileTaskManager = new FileTaskManager(this.Config);
			FileTaskManager.FileReceiveTaskDiscarded += (s, e) => this.SendReleaseFilesSignal(e.TaskInfo.RemoteHost, e.TaskInfo.PackageID);
			FileTaskModule = new FSLib.IPMessager.Network.TCPThread(_client)
			{
				TaskManager = FileTaskManager
			};


			//与接收消息进行挂钩
			MessageProxy.MessageReceived += MessageProxy_MessageReceived;
		}