Microsoft.VsSDK.IntegrationTestLibrary.TestUtils.GetNewFileName C# (CSharp) Method

GetNewFileName() public static method

Returns the first available file name on the form [baseFileName]i.[extension] where [i] starts at 1 and increases until there is an available file name in the given directory. Also creates an empty file with that name to mark that file as occupied.
public static GetNewFileName ( string directory, string baseFileName, string extension ) : string
directory string Directory that the file should live in.
baseFileName string
extension string may be null, in which case the .[extension] part /// is not added.
return string
        public static string GetNewFileName(string directory, string baseFileName, string extension)
        {
            // Get the new file name
            string fileName = GetNewFileOrDirectoryNameWithoutCreatingAnything(directory, baseFileName, extension);

            // Create an empty file to mark it as taken
            StreamWriter sw = new StreamWriter(fileName);

            sw.Write("");
            sw.Close();
            return fileName;
        }