public ParserValue Get(ParserValue obj, string token) { if (!Enabled) { return(ParserValue.Empty); } if (obj.IsNull) { if (token == "#") { obj = new StaticClass(token, ShortCut); } else if (TypeBinding.ContainsKey(token)) { Type type = (Type)TypeBinding[token]; obj = new StaticClass(token, type); } else if (CurrentScope.Contains(token)) { obj = CurrentScope.Get(token); } else if (Namespaces.Contains(token)) { obj = new ScopeClass(token, (ResourceScope)Namespaces[token]); } else { Fail("Can't find field or type: " + token); } return(obj); } ParserValue result = ParserValue.Empty; if (obj is StaticClass) { Type type = (obj as StaticClass).Type; if (GetStaticField(type, token, out result)) { return(result); } obj = CurrentScope.Get((obj as StaticClass).Name); } else if (obj is ScopeClass) { ResourceScope scope = (obj as ScopeClass).Scope; if (scope.Contains(token)) { return(scope.Get(token)); } string newScopeName = scope.Name + "." + token; if (Namespaces.Contains(newScopeName)) { return(new ScopeClass(newScopeName, (ResourceScope)Namespaces[newScopeName])); } else { obj = CurrentScope.Get(scope.Name); } } if (!GetField(obj, token, out result)) { Fail("Couldn't get field/property " + token + " for type " + obj.Type.ToString()); } return(result); }