Exemplo n.º 1
0
        public static void GetDogId(string msg, Dictionary <string, Session> sessionPool, string sendIP)
        {
            string dogId         = string.Empty;
            string answerMsgType = Convert.ToInt32(TCPMessageType.读取加密狗).ToString();

            //读取加密狗
            if (DogUtility.GetBogID(out dogId))
            {
                var dataObj = new { dogId = dogId };
                SendSuccessData(answerMsgType, sessionPool, sendIP, "获取加密狗号成功", dataObj);
            }
            else
            {
                SendFailData(answerMsgType, sessionPool, sendIP, "获取加密狗出错");
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 读取加密狗
        /// </summary>
        /// <param name="msg"></param>
        /// <param name="sessionPool"></param>
        /// <param name="sendIP"></param>
        public static void GetDogIdAndMachineName(string msg, Dictionary <string, Session> sessionPool, string sendIP)
        {
            string receiveIP     = string.Empty;
            string dogId         = string.Empty;
            string computerName  = string.Empty;
            string answerMsgType = Convert.ToInt32(TCPMessageType.读取加密狗和机器名).ToString();

            //读取加密狗
            if (!DogUtility.GetBogID(out dogId))
            {
                SendFailData(answerMsgType, sessionPool, sendIP, "获取加密狗号和机器名出错");
            }

            //读取机器名
            if (MachineUtility.GetMachineName(out computerName))
            {
                var dataObj = new { machineName = computerName, dogId = dogId };
                SendSuccessData(answerMsgType, sessionPool, sendIP, "获取加密狗号和机器名成功", dataObj);
            }
            else
            {
                SendFailData(answerMsgType, sessionPool, sendIP, "获取加密狗号和机器名出错");
            }
        }