public override int GetHashCode() { unchecked { var hashCode = MaxSize.GetHashCode(); hashCode = (hashCode * 397) ^ BinaryExists.GetHashCode(); hashCode = (hashCode * 397) ^ ValidImage.GetHashCode(); hashCode = (hashCode * 397) ^ ExtensionMatchContentFormat.GetHashCode(); hashCode = (hashCode * 397) ^ MaxFilenameLength.GetHashCode(); hashCode = (hashCode * 397) ^ (SupportedFileFormats?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ (SupportedImageSizes?.GetHashCode() ?? 0); hashCode = (hashCode * 397) ^ IsAlphaChannelRequired.GetHashCode(); return(hashCode); } }
public bool Equals(BitmapImageElementConstraints other) { if (ReferenceEquals(null, other)) { return(false); } if (ReferenceEquals(this, other)) { return(true); } if (SupportedFileFormats == null && other.SupportedFileFormats != null || SupportedFileFormats != null && other.SupportedFileFormats == null) { return(false); } if (SupportedImageSizes == null && other.SupportedImageSizes != null || SupportedImageSizes != null && other.SupportedImageSizes == null) { return(false); } return(MaxSize == other.MaxSize && MaxFilenameLength == other.MaxFilenameLength && BinaryExists == other.BinaryExists && ValidImage == other.ValidImage && ExtensionMatchContentFormat == other.ExtensionMatchContentFormat && (ReferenceEquals(SupportedFileFormats, other.SupportedFileFormats) || SupportedFileFormats.SequenceEqual(other.SupportedFileFormats)) && (ReferenceEquals(SupportedImageSizes, other.SupportedImageSizes) || SupportedImageSizes.SequenceEqual(other.SupportedImageSizes)) && IsAlphaChannelRequired == other.IsAlphaChannelRequired); }
private static void CheckParameters(string[] args, out string sourceImage, out string targetImage, out SupportedImageSizes targetImageSize, out int targetWidth, out int targetHeight) { sourceImage = string.Empty; targetImage = string.Empty; targetHeight = 0; targetWidth = 0; targetImageSize = SupportedImageSizes.Medium; // // Expects three arguments - source image, target image, and image-size // Console.WriteLine("Checking parameters..."); if (args.Length < 3) { Console.WriteLine("Please call with 'thumbnailproducerapp sourceImage targetImage targetSize [optional: height] [optional: width]"); System.Environment.Exit(10); return; } else { sourceImage = args[0]; targetImage = args[1]; if (!Enum.TryParse(args[2], out targetImageSize)) { Console.WriteLine("Please use one of the following values for targetSize: Large, Medium, Small"); System.Environment.Exit(10); return; } else { if (targetImageSize == SupportedImageSizes.Custom) { if (args.Length != 5) { Console.WriteLine("Please call with 'thumbnailproducerapp sourceImage targetImage Custom height width"); } else { if (!int.TryParse(args[3], out targetHeight)) { Console.WriteLine("Cannot parse targetHeight specified. Please specify a full number!"); System.Environment.Exit(10); return; } if (!int.TryParse(args[4], out targetWidth)) { Console.WriteLine("Cannot parse targetWidth specified. Please specify a full number!"); System.Environment.Exit(10); return; } } } } } Console.WriteLine("Parameters checked successfully!"); }