Exemple #1
0
        public static List <string> FindSimilarNames(string path, string[] types,
                                                     string[] otherFiles, out bool nameHasSuffix, out string pathWithoutSuffix)
        {
            // parse the file
            pathWithoutSuffix = null;
            nameHasSuffix     = FindPathWithSuffixRemoved(path, types, out pathWithoutSuffix);

            // delete all the rest in group
            var           nameWithoutSuffix = nameHasSuffix ? pathWithoutSuffix : path;
            List <string> results           = new List <string>();

            foreach (var otherFile in otherFiles)
            {
                if (otherFile.ToUpperInvariant() != path.ToUpperInvariant())
                {
                    if (FilenameUtils.SameExceptExtension(nameWithoutSuffix, otherFile) ||
                        (FindPathWithSuffixRemoved(otherFile, types, out string nameMiddleRemoved) &&
                         FilenameUtils.SameExceptExtension(nameWithoutSuffix, nameMiddleRemoved)))
                    {
                        results.Add(otherFile);
                    }
                }
            }

            return(results);
        }