diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-20 18:48:52 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2016-11-20 18:48:52 -0500 |
| commit | e297e90bceeb3310e32142af406403d54875720d (patch) | |
| tree | 27cedda92ea6452f148bbc87c59fbdbf50566174 /Emby.Server.Core/ApplicationHost.cs | |
| parent | 94e622e3a0cfcd14ad47ede3342dfab7a862c4d9 (diff) | |
update .net core startup
Diffstat (limited to 'Emby.Server.Core/ApplicationHost.cs')
| -rw-r--r-- | Emby.Server.Core/ApplicationHost.cs | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/Emby.Server.Core/ApplicationHost.cs b/Emby.Server.Core/ApplicationHost.cs index ba0d830d3..55a851033 100644 --- a/Emby.Server.Core/ApplicationHost.cs +++ b/Emby.Server.Core/ApplicationHost.cs @@ -132,6 +132,8 @@ using SocketHttpListener.Primitives; using StringExtensions = MediaBrowser.Controller.Extensions.StringExtensions; using Emby.Drawing; using Emby.Server.Implementations.Migrations; +using MediaBrowser.Model.Diagnostics; +using Emby.Common.Implementations.Diagnostics; namespace Emby.Server.Core { @@ -1543,7 +1545,39 @@ namespace Emby.Server.Core } } - public abstract void LaunchUrl(string url); + public void LaunchUrl(string url) + { + if (EnvironmentInfo.OperatingSystem != MediaBrowser.Model.System.OperatingSystem.Windows) + { + throw new NotImplementedException(); + } + + var process = ProcessFactory.Create(new ProcessOptions { + FileName = url, + EnableRaisingEvents = true, + UseShellExecute = true, + ErrorDialog = false + }); + + process.Exited += ProcessExited; + + try + { + process.Start(); + } + catch (Exception ex) + { + Console.WriteLine("Error launching url: {0}", url); + Logger.ErrorException("Error launching url: {0}", ex, url); + + throw; + } + } + + private static void ProcessExited(object sender, EventArgs e) + { + ((IProcess)sender).Dispose(); + } public void EnableLoopback(string appName) { |
