using System; using System.Collections.Generic; using System.Text; namespace NJSample.VarInfo { class RootVariableInfo : VariableInfo { //public override void Create(ORiN2.ManagedCAO.CCaoController ctrl) //{ // CreateImpl(ctrl); //} protected override void CreateImpl(ORiN2.ManagedCAO.CCaoController ctrl) { string[] varNames = ctrl.GetVariableNames(null); foreach (string varName in varNames) { Object obj = ctrl.Execute("GetVariableType", varName); VarType vt = (VarType)Convert.ToInt32(obj); VariableInfo info = VariableInfoFactory.CreateVariableInfo(vt); obj = ctrl.Execute("GetVariableCIPType", varName); CIPType cipType = (CIPType)Convert.ToByte(obj); info.Name = varName; info.IsArrayMember = false; info.VarType = vt; info.Parent = this; info.CIPType = cipType; if ((vt & VarType.VT_ARRAY) == VarType.VT_ARRAY) { uint[] arrayLength = (uint[])ctrl.Execute("GetArrayLength", varName); info.ArrayLengthList.AddRange(arrayLength); uint[] arrayLBound = (uint[])ctrl.Execute("GetArrayLBound", varName); info.ArrayLBoundList.AddRange(arrayLBound); } if ((vt & VarType.VT_TYPEMASK) == VarType.VT_USERDEFINED) { string structName = (string)ctrl.Execute("GetStructName", varName); info.StructName = structName; } info.Create(ctrl); ChildList.Add(info); } } protected override string GetNodeString() { return "NJ"; } protected override string GetTypeString() { return string.Empty; } } }