internal static void CreateContext(Type type, ObjectBufferContext info) { if (Instance.builder.IsBaseType(type) == true) { info.IsBaseType = true; return; } FieldInfo[] fields = type.GetFields(info.Seting.Flags); foreach (FieldInfo field in fields) { if (Utils.IsIgnoreAttribute(field) == false) { //info.NamesList.Add(Utils.GetAttributeName(field)); if (Utils.IsDeep(field.FieldType)) { info.IsAllBaseType = false; info.SerializeList.Add(Instance.GenerateDataSerializeSurrogate(field.FieldType)); info.EstimateSizeList.Add(Instance.GenerateSizeSerializeSurrogate(field.FieldType)); info.DeserializeList.Add(Instance.GetDeserializeSurrogate(field.FieldType)); info.TypeCountsList.Add(Instance.GetDeserializeTypes(field.FieldType).Length); info.TypesList.Add(field.FieldType); //info.NameCountsList.Add(GetSerializeNames(field.FieldType).Length); CreateContext(field.FieldType, info); } else { int size = Instance.builder.GetSize(field.FieldType); if (size == 0) { info.IsAllFixedSize = false; } info.MinSize += size; } if (field.FieldType == TypeConsts.Object) { info.IsHaveObjectType = true; } } } PropertyInfo[] propertys = type.GetProperties(info.Seting.Flags); foreach (PropertyInfo property in propertys) { if (Utils.IsIgnoreAttribute(property) == false) { //info.NamesList.Add(Utils.GetAttributeName(property)); if (Utils.IsDeep(property.PropertyType)) { info.IsAllBaseType = false; info.SerializeList.Add(Instance.GenerateDataSerializeSurrogate(property.PropertyType)); info.EstimateSizeList.Add(Instance.GenerateSizeSerializeSurrogate(property.PropertyType)); info.DeserializeList.Add(Instance.GetDeserializeSurrogate(property.PropertyType)); info.TypeCountsList.Add(Instance.GetDeserializeTypes(property.PropertyType).Length); info.TypesList.Add(property.PropertyType); //info.NameCountsList.Add(GetSerializeNames(property.PropertyType).Length); CreateContext(property.PropertyType, info); } else { int size = Instance.builder.GetSize(property.PropertyType); if (size == 0) { info.IsAllFixedSize = false; } info.MinSize += size; } if (property.PropertyType == TypeConsts.Object) { info.IsHaveObjectType = true; } } } }