/// <summary> /// Renames an instance in the registry and saves. /// </summary> public void RenameInstance(string from, string to) { // TODO: What should we do if our target name already exists? KSP ksp = instances[from]; instances.Remove(from); ksp.Name = to; instances.Add(to, ksp); Configuration.SetRegistryToInstances(instances); }
/// <summary> /// Adds a KSP instance to config. /// Returns the resulting KSP object. /// </summary> public GameInstance AddInstance(GameInstance ksp_instance) { if (ksp_instance.Valid) { string name = ksp_instance.Name; instances.Add(name, ksp_instance); Configuration.SetRegistryToInstances(instances); } else { throw new NotKSPDirKraken(ksp_instance.GameDir()); } return(ksp_instance); }
/// <summary> /// Removes the instance from the config and saves. /// </summary> public void RemoveInstance(string name) { instances.Remove(name); Configuration.SetRegistryToInstances(instances); }