private void FriendMSGSend(object obj) { NewMSG newMSG = (NewMSG)obj; Console.WriteLine(newMSG.MSGText); ProtocolBytes MSG = new ProtocolBytes(); MSG.AddData("MSG"); string MSGStr = JsonConvert.SerializeObject(newMSG); MSG.AddData(MSGStr); if (ClientMC.A.CTCD.ContainsKey(newMSG.Destination)) { ClientMC.A.CTCD[newMSG.Destination].Send(MSG); } }
public void WroldMSGSend(object O) { NewMSG newMSG = (NewMSG)O; Console.WriteLine(newMSG.MSGText); ProtocolBytes MSG = new ProtocolBytes(); MSG.AddData("MSG"); string MSGStr = JsonConvert.SerializeObject(newMSG); MSG.AddData(MSGStr); Dictionary <string, ConnToClient> Online = ClientMC.A.CTCD; foreach (ConnToClient CTC in Online.Values) { CTC.Send(MSG); } }
public void SendMSGTo(ConnToClient CTC, object[] OB) { Console.WriteLine("MSGProcess"); string MSG = OB[1].ToString(); NewMSG newMSG = JsonConvert.DeserializeObject <NewMSG>(MSG); switch (newMSG.MSGState) { case State.Friend: Thread FriendMSGSendTo = new Thread(new ParameterizedThreadStart(FriendMSGSend)); FriendMSGSendTo.Start(newMSG); break; case State.Team: break; case State.Wrold: Thread WroldMSGSendTo = new Thread(new ParameterizedThreadStart(WroldMSGSend)); WroldMSGSendTo.Start(newMSG); Console.WriteLine("send to" + newMSG.Destination); break; } }