internal void GetThumbs(ScriptTask t, string artist, string album) { try { getThumbs.Invoke(null, new object[] { t, artist, album }); } catch (Exception e) { if (e.GetType() == typeof(System.Reflection.TargetInvocationException)) { throw e.InnerException; } } }
void Run() { while (!e_abort.WaitOne(0, false)) { ScriptTask t = artdownloader.FetchTask(); if (t != null) { try { if (t.script.Enabled) { t.script.GetThumbs(t, t.task.Artist, t.task.Album); lock (t.task.results) { string s = string.Format("{0}/{1}", t.rescount, t.rescount); artdownloader.mainForm.BeginInvoke(artdownloader.mainForm.taskupdate, t.task, t.script, s); } } else { artdownloader.mainForm.BeginInvoke(artdownloader.mainForm.taskupdate, t.task, t.script, "Script disabled"); } } catch (AbortedException) { continue; } catch (Exception e) { artdownloader.mainForm.BeginInvoke(artdownloader.mainForm.taskupdate, t.task, t.script, e.Message); } finally { --t.task.ScriptsToGo; } } else { e_wakeup.WaitOne(); } } artdownloader.UnRegisterThread(this); }