Do not add duplicate jobs
This commit is contained in:
parent
32036df057
commit
c813e1854d
@ -14,10 +14,30 @@ public class JobBoss : GlobalBase
|
||||
}
|
||||
|
||||
public void AddJob(Job job)
|
||||
{
|
||||
if (ContainsJobLike(job))
|
||||
{
|
||||
Log($"Already Contains Job {job}");
|
||||
}
|
||||
else
|
||||
{
|
||||
Log($"Added {job}");
|
||||
this.jobs.Add(job);
|
||||
}
|
||||
}
|
||||
|
||||
public bool ContainsJobLike(Job job)
|
||||
{
|
||||
if (job is DownloadChapter dcJob)
|
||||
{
|
||||
return this.GetJobsLike(dcJob.mangaConnector, chapter: dcJob.chapter).Any();
|
||||
}else if (job is DownloadNewChapters ncJob)
|
||||
{
|
||||
return this.GetJobsLike(ncJob.mangaConnector, ncJob.manga).Any();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void RemoveJob(Job job)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user