/// <inheritdoc /> public override InspectableField FindPath(string path) { string subPath = GetSubPath(path, depth + 1); if (string.IsNullOrEmpty(subPath)) { return(null); } int lastLeftIdx = subPath.LastIndexOf('['); int lastRightIdx = subPath.LastIndexOf(']', lastLeftIdx); if (lastLeftIdx == -1 || lastRightIdx == -1) { return(null); } int count = lastRightIdx - 1 - lastLeftIdx; if (count <= 0) { return(null); } string arrayIdxStr = subPath.Substring(lastLeftIdx, count); if (!int.TryParse(arrayIdxStr, out int idx)) { return(null); } if (idx >= listGUIField.NumRows) { return(null); } InspectableListGUIRow row = listGUIField.GetRow(idx); InspectableField field = row?.Field; if (field != null) { if (field.Path == path) { return(field); } return(field.FindPath(path)); } return(null); }
/// <inheritdoc /> public override InspectableField FindPath(string path) { string subPath = GetSubPath(path); if (string.IsNullOrEmpty(subPath) || subPath.Length < 3 || subPath[0] != '[') { return(null); } StringBuilder sb = new StringBuilder(); for (int i = 1; i < subPath.Length; i++) { if (path[i] == ']') { break; } if (!char.IsNumber(path[i])) { return(null); } sb.Append(path[i]); } if (!int.TryParse(sb.ToString(), out int idx)) { return(null); } if (idx >= listGUIField.NumRows) { return(null); } InspectableListGUIRow row = listGUIField.GetRow(idx); if (row != null) { return(row.Field); } return(null); }