public static T GetComponent <T>(this CartesObj cartesObj, string variablename) where T : class, IRPAComponent { IRPAComponent component = cartesObj.component(variablename); if (component == null) { return(null); } else if (component is T result) { return(result); } else { throw new Exception(variablename + " is a " + component.ActiveXClass()); } }
public static string WalkTree(int level, IRPAComponent component, string path) { RPAParameters param = new RPAParameters(); string margin = ""; string result = ""; int i; cartes.balloon("Component : " + path + "\r\nClass : " + component.dochild(path, "class", param)); i = 0; while (i < level) { margin = margin + " "; i = i + 1; } result = margin + level + " - " + component.dochild(path, "name", param) + " " + "[" + component.dochild(path, "class", param) + "] = " + component.dochild(path, "wrapper", param); i = 0; while (i < int.Parse(component.dochild(path, "descendants", param))) { result = result + "\r\n" + WalkTree(level + 1, component, path + "\\" + i.ToString()); i = i + 1; } return(result); }