internal string GetAutoSavePath(ImageEngineFormat newformat)
{
string newpath = null;
bool acceptablePath = false;
int count = 1;
string formatString = ImageFormats.GetExtensionOfFormat(newformat);
string basepath = Path.GetDirectoryName(ImagePath) + "\\" + Path.GetFileNameWithoutExtension(ImagePath) + "." +
(newformat == ImageEngineFormat.Unknown ? Path.GetExtension(ImagePath) : formatString);
newpath = basepath;
// KFreon: Check that path is not already taken
while (!acceptablePath)
{
if (File.Exists(newpath))
{
newpath = Path.Combine(Path.GetDirectoryName(basepath), Path.GetFileNameWithoutExtension(basepath) + "_" + count++ + Path.GetExtension(basepath));
}
else
{
acceptablePath = true;
}
}
return(newpath);
}