using System; using System.Collections.Generic; using System.Text; namespace NJSample.VarInfo { class StructVariableInfo : VariableInfo { protected override void CreateImpl(ORiN2.ManagedCAO.CCaoController ctrl) { string[] varNames = (string[])ctrl.Execute("GetStructMemberNames", StructName); foreach (string varName in varNames) { string[] structId = new string[] { StructName, varName }; Object obj = ctrl.Execute("GetStructMemberType", structId); VarType vt = (VarType)Convert.ToInt32(obj); VariableInfo info = VariableInfoFactory.CreateVariableInfo(vt); obj = ctrl.Execute("GetStructMemberCIPType", structId); CIPType cipType = (CIPType)Convert.ToByte(obj); info.Name = varName; info.IsArrayMember = false; info.VarType = vt; info.CIPType = cipType; info.Parent = this; if ((vt & VarType.VT_ARRAY) == VarType.VT_ARRAY) { uint[] arrayLength = (uint[])ctrl.Execute("GetStructMemberArrayLength", structId); info.ArrayLengthList.AddRange(arrayLength); //uint[] arrayUBound = (uint[])ctrl.Execute("GetStructMemberArrayUBound", structId); uint[] arrayLBound = (uint[])ctrl.Execute("GetStructMemberArrayLBound", new object[] { StructName, varName }); info.ArrayLBoundList.AddRange(arrayLBound); } if ((vt & VarType.VT_TYPEMASK) == VarType.VT_USERDEFINED) { string structName = (string)ctrl.Execute("GetStructMemberStructName", structId); info.StructName = structName; } else { info.StructName = StructName; } info.Create(ctrl); ChildList.Add(info); } } protected override string GetTypeString() { return string.Format(" ({0}({1}))", CIPType, StructName); } } }