Exemplo n.º 1
0
        internal MessageTranslator(UDPThread udpClient, Config config, OnlineHost hostManager)
        {
            this.Client            = udpClient;
            this.Config            = config;
            this.LivedHost         = hostManager;
            this.broadcastEndPoint = new IPEndPoint(IPAddress.Broadcast, Config.Port);

            receivedQueue              = new Queue <ulong>();
            udpClient.PackageReceived += udpClient_PackageReceived;
        }
Exemplo n.º 2
0
		internal MessageTranslator(UDPThread udpClient, Config config, OnlineHost hostManager)
		{
			this.Client = udpClient;
			this.Config = config;
			this.LivedHost = hostManager;
			this.broadcastEndPoint = new IPEndPoint(IPAddress.Broadcast, Config.Port);

			receivedQueue = new Queue<ulong>();
			udpClient.PackageReceived += udpClient_PackageReceived;
		}
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;
		}