public void RetrieveThread(object obj) { Thread2Cls cls = (Thread2Cls)obj; if (RetrieveWebInfo(cls.Game, cls.SpiffyCover)) { cls.Game.RenameWithTitle(cls.Game.Active ? cls.BasePath : cls.InactivePath, cls.Type, !cls.Rename); _gamecnt++; if (OnWebDataLoaded != null) { OnWebDataLoaded.Invoke(cls.Game, _gamecnt); } } threadcnt--; }
private void ExecutorThread(object obj) { ThreadCls cls = (ThreadCls)obj; threadcnt = 0; do { if (cls.Games.Count > 0) { Thread2Cls cls2 = new Thread2Cls(); lock (executorlock) { cls2.Game = cls.Games[0]; cls.Games.RemoveAt(0); } cls2.Rename = cls.Rename; cls2.SpiffyCover = cls.SpiffyCover; cls2.Type = cls.Type; cls2.BasePath = cls.BasePath; cls2.InactivePath = cls.InactivePath; Thread th = new Thread(RetrieveThread); th.Start(cls2); threadcnt++; } while (threadcnt == MAX_THREADS) { Thread.Sleep(50); } Thread.Sleep(50); } while (((cls.Games.Count > 0) || threadcnt > 0) && (!Abort)); Finished = true; if (this.OnFinish != null) { OnFinish.Invoke(); } }