/// <summary> /// Returns an instance of the registry manager for the KSP install. /// The file `registry.json` is assumed. /// </summary> public static RegistryManager Instance(GameInstance ksp) { string directory = ksp.CkanDir(); if (!registryCache.ContainsKey(directory)) { log.DebugFormat("Preparing to load registry at {0}", directory); registryCache[directory] = new RegistryManager(directory, ksp); } return(registryCache[directory]); }
protected void Dispose(bool safeToAlsoFreeManagedObjects) { // Right now we just release our lock, and leave everything else // to the GC, but if we were implementing the full pattern we'd also // free managed (.NET core) objects when called with a true value here. ReleaseLock(); var directory = ksp.CkanDir(); if (!registryCache.ContainsKey(directory)) { log.DebugFormat("Registry not in cache at {0}", directory); return; } log.DebugFormat("Dispose of registry at {0}", directory); if (!registryCache.Remove(directory)) { throw new RegistryInUseKraken(directory); } }
private void GameExit(GameInstance inst) { inst.playTime.Stop(inst.CkanDir()); UpdateStatusBar(); }
/// <summary> /// Initialize the row /// </summary> public PlayTimeRow(string name, GameInstance instance) { Name = name; PlayTime = instance.playTime; path = TimeLog.GetPath(instance.CkanDir()); }