public static bool Equals(IFileContext context, FileInfo file, string otherFileName, string otherFileExtension, FileNameMode comparisonMode) { if (!string.IsNullOrWhiteSpace(otherFileExtension)) { if (!string.Equals(file.Extension, "." + otherFileExtension)) { return(false); } } if (!string.IsNullOrWhiteSpace(otherFileName)) { switch (comparisonMode) { case FileNameMode.Default: { if (!string.Equals(file.Name, otherFileName)) { return(false); } } break; case FileNameMode.NonLiteral: { if (file.Name.IndexOf(otherFileName, System.StringComparison.OrdinalIgnoreCase) == -1) { return(false); } } break; case FileNameMode.NonLiteralIncludePath: { if (context.GetRelativePath(file.FullName).IndexOf(otherFileName, System.StringComparison.OrdinalIgnoreCase) == -1) { return(false); } } break; } } return(true); }