RegisterTypeReturnCode RegisterTypeInternal(Type type) { if (DoesTypeRequireDataTypeAttribute(type)) { BinaryDataTypeAttribute dataTypeAttribute = type.GetCustomAttribute <BinaryDataTypeAttribute>(); if (dataTypeAttribute == null) { return(RegisterTypeReturnCode.DoesNotHaveBinaryDataType); } } if (IsTypeRegistered(type)) { return(RegisterTypeReturnCode.TypeAlreadyRegistered); } if (!IsValidTypeToRegister(type)) { return(RegisterTypeReturnCode.InvalidTypeToRegister); } GetInstantiatorAndWrapper(type, out ValueInstantiator instantiator, out ValueWrapper wrapper); RegisterTypeInternal(ref _nextProprietaryType, type, StandardTypeSignature.Create, instantiator, wrapper); return(RegisterTypeReturnCode.Success); }
static bool TryGetBinaryDataTypeAttribute(Type type, out BinaryDataTypeAttribute attribute) { attribute = type.GetCustomAttribute <BinaryDataTypeAttribute>(); return(attribute != null); }