Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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);
        }