From 844121acc96f0280d9f527175e56e77b4dac8d71 Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Mon, 25 Feb 2013 20:11:51 -0500 Subject: More uninstaller/installer incrementals Gonna need separate installers for server and mbt due to CO limitations --- MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj | 1 + 1 file changed, 1 insertion(+) (limited to 'MediaBrowser.ServerApplication') diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index c843242c3..3ed16f825 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -386,6 +386,7 @@ if $(ConfigurationName) == Release ( mkdir "$(SolutionDir)..\Deploy\Server\System" xcopy "$(TargetDir)$(TargetFileName)" "$(SolutionDir)..\Deploy\Server\System\" /y xcopy "$(SolutionDir)Mediabrowser.Uninstaller\bin\Release\MediaBrowser.Uninstaller.exe" "$(SolutionDir)..\Deploy\Server\System\" /y +xcopy "$(SolutionDir)Mediabrowser.Uninstaller.Execute\bin\Release\MediaBrowser.Uninstaller.Execute.exe" "$(SolutionDir)..\Deploy\Server\System\" /y xcopy "$(TargetDir)$(TargetFileName).config" "$(SolutionDir)..\Deploy\Server\System\" /y -- cgit v1.2.3 From 1013717808c5744f10e97bd8b79132e29b915c1a Mon Sep 17 00:00:00 2001 From: Eric Reed Date: Mon, 25 Feb 2013 21:34:11 -0500 Subject: Show version number on installer download --- MediaBrowser.Installer/MainWindow.xaml.cs | 38 +++++++++++++++++----- .../MediaBrowser.ServerApplication.csproj | 2 ++ .../MainWindow.xaml.cs | 2 +- .../Properties/AssemblyInfo.cs | 4 +-- MediaBrowser.Uninstaller/MainWindow.xaml.cs | 8 +++-- 5 files changed, 40 insertions(+), 14 deletions(-) (limited to 'MediaBrowser.ServerApplication') diff --git a/MediaBrowser.Installer/MainWindow.xaml.cs b/MediaBrowser.Installer/MainWindow.xaml.cs index 00b314b54..6bd2834af 100644 --- a/MediaBrowser.Installer/MainWindow.xaml.cs +++ b/MediaBrowser.Installer/MainWindow.xaml.cs @@ -95,13 +95,17 @@ namespace MediaBrowser.Installer /// protected async Task DoInstall() { - lblStatus.Content = "Downloading "+FriendlyName+"..."; + lblStatus.Content = string.Format("Downloading {0}...", FriendlyName); dlAnimation.StartAnimation(); prgProgress.Value = 0; prgProgress.Visibility = Visibility.Visible; + // Determine Package version + var version = await GetPackageVersion().ConfigureAwait(false); + lblStatus.Content = string.Format("Downloading {0} (version {1})...", FriendlyName, version.versionStr); + // Download - var archive = await DownloadPackage(); + var archive = await DownloadPackage(version).ConfigureAwait(false); dlAnimation.StopAnimation(); prgProgress.Visibility = btnCancel.Visibility = Visibility.Hidden; @@ -141,18 +145,14 @@ namespace MediaBrowser.Installer } - /// - /// Download our specified package to an archive in a temp location - /// - /// The fully qualified name of the downloaded package - protected async Task DownloadPackage() + protected async Task GetPackageVersion() { using (var client = new WebClient()) { try { // get the package information for the server - var json = await client.DownloadStringTaskAsync("http://www.mb3admin.com/admin/service/package/retrieveAll?name="+PackageName); + var json = await client.DownloadStringTaskAsync("http://www.mb3admin.com/admin/service/package/retrieveAll?name=" + PackageName).ConfigureAwait(false); var packages = JsonSerializer.DeserializeFromString>(json); var version = packages[0].versions.Where(v => v.classification == PackageClass).OrderByDescending(v => v.version).FirstOrDefault(v => v.version <= PackageVersion); @@ -161,11 +161,31 @@ namespace MediaBrowser.Installer SystemClose("Could not locate download package. Aborting."); return null; } + } + catch (Exception e) + { + SystemClose(e.GetType().FullName + "\n\n" + e.Message); + } + + } + return null; + } + + /// + /// Download our specified package to an archive in a temp location + /// + /// The fully qualified name of the downloaded package + protected async Task DownloadPackage(PackageVersionInfo version) + { + using (var client = new WebClient()) + { + try + { var archiveFile = Path.Combine(PrepareTempLocation(), version.targetFilename); // setup download progress and download the package client.DownloadProgressChanged += DownloadProgressChanged; - await client.DownloadFileTaskAsync(version.sourceUrl, archiveFile); + await client.DownloadFileTaskAsync(version.sourceUrl, archiveFile).ConfigureAwait(false); return archiveFile; } catch (Exception e) diff --git a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj index 3ed16f825..3c8b2c735 100644 --- a/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj +++ b/MediaBrowser.ServerApplication/MediaBrowser.ServerApplication.csproj @@ -385,6 +385,8 @@ if $(ConfigurationName) == Release ( mkdir "$(SolutionDir)..\Deploy\Server\System" xcopy "$(TargetDir)$(TargetFileName)" "$(SolutionDir)..\Deploy\Server\System\" /y +xcopy "$(SolutionDir)Mediabrowser.Uninstaller\bin\Release\MediaBrowser.Uninstaller.exe.config" "$(SolutionDir)..\Deploy\Server\System\" /y +xcopy "$(SolutionDir)Mediabrowser.Uninstaller.Execute\bin\Release\MediaBrowser.Uninstaller.Execute.exe.config" "$(SolutionDir)..\Deploy\Server\System\" /y xcopy "$(SolutionDir)Mediabrowser.Uninstaller\bin\Release\MediaBrowser.Uninstaller.exe" "$(SolutionDir)..\Deploy\Server\System\" /y xcopy "$(SolutionDir)Mediabrowser.Uninstaller.Execute\bin\Release\MediaBrowser.Uninstaller.Execute.exe" "$(SolutionDir)..\Deploy\Server\System\" /y diff --git a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs index 0d66ee94e..bdf34b956 100644 --- a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs +++ b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs @@ -34,7 +34,7 @@ namespace MediaBrowser.Uninstaller.Execute break; default: - Console.WriteLine("Please specify which application to un-install (server or mbt)"); + MessageBox.Show("Please specify which application to un-install (server or mbt)"); Close(); break; diff --git a/MediaBrowser.Uninstaller.Execute/Properties/AssemblyInfo.cs b/MediaBrowser.Uninstaller.Execute/Properties/AssemblyInfo.cs index 02bd2c244..613589a7d 100644 --- a/MediaBrowser.Uninstaller.Execute/Properties/AssemblyInfo.cs +++ b/MediaBrowser.Uninstaller.Execute/Properties/AssemblyInfo.cs @@ -10,9 +10,9 @@ using System.Windows; [assembly: AssemblyTitle("MediaBrowser.Uninstaller")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Toshiba")] +[assembly: AssemblyCompany("Media Browser Team")] [assembly: AssemblyProduct("MediaBrowser.Uninstaller")] -[assembly: AssemblyCopyright("Copyright © Toshiba 2013")] +[assembly: AssemblyCopyright("Copyright © Media Browser Team 2013")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] diff --git a/MediaBrowser.Uninstaller/MainWindow.xaml.cs b/MediaBrowser.Uninstaller/MainWindow.xaml.cs index 3e95820cd..fb5f32a7f 100644 --- a/MediaBrowser.Uninstaller/MainWindow.xaml.cs +++ b/MediaBrowser.Uninstaller/MainWindow.xaml.cs @@ -31,12 +31,16 @@ namespace MediaBrowser.Uninstaller var args = Environment.GetCommandLineArgs(); 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(), "MBUninstall.exe"); + 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 - File.WriteAllBytes(tempExe, File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase) ?? "","MediaBrowser.Uninstaller.Execute.exe"))); + var sourceDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().GetName().CodeBase) ?? ""; + File.WriteAllBytes(tempExe, File.ReadAllBytes(Path.Combine(sourceDir ,"MediaBrowser.Uninstaller.Execute.exe"))); + File.Copy(tempConfig, Path.Combine(sourceDir ,"MediaBrowser.Uninstaller.Execute.exe.config")); //kick off the copy + MessageBox.Show("About to start " + tempExe); Process.Start(tempExe, product); //wait for it to start up Thread.Sleep(500); -- cgit v1.2.3