src/AnvilPacker/Util/Utils.cs
/// <summary> Checks if the file path has any of the specified extensions. </summary>
/// <param name="extension">The array with the extensions to check for; they all must start with a period. </param>
Checks if the file path has any of the specified extensions.
Checks if the file path has any of the specified extensions .
public static bool FileHasExtension(string path, params string[] extensions)
        {
            var actualExt = Path.GetExtension(path.AsSpan());
            foreach (var ext in extensions) {
                if (actualExt.Equals(ext, StringComparison.OrdinalIgnoreCase)) {
                    return true;
                }
            }
            return false;
        }
public static bool FileHasExtension ( string path , params string [ ] extensions ) { var actualExt = Path . GetExtension ( path . AsSpan ( ) ) ; foreach ( var ext in extensions ) { if ( actualExt . Equals ( ext , StringComparison . OrdinalIgnoreCase ) ) { return true ; } } return false ; }
Checks if the file path has any of the specified extensions.
Checks if the file path has any of the specified extensions .
path
string
extension
The array with the extensions to check for; they all must start with a period.
The array with the extensions to check for ; they all must start with a period .