public UpdaterCore(WindowsPatcherConfig windowsPatcherConfig, Process hostProcess, IPatcherTranslation translation) { _windowsPatcherConfig = windowsPatcherConfig; _hostProcess = hostProcess; _environmentManager = new EnvironmentManager(windowsPatcherConfig); _rollbackInfo = new RollbackInfo("rollbackInfo.json") { ApplicationPath = windowsPatcherConfig.ApplicationPath, PatcherConfig = windowsPatcherConfig }; _logger = new Logger(Path.Combine(windowsPatcherConfig.ActionConfig.ProjectId.GetTempDirectory(), "patcher", "log.txt")); Translation = translation; _statusUpdater = new StatusUpdater(Translation); _statusUpdater.StatusUpdated += StatusUpdaterOnStatusUpdated; }
public EnvironmentManager(WindowsPatcherConfig config) { BaseDirectory = config.BaseDirectory; //use a directory in the base directory if possible because the move operations will be much faster then if (FileExtensions.HasWriteAccessToFolder(BaseDirectory)) { RevertTempDirectory = new DirectoryInfo(FileExtensions.MakeDirectoryUnique(Path.Combine(BaseDirectory, "CodeElements.UpdateSystem.Backup"))); } else { RevertTempDirectory = new DirectoryInfo(Path.Combine(config.ActionConfig.ProjectId.GetTempDirectory(), "backup")); } RevertTempDirectory.Create(); }