Exemple #1
0
 private void GetCellDataFragment(IFragment fragment, Column column, CellData cellData)
 {
     if (column == columnName)
     {
         cellData.Value = (ResultBeingRetrieved == fragment)
                                          ? string.Format("Retrieving data {0}%", RetrieveResultProgressPercentage)
                                          : fragment.GetDescriptiveName();
     }
     else if (column == columnDetector)
     {
         IDetector detector = fragment.Detectors.First();
         cellData.Value = IsUnknownDetector(detector) ? "Not available" : detector.Name;
     }
     else if (column == columnDetectorVersion)
     {
         cellData.Value = GetDetectorVersion(fragment.Detectors.First());
     }
     else if (column == columnOffset)
     {
         if (fragment is IDataBlock)
         {
             cellData.Format = _numericColumnFormat;
             cellData.Value  = fragment.StartOffset;
         }
     }
     else if (column == columnLength)
     {
         cellData.Format = _numericColumnFormat;
         cellData.Value  = fragment.Length;
     }
 }
        /*
         * private CodecDetectorInfo DetectorInfo
         * {
         *      get
         *      {
         *              var detectorInfo = new CodecDetectorInfo();
         *              if (KeyframesSourceFragment != null)
         *              {
         *                      var codecStream = KeyframesSourceFragment as ICodecStream;
         *                      if (codecStream != null)
         *                      {
         *                              // It is a codecstream inside a container.
         *                              IDataBlock datablock = codecStream.DataBlock;
         *
         *                              detectorInfo.Text= string.Format("{0}, from: {1}{2}{3}{4}, to: {5}{6}{7}{8}, length: {9}{10}{11}{12}{13}{14}, length: {15}{16}{17}{18}",
         *                                                   datablock.GetDescriptiveName(),
         *                                                   '{', RtfBold, ToOffsetValue(datablock.StartOffset), '}',
         *                                                   '{', RtfBold, ToOffsetValue(datablock.EndOffset), '}',
         *                                                   '{', RtfBold, ToOffsetValue(datablock.Length), '}',
         *                                                   RtfNewLine,
         *                                                   KeyframesSourceFragment.GetDescriptiveName(),
         *                                                   '{', RtfBold, ToOffsetValue(KeyframesSourceFragment.Length), '}');
         *                              return detectorInfo;
         *
         *                      }
         *                      detectorInfo.Text=string.Format("{0}, from: {1}{2}{3}{4}, to: {5}{6}{7}{8}, length: {9}{10}{11}{12}",
         *                                           KeyframesSourceFragment.GetDescriptiveName(),
         *                                           '{', RtfBold, ToOffsetValue(KeyframesSourceFragment.StartOffset), '}',
         *                                           '{', RtfBold, ToOffsetValue(KeyframesSourceFragment.EndOffset), '}',
         *                                           '{', RtfBold, ToOffsetValue(KeyframesSourceFragment.Length), '}');
         *                      return detectorInfo;
         *              }
         *              return detectorInfo;
         *      }
         * }
         */

        private static ISourceInfo Describe(IFragment fragment)         //TODO: move to member method of Fragment
        {
            var codecStream   = fragment as ICodecStream;
            var containerInfo = new CodecStreamContainerInfo();

            if (codecStream != null)
            {
                // It is a codecstream inside a container.
                containerInfo.DataBlock = Describe(codecStream.DataBlock);
            }
            containerInfo.Name        = fragment.GetDescriptiveName();
            containerInfo.StartOffset = fragment.StartOffset;
            containerInfo.EndOffset   = fragment.EndOffset;
            containerInfo.Length      = fragment.Length;
            return(containerInfo);
        }