private void Update()
{
uint count;
IBackgroundCopyJob currentJob;
uint fetchedCount = 0;
BitsJob job;
Dictionary <Guid, BitsJob> currentList = new Dictionary <Guid, BitsJob>();
foreach (KeyValuePair <Guid, BitsJob> entry in this)
{
currentList.Add(entry.Key, entry.Value);
}
this.jobList.Reset();
this.Clear();
this.jobList.GetCount(out count);
for (int i = 0; i < count; i++)
{
this.jobList.Next(1, out currentJob, out fetchedCount);
if (fetchedCount == 1)
{
Guid guid;
currentJob.GetId(out guid);
if (currentList.ContainsKey(guid))
{
job = currentList[guid];
currentList.Remove(guid);
}
else
{
job = new BitsJob(manager, currentJob);
}
this.Add(job.JobId, job);
}
}
foreach (BitsJob disposeJob in currentList.Values)
{
manager.NotifyOnJobRemoval(disposeJob);
disposeJob.Dispose();
}
}