private IMapConverter CreateNullableBooleanConverter(IBuilderContext context) { return(new NullableBooleanConverter( TrueValue ?? context.GetParameter <byte>(Parameter.TrueValue), FalseValue ?? context.GetParameter <byte>(Parameter.FalseValue), NullValue ?? context.GetParameter <byte>(Parameter.Filler))); }
private IMapConverter CreateDateTimeOffsetConverter(Type type, IBuilderContext context) { return(new DateTimeOffsetConverter( Format, Kind ?? context.GetParameter <DateTimeKind>(Parameter.DateTimeKind), Filler ?? context.GetParameter <byte>(Parameter.Filler), type)); }
private IMapConverter CreateAsciiConverter(IBuilderContext context) { return(new AsciiConverter( Length, Trim ?? context.GetParameter <bool>(Parameter.Trim), Padding ?? context.GetParameter <Padding>(Parameter.TextPadding), Filler ?? context.GetParameter <byte>(Parameter.TextFiller))); }
private IMapConverter CreateDateTimeBinaryConverter(IBuilderContext context) { var targetEndian = Endian ?? context.GetParameter <Endian>(Parameter.Endian); var kind = context.GetParameter <DateTimeKind>(Parameter.DateTimeKind); return(targetEndian == Smart.IO.ByteMapper.Endian.Big ? (IMapConverter) new BigEndianDateTimeBinaryConverter(kind) : new LittleEndianDateTimeBinaryConverter(kind)); }
private IMapConverter CreateInt16Converter(Type type, IBuilderContext context) { return(new Int16Converter( Length, Padding ?? context.GetParameter <Padding>(OptionsParameter.NumberPadding), ZeroFill ?? context.GetParameter <bool>(OptionsParameter.ZeroFill), Filler ?? context.GetParameter <byte>(OptionsParameter.NumberFiller), type)); }
private IMapConverter CreateAsciiConverter(IBuilderContext context) { return(new UnicodeConverter( Length, Trim ?? context.GetParameter <bool>(Parameter.Trim), Padding ?? context.GetParameter <Padding>(Parameter.TextPadding), Filler ?? (context.TryGetParameter <char>(OptionsParameter.UnicodeFiller, out var filler) ? filler : (char)context.GetParameter <byte>(Parameter.TextFiller)))); }
private IMapConverter CreateDecimalConverter(Type type, IBuilderContext context) { return(new DecimalConverter( Length, Scale, UseGrouping ?? context.GetParameter <bool>(OptionsParameter.UseGrouping) ? GroupingSize : 0, Padding ?? context.GetParameter <Padding>(OptionsParameter.NumberPadding), ZeroFill ?? context.GetParameter <bool>(OptionsParameter.ZeroFill), Filler ?? context.GetParameter <byte>(OptionsParameter.NumberFiller), type)); }
private IMapConverter CreateDateTimeOffsetTextConverter(Type type, IBuilderContext context) { return(new DateTimeOffsetTextConverter( Length, Format, Encoding ?? context.GetParameter <Encoding>(Parameter.DateTimeTextEncoding), Filler ?? context.GetParameter <byte>(Parameter.Filler), Style ?? context.GetParameter <DateTimeStyles>(Parameter.DateTimeTextStyle), Provider ?? context.GetParameter <IFormatProvider>(Parameter.DateTimeTextProvider), type)); }
public IMapper CreateMapper(IBuilderContext context) { return(new FillMapper( Offset, Length, Filler ?? context.GetParameter <byte>(Parameter.Filler))); }
private IMapConverter CreateDateTimeOffsetBinaryConverter(IBuilderContext context) { var targetEndian = Endian ?? context.GetParameter <Endian>(Parameter.Endian); return(targetEndian == Smart.IO.ByteMapper.Endian.Big ? BigEndianDateTimeOffsetBinaryConverter.Default : LittleEndianDateTimeOffsetBinaryConverter.Default); }
public IMapConverter CreateConverter(IBuilderContext context, Type type) { var delegateFactory = context.Components.Get <IDelegateFactory>(); var elementType = type.GetElementType(); return(new ArrayConverter( delegateFactory.CreateArrayAllocator(elementType), Length, Filler ?? context.GetParameter <byte>(Parameter.Filler), ElementConverterBuilder.CalcSize(elementType), ElementConverterBuilder.CreateConverter(context, elementType))); }
private IMapConverter CreateDecimalTextConverter(Type type, IBuilderContext context) { return(new DecimalTextConverter( Length, Format, Encoding ?? context.GetParameter <Encoding>(Parameter.NumberTextEncoding), Trim ?? context.GetParameter <bool>(Parameter.Trim), Padding ?? context.GetParameter <Padding>(Parameter.NumberTextPadding), Filler ?? context.GetParameter <byte>(Parameter.NumberTextFiller), Style ?? context.GetParameter <NumberStyles>(Parameter.NumberTextDecimalStyle), Provider ?? context.GetParameter <IFormatProvider>(Parameter.NumberTextProvider), type)); }