private string pathnameLOS = ""; // they can be reused later. static void Main(string[] args) { PersistEngine pe = new PersistEngine(); TEST_PERSISTENGINE pet = new TEST_PERSISTENGINE(); DBEngine <int, DBElement <int, string> > db = new DBEngine <int, DBElement <int, string> >(); DBEngine <string, DBElement <string, List <string> > > dbLOS = new DBEngine <string, DBElement <string, List <string> > >(); DBElement <int, string> elem = new DBElement <int, string>(); DBElement <string, List <string> > elemLOS = new DBElement <string, List <string> >(); //Adding DBElement<int, string> elem.name = "name"; elem.descr = "descr"; elem.timeStamp = DateTime.Now; elem.children.AddRange(new List <int>() { 1, 2, 3 }); elem.payload = "hello"; db.insert(0, elem); DBElement <int, string> elem1 = new DBElement <int, string>(); elem1.name = "name1"; elem1.descr = "descr1"; elem1.children.AddRange(new List <int>() { 1, 2, 3 }); elem1.timeStamp = DateTime.Now; elem1.payload = "hello1"; db.insert(1, elem1); //Adding DBElement<string, List<string>> elemLOS.name = "name2"; elemLOS.descr = "descr2"; elem.timeStamp = DateTime.Now; elemLOS.payload = new List <string>() { "hello", "world" }; dbLOS.insert("Two", elemLOS); elemLOS = new DBElement <string, List <string> >(); elemLOS.name = "name3"; elemLOS.descr = "descr3"; elemLOS.timeStamp = DateTime.Now; elemLOS.children.AddRange(new List <string>() { "One", "Two", "Three" }); elemLOS.payload = new List <string>() { "fee", "foo", "bar" }; dbLOS.insert("Three", elemLOS); pe.XMLWrite(db, out pet.pathname); pe.XMLWriteLOS(dbLOS, out pet.pathnameLOS); WriteLine("\n{0}", XDocument.Load(pet.pathname).ToString()); WriteLine("\n{0}", XDocument.Load(pet.pathnameLOS).ToString()); pe.XMLRestore("../../xmlRestore.xml", db); db.show <int, DBElement <int, string>, string>(); pe.XMLRestoreLOS("../../xmlRestoreLOS.xml", dbLOS); dbLOS.show <string, DBElement <string, List <string> >, List <string>, string>(); }
private string pathnameLOS = ""; // they can be reused later. static void Main(string[] args) { PersistEngine pe = new PersistEngine(); TEST_PERSISTENGINE pet = new TEST_PERSISTENGINE(); DBEngine<int, DBElement<int, string>> db = new DBEngine<int, DBElement<int, string>>(); DBEngine<string, DBElement<string, List<string>>> dbLOS = new DBEngine<string, DBElement<string, List<string>>>(); DBElement<int, string> elem = new DBElement<int, string>(); DBElement<string, List<string>> elemLOS = new DBElement<string, List<string>>(); //Adding DBElement<int, string> elem.name = "name"; elem.descr = "descr"; elem.timeStamp = DateTime.Now; elem.children.AddRange(new List<int>() { 1, 2, 3 }); elem.payload = "hello"; db.insert(0, elem); DBElement<int, string> elem1 = new DBElement<int, string>(); elem1.name = "name1"; elem1.descr = "descr1"; elem1.children.AddRange(new List<int>() { 1, 2, 3 }); elem1.timeStamp = DateTime.Now; elem1.payload = "hello1"; db.insert(1, elem1); //Adding DBElement<string, List<string>> elemLOS.name = "name2"; elemLOS.descr = "descr2"; elem.timeStamp = DateTime.Now; elemLOS.payload = new List<string>() { "hello", "world" }; dbLOS.insert("Two", elemLOS); elemLOS = new DBElement<string, List<string>>(); elemLOS.name = "name3"; elemLOS.descr = "descr3"; elemLOS.timeStamp = DateTime.Now; elemLOS.children.AddRange(new List<string>() { "One", "Two", "Three" }); elemLOS.payload = new List<string>() { "fee", "foo", "bar" }; dbLOS.insert("Three", elemLOS); pe.XMLWrite(db, out pet.pathname); pe.XMLWriteLOS(dbLOS, out pet.pathnameLOS); WriteLine("\n{0}", XDocument.Load(pet.pathname).ToString()); WriteLine("\n{0}", XDocument.Load(pet.pathnameLOS).ToString()); pe.XMLRestore("../../xmlRestore.xml", db); db.show<int, DBElement<int, string>, string>(); pe.XMLRestoreLOS("../../xmlRestoreLOS.xml", dbLOS); dbLOS.show<string, DBElement<string, List<string>>, List<string>, string>(); }