예제 #1
0
        internal string GetParameterWithMarkerOccurance(string token, TextObject parent)
        {
            int length = token.IndexOf('!');

            if (length == -1)
            {
                return("");
            }
            string     rawValue             = token.Substring(0, length);
            string     searchedIdentifier   = token.Substring(length + 2, token.Length - length - 2);
            TextObject paramWithoutEvaluate = this.GetFunctionParamWithoutEvaluate(rawValue);
            TextObject to;

            return((parent?.Attributes != null && parent.TryGetAttributesValue(paramWithoutEvaluate.ToString(), out to) || this._variables.TryGetValue(paramWithoutEvaluate.ToString(), out to)) && to.Length > 0 ? this.CountMarkerOccurancesInString(searchedIdentifier, MBTextManager.ProcessWithoutLanguageProcessor(to)).ToString() : "");
        }
예제 #2
0
        internal (TextObject value, bool doesValueExist) GetQualifiedVariableValue(
            string token,
            TextObject parent)
        {
            int length = token.IndexOf('.');

            if (length == -1)
            {
                return(this.GetVariableValueAsTextObject(token, parent));
            }
            string str1 = token.Substring(0, length);
            string str2 = token.Substring(length + 1, token.Length - (length + 1));

            if (parent?.Attributes != null)
            {
                TextObject parent1;
                if (parent.TryGetAttributesValue(str1, out parent1))
                {
                    (TextObject value4, bool doesValueExist4) = this.GetQualifiedVariableValue(str2, parent1);
                    if (!value4.Equals(TextObject.Empty))
                    {
                        return(value4, doesValueExist4);
                    }
                }
            }
            else
            {
                TextObject textObject;
                if (this._variables.TryGetValue(str1, out textObject) && textObject.Length > 0)
                {
                    return(TextProcessingContext.FindNestedFieldValue(textObject.Value, str2), true);
                }
                foreach (KeyValuePair <string, TextObject> variable in this._variables)
                {
                    if (variable.Key == str1 && variable.Value.Attributes != null)
                    {
                        foreach (KeyValuePair <string, object> attribute in variable.Value.Attributes)
                        {
                            if (attribute.Key == str2)
                            {
                                return(TextObject.TryGetOrCreateFromObject(attribute.Value), true);
                            }
                        }
                    }
                }
            }
            return(TextObject.Empty, false);
        }