public static bool IsLocalShare(string shareName)
{
if (!String.IsNullOrEmpty(shareName))
{
string shareServerName = GetServerNameFromShareName(shareName);
if (String.Compare(shareServerName, Environment.MachineName, true) == 0)
{
DirectoryInfo dirInfo = new DirectoryInfo(shareName);
if (dirInfo.Exists && dirInfo.Root != null)
{
List<ShareInfo> localShares = GetShareInfo(ShareType.Disk);
foreach (ShareInfo shareInfo in localShares)
{
if (shareInfo.Root != null)
{
if (String.Compare(shareInfo.Root.FullName, 0, dirInfo.FullName, 0, shareInfo.Root.FullName.Length, true) == 0)
{
return true;
}
}
}
}
}
}
return false;
}