- Timestamp:
- 06/04/09 18:04:01 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/sources/HeuristicLab.Hive.Client.Core/3.2/ConfigurationManager/UptimeManager.cs
r2010 r2011 4 4 using System.Text; 5 5 using Calendar; 6 using System.Xml.Serialization; 7 using System.IO; 6 8 7 9 namespace HeuristicLab.Hive.Client.Core.ConfigurationManager { … … 9 11 10 12 public List<Appointment> Appointments { get; set; } 13 private static String path = System.IO.Directory.GetCurrentDirectory()+"\\plugins\\Hive.Client.Jobs\\"; 11 14 12 15 private static UptimeManager instance = null; … … 20 23 } 21 24 22 25 private void PersistToHDD() { 26 XmlSerializer s = new XmlSerializer(typeof(List<Appointment>)); 27 using (TextWriter w = new StreamWriter(path + "calendar.xml")) { 28 s.Serialize(w, Appointments); 29 } 30 } 31 32 private void RestoreFromHDD() { 33 XmlSerializer s = new XmlSerializer(typeof(List<Appointment>)); 34 using (TextReader r = new StreamReader(path + "calendar.xml")) { 35 Appointments = (List<Appointment>)s.Deserialize(r); 36 } 37 } 38 39 public bool isOnline(DateTime time) { 40 foreach (Appointment app in Appointments) 41 if ((time >= app.StartDate) && 42 (time <= app.EndDate)) 43 return true; 44 return false; 45 } 23 46 } 24 47 }
Note: See TracChangeset
for help on using the changeset viewer.