public FakeWin32Registry(KSP instance, string autostart) { Instances = new List <Tuple <string, string> > { new Tuple <string, string>("test", instance.GameDir()) }; AutoStartInstance = autostart; }
/// <summary> /// Creates a copy of the provided argument, or a known-good KSP install if passed null. /// Use .KSP to access the KSP object itself. /// </summary> public DisposableKSP(string directory_to_clone = null, string registry_file = null) { directory_to_clone = directory_to_clone ?? good_ksp; disposable_dir = TestData.NewTempDir(); TestData.CopyDirectory(directory_to_clone, disposable_dir); // If we've been given a registry file, then copy it into position before // creating our KSP object. if (registry_file != null) { string registry_dir = Path.Combine(disposable_dir, "CKAN"); string registry_path = Path.Combine(registry_dir, "registry.json"); Directory.CreateDirectory(registry_dir); File.Copy(registry_file, registry_path, true); } KSP = new KSP(disposable_dir, NullUser.User); }
public FakeWin32Registry(KSP instance) : this(instance, "test") { }
public void Dispose() { Directory.Delete(disposable_dir, true); KSP = null; // In case .Dispose() was called manually. }