/// <summary> /// Gets the mod info that is currently in the install log, indexed by mod key. /// </summary> /// <returns>The mod info that is currently in the install log, indexed by mod key.</returns> private IDictionary <string, IMod> GetInstallLogModInfo() { var loggedModInfo = new Dictionary <string, IMod>(); var log = XDocument.Load(LogPath); var logVersion = log.Element("installLog")?.Attribute("fileVersion")?.Value; if (!CurrentVersion.ToString().Equals(logVersion)) { throw new Exception($"Invalid Install Log version: \"{logVersion}\", expected \"{CurrentVersion}\"."); } var modList = log.Descendants("modList").FirstOrDefault(); if (modList != null) { foreach (var mod in modList.Elements("mod")) { var modPath = mod.Attribute("path")?.Value; if (!OriginalValueMod.Filename.Equals(modPath) && !ModManagerValueMod.Filename.Equals(modPath)) { if (string.IsNullOrEmpty(modPath)) { throw new Exception($"Could not determine path to mod \"{mod}\""); } modPath = Path.Combine(ModInstallDirectory, modPath); var version = mod.Element("version"); var humanReadableVersion = version?.Attribute("machineVersion")?.Value; var machineVersion = string.IsNullOrEmpty(humanReadableVersion) ? null : new Version(humanReadableVersion); humanReadableVersion = version?.Value; var modName = mod.Element("name")?.Value; var installDate = "<No Data>"; if (mod.Element("installDate") != null) { installDate = mod.Element("installDate")?.Value; } IMod dummyMod = new DummyMod(modName, modPath, machineVersion, humanReadableVersion, "", installDate); var loggedModInfoKey = mod.Attribute("key")?.Value; if (loggedModInfoKey != null) { loggedModInfo[loggedModInfoKey] = dummyMod; } } } } return(loggedModInfo); }
/// <summary> /// Gets the mod info that is currently in the install log, indexed by mod key. /// </summary> /// <returns>The mod info that is currently in the install log, indexed by mod key.</returns> private IDictionary <string, IMod> GetInstallLogModInfo() { Dictionary <string, IMod> dicLoggedModInfo = new Dictionary <string, IMod>(); XDocument docLog = XDocument.Load(LogPath); string strLogVersion = docLog.Element("installLog").Attribute("fileVersion").Value; if (!CURRENT_VERSION.ToString().Equals(strLogVersion)) { throw new Exception(String.Format("Invalid Install Log version: {0} Expecting {1}", strLogVersion, CURRENT_VERSION)); } XElement xelModList = docLog.Descendants("modList").FirstOrDefault(); if (xelModList != null) { foreach (XElement xelMod in xelModList.Elements("mod")) { string strModPath = xelMod.Attribute("path").Value; if (!OriginalValueMod.Filename.Equals(strModPath) && !ModManagerValueMod.Filename.Equals(strModPath)) { strModPath = Path.Combine(ModInstallDirectory, strModPath); XElement xelVersion = xelMod.Element("version"); string strVersion = xelVersion.Attribute("machineVersion").Value; Version verVersion = String.IsNullOrEmpty(strVersion) ? null : new Version(strVersion); strVersion = xelVersion.Value; string strModName = xelMod.Element("name").Value; string strInstallDate = "<No Data>"; if (!(xelMod.Element("installDate") == null)) { strInstallDate = xelMod.Element("installDate").Value; } IMod modMod = new DummyMod(strModName, strModPath, verVersion, strVersion, "", strInstallDate); dicLoggedModInfo[xelMod.Attribute("key").Value] = modMod; } } } return(dicLoggedModInfo); }
/// <summary> /// Gets the mod info that is currently in the install log, indexed by mod key. /// </summary> /// <returns>The mod info that is currently in the install log, indexed by mod key.</returns> private IDictionary<string, IMod> GetInstallLogModInfo() { Dictionary<string, IMod> dicLoggedModInfo = new Dictionary<string, IMod>(); XDocument docLog = XDocument.Load(LogPath); string strLogVersion = docLog.Element("installLog").Attribute("fileVersion").Value; if (!CURRENT_VERSION.ToString().Equals(strLogVersion)) throw new Exception(String.Format("Invalid Install Log version: {0} Expecting {1}", strLogVersion, CURRENT_VERSION)); XElement xelModList = docLog.Descendants("modList").FirstOrDefault(); if (xelModList != null) { foreach (XElement xelMod in xelModList.Elements("mod")) { string strModPath = xelMod.Attribute("path").Value; if (!OriginalValueMod.Filename.Equals(strModPath) && !ModManagerValueMod.Filename.Equals(strModPath)) { strModPath = Path.Combine(ModInstallDirectory, strModPath); XElement xelVersion = xelMod.Element("version"); string strVersion = xelVersion.Attribute("machineVersion").Value; Version verVersion = String.IsNullOrEmpty(strVersion) ? null : new Version(strVersion); strVersion = xelVersion.Value; string strModName = xelMod.Element("name").Value; string strInstallDate = "<No Data>"; if (!(xelMod.Element("installDate") == null)) strInstallDate = xelMod.Element("installDate").Value; IMod modMod = new DummyMod(strModName, strModPath, verVersion, strVersion, "", strInstallDate); dicLoggedModInfo[xelMod.Attribute("key").Value] = modMod; } } } return dicLoggedModInfo; }