public InstalledVersion(Version v, InstalledMod parent) { this.ParentMod = parent; Name = v.Name; LongName = v.LongName; Description = v.Description; IconUrl = v.IconUrl; VersionNumber = v.VersionNumber; Dependencies = v.Dependencies; }
public InstalledGrouping(InstalledMod m, Form1 p) { this.mod = m; this.parent = p; InitializeComponent(); }
//[DebuggerStepThrough] public void UpdateModLists() { this.AvailableMods = new List <MiniMod>(); this.InstalledMods = new List <InstalledMod>(); List <InstalledMod> tempAvail = new List <InstalledMod>(); List <InstalledMod> tempDep = new List <InstalledMod>(); /*{ * new InstalledMod(this.bep, FindMod(string.Format("{0}-{1}", this.bep.LongName, this.installedmods[this.bep.LongName].VersionNumber))), * new InstalledMod(this.r2api, FindMod(string.Format("{0}-{1}", this.r2api.LongName, this.installedmods[this.r2api.LongName].VersionNumber))) * };*/ try { tempDep.Add(new InstalledMod(this.bep, FindMod(string.Format("{0}-{1}", this.bep.LongName, this.installedmods[this.bep.LongName].VersionNumber)))); } catch (Exception) { tempDep.Add(new InstalledMod(this.bep, this.bep.GetLatestVersion())); } try { tempDep.Add(new InstalledMod(this.r2api, FindMod(string.Format("{0}-{1}", this.r2api.LongName, this.installedmods[this.r2api.LongName].VersionNumber)))); } catch (Exception) { tempDep.Add(new InstalledMod(this.r2api, this.r2api.GetLatestVersion())); } foreach (Mod m in this.mods) { if (this.installedmods.ContainsKey(m.LongName)) { Version v = FindMod(string.Format("{0}-{1}", m.LongName, this.installedmods[m.LongName].VersionNumber)); tempAvail.Add(new InstalledMod(m, v)); foreach (string s in v.Dependencies) { Version vt = FindMod(s); InstalledMod test = tempDep.Find((x) => x.LongName == vt.ParentMod.LongName); if (test == null) { tempDep.Add(new InstalledMod(vt.ParentMod, vt)); } else if (vt.VersionNumber.IsNewer(test.Version.VersionNumber)) { tempDep.Remove(test); tempDep.Add(new InstalledMod(vt.ParentMod, vt)); } } } else { this.AvailableMods.Add(new MiniMod(m)); } } foreach (InstalledMod m in tempAvail) { if (tempDep.Find((x) => x.LongName == m.LongName) == null) { this.InstalledMods.Add(m); } } this.InstalledDependencies = new List <InstalledMod>(tempDep); }