public static T GetValue2 <T>(this Wz_Node Node, string Path, T DefaultValue) { if (Node.FindNodeByPathA(Path, true) != null) { return(Node.FindNodeByPathA(Path, true).GetValueEx(DefaultValue)); } else { return(DefaultValue); } }
public static Wz_Node GetNode(this Wz_Node Node, string Path) { if (Node.FindNodeByPathA(Path, true) != null) { if (Node.FindNodeByPathA(Path, true).Value is Wz_Uol) { return(Node.FindNodeByPathA(Path, true).ResolveUol()); } else { return(Node.FindNodeByPathA(Path, true)); } } else { string[] Split = Path.Split('/'); int Count = 0; string Str = ""; string Path1 = ""; string Path2 = ""; bool HasUol = false; for (int i = 0; i < Split.Length; i++) { if (i == 0) { Str = Str + Split[i]; } else { Str += '/' + Split[i]; } if ((Node.FindNodeByPathA(Str, true) != null) && (Node.FindNodeByPathA(Str, true).Value is Wz_Uol)) { HasUol = true; Count = i; Path1 = Str; break; } } if (HasUol) { Str = ""; for (int i = Count + 1; i < Split.Length; i++) { if (i == Count + 1) { Str = Str + Split[i]; } else { Str = Str + '/' + Split[i]; } Path2 = Str; } return(Node.FindNodeByPathA(Path1, true).ResolveUol().FindNodeByPathA(Path2, true)); } } return(null); }