Exemple #1
0
 public void RefreshByTimeRange(DateTime start, DateTime end)
 {
     if (fileDescriptor != null && end >= start)
     {
         try
         {
             if (fileDescriptor.FileBlockCount == 0)
             {
                 lblLoadSize.Text       = SR.GetString("FileBlockInfo_LoadingSize") + SR.GetString("FileBlockInfo_EmptyFile");
                 lblLoadPercentage.Text = string.Empty;
                 graphics.FillRectangle(selectedItemBrush, new Rectangle(new Point(0, 0), DrawPanel.Size));
             }
             else
             {
                 long num  = 0L;
                 long num2 = 0L;
                 long num3 = 0L;
                 if (end > start)
                 {
                     foreach (FileBlockInfo fileBlock in fileDescriptor.FileBlocks)
                     {
                         long num4 = fileBlock.EndFileOffset - fileBlock.StartFileOffset;
                         if (num4 > 0)
                         {
                             if ((fileBlock.StartDate >= start && fileBlock.EndDate <= end) || (fileBlock.StartDate <= start && fileBlock.EndDate >= start) || (fileBlock.StartDate <= end && fileBlock.EndDate >= end))
                             {
                                 num2 += num4;
                             }
                             else if (fileBlock.EndDate < start)
                             {
                                 num += num4;
                             }
                             else if (fileBlock.StartDate > end)
                             {
                                 num3 += num4;
                             }
                         }
                         else if (fileBlock.StartDate == fileBlock.EndDate)
                         {
                             if (fileBlock.StartDate >= start && fileBlock.StartDate <= end)
                             {
                                 num2 += ((fileDescriptor.FileSize <= 5000000) ? fileDescriptor.FileSize : 5000000);
                             }
                             else if (fileBlock.StartDate < start)
                             {
                                 num += ((fileDescriptor.FileSize <= 5000000) ? fileDescriptor.FileSize : 5000000);
                             }
                             else if (fileBlock.StartDate > end)
                             {
                                 num3 += ((fileDescriptor.FileSize <= 5000000) ? fileDescriptor.FileSize : 5000000);
                             }
                         }
                         else
                         {
                             num2 += ((fileDescriptor.FileSize <= 5000000) ? fileDescriptor.FileSize : 5000000);
                         }
                     }
                 }
                 else
                 {
                     num  = fileDescriptor.FileSize;
                     num3 = 0L;
                     num2 = 0L;
                 }
                 graphics.FillRectangle(unselectedItemBrush, new Rectangle(new Point(0, 0), DrawPanel.Size));
                 if (num2 != 0L)
                 {
                     int num5 = (int)((double)num / (double)fileDescriptor.FileSize * (double)DrawPanel.Size.Width);
                     int num6 = (int)((double)num3 / (double)fileDescriptor.FileSize * (double)DrawPanel.Size.Width);
                     graphics.FillRectangle(selectedItemBrush, new Rectangle(num5, 0, DrawPanel.Size.Width - num5 - num6, DrawPanel.Size.Height));
                 }
                 lblLoadSize.Text = SR.GetString("FileBlockInfo_LoadingSize") + Utilities.GetFileSizeString(num2);
                 double num7 = 0.0;
                 num7 = ((num2 + num + num3 == 0L) ? 0.0 : ((double)num2 / (double)(num2 + num + num3) * 100.0));
                 lblLoadPercentage.Text = SR.GetString("FileBlockInfo_LoadingPre") + num7.ToString("###.##", CultureInfo.CurrentCulture);
                 startDateTime          = start;
                 endDateTime            = end;
             }
         }
         catch (Exception e)
         {
             ExceptionManager.GeneralExceptionFilter(e);
         }
     }
 }