public static Boolean Validate(this ICssMedium medium, IRenderDevice device) { if (!String.IsNullOrEmpty(medium.Type) && KnownTypes.Contains(medium.Type) == medium.IsInverse) { return(false); } return(!medium.IsInvalid(device) && !medium.Features.Any(m => m.Validate(device) == medium.IsInverse)); }
private static Boolean IsInvalid(this ICssMedium medium, IRenderDevice device, String keyword, DeviceCategory category) => device != null && keyword.Is(medium.Type) && device.Category == category == medium.IsInverse;
private static Boolean IsInvalid(this ICssMedium medium, IRenderDevice device) => medium.IsInvalid(device, CssKeywords.Screen, DeviceCategory.Screen) || medium.IsInvalid(device, CssKeywords.Speech, DeviceCategory.Speech) || medium.IsInvalid(device, CssKeywords.Print, DeviceCategory.Printer);
private static Boolean IsInvalid(this ICssMedium medium, IRenderDevice device, String keyword, DeviceCategory category) { return(keyword.Is(medium.Type) && (device.Category == category) == medium.IsInverse); }