GitSharp.Core.Transport.WalkFetchConnection.DownloadPackedObject C# (CSharp) Method

DownloadPackedObject() private method

private DownloadPackedObject ( ProgressMonitor monitor, AnyObjectId id ) : bool
monitor ProgressMonitor
id AnyObjectId
return bool
        private bool DownloadPackedObject(ProgressMonitor monitor, AnyObjectId id)
        {
            IEnumerator<RemotePack> packItr = _unfetchedPacks.GetEnumerator();
            while (packItr.MoveNext() && !monitor.IsCancelled)
            {
                RemotePack pack = packItr.Current;
                try
                {
                    pack.OpenIndex(monitor);
                }
                catch (IOException err)
                {
                    RecordError(id, err);
                    _unfetchedPacks.Remove(pack);
                    continue;
                }

                if (monitor.IsCancelled)
                    return false;

                if (!pack.Index.HasObject(id))
                    continue;

                try
                {
                    pack.DownloadPack(monitor);
                }
                catch (IOException err)
                {
                    RecordError(id, err);
                    continue;
                }
                finally
                {
                    pack.TmpIdx.Delete();
                    _unfetchedPacks.Remove(pack);
                }

                if (!_local.HasObject(id))
                {
                    RecordError(id,
                                new FileNotFoundException("Object " + id.Name + " not found in " + pack.PackName + "."));
                    continue;
                }

                IEnumerator<ObjectId> pending = SwapFetchQueue();
                while (pending.MoveNext())
                {
                    ObjectId p = pending.Current;
                    if (pack.Index.HasObject(p))
                    {
                        _workQueue.Remove(p);
                        Process(p);
                    }
                    else
                        _workQueue.AddLast(p);
                }
                return true;
            }
            return false;
        }