Beispiel #1
0
 public void AddThumb(Stream thumb, string name, int width, int height, object callback)
 {
     if (task.ShouldAbort())
     {
         throw new AbortedException();
     }
     AlbumArtDownloader.ArtDownloader.ThumbRes result = new AlbumArtDownloader.ArtDownloader.ThumbRes();
     result.Width        = width;
     result.Height       = height;
     result.CallbackData = callback;
     if (callback == null)
     {
         result.FullSize = new MemoryStream();
         artdownloader.GetStreamToStream(result.FullSize, thumb, 0, false);
         result.Thumb = System.Drawing.Bitmap.FromStream(result.FullSize);
         result.FullSize.Seek(0, SeekOrigin.Begin);
     }
     else
     {
         result.Thumb = System.Drawing.Bitmap.FromStream(thumb);
     }
     result.OwnerTask   = task;
     result.ScriptOwner = script;
     result.Name        = name;
     task.AddResult(result);
     ++rescount;
     artdownloader.mainForm.BeginInvoke(artdownloader.mainForm.taskupdate, task, script, estimate == 0 ? string.Format("{0}", rescount) : string.Format("{0}/{1}", rescount, estimate));
     if (rescount >= Properties.Settings.Default.MaxResults)
     {
         throw new AbortedException();
     }
 }
Beispiel #2
0
 public PreviewForm(MainForm mainForm, Image show, AlbumArtDownloader.ArtDownloader.ThumbRes thethumb)
 {
     InitializeComponent();
     pictureBoxPreview.ClientSize = show.Size;
     pictureBoxPreview.Image      = b = show;
     thumbres      = thethumb;
     this.mainForm = mainForm;
 }
Beispiel #3
0
 public void AddResult(AlbumArtDownloader.ArtDownloader.ThumbRes result)
 {
     if (result.Name.ToLowerInvariant() == (Album.ToLowerInvariant()))
     {
         result.Exact = true;
     }
     lock (results)
     {
         results.Add(result);
     }
     lock (artdownloader)
     {
         if (artdownloader.SelectedTask == this)
         {
             artdownloader.SendThumb(result);
         }
     }
 }
Beispiel #4
0
 public void AddThumb(System.Drawing.Image thumb, string name, int width, int height, object callback)
 {
     if (task.ShouldAbort())
     {
         throw new AbortedException();
     }
     AlbumArtDownloader.ArtDownloader.ThumbRes result = new AlbumArtDownloader.ArtDownloader.ThumbRes();
     result.Width        = width;
     result.Height       = height;
     result.Thumb        = thumb;
     result.OwnerTask    = task;
     result.CallbackData = callback;
     result.ScriptOwner  = script;
     result.Name         = name;
     task.AddResult(result);
     ++rescount;
     artdownloader.mainForm.BeginInvoke(artdownloader.mainForm.taskupdate, task, script, estimate == 0 ? string.Format("{0}", rescount) : string.Format("{0}/{1}", rescount, estimate));
     if (rescount >= Properties.Settings.Default.MaxResults)
     {
         throw new AbortedException();
     }
 }