#pragma warning restore public static BatchLibraryInstallQueue ParseInstallQueue(string queueFile, List <Mod> allLoadedMods) { if (!File.Exists(queueFile)) { return(null); } BatchLibraryInstallQueue result = new BatchLibraryInstallQueue(); result.BackingFilename = Path.GetFileName(queueFile); string[] lines = File.ReadAllLines(queueFile); int line = 0; if (Path.GetExtension(queueFile) == @".biq") { //New Mod Manager 6 format if (Enum.TryParse <MEGame>(lines[line], out var game)) { result.Game = game; line++; } } else { //Old Mod Manager 5 format. This code is only used for transition purposes result.Game = MEGame.ME3; } result.QueueName = lines[line]; line++; result.QueueDescription = lines[line]; line++; while (line < lines.Length) { string moddescPath = lines[line]; var libraryRoot = Utilities.GetModDirectoryForGame(result.Game); //workaround for 103/104 to 105: moddesc path's in biq were stored as full paths instead of relative. me3cmm is relative paths var fullModdescPath = File.Exists(moddescPath) ? moddescPath : Path.Combine(libraryRoot, moddescPath); Mod m = allLoadedMods.FirstOrDefault(x => x.ModDescPath.Equals(fullModdescPath, StringComparison.InvariantCultureIgnoreCase)); if (m != null) { result.ModsToInstall.Add(m); } else { result.ModsMissing.Add(moddescPath); } line++; } result.InstallCompressed = result.Game >= MEGame.ME2 && Settings.PreferCompressingPackages; return(result); }
private void parseBatchFiles(string pathToHighlight = null) { AvailableBatchQueues.ClearEx(); var batchDir = Utilities.GetBatchInstallGroupsFolder(); var files = Directory.GetFiles(batchDir); foreach (var file in files) { var extension = Path.GetExtension(file); if (extension == @".biq" || extension == @".txt") { var queue = BatchLibraryInstallQueue.ParseInstallQueue(file, mainwindow.AllLoadedMods.ToList()); if (queue != null) { AvailableBatchQueues.Add(queue); if (file == pathToHighlight) { SelectedBatchQueue = queue; } } } } }