private static IEnumerable <string> ProcessBINAdditionalData(BINOptional additionalData) { List <string> strings = new List <string>(); if (additionalData.Value != null) { strings.AddRange(ProcessBINValue(additionalData.Value)); } return(strings); }
private static object SerializeOptional(BINValue value, PropertyInfo propertyInfo) { BINOptional optional = value.Value as BINOptional; object constructedOptional = null; if (optional.Value != null) { if (IsPrimitiveType(optional.Type)) { constructedOptional = optional.Value.Value; } else if (value.Type == BINValueType.Hash) { constructedOptional = new Hash((uint)optional.Value.Value); } else if (value.Type == BINValueType.LinkOffset) { Type linkType = typeof(Link <>).MakeGenericType(propertyInfo.PropertyType.GenericTypeArguments[0]); constructedOptional = Activator.CreateInstance(linkType, new object[] { (uint)value.Value }); } else if (value.Type == BINValueType.Structure || value.Type == BINValueType.Embedded) { constructedOptional = SerializeStructure(optional.Value); } else if (value.Type == BINValueType.Container) { constructedOptional = SerializeContainer(optional.Value, propertyInfo); } else if (value.Type == BINValueType.Map) { constructedOptional = SerializeMap(optional.Value, propertyInfo); } } return(constructedOptional); }