Esempio n. 1
0
        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);
            }
        }
Esempio n. 2
0
 /// <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);
 }
Esempio n. 3
0
 /// <summary>
 /// Adds a data type.
 /// </summary>
 /// <param name="type">The data type.</param>
 public void AddDataType(IXerusDataType type)
 {
     this.xerusDataTypes.Add(type);
 }