private SaveResult SaveFile(int index) { GPhotoCameraFile camfile = (GPhotoCameraFile)camera.FileList [index]; string tempdir = FSpot.Global.PhotoDirectory; if (!Directory.Exists(tempdir)) { Directory.CreateDirectory(tempdir); } string orig = Path.Combine(tempdir, camfile.FileName.ToLower()); string path = orig; int i = 0; while (File.Exists(path)) { string name = String.Format("{0}-{1}{2}", Path.GetFileNameWithoutExtension(orig), i, Path.GetExtension(orig)); path = System.IO.Path.Combine(Path.GetDirectoryName(orig), name); i++; } string msg = String.Format(Catalog.GetString("Transferring \"{0}\" from camera"), Path.GetFileName(path)); progress_dialog.Message = msg; camera.SaveFile(index, path); if (duplicate_check.Active && db.Photos.CheckForDuplicate(FSpot.Utils.UriUtils.PathToFileUri(path)) != null) { System.IO.File.Delete(path); return(new SaveResult(path, true)); } else { string dest = FileImportBackend.ChooseLocation(path); System.IO.File.Move(path, dest); return(new SaveResult(dest, false)); } }
private string SaveFile(int index) { GPhotoCameraFile camfile = (GPhotoCameraFile)camera.FileList [index]; string tempdir = FSpot.Global.PhotoDirectory; if (!Directory.Exists(tempdir)) { Directory.CreateDirectory(tempdir); } string orig = Path.Combine(tempdir, camfile.FileName.ToLower()); string path = orig; int i = 0; while (File.Exists(path)) { string name = String.Format("{0}-{1}{2}", Path.GetFileNameWithoutExtension(orig), i, Path.GetExtension(orig)); path = System.IO.Path.Combine(Path.GetDirectoryName(orig), name); i++; } string msg = String.Format(Catalog.GetString("Transferring \"{0}\" from camera"), Path.GetFileName(path)); progress_dialog.Message = msg; camera.SaveFile(index, path); string dest = FileImportBackend.ChooseLocation(path); System.IO.File.Move(path, dest); path = dest; return(path); }