/// <summary>Save data fetched from the wiki compatibility list.</summary> /// <param name="stableVersion">The current stable Stardew Valley version.</param> /// <param name="betaVersion">The current beta Stardew Valley version.</param> /// <param name="mods">The mod data.</param> /// <param name="cachedMetadata">The stored metadata record.</param> /// <param name="cachedMods">The stored mod records.</param> public void SaveWikiData(string stableVersion, string betaVersion, IEnumerable <WikiModEntry> mods, out CachedWikiMetadata cachedMetadata, out CachedWikiMod[] cachedMods) { cachedMetadata = new CachedWikiMetadata(stableVersion, betaVersion); cachedMods = mods.Select(mod => new CachedWikiMod(mod)).ToArray(); this.Mods.DeleteMany("{}"); this.Mods.InsertMany(cachedMods); this.Metadata.DeleteMany("{}"); this.Metadata.InsertOne(cachedMetadata); }
/// <summary>Save data fetched from the wiki compatibility list.</summary> /// <param name="stableVersion">The current stable Stardew Valley version.</param> /// <param name="betaVersion">The current beta Stardew Valley version.</param> /// <param name="mods">The mod data.</param> /// <param name="cachedMetadata">The stored metadata record.</param> /// <param name="cachedMods">The stored mod records.</param> public void SaveWikiData(string stableVersion, string betaVersion, IEnumerable <WikiModEntry> mods, out CachedWikiMetadata cachedMetadata, out CachedWikiMod[] cachedMods) { this.Metadata = cachedMetadata = new CachedWikiMetadata(stableVersion, betaVersion); this.Mods = cachedMods = mods.Select(mod => new CachedWikiMod(mod)).ToArray(); }
/// <summary>Get the cached wiki metadata.</summary> /// <param name="metadata">The fetched metadata.</param> public bool TryGetWikiMetadata(out CachedWikiMetadata metadata) { metadata = this.Metadata.Find("{}").FirstOrDefault(); return(metadata != null); }
/********* ** Public methods *********/ /// <summary>Get the cached wiki metadata.</summary> /// <param name="metadata">The fetched metadata.</param> public bool TryGetWikiMetadata(out CachedWikiMetadata metadata) { metadata = this.Metadata; return(metadata != null); }