public static MessageRecievedEventArgs GetAllPhotos() { MessageRecievedEventArgs message = new MessageRecievedEventArgs(MessageTypeEnum.P_SEND, ""); Settings settings = Settings.Instance; PhotoList photos = new PhotoList(); string[] thumbnailsPath; try { thumbnailsPath = Directory.GetFiles(settings.OutputPath + "\\Thumbnails", "*.*", SearchOption.AllDirectories); } catch (Exception) { return(message); } foreach (var thumbPath in thumbnailsPath) { Image image; Image imageThumb; int index = thumbPath.IndexOf("\\Thumbnails"); string imagePath = (index < 0) ? thumbPath : thumbPath.Remove(index, "\\Thumbnails".Length); try { image = Image.FromFile(imagePath); imageThumb = Image.FromFile(thumbPath); } catch (Exception) { continue; } photos.Photos.Add(new PhotoPackage(imagePath, thumbPath, image, imageThumb)); } message.Message = photos.Serialize(); return(message); }
public static void DeletePhoto(PhotoPackage photo) { PhotoList photoList = Instance.photoList; photoList.Photos.RemoveAll(a => a.PhotoPath == photo.PhotoPath); }
public static PhotoPackage GetPhoto(int index) { PhotoList photoList = Instance.photoList; return(photoList.Photos[index]); }
public static int GetIndex(PhotoPackage photo) { PhotoList photoList = Instance.photoList; return(photoList.Photos.IndexOf(photo)); }
public static void AddPhoto(PhotoPackage photo) { PhotoList photoList = Instance.photoList; photoList.Photos.Add(photo); }
public static void AddPhotos(PhotoList photoList_) { PhotoList photoList = Instance.photoList; photoList.Photos.AddRange(photoList_.Photos); }
private PhotoDB() { photoList = new PhotoList(); }