static void Main(string[] args) { //Thread.Sleep(TimeSpan.FromSeconds(30)); if (args == null || args.Length < 4) { Console.WriteLine("Usage: Updater <processId> \"<sourcePath>\" \"<destinationPath>\" \"<executableFile>\""); Debug.WriteLine("Usage: Updater <processId> \"<sourcePath>\" \"<destinationPath>\" \"<executableFile>\""); return; } ExceptionHelper.SetLogger(new EventLogLogger()); var updaterConfig = new UpdaterConfig(args); WaitForCallerExit(updaterConfig.ProcessId); // TODO: KG - Pourrait être plus conservateur et effacer seulement les fichiers installés par nous. // TODO: KG - Faire un backup de l'installation courante avant d'updater. DeleteDestinationFolderIfExists(updaterConfig.DestinationPath); var copySucceeded = ExceptionHelper.TrySafe <Exception>( () => DirectoryHelper.CopyDirectory(updaterConfig.SourcePath, updaterConfig.DestinationPath)); if (copySucceeded) { // TODO: KG - Here we do nothing on error. Should log to somewhere at least. ExceptionHelper.TrySafe <Exception>(() => Process.Start(updaterConfig.ExecutableFile)); } else { // TODO: KG - Do not fail in silence. Report to EventLog and show message. } }
public Updater(UpdaterConfig updaterConfig) { _updaterConfig = updaterConfig; _websiteUrl = updaterConfig.WebsiteUrl; _workingDir = new DirectoryInfo(updaterConfig.WorkingDir); _updateFilesDir = new DirectoryInfo(updaterConfig.UpdateTempDirectory); }
public BackupDirectories(UpdaterConfig config) : base(config) { }
public MigrationRestore(UpdaterConfig config, IEnumerable<MigrationFile> migrationFiles) : base(config) { this.MigrationFiles = migrationFiles; }
public ExtractDownload(UpdaterConfig config) : base(config) { }
public RemoveApplication(UpdaterConfig config) : base(config) { }
public RunPatch(UpdaterConfig config) : base(config) { }
public DownloadUpdate(UpdaterConfig config) : base(config) { }
public ReplaceApplicationFiles(UpdaterConfig config) : base(config) { }
public CopyUpdate(UpdaterConfig config) : base(config) { }
public RestoreDirectories(UpdaterConfig config) : base(config) { }
public MigrationRestore(UpdaterConfig config, IEnumerable <MigrationFile> migrationFiles) : base(config) { this.MigrationFiles = migrationFiles; }
public MigrationBackup(UpdaterConfig config) : base(config) { this.path = Config.ApplicationPath; this.files = Config.Migrate.Split(','); }