Method GenerateUniqueFilenameInDownloads
GenerateUniqueFilenameInDownloads(string)
Generates a unique filename in the user's Downloads folder based on the specified filename template.
public static string GenerateUniqueFilenameInDownloads(string fileNameTemplate)
Parameters
fileNameTemplatestringThe template for the filename, which may include placeholders or a base name. For example, "file_{0}.txt" can be used to generate filenames like "file_1.txt", "file_2.txt", etc.
Returns
- string
A unique filename within the Downloads folder that does not conflict with existing files.
Remarks
This method ensures that the generated filename is unique by checking for conflicts in the Downloads folder. The filename template should be designed to allow for uniqueness, such as including placeholders for numbering.