From 098ba6db0d15bde7edb7a8e96452991744b98262 Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Mon, 25 Feb 2013 22:52:29 -0500 Subject: Uninstaller stub as silent console app --- MediaBrowser.Uninstaller/Program.cs | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 MediaBrowser.Uninstaller/Program.cs (limited to 'MediaBrowser.Uninstaller/Program.cs') diff --git a/MediaBrowser.Uninstaller/Program.cs b/MediaBrowser.Uninstaller/Program.cs new file mode 100644 index 000000000..bbbdba14b --- /dev/null +++ b/MediaBrowser.Uninstaller/Program.cs @@ -0,0 +1,33 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; +using System.IO; +using System.Linq; +using System.Reflection; +using System.Text; +using System.Threading; +using System.Threading.Tasks; + +namespace MediaBrowser.Uninstaller +{ + class Program + { + static void Main(string[] args) + { + var product = args.Length > 1 ? args[1] : "server"; + //copy the real program to a temp location so we can delete everything here (including us) + var tempExe = Path.Combine(Path.GetTempPath(), "MediaBrowser.Uninstaller.Execute.exe"); + var tempConfig = Path.Combine(Path.GetTempPath(), "MediaBrowser.Uninstaller.Execute.exe.config"); + //using (var file = File.Create(tempExe, 4096, FileOptions.DeleteOnClose)) + { + //copy the real uninstaller to temp location + var sourceDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? ""; + File.WriteAllBytes(tempExe, File.ReadAllBytes(Path.Combine(sourceDir, "MediaBrowser.Uninstaller.Execute.exe"))); + File.Copy(Path.Combine(sourceDir, "MediaBrowser.Uninstaller.Execute.exe.config"), tempConfig); + //kick off the copy + Process.Start(tempExe, product); + //and shut down + } + } + } +} -- cgit v1.2.3 From d4690904fbd2733118d5a8d540105d90a202ff7a Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Tue, 26 Feb 2013 07:59:57 -0500 Subject: Overwrite on uninstaller copy --- MediaBrowser.Uninstaller/Program.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'MediaBrowser.Uninstaller/Program.cs') diff --git a/MediaBrowser.Uninstaller/Program.cs b/MediaBrowser.Uninstaller/Program.cs index bbbdba14b..8ea1a950a 100644 --- a/MediaBrowser.Uninstaller/Program.cs +++ b/MediaBrowser.Uninstaller/Program.cs @@ -23,7 +23,7 @@ namespace MediaBrowser.Uninstaller //copy the real uninstaller to temp location var sourceDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? ""; File.WriteAllBytes(tempExe, File.ReadAllBytes(Path.Combine(sourceDir, "MediaBrowser.Uninstaller.Execute.exe"))); - File.Copy(Path.Combine(sourceDir, "MediaBrowser.Uninstaller.Execute.exe.config"), tempConfig); + File.Copy(Path.Combine(sourceDir, "MediaBrowser.Uninstaller.Execute.exe.config"), tempConfig, true); //kick off the copy Process.Start(tempExe, product); //and shut down -- cgit v1.2.3