public bool ContainsAttributes(GUIStyle style) { foreach (var input in this.searchAttributes) { var name = input.name; var rawValue = input.value; var value = rawValue.Remove("*", "#"); var state = input.state; var CheckMatch = input.method; if (value.IsEmpty()) { continue; } if (name.ContainsAny("textColor", "background")) { var found = false; var states = style.GetNamedStates(); if (!state.IsEmpty() && states.ContainsKey(state)) { states = states[state].AsArray().ToDictionary(x => state, x => x); } foreach (var item in states) { var styleState = item.Value; if (name.Matches("textColor", true)) { bool hasAlpha = !rawValue.Contains(" ") ? value.Length > 6 : value.Split(" ").Length == 4; bool hexMatch = !rawValue.Contains(" ") && CheckMatch(styleState.textColor.ToHex(hasAlpha)); bool decimalMatch = rawValue.Contains(" ") && CheckMatch(styleState.textColor.ToDecimal(hasAlpha)); if (hexMatch || decimalMatch) { found = true; } } if (name.Matches("background", true) && !styleState.background.IsNull() && CheckMatch(styleState.background.name)) { found = true; } } if (found) { continue; } return(false); } name = name.Replace("textClipping", "clipping").Replace("color", "textColor"); if (name.IsEnum <GUIStyleField>()) { var current = style.GetVariable(name); var type = style.GetVariableType(name); if (current.IsNull()) { return(false); } if (type.Is <RectOffset>()) { if (!CheckMatch(current.As <RectOffset>().Serialize())) { return(false); } } else if (type.Is <Vector2>()) { if (!CheckMatch(current.As <Vector2>().ToString().Remove(".0", ",", "(", ")"))) { return(false); } } else if (type.Is <bool>()) { if (value.ToBool() != current.As <bool>()) { return(false); } } else if (type.IsAny <float, int>()) { if (current.ToString() != value) { return(false); } } else if (type.Is <Font>()) { if (!CheckMatch(current.As <Font>().name)) { return(false); } } else if (!CheckMatch(current.ToString()) && !CheckMatch(current.ToString().ToTitleCase())) { return(false); } } else { return(false); } } return(true); }