예제 #1
0
        public void InsertSection(FileSection fileSection)
        {
            if (fileSection == null)
            {
                return;
            }

            if (FileSections[fileSection.SectionNumber] == null)
            {
                FileSections[fileSection.SectionNumber] = fileSection;
            }

            if (fileSection.SectionNumber == LowestSectionNotReceived)
            {
                LowestSectionNotReceived++;
                while (LowestSectionNotReceived < FileSections.Length ? FileSections[LowestSectionNotReceived] != null : false)
                {
                    LowestSectionNotReceived++;
                }
            }

            if (LowestSectionNotReceived == FileSections.Length)
            {
                Completed = true;
            }
        }
예제 #2
0
 public File(int numberOfSections)
 {
     NumberOfSections         = numberOfSections;
     FileSections             = new FileSection[NumberOfSections];
     LowestSectionNotReceived = 0;
     Completed = false;
 }
예제 #3
0
 public DownloadingFrom(FileSection fileSection, double percentageDownloaded)
 {
     FileSection          = fileSection;
     PercentageDownloaded = percentageDownloaded;
 }
예제 #4
0
 public UploadingTo(FileSection fileSection, double percentageUploaded)
 {
     FileSection        = fileSection;
     PercentageUploaded = percentageUploaded;
 }
예제 #5
0
 public bool HasSection(FileSection fileSection)
 {
     return(FileSections[fileSection.SectionNumber] != null);
 }