/// <summary> /// Returns the <see cref="Share"/> which matches a given local path /// </summary> /// <param name="path">The path to match</param> public Share this[string path] { get { if (null == path || 0 == path.Length) { return(null); } path = Path.GetFullPath(path); if (!IsValidFilePath(path)) { return(null); } Share match = null; for (int i = 0; i < InnerList.Count; i++) { Share s = (Share)InnerList[i]; if (s.IsFileSystem && s.MatchesPath(path)) { //Store first match if (null == match) { match = s; } // If this has a longer path, // and this is a disk share or match is a special share, // then this is a better match else if (match.Path.Length < s.Path.Length) { if (ShareType.Disk == s.ShareType || ShareType.Disk != match.ShareType) { match = s; } } } } return(match); } }