protected virtual bool TryParseAspectRatio() { _parsedAspectVal1 = null; _parsedAspectVal2 = null; if (!string.IsNullOrWhiteSpace(AspectRatio)) { var regex = new Regex("^[0-9]{1,9}:[0-9]{1,9}$"); if (!regex.IsMatch(AspectRatio)) { return(false); } var vals = AspectRatio.Split(':'); //Reduce the users aspect ratio so we can accurately compare them to the image aspects. e.g. 32:18 will be reduced to 16:9 var reducedRatio = ImageHelper.GetAspectRatio(int.Parse(vals[0]), int.Parse(vals[1])); _parsedAspectVal1 = reducedRatio.Item1; _parsedAspectVal2 = reducedRatio.Item2; } return(true); }