aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLukePulverenti <luke.pulverenti@gmail.com>2013-02-28 14:41:25 -0500
committerLukePulverenti <luke.pulverenti@gmail.com>2013-02-28 14:41:25 -0500
commit7cacbeee7b01a30e85339266270aa1ee8c866ec8 (patch)
treee2c25f8e1d7c53d78ce91879eb2d99551be42f0d
parentaf7aa597c35279e286ee88641854db69744e7b15 (diff)
parent759f7fe84210d810685576ae99f6aecc187a24eb (diff)
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
Conflicts: MediaBrowser.ServerApplication/ApplicationHost.cs
-rw-r--r--MediaBrowser.Api/PackageService.cs5
-rw-r--r--MediaBrowser.Common/Constants/Constants.cs2
-rw-r--r--MediaBrowser.Installer/MainWindow.xaml.cs68
-rw-r--r--MediaBrowser.Installer/MediaBrowser.Installer.csproj2
-rw-r--r--MediaBrowser.Model/Updates/CheckForUpdateResult.cs11
-rw-r--r--MediaBrowser.ServerApplication/ApplicationHost.cs13
-rw-r--r--MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs38
7 files changed, 107 insertions, 32 deletions
diff --git a/MediaBrowser.Api/PackageService.cs b/MediaBrowser.Api/PackageService.cs
index 698d7e47f..a45b11e26 100644
--- a/MediaBrowser.Api/PackageService.cs
+++ b/MediaBrowser.Api/PackageService.cs
@@ -123,10 +123,7 @@ namespace MediaBrowser.Api
if (updateCheckResult.IsUpdateAvailable)
{
- result.Add(new PackageVersionInfo
- {
- versionStr = updateCheckResult.AvailableVersion.ToString()
- });
+ result.Add(updateCheckResult.Package);
}
}
diff --git a/MediaBrowser.Common/Constants/Constants.cs b/MediaBrowser.Common/Constants/Constants.cs
index e8a347829..676518737 100644
--- a/MediaBrowser.Common/Constants/Constants.cs
+++ b/MediaBrowser.Common/Constants/Constants.cs
@@ -8,6 +8,6 @@ namespace MediaBrowser.Common.Constants
{
public static class Constants
{
- public const string MBAdminUrl = "http://mb3admin.com/admin/";
+ public const string MBAdminUrl = "http://www.mb3admin.com/admin/";
}
}
diff --git a/MediaBrowser.Installer/MainWindow.xaml.cs b/MediaBrowser.Installer/MainWindow.xaml.cs
index fe672ec07..63e1f5dbd 100644
--- a/MediaBrowser.Installer/MainWindow.xaml.cs
+++ b/MediaBrowser.Installer/MainWindow.xaml.cs
@@ -112,31 +112,59 @@ namespace MediaBrowser.Installer
// Determine Package version
var version = await GetPackageVersion();
- lblStatus.Content = string.Format("Downloading {0} (version {1})...", FriendlyName, version.versionStr);
- // Now in the background - try and shut down the server if that is what we are installing
- if (PackageName == "MBServer")
+ // Now try and shut down the server if that is what we are installing and it is running
+ if (PackageName == "MBServer" && Process.GetProcessesByName("mediabrowser.serverapplication").Length != 0)
{
- Task.Run(async () =>
- {
- using (var client = new WebClient())
- {
- try
- {
- await client.UploadStringTaskAsync("http://localhost:8096/mediabrowser/system/shutdown", "").ConfigureAwait(false);
- }
- catch (WebException e)
- {
- if (e.GetStatus() == HttpStatusCode.NotFound || e.Message.StartsWith("Unable to connect",StringComparison.OrdinalIgnoreCase)) return; // just wasn't running
-
- MessageBox.Show("Error shutting down server.\n\n" + e.GetStatus() + "\n\n" + e.Message);
- }
- }
- });
+ lblStatus.Content = "Shutting Down Media Browser Server...";
+ using (var client = new WebClient())
+ {
+ try
+ {
+ client.UploadString("http://localhost:8096/mediabrowser/System/Shutdown", "");
+ }
+ catch (WebException e)
+ {
+ if (e.GetStatus() == HttpStatusCode.NotFound || e.Message.StartsWith("Unable to connect",StringComparison.OrdinalIgnoreCase)) return; // just wasn't running
+
+ MessageBox.Show("Error shutting down server. Please be sure it is not running before hitting OK.\n\n" + e.GetStatus() + "\n\n" + e.Message);
+ }
+ }
+ }
+ else
+ {
+ if (PackageName == "MBTheater")
+ {
+ // Uninstalling MBT - shut it down if it is running
+ var processes = Process.GetProcessesByName("mediabrowser.ui");
+ if (processes.Length > 0)
+ {
+ lblStatus.Content = "Shutting Down Media Browser Theater...";
+ try
+ {
+ processes[0].Kill();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Unable to shutdown Media Browser Theater. Please ensure it is not running before hitting OK.\n\n" + ex.Message, "Error");
+ }
+ }
+
+ }
}
// Download
- var archive = await DownloadPackage(version);
+ string archive = null;
+ lblStatus.Content = string.Format("Downloading {0} (version {1})...", FriendlyName, version.versionStr);
+ try
+ {
+ archive = await DownloadPackage(version);
+ }
+ catch (Exception e)
+ {
+ SystemClose("Error Downloading Package - " + e.GetType().FullName + "\n\n" + e.Message);
+ }
+
dlAnimation.StopAnimation();
prgProgress.Visibility = btnCancel.Visibility = Visibility.Hidden;
diff --git a/MediaBrowser.Installer/MediaBrowser.Installer.csproj b/MediaBrowser.Installer/MediaBrowser.Installer.csproj
index 36769fdb2..4149a8ab1 100644
--- a/MediaBrowser.Installer/MediaBrowser.Installer.csproj
+++ b/MediaBrowser.Installer/MediaBrowser.Installer.csproj
@@ -29,7 +29,7 @@
<PublisherName>Media Browser Team</PublisherName>
<SuiteName>Media Browser</SuiteName>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish>
- <ApplicationRevision>21</ApplicationRevision>
+ <ApplicationRevision>28</ApplicationRevision>
<ApplicationVersion>0.1.1.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
diff --git a/MediaBrowser.Model/Updates/CheckForUpdateResult.cs b/MediaBrowser.Model/Updates/CheckForUpdateResult.cs
index 48c0b398c..c9bc2d6b9 100644
--- a/MediaBrowser.Model/Updates/CheckForUpdateResult.cs
+++ b/MediaBrowser.Model/Updates/CheckForUpdateResult.cs
@@ -17,6 +17,15 @@ namespace MediaBrowser.Model.Updates
/// Gets or sets the available version.
/// </summary>
/// <value>The available version.</value>
- public Version AvailableVersion { get; set; }
+ public Version AvailableVersion
+ {
+ get { return Package != null ? Package.version : new Version(0, 0); }
+ set { } // need this for the serializer
+ }
+
+ /// <summary>
+ /// Get or sets package information for an available update
+ /// </summary>
+ public PackageVersionInfo Package { get; set; }
}
}
diff --git a/MediaBrowser.ServerApplication/ApplicationHost.cs b/MediaBrowser.ServerApplication/ApplicationHost.cs
index d97f4b53f..0ed3b228e 100644
--- a/MediaBrowser.ServerApplication/ApplicationHost.cs
+++ b/MediaBrowser.ServerApplication/ApplicationHost.cs
@@ -11,6 +11,7 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Common.Kernel;
using MediaBrowser.Common.Net;
using MediaBrowser.Common.ScheduledTasks;
+using MediaBrowser.Common.Updates;
using MediaBrowser.Controller;
using MediaBrowser.Controller.Library;
using MediaBrowser.IsoMounter;
@@ -148,7 +149,7 @@ namespace MediaBrowser.ServerApplication
/// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
public bool CanSelfUpdate
{
- get { return ClickOnceHelper.IsNetworkDeployed; }
+ get { return true; }
}
/// <summary>
@@ -157,10 +158,14 @@ namespace MediaBrowser.ServerApplication
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="progress">The progress.</param>
/// <returns>Task{CheckForUpdateResult}.</returns>
- public Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
+ public async Task<CheckForUpdateResult> CheckForApplicationUpdate(CancellationToken cancellationToken, IProgress<double> progress)
{
- // Get package manager using Resolve<IPackageManager>()
- return new ApplicationUpdateCheck().CheckForApplicationUpdate(cancellationToken, progress);
+ var pkgManager = Resolve<IPackageManager>();
+ var availablePackages = await pkgManager.GetAvailablePackages(Resolve<IHttpClient>(), Resolve<INetworkManager>(), Kernel.SecurityManager, Kernel.ResourcePools, Resolve<IJsonSerializer>(), CancellationToken.None).ConfigureAwait(false);
+ var version = Kernel.InstallationManager.GetLatestCompatibleVersion(availablePackages, "MBServer", Kernel.Configuration.SystemUpdateLevel);
+
+ return version != null ? new CheckForUpdateResult {AvailableVersion = version.version, IsUpdateAvailable = version.version > ApplicationVersion, Package = version} :
+ new CheckForUpdateResult();
}
/// <summary>
diff --git a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
index 9937177a7..934ff284b 100644
--- a/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
+++ b/MediaBrowser.Uninstaller.Execute/MainWindow.xaml.cs
@@ -1,5 +1,6 @@
using System;
using System.Diagnostics;
+using System.Net;
using System.Reflection;
using System.IO;
using System.Threading;
@@ -78,6 +79,41 @@ namespace MediaBrowser.Uninstaller.Execute
if (Product == "Server")
{
RemoveShortcut(Path.Combine(startMenu, "MB Dashboard.lnk"));
+ if (Process.GetProcessesByName("mediabrowser.serverapplication").Length != 0)
+ {
+ using (var client = new WebClient())
+ {
+ lblHeading.Content = "Shutting Down Media Browser Server...";
+ try
+ {
+ client.UploadString("http://localhost:8096/mediabrowser/system/shutdown", "");
+ }
+ catch (WebException ex)
+ {
+ if (ex.Status != WebExceptionStatus.ConnectFailure && !ex.Message.StartsWith("Unable to connect", StringComparison.OrdinalIgnoreCase))
+ {
+ MessageBox.Show("Error shutting down server. Please be sure it is not running before hitting OK.\n\n" + ex.Status + "\n\n" + ex.Message);
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ // Installing MBT - shut it down if it is running
+ var processes = Process.GetProcessesByName("mediabrowser.ui");
+ if (processes.Length > 0)
+ {
+ lblHeading.Content = "Shutting Down Media Browser Theater...";
+ try
+ {
+ processes[0].Kill();
+ }
+ catch (Exception ex)
+ {
+ MessageBox.Show("Unable to shutdown Media Browser Theater. Please ensure it is not running before hitting OK.\n\n" + ex.Message, "Error");
+ }
+ }
}
// if the startmenu item is empty now - delete it too
if (Directory.GetFiles(startMenu).Length == 0)
@@ -99,6 +135,7 @@ namespace MediaBrowser.Uninstaller.Execute
var rootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser" + RootSuffix);
+ lblHeading.Content = "Removing System Files...";
if (cbxRemoveAll.IsChecked == true)
{
// Just remove our whole directory
@@ -107,7 +144,6 @@ namespace MediaBrowser.Uninstaller.Execute
else
{
// First remove the system
- lblHeading.Content = "Removing System Files...";
RemovePath(Path.Combine(rootPath, "System"));
RemovePath(Path.Combine(rootPath, "MediaTools"));