Ejemplo n.º 1
0
 public static JsonObject TokenToJsonObject(IToken aToken)
 {
     try
     {
         Dictionary <string, object> lDictionary = aToken.GetDictionary();
         JsonObject lJson = new JsonObject();
         foreach (KeyValuePair <string, object> item in lDictionary)
         {
             lJson.Add(item.Key, item.Value);
         }
         return(lJson);
     }
     catch (Exception lEx)
     {
         if (mLog.IsErrorEnabled)
         {
             mLog.Error(lEx.Source + WebSocketMessage.SEPARATOR + lEx.Message);
         }
         return(null);
     }
 }
Ejemplo n.º 2
0
        public static IWebSocketPacket TokenToPacket(IToken aToken)
        {
            try
            {
                Dictionary <string, object> lDictionary = aToken.GetDictionary();
                JsonObject lJson = new JsonObject();

                foreach (KeyValuePair <string, object> item in lDictionary)
                {
                    lJson.Add(item.Key, ConvertObjectToJsonObject(item.Value));
                }
                Console.WriteLine(lJson.ToString());
                return(new WebSocketPacket(lJson.ToString()));
            }
            catch (Exception lEx)
            {
                if (mLog.IsErrorEnabled)
                {
                    mLog.Error(lEx.Source + WebSocketMessage.SEPARATOR + lEx.Message);
                }
                return(null);
            }
        }
Ejemplo n.º 3
0
        private void DictResponse(WebSocketTokenClient sender, TokenResponse e)
        {
            IToken lToken = e.TokenRecive;

            listBox1.Items.Add("Recived token [ type:" + lToken.GetType() + " - NS:" + lToken.GetNS() + " - utid:" + lToken.GetInt("utid") + " - data:" + lToken.GetDictionary("data") + " ]");
        }