public void SaveAllFiles(string prefix, int start_number) { for (int index = 0; index < files.Count; index++) { GPhotoCameraFile curFile = (GPhotoCameraFile)files [index]; string extension = Path.GetExtension(curFile.FileName).ToLower(); SaveFile(index, prefix + Convert.ToString(start_number + index) + extension); } }
public int CompareTo(object obj) { GPhotoCameraFile f2 = obj as GPhotoCameraFile; int result = Directory.CompareTo(f2.Directory); if (result == 0) { result = FileName.CompareTo(f2.FileName); } return(result); }
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)); } }
public CameraFile GetFile(int index) { if (camera_fs == null || files == null || index < 0 || index >= files.Count) { return(null); } GPhotoCameraFile selected_file = (GPhotoCameraFile)files [index]; if (selected_file.NormalFile == null) { selected_file.NormalFile = camera_fs.GetFile(selected_file.Directory, selected_file.FileName, CameraFileType.Normal, context); } return(selected_file.NormalFile); }
public Pixbuf GetPreviewPixbuf(GPhotoCameraFile camfile) { CameraFile cfile = GetPreview(camfile); if (cfile != null) { byte[] bytedata = cfile.GetDataAndSize(); if (bytedata.Length > 0) { MemoryStream dataStream = new MemoryStream(bytedata); try { return(new Pixbuf(dataStream)); } catch (Exception e) { // Actual errors with the data libgphoto gives us have been // observed here see b.g.o #357569. Console.WriteLine("Error retrieving preview image"); Console.WriteLine(e); } } } return(null); }
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); }
public CameraFile GetPreview(int index) { if (camera_fs == null || files == null || index < 0 || index >= files.Count) { return(null); } GPhotoCameraFile selected_file = (GPhotoCameraFile)files [index]; if (selected_file.PreviewFile == null) { try { selected_file.PreviewFile = camera_fs.GetFile(selected_file.Directory, selected_file.FileName, CameraFileType.Preview, context); } catch (System.Exception e) { System.Console.WriteLine(e.ToString()); selected_file.PreviewFile = null; } } return(selected_file.PreviewFile); }
public Pixbuf GetPreviewPixbuf (GPhotoCameraFile camfile) { CameraFile cfile = GetPreview (camfile); if (cfile != null) { byte[] bytedata = cfile.GetDataAndSize (); if (bytedata.Length > 0) { MemoryStream dataStream = new MemoryStream (bytedata); try { return new Pixbuf (dataStream); } catch (Exception e) { // Actual errors with the data libgphoto gives us have been // observed here see b.g.o #357569. Console.WriteLine ("Error retrieving preview image"); Console.WriteLine (e); } } } return null; }
public CameraFile GetPreview (GPhotoCameraFile camfile) { int index = files.IndexOf (camfile); return GetPreview (index); }
public CameraFile GetPreview(GPhotoCameraFile camfile) { int index = files.IndexOf(camfile); return(GetPreview(index)); }
public Pixbuf GetPreviewPixbuf(GPhotoCameraFile camfile) { CameraFile cfile = GetPreview (camfile); if (cfile != null) { byte[] bytedata = cfile.GetDataAndSize (); if (bytedata.Length > 0) { MemoryStream dataStream = new MemoryStream (bytedata); try { Gdk.Pixbuf temp = new Pixbuf (dataStream); Cms.Profile screen_profile; if (FSpot.ColorManagement.Profiles.TryGetValue (Preferences.Get<string> (Preferences.COLOR_MANAGEMENT_DISPLAY_PROFILE), out screen_profile)) FSpot.ColorManagement.ApplyProfile (temp, screen_profile); return temp; } catch (Exception e) { // Actual errors with the data libgphoto gives us have been // observed here see b.g.o #357569. Log.Information ("Error retrieving preview image"); Log.DebugException (e); } } } return null; }