Esempio n. 1
0
 public virtual HashJson Concat(HashJson json)
 {
     foreach (DictionaryEntry de in json)
     {
         this.Add(de.Key, de.Value);
     }
     return(this);
 }
Esempio n. 2
0
        public HashJson(string jsonStr) : base()
        {
            HashJson json = HashJson.Parse(jsonStr);

            foreach (DictionaryEntry de in json)
            {
                this.Add(de.Key, de.Value);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 创建HashJson的副本
        /// </summary>
        /// <returns></returns>
        public virtual HashJson CloneBase()
        {
            HashJson hJson = new HashJson();

            lock (this)
            {
                foreach (DictionaryEntry dic in this)
                {
                    hJson.Add(dic.Key, dic.Value);
                }
                return(hJson);
            }
        }
Esempio n. 4
0
        public virtual HashJson AryToHashJson(string [,] args)
        {
            HashJson _json = new HashJson();

            try{
                for (int i = 0; i < args.Length; i++)
                {
                    _json.Add(args[i, 0], args[i, 1]);
                }
            }catch (Exception e) {
                _json["ERROR"] = e.Message;
            }
            return(_json);
        }
Esempio n. 5
0
        public static HashJson Parse(string jsonStr)
        {
            HashJson _json = new HashJson();

            try
            {
                JObject obj = JObject.Parse(jsonStr);
                JEnumerable <JToken> _children = obj.Children();
                foreach (JProperty field in _children)
                {
                    string name  = field.Name;
                    string value = field.Value.ToString();
                    _json.Add(name, value);
                }
            }
            catch (Exception)
            {
            }
            return(_json);
        }