public IEnumerable <FishingContent> Reload() { // Load content packs foreach (var pack in this.helper.ContentPacks.GetOwned()) { // Create content source var content = new FishingContent(pack.Manifest); var isNewPack = false; var warnedObsolete = false; // Content if (this.TryRead <FishingContentPack>(pack, "content.json", out var contentPack)) { content = contentPack.AddTo(content, string.Empty, pack, this.jsonProvider, this.monitor); isNewPack = true; } // Fish traits // TODO: Remove this when compatibility with the old content pack system is no longer needed if (!isNewPack && this.TryRead <FishTraitsPack>(pack, "fishTraits.json", out var fishTraits)) { content = fishTraits.AddTo(content); this.WarnObsolete(ref warnedObsolete, pack.Manifest.UniqueID); } // Fish // TODO: Remove this when compatibility with the old content pack system is no longer needed if (!isNewPack && this.TryRead <FishPack>(pack, "fish.json", out var fish)) { content = fish.AddTo(content); this.WarnObsolete(ref warnedObsolete, pack.Manifest.UniqueID); } // Trash // TODO: Remove this when compatibility with the old content pack system is no longer needed if (!isNewPack && this.TryRead <TrashPack>(pack, "trash.json", out var trash)) { content = trash.AddTo(content); this.WarnObsolete(ref warnedObsolete, pack.Manifest.UniqueID); } // Treasure // TODO: Remove this when compatibility with the old content pack system is no longer needed if (!isNewPack && this.TryRead <TreasurePack>(pack, "treasure.json", out var treasure)) { content = treasure.AddTo(content); this.WarnObsolete(ref warnedObsolete, pack.Manifest.UniqueID); } // Yield the content yield return(content); } }
public IEnumerable <FishingContent> Reload() { // Load content packs foreach (var pack in this.helper.ContentPacks.GetOwned()) { // Create content source var content = new FishingContent(pack.Manifest); var isNewPack = false; var warnedObsolete = false; // Content if (this.TryRead <FishingContentPack>(pack, "content.json", out var contentPack)) { var warnings = new List <string>(); content = contentPack.AddTo( content, string.Empty, pack, this.jsonProvider, this.monitor, warnings ); isNewPack = true; // Show warnings if (warnings.Any()) { this.monitor.Log( $"{warnings.Count} warnings were generated by {pack.Manifest.Name} ({pack.Manifest.UniqueID}):", LogLevel.Warn ); foreach (var warning in warnings) { this.monitor.Log($" {warning}", LogLevel.Warn); } } } // Fish traits // TODO: Remove this when compatibility with the old content pack system is no longer needed if (!isNewPack && this.TryRead <FishTraitsPack>(pack, "fishTraits.json", out var fishTraits)) { content = fishTraits.AddTo(content); this.WarnObsolete(ref warnedObsolete, pack.Manifest.UniqueID); } // Fish // TODO: Remove this when compatibility with the old content pack system is no longer needed if (!isNewPack && this.TryRead <FishPack>(pack, "fish.json", out var fish)) { content = fish.AddTo(content); this.WarnObsolete(ref warnedObsolete, pack.Manifest.UniqueID); } // Trash // TODO: Remove this when compatibility with the old content pack system is no longer needed if (!isNewPack && this.TryRead <TrashPack>(pack, "trash.json", out var trash)) { content = trash.AddTo(content); this.WarnObsolete(ref warnedObsolete, pack.Manifest.UniqueID); } // Treasure // TODO: Remove this when compatibility with the old content pack system is no longer needed if (!isNewPack && this.TryRead <TreasurePack>(pack, "treasure.json", out var treasure)) { content = treasure.AddTo(content); this.WarnObsolete(ref warnedObsolete, pack.Manifest.UniqueID); } // Yield the content yield return(content); } }