Exemple #1
0
        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.
            }
        }
Exemple #2
0
 public Updater(UpdaterConfig updaterConfig)
 {
     _updaterConfig  = updaterConfig;
     _websiteUrl     = updaterConfig.WebsiteUrl;
     _workingDir     = new DirectoryInfo(updaterConfig.WorkingDir);
     _updateFilesDir = new DirectoryInfo(updaterConfig.UpdateTempDirectory);
 }
Exemple #3
0
 public BackupDirectories(UpdaterConfig config)
     : base(config)
 {
 }
Exemple #4
0
 public MigrationRestore(UpdaterConfig config, IEnumerable<MigrationFile> migrationFiles) : base(config)
 {
     this.MigrationFiles = migrationFiles;
 }
 public ExtractDownload(UpdaterConfig config) : base(config)
 {
 }
Exemple #6
0
 public RemoveApplication(UpdaterConfig config) : base(config)
 {
 }
Exemple #7
0
 public RunPatch(UpdaterConfig config)
     : base(config)
 {
 }
Exemple #8
0
 public DownloadUpdate(UpdaterConfig config)
     : base(config)
 {
 }
 public ReplaceApplicationFiles(UpdaterConfig config) : base(config)
 {
 }
Exemple #10
0
 public CopyUpdate(UpdaterConfig config) : base(config)
 {
 }
 public RestoreDirectories(UpdaterConfig config)
     : base(config)
 {
 }
Exemple #12
0
 public DownloadUpdate(UpdaterConfig config)
     : base(config)
 {
 }
 public MigrationRestore(UpdaterConfig config, IEnumerable <MigrationFile> migrationFiles) : base(config)
 {
     this.MigrationFiles = migrationFiles;
 }
 public ExtractDownload(UpdaterConfig config) : base(config)
 {
 }
 public MigrationBackup(UpdaterConfig config) : base(config)
 {
     this.path  = Config.ApplicationPath;
     this.files = Config.Migrate.Split(',');
 }
Exemple #16
0
 public RestoreDirectories(UpdaterConfig config)
     : base(config)
 {
 }
Exemple #17
0
 public RunPatch(UpdaterConfig config)
     : base(config)
 {
 }
Exemple #18
0
 public ReplaceApplicationFiles(UpdaterConfig config) : base(config)
 {
 }
Exemple #19
0
 public MigrationBackup(UpdaterConfig config)
     : base(config)
 {
     this.path = Config.ApplicationPath;
     this.files = Config.Migrate.Split(',');
 }
Exemple #20
0
 public BackupDirectories(UpdaterConfig config)
     : base(config)
 {
 }