Example #1
0
 private static bool CheckImageDimensions(ScriptResult result, int?minSize, int?maxSize, float minAspect, Orientation requiredOrientation, bool forceDownload)
 {
     //Valid if there is no limit specified, or the size is within the limit. Both limits must apply if both are present
     //Check size
     if (minSize.HasValue || maxSize.HasValue)
     {
         if (!CheckImageSize(minSize, maxSize, result.GetMinImageDimension(forceDownload)))
         {
             return(false);
         }
     }
     if (requiredOrientation != Orientation.None)
     {
         if (result.GetImageOrientation(forceDownload) != requiredOrientation)
         {
             return(false);
         }
     }
     //Check aspect ratio
     if (minAspect > 0)
     {
         if (result.GetImageAspectRatio(forceDownload) < minAspect)
         {
             return(false);
         }
     }
     //Passes all tests
     return(true);
 }
Example #2
0
 private static bool CheckCoverType(ScriptResult result, AllowedCoverType?allowedCoverTypes)
 {
     if (allowedCoverTypes.HasValue)
     {
         var coverType = MakeAllowedCoverType(result.CoverType);
         return((coverType & allowedCoverTypes.Value) == coverType); //Cover type is one of the allowed types
     }
     return(true);                                                   //allowedCoverTypes not specified, so allow any result.
 }