ArgusTV.Recorders.Common.ShareExplorer.FindBestShareInfoMatch C# (CSharp) Метод

FindBestShareInfoMatch() приватный статический Метод

private static FindBestShareInfoMatch ( List shareInfoList, string fileName ) : ShareInfo
shareInfoList List
fileName string
Результат ShareInfo
        private static ShareInfo FindBestShareInfoMatch(List<ShareInfo> shareInfoList, string fileName)
        {
            ShareInfo matched = null;
            foreach (ShareInfo shareInfo in shareInfoList)
            {
                if (shareInfo.IsFileSystem
                    && shareInfo.ShareType != ShareType.Special
                    && shareInfo.MatchesPath(fileName))
                {
                    //Store first match
                    if (matched == null)
                    {
                        matched = shareInfo;
                    }
                    // better match ? if so keep it
                    else if (matched.Path.Length < shareInfo.Path.Length)
                    {
                        if (ShareType.Disk == shareInfo.ShareType || ShareType.Disk != matched.ShareType)
                        {
                            matched = shareInfo;
                        }
                    }
                }
            }
            return matched;
        }