public JWrapper ResolveDotPath(params string[] words) { foreach (JWrapper child in Children) { if (Parent == null) //we're a root holder { JWrapper r = child.ResolveDotPath(words); if (r != null) { return(r); } } else if (child.Name.Equals(words[0])) { if (words.Length > 1) { JWrapper r = child.ResolveDotPath(SubArray(words, 1, words.Length - 1)); if (r != null) { return(r); } } else { return(child); } } } if (this.Name.Equals(words[0])) { return(this); } return(null); }
public JWrapper GetTopMost() { JWrapper cur = this; while (cur != null && cur.Parent != null) { cur = cur.Parent; } return(cur); }
public string GetTildePath() { string ret = ""; JWrapper cur = this; while (cur.Parent != null) { ret = cur.Name + (ret.Length > 0 ? "~" : "") + ret; cur = cur.Parent; } return(ret); }
public virtual JWrapper ContainsKey(string key) { foreach (JWrapper obj in Children) { if (obj.Name.Equals(key)) { return(obj); } JWrapper r = obj.ContainsKey(key); if (r != null) { return(r); } } return(null); }
public bool Evaluate(JWrapper root) { if (root == null) { Value = "{Impossible to evaluate while not debugging}"; return false; } JWrapper end = root.ResolveDotPath(Variable.Replace("this.","").Replace("global.","").Split('.')); if (end is JLeaf) { lastResolvedAs = end as JLeaf; Value = lastResolvedAs.Value; OnPropertyChanged("IsEditable"); return true; } else { Value = "{Unable to resolve value; Likely doesn't exist in scope}"; OnPropertyChanged("IsEditable"); return false; } }
public JWrapper ResolveDotPath(params string[] words) { foreach (JWrapper child in Children) { // Cludge for script engine registration vs asPEEK registration //\todo Determine most appropriate means of registering objects in Urho3D asPEEK implementation //Script types are registered differently than types are named in C++ if (child.Name.Equals(words[0]) || (child.Name.EndsWith("_") && child.Name.Replace("_", "").Equals(words[0]))) { if (words.Length > 1) { JWrapper r = child.ResolveDotPath(SubArray(words, 1, words.Length - 1)); if (r != null) { return(r); } } else { return(child); } } else if (Parent == null) //we're a root holder, applies to "Stack Level nodes" { JWrapper r = child.ResolveDotPath(words); if (r != null) { return(r); } } } // Cludge for script engine registration vs asPEEK registration if (Name.Equals(words[0]) || (Name.EndsWith("_") && Name.Replace("_", "").Equals(words[0]))) { return(this); } return(null); }