private static int AddInstall(AddOptions options) { if (options.name == null || options.path == null) { User.WriteLine("add <name> <path> - argument missing, perhaps you forgot it?"); return(Exit.BADOPT); } if (KSPManager.Instances.ContainsKey(options.name)) { User.WriteLine("Install with name \"{0}\" already exists, aborting..", options.name); return(Exit.BADOPT); } try { KSPManager.AddInstance(options.name, options.path); User.WriteLine("Added \"{0}\" with root \"{1}\" to known installs", options.name, options.path); return(Exit.OK); } catch (NotKSPDirKraken ex) { User.WriteLine("Sorry, {0} does not appear to be a KSP directory", ex.path); return(Exit.BADOPT); } }
public void AddInstance_ManagarHasInstance() { const string newInstance = "tidy2"; Assert.That(manager.HasInstance(newInstance), Is.False); manager.AddInstance(newInstance, tidy2.KSP); Assert.That(manager.HasInstance(newInstance), Is.True); }
public void AddInstance_ManagarHasInstance() { using (var tidy2 = new DisposableKSP()) { const string newInstance = "tidy2"; Assert.That(manager.HasInstance(newInstance), Is.False); manager.AddInstance(newInstance, tidy2.KSP); Assert.That(manager.HasInstance(newInstance), Is.True); } }
public void AddInstance_ManagerHasInstance() { using (var tidy2 = new DisposableKSP()) { const string newInstance = "tidy2"; tidy2.KSP.Name = newInstance; Assert.IsFalse(manager.HasInstance(newInstance)); manager.AddInstance(tidy2.KSP); Assert.IsTrue(manager.HasInstance(newInstance)); } }