EyeAuras Docs EyeAuras Docs
EyeAuras Docs EyeAuras Docs
DocFX + Singulink = ♥

Search Results for

    Method GenerateValidName

    GenerateValidName(string, Func<string, int, string>, Predicate<string>)

    Generates a valid path name by mutating a base path name.

    Declaration
    public static string GenerateValidName(string baseName, Func<string, int, string> mutation, Predicate<string> pathValidator)
    Parameters
    Type Name Description
    string baseName

    The base path.

    Func<string, int, string> mutation

    A function defining how to mutate the baseName when the pathValidator returns false.

    Predicate<string> pathValidator

    A function to check the validity of a path, which returns true when valid and false otherwise.

    Returns
    Type Description
    string

    A valid path based on the baseName.

    Exceptions
    Type Condition
    ArgumentException

    Thrown when no folder path is specified or invalid new folder path is provided.

    GenerateValidName(string, Predicate<string>)

    Creates a valid path name by appending a number to a base path name.

    Declaration
    public static string GenerateValidName(string baseName, Predicate<string> pathValidator)
    Parameters
    Type Name Description
    string baseName

    The base path.

    Predicate<string> pathValidator

    A function to validate a path, which returns true when valid and false otherwise.

    Returns
    Type Description
    string

    A valid path converted from the base path.

    Examples
    GenerateValidName("C:\\temp", path => !Directory.Exists(path)); //Returns "C:\\temp (1)" if "C:\\temp" exists
    © Xab3r. All rights reserved.