diff options
| author | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-26 11:11:05 -0500 |
|---|---|---|
| committer | LukePulverenti <luke.pulverenti@gmail.com> | 2013-02-26 11:11:05 -0500 |
| commit | cbb2f00da5a6a45610c517392dae7067a620dba2 (patch) | |
| tree | 562768e8cc47c887b26c454fc2c196a751830817 /MediaBrowser.Uninstaller/Program.cs | |
| parent | 6efd22a3d22f8d87ad17da3a1e47ca26c5bb09f2 (diff) | |
| parent | c76c74fb24c471218a43cb3538080f3c86dabfba (diff) | |
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Diffstat (limited to 'MediaBrowser.Uninstaller/Program.cs')
| -rw-r--r-- | MediaBrowser.Uninstaller/Program.cs | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/MediaBrowser.Uninstaller/Program.cs b/MediaBrowser.Uninstaller/Program.cs new file mode 100644 index 000000000..8ea1a950a --- /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, true); + //kick off the copy + Process.Start(tempExe, product); + //and shut down + } + } + } +} |
