/// <summary> /// Truncates an existing file to a specified length /// </summary> /// <param name="fileInfo">File to truncate</param> /// <param name="length">New length of file</param> private void TruncateFile(IO.FileInfo fileInfo, int length) { IO.FileStream fstream = fileInfo.OpenWrite(); fstream.SetLength(length); fstream.Close(); }
/// <summary> /// Creates an empty file /// </summary> /// <param name="fileInfo">File to create</param> /// <param name="length">Length of file</param> private void CreateEmptyFile(IO.FileInfo fileInfo, int length) { fileInfo.Directory.Create(); IO.FileStream fstream = fileInfo.OpenWrite(); fstream.SetLength(length); fstream.Close(); }