using System; using System.Collections.Generic; using System.Collections.ObjectModel; using MediaBrowser.Model.Plugins; namespace ConfusedPolarBear.Plugin.IntroSkipper.Configuration; /// /// Plugin configuration. /// public class PluginConfiguration : BasePluginConfiguration { /// /// Initializes a new instance of the class. /// public PluginConfiguration() { AnalysisResults = new Collection(); } /// /// Save timestamps to disk. /// public void SaveTimestamps() { AnalysisResults.Clear(); foreach (var intro in Plugin.Instance!.Intros) { AnalysisResults.Add(intro.Value); } Plugin.Instance!.SaveConfiguration(); } /// /// Restore previous analysis results from disk. /// public void RestoreTimestamps() { // Since dictionaries can't be easily serialized, analysis results are stored on disk as a list. foreach (var intro in AnalysisResults) { Plugin.Instance!.Intros[intro.EpisodeId] = intro; } } /// /// Previous analysis results. /// public Collection AnalysisResults { get; private set; } }