Пример #1
0
        private void GetDataFromXmlStorage()
        {
            Debug.Log(XmlStorage.GetInt("integer", 0));
            Debug.Log(XmlStorage.GetFloat("float", 0f));
            Debug.Log(XmlStorage.Get <ExampleController.Test>("TestClass", null));
            Debug.Log(XmlStorage.Get <ExampleController.Test>("TestClass", null).str);
            Debug.Log(XmlStorage.Get <ExampleController.Test>("TestClass", null).list1.First());
            Debug.Log(XmlStorage.Get <ExampleController.Test>("TestClass", null).list1.Last());

            Debug.Log("");

            Debug.Log(XmlStorage.GetInt("del_tes1"));
            Debug.Log(XmlStorage.GetString("del_tes1"));

            Debug.Log("");

            Debug.Log(XmlStorage.GetInt("del_tes2"));
            Debug.Log(XmlStorage.GetString("del_tes2"));

            Debug.Log("");

            Debug.Log(XmlStorage.Get <string>("address"));

            Debug.Log("");

            Debug.Log(XmlStorage.Get("vec2", Vector2.zero));
            Debug.Log(XmlStorage.Get("vec3", Vector3.zero));
            Debug.Log(XmlStorage.Get("qua", Quaternion.identity).eulerAngles);

            Debug.Log("");
            Debug.Log("");
        }
Пример #2
0
        public static void Main(String[] args)
        {
            IStorage storage = new XmlStorage(AppName);

            storage.SetInt("a", 7);
            storage.SetInt("a", 15);
            storage.Set("b", "yuhuueo");
            storage.SetFloat("c", (Single)14.6d);
            storage.SetFloat("b", (Single)14.6d);
            storage.SetFloat("d", (Single)46.89865m);
            storage.Set("b", "arererere");
            storage.SetInt("e", (Int32)23L);
            storage.SetInt("f", 255_879_886);
            storage.SetDatetime("i", DateTime.Now);
            storage.SetTimespan("j", new TimeSpan(5, 3, 20, 40));

            String path    = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "storage.xml");
            String content = File.ReadAllText(path);
            var    xmlDoc  = new XmlDocument();

            xmlDoc.LoadXml(content);

            dynamic  readValue = new ExpandoObject();
            IStorage storage2  = new XmlStorage(path, AppName);

            readValue.A = storage2.GetInt("a");
            readValue.B = storage2.GetInt("b");
            readValue.C = storage2.GetFloat("c");
            readValue.D = storage2.GetFloat("d");
            readValue.E = storage2.GetInt("e");
            readValue.F = storage2.GetInt("f");
            readValue.I = storage2.GetDatetime("i");
            readValue.J = storage2.GetTimespan("j");

            System.Console.ReadLine();
        }