33public abstract class MiniExcelDataReaderBase : IMiniExcelDataReader
44{
55 protected readonly IMiniExcelReader MiniExcelReader ;
6+ protected readonly MiniExcelBaseConfiguration MiniExcelConfiguration ;
67
78 protected IEnumerator < IDictionary < string , object ? > > ? Source ;
89 protected IAsyncEnumerator < IDictionary < string , object ? > > ? AsyncSource ;
@@ -32,11 +33,12 @@ public virtual object this[string name]
3233 public bool IsClosed { get ; protected set ; }
3334
3435
35- protected MiniExcelDataReaderBase ( IMiniExcelReader miniExcelReader , bool hasHeaderRow , bool isAsyncSource )
36+ protected MiniExcelDataReaderBase ( IMiniExcelReader miniExcelReader , bool hasHeaderRow , bool isAsyncSource , MiniExcelBaseConfiguration configuration )
3637 {
3738 MiniExcelReader = miniExcelReader ;
3839 HasHeaderRow = hasHeaderRow ;
3940 IsAsyncSource = isAsyncSource ;
41+ MiniExcelConfiguration = configuration ;
4042 }
4143
4244 public virtual bool Read ( )
@@ -110,47 +112,47 @@ public virtual long GetChars(int i, long fieldoffset, char[]? buffer, int buffer
110112 {
111113 bool b => b ,
112114 null => throw new InvalidOperationException ( "The value is null" ) ,
113- var value => Convert . ToBoolean ( value )
115+ var value => Convert . ToBoolean ( value , MiniExcelConfiguration . Culture )
114116 } ;
115117
116118 public virtual byte GetByte ( int i ) => GetValue ( i ) is { } value
117- ? Convert . ToByte ( value )
119+ ? Convert . ToByte ( value , MiniExcelConfiguration . Culture )
118120 : throw new InvalidOperationException ( "The value is null" ) ;
119121
120122 public virtual char GetChar ( int i ) => GetValue ( i ) switch
121123 {
122124 char c => c ,
123125 null => throw new InvalidOperationException ( "The value is null" ) ,
124- var value => Convert . ToChar ( value )
126+ var value => Convert . ToChar ( value , MiniExcelConfiguration . Culture )
125127 } ;
126128
127129 public virtual DateTime GetDateTime ( int i ) => GetValue ( i ) switch
128130 {
129131 DateTime dt => dt ,
130132 double d => DateTime . FromOADate ( d ) ,
131133 null => throw new InvalidOperationException ( "The value is null" ) ,
132- var value => Convert . ToDateTime ( value )
134+ var value => Convert . ToDateTime ( value , MiniExcelConfiguration . Culture )
133135 } ;
134136
135137 public virtual decimal GetDecimal ( int i ) => GetValue ( i ) switch
136138 {
137139 decimal d => d ,
138140 null => throw new InvalidOperationException ( "The value is null" ) ,
139- var value => Convert . ToDecimal ( value )
141+ var value => Convert . ToDecimal ( value , MiniExcelConfiguration . Culture )
140142 } ;
141143
142144 public virtual float GetFloat ( int i ) => GetValue ( i ) switch
143145 {
144146 float f => f ,
145147 null => throw new InvalidOperationException ( "The value is null" ) ,
146- var value => Convert . ToSingle ( value )
148+ var value => Convert . ToSingle ( value , MiniExcelConfiguration . Culture )
147149 } ;
148150
149151 public virtual double GetDouble ( int i ) => GetValue ( i ) switch
150152 {
151153 double d => d ,
152154 null => throw new InvalidOperationException ( "The value is null" ) ,
153- var value => Convert . ToDouble ( value )
155+ var value => Convert . ToDouble ( value , MiniExcelConfiguration . Culture )
154156 } ;
155157
156158 public virtual Guid GetGuid ( int i ) => GetValue ( i ) switch
@@ -166,27 +168,27 @@ public virtual byte GetByte(int i) => GetValue(i) is { } value
166168 {
167169 short s => s ,
168170 null => throw new InvalidOperationException ( "The value is null" ) ,
169- var value => Convert . ToInt16 ( value )
171+ var value => Convert . ToInt16 ( value , MiniExcelConfiguration . Culture )
170172 } ;
171173
172174 public virtual int GetInt32 ( int i ) => GetValue ( i ) switch
173175 {
174176 int s => s ,
175177 null => throw new InvalidOperationException ( "The value is null" ) ,
176- var value => Convert . ToInt32 ( value )
178+ var value => Convert . ToInt32 ( value , MiniExcelConfiguration . Culture )
177179 } ;
178180
179181 public virtual long GetInt64 ( int i ) => GetValue ( i ) switch
180182 {
181183 long l => l ,
182184 null => throw new InvalidOperationException ( "The value is null" ) ,
183- var value => Convert . ToInt64 ( value )
185+ var value => Convert . ToInt64 ( value , MiniExcelConfiguration . Culture )
184186 } ;
185187
186188 public virtual string GetString ( int i ) => GetValue ( i ) switch
187189 {
188190 string s => s ,
189- var value => Convert . ToString ( value ) ?? ""
191+ var value => Convert . ToString ( value , MiniExcelConfiguration . Culture ) ?? ""
190192 } ;
191193
192194 public virtual object GetValue ( int i )
0 commit comments