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(); }
private void SetData2XmlStorage(int value) { XmlStorage.SetInt("integer", value); XmlStorage.SetFloat("float", 1.111f); XmlStorage.Set("TestClass", this.test); XmlStorage.SetInt("del_tes1", 2); XmlStorage.SetString("del_tes1", "del_tes1"); XmlStorage.DeleteKey("del_tes1"); XmlStorage.SetInt("del_tes2", 5); XmlStorage.SetString("del_tes2", "del_tes2"); XmlStorage.DeleteKey("del_tes2", typeof(int)); var address = "*****@*****.**"; XmlStorage.SetString("address", address); XmlStorage.Set("vec2", this.vec2); XmlStorage.Set("vec3", this.vec3); XmlStorage.Set("qua", this.qua); }