Beispiel #1
0
 public LoopCollection CollectLoops()
 {
     InitDB();
     LoopCollection lc = new LoopCollection();
     lc.LoadAll();
     return lc;
 }
Beispiel #2
0
 public Loop CollectThisLoop(string loopName)
 {
     try
     {
         InitDB();
         Loop lc = new Loop();
         LoopCollection lcollection = new LoopCollection();
         lcollection.Query.Where(lcollection.Query.Name.Equal(loopName));
         lcollection.Query.Load();
         foreach (Loop item in lcollection)
         {
             Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"Collecting Loop:" + item.Name);
             lc = item;
             break;
         }
         return lc;
     }
     catch (Exception ex)
     {
         Console.WriteLine(DateTime.Now.ToShortTimeString()+"  "+"COLLECTING LOOP:"+ex.Message);
         return null;
     }
 }
Beispiel #3
0
 private void SerializeLoopCollection()
 {
     try
     {
         string FileName = @"c:\content\media\xml\loops.xml";
         LoopCollection loopCollection = new LoopCollection();
         loopCollection.LoadAll();
         Loop[] arrayOfLoop = loopCollection.ToArray();
         using (FileStream fs = new FileStream(FileName, FileMode.Create))
         {
             XmlSerializer ser = new XmlSerializer(typeof(Loop[]));
             ser.Serialize(fs, arrayOfLoop);
             fs.Flush();
             fs.Close();
         }
     }
     catch (Exception ex)
     {
     }
 }