aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.ServerApplication
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2016-09-12 14:23:41 -0400
committerGitHub <noreply@github.com>2016-09-12 14:23:41 -0400
commit480b9c323ac7c4b4c70f60b1ddc1677d6f233fcd (patch)
tree76a0869402b108e01f7365a0a08acf8e5c1837ce /MediaBrowser.ServerApplication
parent05cd512e81d5c558bd0c4e41aca24d67cc976b09 (diff)
parent151d88f20db2d6fbb8ea901d84d25d26ccbb136c (diff)
Merge pull request #2161 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.ServerApplication')
-rw-r--r--MediaBrowser.ServerApplication/MainStartup.cs27
1 files changed, 25 insertions, 2 deletions
diff --git a/MediaBrowser.ServerApplication/MainStartup.cs b/MediaBrowser.ServerApplication/MainStartup.cs
index cdacdc81f..5d4fba32d 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;
@@ -37,9 +38,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();