示例#1
0
 public CLSVData this[object key]
 {
     get
     {
         if (this.Value is CLSHashtable)
         {
             CLSHashtable hashtable = (CLSHashtable)this.Value;
             return(hashtable[key]);
         }
         return(new CLSVData(this, null));
     }
     set
     {
         if (this.Value is CLSHashtable)
         {
             CLSHashtable hashtable = (CLSHashtable)this.Value;
             hashtable[key] = value;
             if (!hashtable.ContainsKey(key) && (value != null))
             {
                 CLSVData data = value;
                 data.Parent    = this;
                 data.Container = this.Container;
             }
         }
     }
 }
示例#2
0
 private static CLSVData Helper_NS_GetChildObj(CLSHashtable cht, string type, string text)
 {
     if (type == "data")
     {
         return(Convert.FromBase64String(text));
     }
     if (type == "date")
     {
         return(DateTime.Parse(text));
     }
     if (type == "real")
     {
         return(decimal.Parse(text));
     }
     if (type == "integer")
     {
         return(int.Parse(text));
     }
     if (type == "string")
     {
         return(text);
     }
     if (type == "true")
     {
         return(1);
     }
     if (type != "false")
     {
         throw new Exception("该类别不能创建父对象");
     }
     return(0);
 }
示例#3
0
        private ReturnMsgDC ResolveD2(string rcstr)
        {
            int index = rcstr.IndexOf('|');
            int num2  = rcstr.IndexOf(',');

            if ((index == -1) && (num2 == -1))
            {
                return(new ReturnMsgDC(true, string.Empty, this.TryGetCode(rcstr)));
            }
            if ((index == -1) && (num2 != -1))
            {
                return(ResolveD2Compatible(rcstr));
            }
            int code = this.TryGetCode(rcstr.Substring(0, index));

            string[] strArray = rcstr.Remove(0, index + 1).Split("&=".ToCharArray());
            if ((strArray.Length % 2) != 0)
            {
                return(ResolveD2Compatible(rcstr));
            }
            CLSHashtable data = new CLSHashtable();

            for (int i = 0; i < strArray.Length; i += 2)
            {
                string str3 = strArray[i];
                string str4 = strArray[i + 1];
                data[str3] = str4;
            }
            return(new ReturnMsgDC(true, string.Empty, code, data));
        }
示例#4
0
        public CLSHashtable AddNodeCLSHashtable()
        {
            CLSHashtable hashtable = new CLSHashtable();

            base.Add(hashtable);
            return(hashtable);
        }
示例#5
0
        private void Convert_Bin_H2X_Hashtable(MemoryStream ms, Hashtable htb)
        {
            CLSHashtable hashtable = (htb is CLSHashtable) ? ((CLSHashtable)htb) : new CLSHashtable(htb);

            string[] keyArray = hashtable.KeyArray;
            foreach (string str in keyArray)
            {
                object obj2 = hashtable[str];
            }
        }
示例#6
0
 public void CopyTo(CLSHashtable cht_dst, params string[] keys)
 {
     foreach (string str in keys)
     {
         if (this.Has(str))
         {
             cht_dst.Set(str, this[str]);
         }
     }
 }
示例#7
0
 private static CLSVData Helper_NS_GetParentObj(CLSHashtable cht, XmlNode Node)
 {
     if (Node.Name == "dict")
     {
         return(new CLSVData(cht, new CLSHashtable()));
     }
     if (Node.Name != "array")
     {
         throw new Exception("该类别不能创建父对象");
     }
     return(new CLSVData(cht, new CLSArrayList()));
 }
示例#8
0
        public int AddDict(params object[] args)
        {
            if ((args.Length % 2) > 0)
            {
                return(-1);
            }
            CLSHashtable hashtable = new CLSHashtable();

            for (int i = 0; i < args.Length; i += 2)
            {
                hashtable.Add(args[i], args[i + 1]);
            }
            return(this.Add(hashtable));
        }
示例#9
0
        private static ArrayList Convert_H2A(CLSHashtable ht)
        {
            ArrayList list = new ArrayList();

            foreach (object obj2 in ht.Keys)
            {
                object obj3 = ht[obj2];
                if (Allow_H2A(obj3))
                {
                    list.Add(obj2);
                    list.Add(obj3);
                }
            }
            return(list);
        }
示例#10
0
        public CLSHashtable GetValueCLSHT(int index)
        {
            object       obj2     = this[index];
            CLSHashtable valueRaw = null;

            if ((obj2 is CLSVData) && (((CLSVData)obj2).ValueRaw is CLSHashtable))
            {
                valueRaw = (CLSHashtable)((CLSVData)obj2).ValueRaw;
            }
            if (obj2 is CLSHashtable)
            {
                valueRaw = (CLSHashtable)obj2;
            }
            return(valueRaw);
        }
示例#11
0
        private string GetJsonValueStr_CLSHashtable(CLSHashtable cht)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append("{");
            foreach (string str in cht.KeyArray)
            {
                builder.Append(this.GetJsonKeyName(str));
                builder.Append(":");
                builder.Append(this.GetJsonValueStr(cht[str]));
                builder.Append(",");
            }
            if (cht.KeyArray.Length > 0)
            {
                builder.Remove(builder.Length - 1, 1);
            }
            builder.Append("}");
            return(builder.ToString());
        }
示例#12
0
 public CLSVData(CLSHashtable cht, object value, bool convert)
 {
     if (Helper_CCDecimal(value))
     {
         this.Value    = Convert.ToDecimal(value);
         this.ValueRaw = value;
     }
     else
     {
         this.Value = value;
     }
     this.Container = cht;
     if (value is CLSHashtable)
     {
         ((CLSHashtable)value).Parent = this;
     }
     if ((convert && ((value is ArrayList) || (value is Hashtable))) && (this.Container != null))
     {
         this.Container.Convert_X2H_ForCollection(value);
     }
 }
示例#13
0
        private ReturnMsgDC ResolveD2Compatible(string rcstr)
        {
            rcstr = rcstr.Replace("\r\n", "\n");
            rcstr = rcstr.Replace("\r", "\n");
            string[] strArray = rcstr.Split(",\n".ToCharArray());
            int      code     = this.TryGetCode(strArray[0]);

            if (code < 0)
            {
                return(new ReturnMsgDC(false));
            }
            CLSHashtable data = new CLSHashtable();

            for (int i = 1; i < strArray.Length; i++)
            {
                string str  = string.Format("item{0}", i);
                string str2 = strArray[i];
                data[str] = str2;
            }
            return(new ReturnMsgDC(true, string.Empty, code, data));
        }
示例#14
0
 public CLSVData(CLSHashtable cht, object value) : this(cht, value, true)
 {
     this.Parent = cht;
 }
示例#15
0
 public CLSArrayList()
 {
     this.cht          = new CLSHashtable();
     this.m_filename   = "";
     this.cht["array"] = this;
 }
示例#16
0
 public CLSArrayList(ICollection c) : base(c)
 {
     this.cht          = new CLSHashtable();
     this.m_filename   = "";
     this.cht["array"] = this;
 }
示例#17
0
 public ReturnMsgDC(bool isSucceed, string message, int code, CLSHashtable CHT_DC) : base(isSucceed, message, code)
 {
     this.CHT_DC = CHT_DC;
 }
示例#18
0
 private static CLSVData Helper_NS_GetChildObj(CLSHashtable cht, XmlNode Node)
 {
     return(Helper_NS_GetChildObj(cht, Node.Name, Node.InnerText));
 }
示例#19
0
        private static void Func_ParseNode(CLSHashtable cht, XmlNodeList Nodes, object opt)
        {
            foreach (XmlNode node in Nodes)
            {
                string str = ((node.Attributes == null) || (node.Attributes["type"] == null)) ? "" : node.Attributes["type"].Value;
                string key = null;
                if (cht.KeyRule == 2)
                {
                    string str3 = ((node.Attributes == null) || (node.Attributes["N"] == null)) ? "" : node.Attributes["N"].Value;
                    if (((str3 == "") && Helper_WishName(node)) && !(opt is ArrayList))
                    {
                        continue;
                    }
                    if (Helper_WishName(node))
                    {
                        key = str3;
                    }
                }
                else
                {
                    if (cht.KeyRule != 1)
                    {
                        throw new Exception("Key Rule Error");
                    }
                    key = node.Name.StartsWith("K_") ? node.Name.Remove(0, 2) : node.Name;
                }
                if (str != "")
                {
                    switch (str)
                    {
                    case "al":
                    {
                        CLSArrayList list = new CLSArrayList();
                        Func_ParseNode(cht, node.ChildNodes, list);
                        if (opt is CLSHashtable)
                        {
                            ((CLSHashtable)opt).Add(key, list);
                        }
                        else if (opt is Hashtable)
                        {
                            ((Hashtable)opt).Add(key, list);
                        }
                        else if (opt is ArrayList)
                        {
                            ((ArrayList)opt).Add(list);
                        }
                        goto Label_02B9;
                    }

                    case "ht":
                    {
                        CLSHashtable hashtable = new CLSHashtable();
                        Func_ParseNode(cht, node.ChildNodes, hashtable);
                        if (opt is CLSHashtable)
                        {
                            ((CLSHashtable)opt).Add(key, hashtable);
                            goto Label_02B9;
                        }
                        if (opt is Hashtable)
                        {
                            ((Hashtable)opt).Add(key, hashtable);
                        }
                        else if (opt is ArrayList)
                        {
                            ((ArrayList)opt).Add(hashtable);
                        }
                        break;
                    }
                    }
                    Label_02B9 :;
                }
                else if (opt is ArrayList)
                {
                    ((ArrayList)opt).Add(node.InnerText);
                }
                else if (opt is CLSHashtable)
                {
                    ((CLSHashtable)opt).Add(key, node.InnerText, true);
                }
                else if (opt is Hashtable)
                {
                    ((Hashtable)opt).Add(key, node.InnerText);
                }
            }
        }
示例#20
0
        private static void Func_NS_ParseNode(CLSHashtable cht, bool isroot, XmlNode node, CLSVData clsvopt)
        {
            string name = node.Name;

            if (Helper_NS_IsParent(node))
            {
                string str2 = name;
                if (!(str2 == "dict"))
                {
                    if (str2 == "array")
                    {
                        if (isroot)
                        {
                            cht["array"] = new CLSArrayList();
                            clsvopt      = cht["array"];
                        }
                        for (int i = 0; i < node.ChildNodes.Count; i++)
                        {
                            XmlNode node4 = node.ChildNodes[i];
                            if (Helper_NS_IsParent(node4))
                            {
                                CLSVData data3 = Helper_NS_GetParentObj(cht, node4);
                                clsvopt.ValueCLSArrayList.Add(data3.ValueRaw);
                                Func_NS_ParseNode(cht, false, node4, data3);
                            }
                            else
                            {
                                CLSVData data4 = Helper_NS_GetChildObj(cht, node4);
                                clsvopt.ValueCLSArrayList.Add(data4.ValueRaw);
                            }
                        }
                    }
                }
                else if ((node.ChildNodes.Count != 0) && ((node.ChildNodes.Count % 2) <= 0))
                {
                    for (int j = 0; j < node.ChildNodes.Count; j += 2)
                    {
                        XmlNode node2 = node.ChildNodes[j];
                        XmlNode node3 = node.ChildNodes[j + 1];
                        if (node2.Name == "key")
                        {
                            if (Helper_NS_IsParent(node3))
                            {
                                CLSVData data = Helper_NS_GetParentObj(cht, node3);
                                if (isroot)
                                {
                                    cht[node2.InnerText] = data;
                                }
                                else
                                {
                                    clsvopt[node2.InnerText] = data;
                                }
                                Func_NS_ParseNode(cht, false, node3, data);
                            }
                            else
                            {
                                CLSVData data2 = Helper_NS_GetChildObj(cht, node3);
                                if (isroot)
                                {
                                    cht[node2.InnerText] = data2;
                                }
                                else
                                {
                                    clsvopt[node2.InnerText] = data2;
                                }
                            }
                        }
                    }
                }
            }
        }
示例#21
0
 public ReturnMsgDC(bool isSucceed) : base(isSucceed, string.Empty, -9999)
 {
     this.CHT_DC = new CLSHashtable();
 }