Example #1
0
        public DataSafe(string path, string name)
        {
            Ints = new IntGetter(this);
            Longs = new LongGetter(this);
            Bools = new BoolGetter(this);
            Strings = new StringGetter(this);
            Doubles = new DoubleGetter(this);

            path = path + Path.DirectorySeparatorChar + name;
            if(!path.EndsWith(".xml",true,System.Globalization.CultureInfo.CurrentCulture))
                path +=".xml";

            this.path = path;
            this.names = new HashSet<string>();
            if (!File.Exists(path))
            {
                data = new XElement(name);
                data.Save(path);
            }
            else
            {
                data = XElement.Load(path);
                foreach (XElement elem in data.Descendants())
                {
                    names.Add(elem.Name.ToString());
                }
            }
        }
Example #2
0
        public DataSafe(string path, string name)
        {
            Ints    = new IntGetter(this);
            Longs   = new LongGetter(this);
            Bools   = new BoolGetter(this);
            Strings = new StringGetter(this);
            Doubles = new DoubleGetter(this);


            path = path + Path.DirectorySeparatorChar + name;
            if (!path.EndsWith(".xml", true, System.Globalization.CultureInfo.CurrentCulture))
            {
                path += ".xml";
            }

            this.path  = path;
            this.names = new HashSet <string>();
            if (!File.Exists(path))
            {
                data = new XElement(name);
                data.Save(path);
            }
            else
            {
                data = XElement.Load(path);
                foreach (XElement elem in data.Descendants())
                {
                    names.Add(elem.Name.ToString());
                }
            }
        }