private static NetFileCache FindCache(KSPManager kspManager, IWin32Registry reg) { if (Options.CacheDir != null) { Log.InfoFormat("Using user-supplied cache at {0}", Options.CacheDir); return(new NetFileCache(Options.CacheDir)); } try { Log.InfoFormat("Using main CKAN meta-cache at {0}", reg.DownloadCacheDir); /// Create a new file cache in the same location so NetKAN can download pure URLs not sourced from CkanModules return(new NetFileCache(kspManager, reg.DownloadCacheDir)); } catch { // Meh, can't find KSP. 'Scool, bro. } var tempdir = Path.GetTempPath(); Log.InfoFormat("Using tempdir for cache: {0}", tempdir); return(new NetFileCache(tempdir)); }
public OniBuildMap(IWin32Registry registry) { _registry = registry; }
public KSPManager(IUser user, IWin32Registry win32_registry = null) { User = user; Win32Registry = win32_registry ?? new Win32Registry(); LoadInstancesFromRegistry(); }
//// =========================================================================================================== //// Constructors //// =========================================================================================================== public CommandExecutor(ILogger logger, IWin32Registry registry = null) { _logger = Param.VerifyNotNull(logger, nameof(logger)); _registryExecutor = new RegistryCommandExecutor(registry); }
//// =========================================================================================================== //// Constructors //// =========================================================================================================== /// <summary> /// Initializes a new instance of the <see cref="RegistryCommandExecutor"/> class using the specified registry. /// </summary> /// <param name="registry">A registry to use (the real Windows registry is used if null).</param> public RegistryCommandExecutor(IWin32Registry registry = null) { _registry = registry ?? new Win32Registry(); }
public KSPManager(IUser user, IWin32Registry win32_registry = null) { User = user; Win32Registry = win32_registry ?? new Win32Registry(); LoadInstancesFromRegistry(); }
//// =========================================================================================================== //// Methods //// =========================================================================================================== /// <summary> /// Starts the server by waiting for requests (via the <paramref name="readLineFunc"/>) and then sending /// responses via <paramref name="writeLineAction"/>. /// </summary> /// <param name="readLineFunc"> /// The function to call to wait for an incoming command, serialized on a single line. /// </param> /// <param name="writeLineAction"> /// The action to call when a response is sent back to the client, serialized on a singe line. /// </param> /// <param name="registry">A <see cref="IWin32Registry"/> to use for executing registry commands.</param> public void Start(ReadLineFunc readLineFunc, WriteLineAction writeLineAction, IWin32Registry registry) { Param.VerifyNotNull(readLineFunc, nameof(readLineFunc)); Param.VerifyNotNull(writeLineAction, nameof(writeLineAction)); Param.VerifyNotNull(registry, nameof(registry)); var commandExecutor = new CommandExecutor(_logger, registry); // This is the loop that waits for an incoming request (ReadLine), executes a command, and then returns a // response via WriteLine. bool shutdownRequested = false; while (!shutdownRequested) { _logger.LogDebug("Waiting for request"); string serializedCommand = readLineFunc(); _logger.LogInfo("Request received: ", serializedCommand); IServiceCommandResponse response; if (!ServiceCommand.TryDeserializeFromJsonString( serializedCommand, out IServiceCommand command, out IServiceCommandResponse errorResponse)) { response = errorResponse; }
public KspBuildMap(IWin32Registry registry) { _registry = registry; }
public KspBuildMap(IWin32Registry registry) { _registry = registry; }