Пример #1
0
 /// <summary>
 /// The GetJson.
 /// </summary>
 /// <param name="tmsg">The tmsg<see cref="DealMessage"/>.</param>
 /// <param name="jsonstring">The jsonstring<see cref="string"/>.</param>
 /// <returns>The <see cref="DealMessage"/>.</returns>
 public static DealMessage GetJson(this DealMessage tmsg, string jsonstring)
 {
     try
     {
         DealMessage trs = tmsg.GetJsonObject(jsonstring)["DealMessage"];
         return(trs);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Пример #2
0
 /// <summary>
 /// The GetJson.
 /// </summary>
 /// <param name="tmsg">The tmsg<see cref="DealMessage"/>.</param>
 /// <param name="stringbuilder">The stringbuilder<see cref="StringBuilder"/>.</param>
 /// <returns>The <see cref="DealMessage"/>.</returns>
 public static DealMessage GetJson(this DealMessage tmsg, StringBuilder stringbuilder)
 {
     try
     {
         StringBuilder sb  = stringbuilder;
         DealMessage   trs = tmsg.GetJsonObject(sb.ToString())["DealMessage"];
         return(trs);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
Пример #3
0
        /// <summary>
        /// The GetJson.
        /// </summary>
        /// <param name="tmsg">The tmsg<see cref="DealMessage"/>.</param>
        /// <param name="buffer">The buffer<see cref="ISerialBuffer"/>.</param>
        /// <returns>The <see cref="DealMessage"/>.</returns>
        public static DealMessage GetJson(this DealMessage tmsg, ISerialBuffer buffer)
        {
            try
            {
                DealMessage trs = null;

                byte[]        _fromarray = buffer.DeserialBlock;
                StringBuilder sb         = new StringBuilder();

                sb.Append(_fromarray.ToChars(CharEncoding.UTF8));
                trs = tmsg.GetJsonObject(sb.ToString())["DealMessage"];

                _fromarray = null;
                sb         = null;
                return(trs);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Пример #4
0
 /// <summary>
 /// The GetJson.
 /// </summary>
 /// <param name="tmsg">The tmsg<see cref="DealMessage"/>.</param>
 /// <param name="fromstream">The fromstream<see cref="Stream"/>.</param>
 /// <returns>The <see cref="DealMessage"/>.</returns>
 public static DealMessage GetJson(this DealMessage tmsg, Stream fromstream)
 {
     try
     {
         fromstream.Position = 0;
         byte[]        array = new byte[4096];
         int           read  = 0;
         StringBuilder sb    = new StringBuilder();
         while ((read = fromstream.Read(array, 0, array.Length)) > 0)
         {
             sb.Append(array.Cast <char>());
         }
         DealMessage trs = tmsg.GetJsonObject(sb.ToString())["DealMessage"];
         sb = null;
         fromstream.Dispose();
         return(trs);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }