public static void ReadRecentWatchedFromConfig() { if (!File.Exists("RecentWatch")) { return; } RecentWatched = new RecentWatchedConfig("").Read(); }
public static void ClearDateBefore(DateTime dateTime) { if (!File.Exists("RecentWatch")) { return; } RecentWatchedConfig recentWatchedConfig = new RecentWatchedConfig(); for (int i = 1; i < 60; i++) { DateTime date = dateTime.AddDays(-1 * i); recentWatchedConfig.Remove(date); } }
public static void SaveRecentWatched() { foreach (var keyValuePair in RecentWatched) { if (keyValuePair.Key <= DateTime.Now && keyValuePair.Key >= DateTime.Now.AddDays(-1 * Properties.Settings.Default.RecentDays)) { if (keyValuePair.Value.Count > 0) { List <string> IDs = keyValuePair.Value.Where(arg => !string.IsNullOrEmpty(arg)).ToList(); string date = keyValuePair.Key.Date.ToString("yyyy-MM-dd"); RecentWatchedConfig recentWatchedConfig = new RecentWatchedConfig(date); recentWatchedConfig.Save(IDs); } } } }
public static void SaveRecentWatchedToConfig(string date, List <string> IDs) { RecentWatchedConfig recentWatchedConfig = new RecentWatchedConfig(date); recentWatchedConfig.Save(IDs); }