예제 #1
0
        static public string ApplyFolderEquality(string path, FolderPathEquality folderEquality)
        {
            if (path == null)
            {
                throw new ArgumentNullException();
            }

            if (folderEquality == FolderPathEquality.RespectAmbiguity)
            {
                path = PathUtils.TrimEndSeparator(path);
            }

            return(path);
        }
예제 #2
0
        static public bool Equals(string first, string second, PathCaseComparison caseComparison, FolderPathEquality folderEquality)
        {
            if (first == null && second == null)
            {
                return(true);
            }
            if (first == null ^ second == null)
            {
                return(false);
            }

            return(string.Equals(ApplyFolderEquality(PathUtils.Normalize(first), folderEquality), ApplyFolderEquality(PathUtils.Normalize(second), folderEquality), GetStringComparison(caseComparison)));
        }
예제 #3
0
        static public int Compare(string first, string second, PathCaseComparison caseComparison, FolderPathEquality folderEquality)
        {
            if (first == null && second == null)
            {
                return(0);
            }
            if (first == null)
            {
                return(-1);
            }
            if (second == null)
            {
                return(1);
            }

            return(string.Compare(ApplyFolderEquality(PathUtils.Normalize(first), folderEquality), ApplyFolderEquality(PathUtils.Normalize(second), folderEquality), GetStringComparison(caseComparison)));
        }
예제 #4
0
 public PathComparer(PathCaseComparison caseComparison, FolderPathEquality folderEquality)
 {
     CaseComparison = caseComparison;
     FolderEquality = folderEquality;
 }