Beispiel #1
0
        private void ResolveAttribute(GameAttribute attribute, string identifier = "")
        {
            identifier = identifier == "" ? ATTRIBUTE_IDENTIFIER + attribute.Abbreviation.ToLower() : identifier;
            int index;

            //$this.name

            if ((index = resolvedText.IndexOf(identifier)) != -1)
            {
                int end   = resolvedText.IndexOf(' ', index);
                int start = resolvedText.IndexOf('.', index, end) + 1;
                end -= start;

                string propName = "current";
                string replace  = identifier;

                if (start != 0)
                {
                    propName = resolvedText.Substring(start, end);
                    replace  = identifier + "." + propName;
                }

                object value = attribute.GetType().GetProperty(propName[0].ToString().ToUpper() + propName.Substring(1)).GetValue(attribute);

                resolvedText = resolvedText.Replace(replace, value.ToString());
            }
        }