public void Update(string applicationName, string updaterDirectory, string applicationExeFileName) { var applicationDirectory = Path.GetDirectoryName(applicationExeFileName); var backupDirectory = Path.Combine(updaterDirectory, $"{applicationName}.Backup"); CopyDirectory(applicationDirectory, backupDirectory); var sourceDirectory = Path.Combine(updaterDirectory, applicationName); CopyDirectory(sourceDirectory, applicationDirectory); var repository = new DeploymentCommandRepository(_serializer); repository.Save(applicationName, new DeleteUpdater(updaterDirectory)); var processStartInfo = new ProcessStartInfo { WorkingDirectory = applicationDirectory, FileName = applicationExeFileName, Arguments = applicationDirectory }; Process.Start(processStartInfo); }
private void ScheduleCheckForUpdates() { var entryAssembly = Assembly.GetEntryAssembly(); var title = GetTitle(entryAssembly); var applicationName = title; var now = UniversalTime.Default.Now; var tomorrow = now.AddDays(1); var repository = new DeploymentCommandRepository(_serializer); repository.Save(applicationName, new CheckForUpdates(tomorrow)); }