/// <summary> /// 向服务端发送登录 /// </summary> public static void Login() { NetworkStream nStream = client.GetStream(); XMessage msg = new XMessage(); msg.Type = "Login"; msg.AddParam("DeviceId", Config.DeviceId); byte[] buffer = Encoding.Unicode.GetBytes(msg.Raw); nStream.Write(buffer, 0, buffer.Length); }
/// <summary> /// 发送cmd /// </summary> /// <param name="cid"></param> /// <param name="cmd"></param> public static void Cmd(int cid, string cmd) { NetworkStream nStream = clientList[cid].GetStream(); XMessage msg = new XMessage(); msg.Type = "Cmd"; msg.AddParam("Content", cmd); byte[] buffer = Encoding.Unicode.GetBytes(msg.Raw); nStream.Write(buffer, 0, buffer.Length); }
/// <summary> /// 向服务端发送消息 /// </summary> public static void Msg(string text) { NetworkStream nStream = client.GetStream(); XMessage msg = new XMessage(); msg.Type = "Msg"; text = Util.EncodingText(text); msg.AddParam("Text", text); byte[] buffer = Encoding.Unicode.GetBytes(msg.Raw); nStream.Write(buffer, 0, buffer.Length); }