aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication/MainStartup.cs
diff options
context:
space:
mode:
authorhatharry <hatharry@hotmail.com>2016-10-11 17:21:21 +1300
committerhatharry <hatharry@hotmail.com>2016-10-11 17:21:21 +1300
commitd6862cefd83e3733a7a459ffd7cec616db006c22 (patch)
treea712bbef2227b60d8d870898e4205328fbf02484 /MediaBrowser.ServerApplication/MainStartup.cs
parent91225bc9688327e89224c91651dcec7eafa05234 (diff)
parent9b0ac4bde5beb74703a258d582f477c6411ec6ec (diff)
Merge branch 'dev' of https://github.com/hatharry/Emby.git
Diffstat (limited to 'MediaBrowser.ServerApplication/MainStartup.cs')
-rw-r--r--MediaBrowser.ServerApplication/MainStartup.cs30
1 files changed, 26 insertions, 4 deletions
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs
index 46ad714cb..d1972a938 100644
--- a/MediaBrowser.ServerApplication/MainStartup.cs
+++ b/MediaBrowser.ServerApplication/MainStartup.cs
@@ -15,6 +15,7 @@ using System.Linq;
using System.Management;
using System.Runtime.InteropServices;
using System.ServiceProcess;
+using System.Text;
using System.Threading;
using System.Threading.Tasks;
using System.Windows.Forms;
@@ -38,9 +39,31 @@ namespace MediaBrowser.ServerApplication
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool SetDllDirectory(string lpPathName);
+ public static bool TryGetLocalFromUncDirectory(string local, out string unc)
+ {
+ if ((local == null) || (local == ""))
+ {
+ unc = "";
+ throw new ArgumentNullException("local");
+ }
+
+ ManagementObjectSearcher searcher = new ManagementObjectSearcher("SELECT Name FROM Win32_share WHERE path ='" + local.Replace("\\", "\\\\") + "'");
+ ManagementObjectCollection coll = searcher.Get();
+ if (coll.Count == 1)
+ {
+ foreach (ManagementObject share in searcher.Get())
+ {
+ unc = share["Name"] as String;
+ unc = "\\\\" + SystemInformation.ComputerName + "\\" + unc;
+ return true;
+ }
+ }
+ unc = "";
+ return false;
+ }
/// <summary>
- /// Defines the entry point of the application.
- /// </summary>
+ /// Defines the entry point of the application.
+ /// </summary>
public static void Main()
{
var options = new StartupOptions();
@@ -312,7 +335,6 @@ namespace MediaBrowser.ServerApplication
ErrorModes.SEM_NOGPFAULTERRORBOX | ErrorModes.SEM_NOOPENFILEERRORBOX);
}
-
var task = _appHost.Init(initProgress);
Task.WaitAll(task);
@@ -352,7 +374,7 @@ namespace MediaBrowser.ServerApplication
Application.Run();
}
- private static SplashForm _splash;
+ internal static SplashForm _splash;
private static Thread _splashThread;
private static void ShowSplashScreen(Version appVersion, Progress<double> progress, ILogger logger)
{