private TextMatchInfo IsMatch(string str, PatternText text, Module module)
        {

                var encoding = Encodings.FirstOrDefault(patternEncoding => patternEncoding.Name == text.Encoding);
                var encodingInfo = encoding.Encode(str, text.Text, module.Resources);
                if (encoding != null && encodingInfo.Result)
                    return new TextMatchInfo(true, text, encodingInfo.EncodeData);
            return new TextMatchInfo(false, null, null);
        }
 public TextMatchInfo(bool isMatch, PatternText text, Dictionary<string, object> encodeData)
 {
     IsMatch = isMatch;
     Text = text;
     EncodeData = encodeData;
 }
        public static PatternText Parse(XElement te)
        {
            var value = te.Attribute(XName.Get("value")) != null ? te.Attribute(XName.Get("value")).Value : te.Value;

            var type = "base";
            if (te.Attribute(XName.Get("type")) != null)
                type = te.Attribute(XName.Get("type")).Value;


            var result = new PatternText(type, value);

            result.Weight = te.Attribute(XName.Get("weight")) != null ? Convert.ToSingle(te.Attribute(XName.Get("weight")).Value) : 1;

            return result;

        }