public int GetFotosToFolder(Message[] messages, string folderPath, SaveFolderType saveFolderType , Quality quality = Quality.Maximum) { int i = 0; foreach (Message mess in messages) { List <Photo> photos = GetPhoto(mess); if (photos.Count != 0) { foreach (Photo photo in photos) { string finalPath = folderPath; if (saveFolderType == SaveFolderType.SortByNameAndOwner) { if (mess.FromId == api.UserId) { finalPath += "\\My"; } else { finalPath += "\\Buddy"; } } Uri uri = GetPhotoAdress(photo, quality); if (SaveFoto(uri, finalPath)) { i++; } } } } return(i); }
public void GetFotosToFolder(Dictionary <User, Message[]> keyValuePairs, string folderPath, SaveFolderType saveFolderType, Quality quality = Quality.Maximum) { foreach (KeyValuePair <User, Message[]> keyValue in keyValuePairs) { if (saveFolderType == SaveFolderType.SortByNameAndOwner || saveFolderType == SaveFolderType.SortByName) { User user = keyValue.Key; folderPath += "\\" + user.FirstName + "_" + user.LastName; } GetFotosToFolder(keyValue.Value, folderPath, saveFolderType, quality); } }