/// <summary> /// Creates a text file for writing /// </summary> /// <param name="fileName">name of the file</param> public OutputFile(String fileName) : base(OutputFile.CheckAndGetFileName(fileName), FileMode.OpenOrCreate, FileAccess.Write) { this.sw = new StreamWriter(this); }
/// <summary> /// checks if filename is available in the directory it was passed and returns a free filename /// </summary> /// <param name="fileNameWithExtension">complete filename (relative or absolute)</param> /// <returns>a free filename based on the passed one</returns> public static String CheckAndGetFileName(String fileNameWithExtension) { return(OutputFile.CheckAndGetFileName(Path.GetFileNameWithoutExtension(fileNameWithExtension), Path.GetExtension(fileNameWithExtension).Substring(1))); }