public void Install(FileInfo file, Version version) { DirectoryInfo destination = this.context.TempDirectory.CreateSubdirectory(version.ToString()); try { ZipManager zipper = new ZipManager(); zipper.Unzip(file.FullName, destination.FullName); string preUpdatePath = Path.Combine(destination.FullName, PreUpdateFile); if (File.Exists(preUpdatePath)) { Process preUpdate = new Process { StartInfo = new ProcessStartInfo(preUpdatePath, String.Concat("\"", this.context.ApplicationDirectory.FullName, "\"")) }; preUpdate.Start(); preUpdate.WaitForExit(15000); } this.MoveFiles(destination, this.context.ApplicationDirectory); string postUpdatePath = Path.Combine(destination.FullName, PostUpdateFile); if (File.Exists(postUpdatePath)) { Process postUpdate = new Process { StartInfo = this.GetProcessInfo(postUpdatePath, String.Concat("\"", this.context.ApplicationDirectory.FullName, "\"")) }; postUpdate.Start(); postUpdate.BeginOutputReadLine(); this.logger.Info("PostUpdate: {0}", postUpdate.StandardOutput.ReadToEnd()); postUpdate.WaitForExit(15000); } } finally { destination.Delete(true); } }
public void Install(FileInfo file, Version version) { DirectoryInfo destination = this.context.TempDirectory.CreateSubdirectory(version.ToString()); try { ZipManager zipper = new ZipManager(); zipper.Unzip(file.FullName, destination.FullName); string preUpdatePath = Path.Combine(destination.FullName, PreUpdateFile); if (File.Exists(preUpdatePath)) { Process preUpdate = new Process { StartInfo = new ProcessStartInfo(preUpdatePath, String.Concat("\"", this.context.ApplicationDirectory.FullName, "\"")) }; preUpdate.Start(); preUpdate.WaitForExit(15000); } this.MoveFiles(destination, this.context.ApplicationDirectory); string postUpdatePath = Path.Combine(destination.FullName, PostUpdateFile); if (File.Exists(postUpdatePath)) { Process postUpdate = new Process { StartInfo = this.GetProcessInfo(postUpdatePath, String.Concat("\"", this.context.ApplicationDirectory.FullName, "\"")) }; postUpdate.Start(); postUpdate.BeginOutputReadLine(); this.logger.Info("PostUpdate: {0}", postUpdate.StandardOutput.ReadToEnd()); postUpdate.WaitForExit(15000); } } finally { destination.Delete(true); } }