using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace MinecraftClient.Protocol.Handlers.Forge { /// /// Contains information about a modded server install. /// public class ForgeInfo { /// /// Represents an individual forge mod. /// public class ForgeMod { public ForgeMod(String ModID, String Version) { this.ModID = ModID; this.Version = Version; } public readonly String ModID; public readonly String Version; public override string ToString() { return ModID + " v" + Version; } } public List Mods; /// /// Create a new ForgeInfo from the given data. /// /// The modinfo JSON tag. internal ForgeInfo(Json.JSONData data) { // Example ModInfo (with spacing): // "modinfo": { // "type": "FML", // "modList": [{ // "modid": "mcp", // "version": "9.05" // }, { // "modid": "FML", // "version": "8.0.99.99" // }, { // "modid": "Forge", // "version": "11.14.3.1512" // }, { // "modid": "rpcraft", // "version": "Beta 1.3 - 1.8.0" // }] // } this.Mods = new List(); foreach (Json.JSONData mod in data.Properties["modList"].DataArray) { String modid = mod.Properties["modid"].StringValue; String version = mod.Properties["version"].StringValue; this.Mods.Add(new ForgeMod(modid, version)); } } } }