internal void Add(NzbPart newPart)
 {
     lock (this.Parts)
     {
         lock (newPart)
         {
             this.Parts.Add(newPart);
             this.SizeInBytes += newPart.SizeInBytes;
         }
     }
 }
        private NzbPart ParsePart(XmlNode currentNzbFileXmlNode)
        {
            NzbPart newPart = null;
            XmlAttributeCollection attributes = currentNzbFileXmlNode.Attributes;

            string subject = this.GetSubject(attributes);
            string poster = this.GetPoster(attributes);
            string date = this.GetDate(attributes);
            var groups = this.GetGroups(currentNzbFileXmlNode);

            newPart = new NzbPart();

            XmlNodeList segments = currentNzbFileXmlNode["segments"].GetElementsByTagName("segment");

            foreach (XmlNode currentSegment in segments)
            {
                var newSegment = ParseSegment(groups, currentSegment);

                newPart.Add(newSegment);

                newSegment.Parent = newPart;
            }

            return newPart;
        }
        private void PartDecodedCheckpoint(NzbPart decodedPart)
        {
            lock (_isDisposedSynchronization)
            {
                if (_isDisposed)
                {
                    return;
                }
            }

            lock (decodedPart.Parent)
            {
                var parent = decodedPart.Parent;

                var numberOfSuccessfullyDecodedParts = parent.Parts.Where(part => part.Status == NzbPartStatus.Decoded).Count();

                if (parent.Parts.Count == numberOfSuccessfullyDecodedParts)
                {
                    parent.Status = NzbDownloadStatus.Complete;

                    lock (_downloads)
                    {
                        _downloads.Remove(parent);
                    }
                }
            }
        }