ThirdPartVidDisplayEngine.cs 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. namespace fis.Vid
  2. {
  3. public class ThirdPartVidDisplayEngine : IDisplayEngine
  4. {
  5. private readonly VinnoImageData _imageData;
  6. public int ImageCount { get; }
  7. public byte[] BasicData { get; }
  8. public byte[] ExtendedData { get; }
  9. public ThirdPartVidDisplayEngine(string filePath)
  10. {
  11. _imageData = new VinnoImageData(filePath, OperationMode.Open);
  12. if (_imageData != null && _imageData.ImageCount>0)
  13. {
  14. ImageCount = _imageData.ImageCount;
  15. BasicData = _imageData.Probe.ToBytes();
  16. ExtendedData = _imageData.ExtendedData;
  17. }
  18. }
  19. public void Close()
  20. {
  21. _imageData.Dispose();
  22. }
  23. public byte[] GetImageData(int index)
  24. {
  25. if (_imageData.ImageCount > index)
  26. {
  27. var vinnoImage = _imageData.GetImage(index);
  28. if (vinnoImage != null)
  29. {
  30. return vinnoImage.ToBytes();
  31. }
  32. }
  33. return new byte[0];
  34. }
  35. }
  36. }