Untitled
unknown
plain_text
9 months ago
841 B
15
Indexable
public static string GetUniqueTesthausFilePath()
{
string projectRoot = AppDomain.CurrentDomain.BaseDirectory;
string dataFolder = Path.Combine(projectRoot, "Data");
// creez nume unic cu timestamp
string uniqueFileName = $"Testhaus_{DateTime.Now:yyyyMMdd_HHmmss}_Testdata.pdf";
string destFile = Path.Combine(dataFolder, uniqueFileName);
// sursa este fișierul tău de bază (copiat mereu)
string sourceFile = Path.Combine(dataFolder, "TesthausTestdata.pdf");
if (!File.Exists(sourceFile))
throw new FileNotFoundException("Nu găsesc fișierul sursă: " + sourceFile);
// copiez ca să am un fișier nou de fiecare dată
File.Copy(sourceFile, destFile, true);
if (!File.Exists(destFile))
throw new Exception("Fișierul nu a fost creat: " + destFile);
return destFile;
}Editor is loading...
Leave a Comment