PixiFileMaxSizeChecker.cs 664 B

12345678910111213141516171819202122
  1. using PixiEditor.Parser;
  2. namespace PixiEditor.Models.IO
  3. {
  4. internal class PixiFileMaxSizeChecker
  5. {
  6. public int MaxAllowedWidthInPixels { get; init; } = 1080;
  7. public int MaxAllowedHeightInPixels { get; init; } = 1080;
  8. public int MaxAllowedLayerCount { get; init; } = 5;
  9. public PixiFileMaxSizeChecker()
  10. {
  11. }
  12. public bool IsFileUnderMaxSize(SerializableDocument fileToCheck)
  13. {
  14. return fileToCheck.Width <= MaxAllowedWidthInPixels
  15. && fileToCheck.Height <= MaxAllowedHeightInPixels
  16. && fileToCheck.Layers.Count <= MaxAllowedLayerCount;
  17. }
  18. }
  19. }