Quote:
Originally Posted by cloud255
Hmmm, how did your execution time compare to the standard Windows version of this functionality? It sure would make my file names more user friendly...
How does one test the actual speed of how the OS does this? For that matter, I don't know a way to ask the OS for the next available name. So I can only go by how it
feels, and it feels fast. Well, as fast Windoze can be expected I guess.
All of my file save functions use the "UniqueFileName" method. More or less to this effect:
- tlhintoq.GDI.Graphics.Save(Image ImageObjectToSave, String FilePath)
-
{
-
if (MakeDirForFIle(FilePath)) /* return true if folder exists, making if needed */
-
{
-
string NewFilePath = UniqeFilename(FilePath);//This reserves the name
-
switch (System.IO.Path.GetExtension(FilePath).ToLower().TrimStart('.'))
-
{
-
case "jpg":
-
SaveJPG(ImageObjectToSave, NewFilePath);
-
break;
-
case "bmp"
-
// Call bitmap save function
-
break;
-
case "tga"
-
// Call Targa save function
-
break;
-
}
-
}
-
}
And they seem to be working quite fast. Lets face it, most times there isn't an existing file. How many times is the loop going to execute MOST times? 3 maybe?