コード例 #1
0
        public bool SocketStrDataHandle(string message, out ClearDataFormat clearData)
        {
            JsonDataQy _jsonData = JsonToolsQy.GetJsonData(message);
            string     _typeStr  = string.Empty;

            clearData = new ClearDataFormat();
            if (_jsonData["Tp"] != null)
            {
                _typeStr = _jsonData["Tp"].ToString();
                int  _typeInt;
                bool isSucc = int.TryParse(_typeStr, out _typeInt);
                if (isSucc)
                {
                    REV_MSG_TYPE _typeEnum = (REV_MSG_TYPE)_typeInt;
                    clearData.SetType(_typeEnum);
                    if (_jsonData["Tm"] != null)
                    {
                        string _time = _jsonData["Tm"].ToString();
                        clearData.SetTime(_time);
                    }
                    if (_jsonData["Mg"] != null)
                    {
                        string _msg = _jsonData["Mg"].ToString();
                        clearData.SetMsg(_msg);
                    }
                    return(true);
                }
                else
                {
                    //type不是定义的数字类型
                    return(false);
                }
            }
            else
            {
                //找不到相应Type
                return(false);
            }
        }
コード例 #2
0
 public void SetType(REV_MSG_TYPE revType)
 {
     m_type = revType;
 }