コード例 #1
0
        public static DealHeader GetJson(this DealHeader thdr, ref object fromarray)
        {
            try
            {
                DealHeader trs = null;
                if (fromarray is String)
                {
                    trs = thdr.GetJsonObject((String)fromarray)["DealHeader"];
                }
                else
                {
                    byte[]        _fromarray = (byte[])fromarray;
                    StringBuilder sb         = new StringBuilder();

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

                    fromarray  = null;
                    _fromarray = null;
                    sb         = null;
                }
                return(trs);
            }
            catch (Exception ex)
            {
                return(null);
            }
        }
コード例 #2
0
 public static DealHeader GetJson(this DealHeader thdr, string jsonstring)
 {
     try
     {
         DealHeader trs = thdr.GetJsonObject(jsonstring)["DealHeader"];
         return(trs);
     }
     catch (Exception ex)
     {
         return(null);
     }
 }
コード例 #3
0
 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);
     }
 }
コード例 #4
0
 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);
     }
 }