diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-11-20 19:58:37 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-11-20 19:58:37 -0500 |
| commit | b91ebfae1b0a72d3b643221c48932bc45b2612b1 (patch) | |
| tree | f909f0436c4c8cd571084df18cdc7efb5a6ba922 /Emby.Server.Core | |
| parent | a6ded79ea7d9d4cc9ed8d28b7043aa18c8ec02ae (diff) | |
| parent | 985c9111cf14431c3e1a1f94953a6d4422d167ee (diff) | |
Merge pull request #2298 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Core')
| -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) { |
