public override void decodeCssString(string cssString) { Inset = false; char[] splitChars = { ' ' }; string[] tokens = cssString.Split(splitChars, StringSplitOptions.RemoveEmptyEntries); if (tokens.Length < 2) { Debug.WriteLine("Error in BoxShadow css rule need to have a h and v position"); return; } string position = tokens[0] + " " + tokens[1]; ShadowPosition = new CssPosition(); ShadowPosition.decodeCssString(position); if (tokens.Length >= 3) { Regex regex = new Regex("\\d"); string blurSpread = ""; if (regex.IsMatch(tokens[2])) { blurSpread = tokens[2]; } else { ShadowColor = CssHelpers.decodeColorString(tokens[2]); } if (tokens.Length >= 4) { if (regex.IsMatch(tokens[3])) { blurSpread += " " + tokens[3]; } else { ShadowColor = CssHelpers.decodeColorString(tokens[3]); } } BlurSpread = new CssPosition(); BlurSpread.decodeCssString(blurSpread); if (tokens.Length >= 6) { ShadowColor = CssHelpers.decodeColorString(tokens[4]); if (tokens[5] == "inset") { Inset = true; } } else { ShadowColor = CssHelpers.decodeColorString(tokens[4]); } } }
public override void decodeCssString(string cssString) { string positionStr = cssString.Replace("position", ""); positionStr = positionStr.Replace(")", ""); positionStr = positionStr.Replace("(", ""); Position = new CssPosition(); Position.decodeCssString(positionStr); }