public static void GetFormatters(IMessagePackProvider provider, IMessagePackContext context, IDictionary <Type, IMessagePackFormatter> formatters, int formatterType, Assembly assembly = null) { if (provider == null) { throw new ArgumentNullException(nameof(provider)); } if (context == null) { throw new ArgumentNullException(nameof(context)); } if (formatters == null) { throw new ArgumentNullException(nameof(formatters)); } foreach (Type type in AssemblyUtility.GetBrowsableTypes <MessagePackFormatterAttribute>(assembly)) { var attribute = type.GetCustomAttribute <MessagePackFormatterAttribute>(false); if (attribute.Type == formatterType && TypesUtility.TryCreateType(type, new object[] { provider, context }, out IMessagePackFormatter formatter)) { formatters.Add(formatter.TargetType, formatter); } } }
public static IMessagePackProvider CreateProvider(IMessagePackContext context, int type, Assembly assembly = null) { if (context == null) { throw new ArgumentNullException(nameof(context)); } var provider = new MessagePackProviderComposite(); GetFormatters(provider, context, provider.Formatters, type, assembly); GetProviders(provider.Providers, type, assembly); provider.Providers.Sort(MessagePackProviderByAttributeComparer.Default); provider.Providers.Add(new EnumProvider(provider, context)); provider.Providers.Add(new CollectionProvider(provider, context)); provider.Providers.Add(new MessagePackProviderWrapper(provider, context, BuiltinResolver.Instance)); provider.Initialize(); return(provider); }
public MessagePackProviderWrapper(IMessagePackProvider provider, IMessagePackContext context, IFormatterResolver resolver) { Provider = provider ?? throw new ArgumentNullException(nameof(provider)); Context = context ?? throw new ArgumentNullException(nameof(context)); Resolver = resolver ?? throw new ArgumentNullException(nameof(resolver)); }
public TestTargetFormatterNamed(IMessagePackProvider provider, IMessagePackContext context) : base(provider, context) { }
public EnumProvider(IMessagePackProvider provider, IMessagePackContext context) { Provider = provider ?? throw new ArgumentNullException(nameof(provider)); Context = context ?? throw new ArgumentNullException(nameof(context)); }
public CollectionFormatterList(IMessagePackProvider provider, IMessagePackContext context) : base(provider, context) { }
public Formatter(IMessagePackProvider provider, IMessagePackContext context) : base(provider, context) { }
public EnumFormatterByte(IMessagePackProvider provider, IMessagePackContext context) : base(provider, context) { }
protected MessagePackFormatterBase(IMessagePackProvider provider, IMessagePackContext context) { Provider = provider ?? throw new ArgumentNullException(nameof(provider)); Context = context ?? throw new ArgumentNullException(nameof(context)); }
public static void GetFormatters(IMessagePackProvider provider, IMessagePackContext context, IDictionary <Type, IMessagePackFormatter> formatters, MessagePackFormatterType formatterType = MessagePackFormatterType.Unknown, Assembly assembly = null) { GetFormatters(provider, context ?? MessagePackContext.Empty, formatters, (int)formatterType, assembly); }
public static IMessagePackProvider CreateProvider(IMessagePackContext context = null, MessagePackFormatterType type = MessagePackFormatterType.Unknown, Assembly assembly = null) { return(CreateProvider(context ?? MessagePackContext.Empty, (int)type, assembly)); }
public MessagePackFormatterWrapper(IMessagePackProvider provider, IMessagePackContext context, global::MessagePack.Formatters.IMessagePackFormatter <T> formatter, IFormatterResolver resolver) : base(provider, context) { Formatter = formatter ?? throw new ArgumentNullException(nameof(formatter)); Resolver = resolver ?? throw new ArgumentNullException(nameof(resolver)); }