private static void ProcessStruct(List <IXerusDataType> dataTypes, IXerusDataType xerusDataType) { foreach (var memberInfo in xerusDataType.GetType().GetFields()) { if (typeof(XerusStruct).IsAssignableFrom(memberInfo.FieldType)) { var baseType = memberInfo.GetValue(xerusDataType) ?? Activator.CreateInstance(memberInfo.FieldType) as XerusStruct; if (!dataTypes.Contains(baseType)) { ProcessStruct(dataTypes, (IXerusDataType)baseType); } } } if (dataTypes.Find( dataType => dataType.GetType() == xerusDataType.GetType()) == null) { dataTypes.Add(xerusDataType); } }
/// <summary> /// Creates the type definition for the specified data type. /// </summary> /// <param name="dataType">Type of the data.</param> private void Create(IXerusDataType dataType) { this.Create(dataType as dynamic); }
/// <summary> /// Adds a data type. /// </summary> /// <param name="type">The data type.</param> public void AddDataType(IXerusDataType type) { this.xerusDataTypes.Add(type); }