Example #1
0
        public void Set(string id, VariousTable val)
        {
            Element e;

            CreateElement(id, enumVariousElement.Table, out e);
            e.Value = val;
        }
Example #2
0
        public bool TryGetListString(string id, out List <string> res)
        {
            res = null;
            Element e;

            if (!AccessElement(id, enumVariousElement.Table, out e))
            {
                return(false);
            }

            VariousTable t = (VariousTable)e.Value;
            int          count;

            if (!t.TryGetInt("Count", out count))
            {
                return(false);
            }
            res = new List <string>();
            for (int i = 0; i < count; i++)
            {
                string v;
                if (!t.TryGetString(i.ToString(), out v))
                {
                    return(false);
                }
                res.Add(v);
            }
            return(true);
        }
Example #3
0
        public bool TryGetClassList <T>(string id, out List <T> res) where T : class, IVariousTableElement, new()
        {
            res = null;
            Element e;

            if (!AccessElement(id, enumVariousElement.Table, out e))
            {
                return(false);
            }

            VariousTable t = (VariousTable)e.Value;
            int          count;

            if (!t.TryGetInt("Count", out count))
            {
                return(false);
            }
            res = new List <T>();
            for (int i = 0; i < count; i++)
            {
                T v;
                if (!t.TryGetClass(i.ToString(), out v))
                {
                    return(false);
                }
                res.Add(v);
            }
            return(true);
        }
Example #4
0
        public bool TryGetTable(string id, out VariousTable res)
        {
            res = null;
            Element e;

            if (!AccessElement(id, enumVariousElement.Table, out e))
            {
                return(false);
            }
            res = (VariousTable)e.Value;
            return(true);
        }
Example #5
0
        public VariousTable Clone()
        {
            using (System.IO.MemoryStream mem = new MemoryStream())
            {
                this.Write(mem);
                mem.Seek(0, SeekOrigin.Begin);

                VariousTable vt = new VariousTable();
                vt.Read(mem);

                return(vt);
            }
        }
Example #6
0
        public void SetList <T>(string id, IEnumerable <T> val) where T : class, IVariousTableElement, new()
        {
            Element e;

            CreateElement(id, enumVariousElement.Table, out e);
            VariousTable subTable = new VariousTable();

            e.Value = subTable;

            int c = 0;

            foreach (var el in val)
            {
                subTable.Set(c.ToString(), el);
                c++;
            }
            subTable.Set("Count", c);
        }