private static string FindNonexistantFile(string downloadedFile)
{
if (!File.Exists(downloadedFile))
return downloadedFile;
else {
string newFile;
int i = 1;
do {
newFile = Path.Combine(Path.GetDirectoryName(downloadedFile), Path.GetFileNameWithoutExtension(downloadedFile) + "(" + i.ToString() + ")" + Path.GetExtension(downloadedFile));
i += 1;
} while (File.Exists(newFile));
return newFile;
}
}