Conflicts:
	MediaBrowser.ServerApplication/ApplicationHost.cs
pull/702/head
LukePulverenti 12 years ago
commit 7cacbeee7b

@ -123,10 +123,7 @@ namespace MediaBrowser.Api
if (updateCheckResult.IsUpdateAvailable) if (updateCheckResult.IsUpdateAvailable)
{ {
result.Add(new PackageVersionInfo result.Add(updateCheckResult.Package);
{
versionStr = updateCheckResult.AvailableVersion.ToString()
});
} }
} }

@ -8,6 +8,6 @@ namespace MediaBrowser.Common.Constants
{ {
public static class Constants public static class Constants
{ {
public const string MBAdminUrl = "http://mb3admin.com/admin/"; public const string MBAdminUrl = "http://www.mb3admin.com/admin/";
} }
} }

@ -112,31 +112,59 @@ namespace MediaBrowser.Installer
// Determine Package version // Determine Package version
var version = await GetPackageVersion(); 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 // Now try and shut down the server if that is what we are installing and it is running
if (PackageName == "MBServer") if (PackageName == "MBServer" && Process.GetProcessesByName("mediabrowser.serverapplication").Length != 0)
{
Task.Run(async () =>
{ {
lblStatus.Content = "Shutting Down Media Browser Server...";
using (var client = new WebClient()) using (var client = new WebClient())
{ {
try try
{ {
await client.UploadStringTaskAsync("http://localhost:8096/mediabrowser/system/shutdown", "").ConfigureAwait(false); client.UploadString("http://localhost:8096/mediabrowser/System/Shutdown", "");
} }
catch (WebException e) catch (WebException e)
{ {
if (e.GetStatus() == HttpStatusCode.NotFound || e.Message.StartsWith("Unable to connect",StringComparison.OrdinalIgnoreCase)) return; // just wasn't running 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); 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 // 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(); dlAnimation.StopAnimation();
prgProgress.Visibility = btnCancel.Visibility = Visibility.Hidden; prgProgress.Visibility = btnCancel.Visibility = Visibility.Hidden;

@ -29,7 +29,7 @@
<PublisherName>Media Browser Team</PublisherName> <PublisherName>Media Browser Team</PublisherName>
<SuiteName>Media Browser</SuiteName> <SuiteName>Media Browser</SuiteName>
<OpenBrowserOnPublish>false</OpenBrowserOnPublish> <OpenBrowserOnPublish>false</OpenBrowserOnPublish>
<ApplicationRevision>21</ApplicationRevision> <ApplicationRevision>28</ApplicationRevision>
<ApplicationVersion>0.1.1.%2a</ApplicationVersion> <ApplicationVersion>0.1.1.%2a</ApplicationVersion>
<UseApplicationTrust>false</UseApplicationTrust> <UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted> <PublishWizardCompleted>true</PublishWizardCompleted>

@ -17,6 +17,15 @@ namespace MediaBrowser.Model.Updates
/// Gets or sets the available version. /// Gets or sets the available version.
/// </summary> /// </summary>
/// <value>The available version.</value> /// <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; }
} }
} }

@ -11,6 +11,7 @@ using MediaBrowser.Common.IO;
using MediaBrowser.Common.Kernel; using MediaBrowser.Common.Kernel;
using MediaBrowser.Common.Net; using MediaBrowser.Common.Net;
using MediaBrowser.Common.ScheduledTasks; using MediaBrowser.Common.ScheduledTasks;
using MediaBrowser.Common.Updates;
using MediaBrowser.Controller; using MediaBrowser.Controller;
using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Library;
using MediaBrowser.IsoMounter; 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> /// <value><c>true</c> if this instance can self update; otherwise, <c>false</c>.</value>
public bool CanSelfUpdate public bool CanSelfUpdate
{ {
get { return ClickOnceHelper.IsNetworkDeployed; } get { return true; }
} }
/// <summary> /// <summary>
@ -157,10 +158,14 @@ namespace MediaBrowser.ServerApplication
/// <param name="cancellationToken">The cancellation token.</param> /// <param name="cancellationToken">The cancellation token.</param>
/// <param name="progress">The progress.</param> /// <param name="progress">The progress.</param>
/// <returns>Task{CheckForUpdateResult}.</returns> /// <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>() var pkgManager = Resolve<IPackageManager>();
return new ApplicationUpdateCheck().CheckForApplicationUpdate(cancellationToken, progress); 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> /// <summary>

@ -1,5 +1,6 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.Net;
using System.Reflection; using System.Reflection;
using System.IO; using System.IO;
using System.Threading; using System.Threading;
@ -78,6 +79,41 @@ namespace MediaBrowser.Uninstaller.Execute
if (Product == "Server") if (Product == "Server")
{ {
RemoveShortcut(Path.Combine(startMenu, "MB Dashboard.lnk")); 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 the startmenu item is empty now - delete it too
if (Directory.GetFiles(startMenu).Length == 0) 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); var rootPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData), "MediaBrowser" + RootSuffix);
lblHeading.Content = "Removing System Files...";
if (cbxRemoveAll.IsChecked == true) if (cbxRemoveAll.IsChecked == true)
{ {
// Just remove our whole directory // Just remove our whole directory
@ -107,7 +144,6 @@ namespace MediaBrowser.Uninstaller.Execute
else else
{ {
// First remove the system // First remove the system
lblHeading.Content = "Removing System Files...";
RemovePath(Path.Combine(rootPath, "System")); RemovePath(Path.Combine(rootPath, "System"));
RemovePath(Path.Combine(rootPath, "MediaTools")); RemovePath(Path.Combine(rootPath, "MediaTools"));

Loading…
Cancel
Save