Exemplo n.º 1
0
        public override bool Decoding(byte[] bytes)
        {
            if (((bytes != null) && (bytes.Length > 0)) && bytes[0].ToString().Equals("48"))
            {
                return(false);
            }
            bool            flag   = true;
            IndicatorEntity entity = null;

            try
            {
                entity = JSONHelper.DeserializeObject <IndicatorEntity>(Encoding.UTF8.GetString(bytes));
                IndicatorDataCore.SetIndicatorEntity(this._categoryCode, entity);
            }
            catch (Exception exception)
            {
                //LogUtility.LogMessage("获取指标实体解包失败," + exception.ToString());
                flag = false;
            }
            return(flag);
        }
Exemplo n.º 2
0
 public override bool Decoding(byte[] bytes)
 {
     if (((bytes != null) && (bytes.Length > 0)) && bytes[0].ToString().Equals("48"))
     {
         return(false);
     }
     try
     {
         String   str        = Encoding.UTF8.GetString(bytes);
         int      index      = str.IndexOf('|');
         String   str2       = str.Substring(0, index);
         String   str3       = str.Substring(index + 1);
         String[] strArray   = str2.Split(new String[] { "," }, StringSplitOptions.RemoveEmptyEntries);
         int      startIndex = 0;
         if ((strArray != null) && (strArray.Length > 0))
         {
             for (int i = 0; i < strArray.Length; i++)
             {
                 if ((i % 2) == 0)
                 {
                     int    length       = Convert.ToInt32(strArray[i]);
                     String categoryCode = str3.Substring(startIndex, length);
                     startIndex += length;
                     int    num5 = Convert.ToInt32(strArray[i + 1]);
                     String str5 = str3.Substring(startIndex, num5);
                     startIndex += num5;
                     IndicatorEntity entity = JSONHelper.DeserializeObject <IndicatorEntity>(str5);
                     this.IndicatorEntityDict[categoryCode] = entity;
                     IndicatorDataCore.SetIndicatorEntity(categoryCode, entity);
                 }
             }
         }
         return(true);
     }
     catch (Exception exception)
     {
         //LogUtility.LogMessage("获取指标实体List解包失败," + exception.Message + exception.StackTrace);
         return(false);
     }
 }