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

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

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

                _fromarray = null;
                sb         = null;
                return(trs);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
Exemple #4
0
 /// <summary>
 /// The GetJson.
 /// </summary>
 /// <param name="thdr">The thdr<see cref="DealHeader"/>.</param>
 /// <param name="fromstream">The fromstream<see cref="Stream"/>.</param>
 /// <returns>The <see cref="DealHeader"/>.</returns>
 public static DealHeader GetJson(this DealHeader thdr, 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.Select(b => (char)b).ToArray());
         }
         DealHeader trs = thdr.GetJsonObject(sb.ToString())["DealHeader"];
         sb = null;
         fromstream.Dispose();
         return(trs);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }