Inheritance: BaseEntry
Esempio n. 1
0
 private AlbumEntry buildAlbumEntry(XmlNode node)
 {
     if (node != null)
     {
         XmlUtils.UseNode(node);
         AlbumEntry a = new AlbumEntry();
         a.Id          = XmlUtils.Int("aid");
         a.ThumbnailId = XmlUtils.Int("thumb_id");
         a.OwnerId     = XmlUtils.Int("owner_id");
         a.Title       = XmlUtils.String("title");
         a.Description = XmlUtils.String("description");
         a.DateCreated = CommonUtils.FromUnixTime(XmlUtils.Int("created"));
         a.DateUpdated = CommonUtils.FromUnixTime(XmlUtils.Int("updated"));
         a.Size        = XmlUtils.Int("size");
         a.Privacy     = XmlUtils.Int("privacy");
         return(a);
     }
     return(null);
 }
Esempio n. 2
0
        private void DownloadAlbum(AlbumEntry album, List<PhotoEntryFull> photos)
        {
            try
            {
                if (this.pathToPhotosStore == null)
                {
                    if (FB.ShowDialog() == DialogResult.OK)
                    {
                        this.pathToPhotosStore = FB.SelectedPath;
                    }
                    else
                    {
                        return;
                    }
                }
                    Regex r = new Regex(@"[^A-Za-zA-Яа-я0-9\ \,\.\!\+\=\)\(\&\%\$\#\@\-\{\}\[\]]");
                    Regex ra = new Regex(@"[^A-Za-zA-Яа-я0-9\ \!\+\=\)\(\&\%\$\#\@\-\{\}\[\]]");
                    string path = this.pathToPhotosStore + "\\" + ((this.selectedFriend != null) ? r.Replace(this.selectedFriend.ToString(), "_") : UserId.Text) + "\\" + ra.Replace(album.Title, "_") + "\\";

                    if (!Directory.Exists(path))
                    {
                        Directory.CreateDirectory(path);
                    }

                    this.photosInAlbum = album.Size;
                    this.downloadInProgress = true;
                    stopDownloadingToolStripMenuItem.Enabled = true;
                    this.TotalProgress.Maximum = album.Size;
                    this.DownloadPanel.Visible = true;
                    this.TotalProgress.Value = 0;
                    this.FriendList.Enabled = false;
                    this.AlbumsList.Enabled = false;

                    this.itemsDownloaded = 1;

                    for (int friendId = 0; friendId < photos.Count; friendId++)
                    {
                        if (!this.exitPending)
                        {
                            if (Small.Checked && photos[friendId].UrlSmall != "")
                            {
                                this.DownloadFile(photos[friendId].UrlSmall, path);
                            }
                            if (Big.Checked && photos[friendId].UrlBig != "")
                            {
                                this.DownloadFile(photos[friendId].UrlBig, path);
                            }
                            if (Thumb.Checked && photos[friendId].Url != "")
                            {
                                this.DownloadFile(photos[friendId].Url, path);
                            }
                            if (X.Checked && photos[friendId].UrlXBig != "")
                            {
                                this.DownloadFile(photos[friendId].UrlXBig, path);
                            }
                            if (Xx.Checked && photos[friendId].UrlXXBig != "")
                            {
                                this.DownloadFile(photos[friendId].UrlXXBig, path);
                            }

                                this.TotalProgress.Value++;
                                this.itemsDownloaded++;
                        }
                    }

                    this.DownloadPanel.Visible = false;
                    this.FriendList.Enabled = true;
                    this.AlbumsList.Enabled = true;
                    this.downloadInProgress = false;

            }
            catch (Exception e)
            {
                this.StopDownload();
                MessageBox.Show("Some errors ocurred while downloading photos:\n" + e.Message);
            }
        }
Esempio n. 3
0
 private void AlbumsList_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.selectedAlbum = this.albumList[((ListBox)sender).SelectedIndex];
     this.LoadAlbumPhotos(this.selectedAlbum);
 }
Esempio n. 4
0
 private void LoadAlbumPhotos(AlbumEntry album)
 {
     List<PhotoEntryFull> photoList = this.photoFactory.GetPhotos(album.OwnerId, album.Id, null, null, null);
     if (photoList.Count > 0)
     {
         this.DownloadAlbum(album, photoList);
     }
 }
Esempio n. 5
0
 private AlbumEntry buildAlbumEntry(XmlNode node)
 {
     if (node != null)
     {
         XmlUtils.UseNode(node);
         AlbumEntry a = new AlbumEntry();
         a.Id = XmlUtils.Int("aid");
         a.ThumbnailId = XmlUtils.Int("thumb_id");
         a.OwnerId = XmlUtils.Int("owner_id");
         a.Title = XmlUtils.String("title");
         a.Description = XmlUtils.String("description");
         a.DateCreated = CommonUtils.FromUnixTime(XmlUtils.Int("created"));
         a.DateUpdated = CommonUtils.FromUnixTime(XmlUtils.Int("updated"));
         a.Size = XmlUtils.Int("size");
         a.Privacy = XmlUtils.Int("privacy");
         return a;
     }
     return null;
 }