/// <summary> /// Sets the current instance. /// Throws an InvalidKSPInstanceKraken if not found. /// </summary> public void SetCurrentInstance(string name) { if (!HasInstance(name)) { throw new InvalidKSPInstanceKraken(name); } else if (!instances[name].Valid) { throw new NotKSPDirKraken(instances[name].GameDir()); } // Don't try to Dispose a null CurrentInstance. if (CurrentInstance != null && !CurrentInstance.Equals(instances[name])) { // Dispose of the old registry manager, to release the registry. RegistryManager.Instance(CurrentInstance)?.Dispose(); } CurrentInstance = instances[name]; }