コード例 #1
0
ファイル: Scheduler.cs プロジェクト: lxinghe/681project4
 public Scheduler(DBEngine<int, DBElement<int, string>> db)
 {
     schedular.Interval = 1000; // save interval is 1 second
     schedular.AutoReset = true;
     schedular.Elapsed += (object source, ElapsedEventArgs e) =>
     {
         PersistToXML toxml = new PersistToXML(db);
         Console.Write("\n  myDBXml.xml was saved at {0}", e.SignalTime);
         toxml.writeXML("myDBXml.xml");
     };
 }
コード例 #2
0
ファイル: TestExec.cs プロジェクト: lxinghe/681project4
    void TestR5()
    {
      "Demonstrating Requirement #5".title();
	  DBElement<int, string> elem2 = new DBElement<int, string>();
      elem2.name = "element#2";//add a new key/value pairs
      elem2.descr = "test element#2";
      elem2.timeStamp = DateTime.Now;
      elem2.children.AddRange(new List<int>{ 16, 48 });
      elem2.payload = "elem#2's payload";
      db.insert(7, elem2);
	 
	  PersistToXML toxml  = new PersistToXML(db);
	  toxml.writeXML("Test.xml");
	  toxml.displayXML();
	  toxml.cleanDB();
	  
	  Write("\n --- Test read XML file Start---");
      LoadXML fromxml = new LoadXML(db, "ReadFile.xml");
	  fromxml.WriteToDBEngine();
	  
	  Write("\n\n Show key/value pairs in data base:\n");
      db.showDB();
	  
	  Write("\n --- Test read XML file End---");
      WriteLine();
    }
コード例 #3
0
ファイル: Server.cs プロジェクト: lxinghe/681project4
	public void persistDB(XDocument message){//method used to persist a database to xml file
		XElement element = message.Element("Message").Element("File");
		PersistToXML toxml  = new PersistToXML(db);
		toxml.writeXML(element.Value);
		//toxml.displayXML();
		toxml.cleanDB();
	}