/// <summary> /// Ensure the receive reports memo file doesn't grow indefinitely /// High thread contention? /// </summary> void ForgetOldReports() { // Recreate the dictionary with only recent reports ReceivedReports = new ReportsDict ( from Item in ReceivedReports where Item.Value.AddDays(DaysToRememberReportsFor) > DateTime.Now select Item ); }
/// <summary> /// Load a list of received reports from disk /// </summary> void ReadMemorizedReceivedReports() { var MemoPath = Path.Combine(Directory, MemoFilename); try { ReceivedReports = new ReportsDict ( from element in XElement.Load(MemoPath).Descendants() select new KeyValuePair <string, DateTime>(element.Value.ToString(), DateTime.Parse(element.Attribute("time").Value)) ); } catch (Exception) { // Not an error: the file isn't there the first time } }
/// <summary> /// Ensure the receive reports memo file doesn't grow indefinitely /// High thread contention? /// </summary> void ForgetOldReports() { // Recreate the dictionary with only recent reports ReceivedReports = new ReportsDict ( from Item in ReceivedReports where Item.Value.AddDays(DaysToRememberReportsFor) > DateTime.Now select Item ); }
/// <summary> /// Load a list of received reports from disk /// </summary> void ReadMemorizedReceivedReports() { var MemoPath = Path.Combine(Directory, MemoFilename); try { ReceivedReports = new ReportsDict ( from element in XElement.Load(MemoPath).Descendants() select new KeyValuePair<string, DateTime>(element.Value.ToString(), DateTime.Parse(element.Attribute("time").Value)) ); } catch (Exception) { // Not an error: the file isn't there the first time } }