public static NMMod Deserialize(XElement xmlMod) { if (xmlMod.Attribute("url") == null) { throw new InvalidDataException("'url' attribute wasn't provided."); } NMMod mod = new NMMod(xmlMod.Attribute("url").Value); if (xmlMod.Attribute("latestVersion") != null) { mod.LatestVersion = xmlMod.Attribute("latestVersion").Value; } if (xmlMod.Attribute("thumbnailUrl") != null) { mod.ThumbnailURL = xmlMod.Attribute("thumbnailUrl").Value; } if (xmlMod.Attribute("thumbnail") != null) { mod.Thumbnail = xmlMod.Attribute("thumbnail").Value; } if (xmlMod.Attribute("title") != null) { mod.Title = xmlMod.Attribute("title").Value; } return(mod); }
public static void Load() { Mods.Clear(); if (Shared.GamePath == null) { return; } String path = Path.Combine(Shared.GamePath, "Mods", "remote.xml"); if (!File.Exists(path)) { return; } XDocument xmlDoc = XDocument.Load(path); foreach (XElement xmlMod in xmlDoc.Descendants("Mod")) { try { NMMod mod = NMMod.Deserialize(xmlMod); Mods[mod.ID] = mod; } catch (Exception ex) { /* InvalidDataException, ArgumentException */ //MsgBox.Get("modsInvalidManifestEntry").FormatText(ex.Message).Show(MessageBoxIcon.Warning); // TODO: Handle invalid entries. } } NexusMods.Profile.Load(); }
public static void RefreshModInfo(String url) { NMMod mod = new NMMod(url); mod.RequestInformation(); Mods[mod.ID] = mod; }