private static string GetTargetFilePath(string tempFolderPath, string targetFilePath)
{
if (!string.IsNullOrWhiteSpace(tempFolderPath) && Directory.Exists(tempFolderPath))
{
return targetFilePath ?? Path.Combine(tempFolderPath, Path.GetRandomFileName());
}
return targetFilePath ?? Path.GetTempFileName();
}