Exemplo n.º 1
0
        /// <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]);
        }
Exemplo n.º 2
0
        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);
            }
        }
Exemplo n.º 3
0
 private void GameExit(GameInstance inst)
 {
     inst.playTime.Stop(inst.CkanDir());
     UpdateStatusBar();
 }
Exemplo n.º 4
0
 /// <summary>
 /// Initialize the row
 /// </summary>
 public PlayTimeRow(string name, GameInstance instance)
 {
     Name     = name;
     PlayTime = instance.playTime;
     path     = TimeLog.GetPath(instance.CkanDir());
 }