public override void Execute() { while (Input.HasRowsAvailable) { var inRow = Input.RemoveRow(); var outRow = new Row(); foreach (var column in inRow.Keys) { var rename = RenameMappings.FirstOrDefault(m => string.Equals(m.From, column, StringComparison.OrdinalIgnoreCase)); if (rename != null) { outRow[rename.To] = inRow[rename.From]; } else if (!Remove.Contains(column)) { outRow[column] = inRow[column]; } } foreach (var mapping in Add) { outRow[mapping.Field] = mapping.Value; } Output.AddRow(outRow); } }
void GenerateChangeImage(IReadOnlyCollection <IAbsoluteFilePath> workingPathFiles, IOrderedEnumerable <FileObjectMapping> packageFileMappings, Package package) { var changeDictionary = new Dictionary <string, string>(); foreach (var file in workingPathFiles) { MakeChecksum(package, file, changeDictionary); } foreach (var f in changeDictionary) { EnumerateRemovals(f.Key, packageFileMappings); } foreach (var file in packageFileMappings) { EnumerateChanges(file, changeDictionary, package); } foreach (var file in ChangedCase.Where(file => Remove.Contains(file.Key)).ToArray()) { Remove.Remove(file.Key); } }
/// <summary> /// Return a mod's current status /// This can't be static because the user's installation plans are part of the object. /// This function is extremely performance-sensitive because it's the default sort for /// the main mod list, so anything in here should be O(1) and fast. /// </summary> /// <param name="manager">Game instance manager containing the instances</param> /// <param name="registry">Registry of instance being displayed</param> /// <param name="identifier">The mod</param> /// <returns> /// Status of mod /// </returns> public InstallStatus GetModStatus(GameInstanceManager manager, IRegistryQuerier registry, string identifier) { if (registry.IsInstalled(identifier, false)) { if (Remove.Contains(identifier)) { return(InstallStatus.Removing); } else if (registry.HasUpdate(identifier, manager.CurrentInstance.VersionCriteria())) { if (Upgrade.Contains(identifier)) { return(InstallStatus.Upgrading); } else { return(InstallStatus.Upgradeable); } } else if (registry.IsAutodetected(identifier)) { return(InstallStatus.AutoDetected); } else if (Replace.Contains(identifier)) { return(InstallStatus.Replacing); } else if (registry.GetReplacement(identifier, manager.CurrentInstance.VersionCriteria()) != null) { return(InstallStatus.Replaceable); } else if (!IsAnyAvailable(registry, identifier)) { return(InstallStatus.Unavailable); } else if (registry.InstalledModule(identifier)?.AutoInstalled ?? false) { return(InstallStatus.AutoInstalled); } else { return(InstallStatus.Installed); } } else { foreach (CkanModule m in Install) { if (m.identifier == identifier) { return(InstallStatus.Installing); } } return(InstallStatus.NotInstalled); } }
/// <summary> /// Return a mod's current status /// This can't be static because the user's installation plans are part of the object. /// This function is extremely performance-sensitive because it's the default sort for /// the main mod list, so anything in here should be O(1) and fast. /// </summary> /// <param name="manager">KSP manager containing the instances</param> /// <param name="registry">Registry of instance being displayed</param> /// <param name="identifier">The mod</param> /// <returns> /// Status of mod /// </returns> public InstallStatus GetModStatus(KSPManager manager, IRegistryQuerier registry, string identifier) { if (registry.IsInstalled(identifier, false)) { if (Remove.Contains(identifier)) { return(InstallStatus.Removing); } else if (registry.HasUpdate(identifier, manager.CurrentInstance.VersionCriteria())) { if (Upgrade.Contains(identifier)) { return(InstallStatus.Upgrading); } else { return(InstallStatus.Upgradeable); } } else if (!IsAnyAvailable(registry, identifier)) { return(InstallStatus.Unavailable); } else { return(InstallStatus.Installed); } } else { if (Install.Contains(identifier)) { return(InstallStatus.Installing); } else { return(InstallStatus.NotInstalled); } } }