/// <summary> /// Saves user settings /// </summary> /// <param name="changes">changes to be saved</param> public static void Save(LocalIDChanges changes) { String path = "ReplicationChanges.xml"; //if (!Directory.Exists(Path.GetDirectoryName(path))) // Directory.CreateDirectory(Path.GetDirectoryName(path)); var serializer = new XmlSerializer(typeof(LocalIDChanges)); using (var writer = new StreamWriter(path)) { serializer.Serialize(writer, changes); } }
/// <summary> /// Removes old entries from the list of changes /// </summary> /// <param name="changes">List of changes</param> /// <param name="AgeDays">Age in days of entries to remove</param> private static void RemoveOldEntries(LocalIDChanges changes, int AgeDays) { //remove any entries that are 1 week old for (int i = changes.Count - 1; i >= 0; i--) { UpdateLocalID update = changes[i]; TimeSpan span = DateTime.Now - update.CreateDate; if (span.Days > AgeDays) { changes.Remove(update); } } }
public void Save() { LastReplication = DateTime.Now; LocalIDChanges.Save(this); }