@@ -147,13 +147,13 @@ function Convert-ValueToProperType {
147
147
$parsedValue = [Convert ]::ToInt64($Node.Value.Substring (2 ), 16 )
148
148
}
149
149
default {
150
- if (! [System.Numerics.BigInteger ]::TryParse($Node.Value , [Globalization.NumberStyles ]::Any , [Globalization.CultureInfo ]::InvariantCulture, [ref ]$parsedValue )) {
150
+ if (! [System.Numerics.BigInteger ]::TryParse($Node.Value , @ ( [Globalization.NumberStyles ]::Float , [ Globalization.NumberStyles ]::Integer) , [Globalization.CultureInfo ]::InvariantCulture, [ref ]$parsedValue )) {
151
151
Throw (" failed to parse scalar {0} as long" -f $Node )
152
152
}
153
153
}
154
154
}
155
155
} else {
156
- if (! [System.Numerics.BigInteger ]::TryParse($Node.Value , [Globalization.NumberStyles ]::Any , [Globalization.CultureInfo ]::InvariantCulture, [ref ]$parsedValue )) {
156
+ if (! [System.Numerics.BigInteger ]::TryParse($Node.Value , @ ( [Globalization.NumberStyles ]::Float , [ Globalization.NumberStyles ]::Integer) , [Globalization.CultureInfo ]::InvariantCulture, [ref ]$parsedValue )) {
157
157
Throw (" failed to parse scalar {0} as long" -f $Node )
158
158
}
159
159
}
@@ -179,7 +179,7 @@ function Convert-ValueToProperType {
179
179
}
180
180
}
181
181
}
182
- if (! [double ]::TryParse($Node.Value , [Globalization.NumberStyles ]::Any , [Globalization.CultureInfo ]::InvariantCulture, [ref ]$parsedValue )) {
182
+ if (! [double ]::TryParse($Node.Value , [Globalization.NumberStyles ]::Float , [Globalization.CultureInfo ]::InvariantCulture, [ref ]$parsedValue )) {
183
183
Throw (" failed to parse scalar {0} as double" -f $Node )
184
184
}
185
185
return $parsedValue
@@ -205,7 +205,7 @@ function Convert-ValueToProperType {
205
205
}
206
206
207
207
$parsedValue = New-Object - TypeName ([System.Numerics.BigInteger ].FullName)
208
- $result = [System.Numerics.BigInteger ]::TryParse($Node , [Globalization.NumberStyles ]::Any , [Globalization.CultureInfo ]::InvariantCulture, [ref ]$parsedValue )
208
+ $result = [System.Numerics.BigInteger ]::TryParse($Node , @ ( [Globalization.NumberStyles ]::Float , [ Globalization.NumberStyles ]::Integer) , [Globalization.CultureInfo ]::InvariantCulture, [ref ]$parsedValue )
209
209
if ($result ) {
210
210
$types = @ ([int ], [long ])
211
211
foreach ($i in $types ){
@@ -216,11 +216,10 @@ function Convert-ValueToProperType {
216
216
}
217
217
return $parsedValue
218
218
}
219
-
220
219
$types = @ ([double ], [decimal ])
221
220
foreach ($i in $types ){
222
221
$parsedValue = New-Object - TypeName $i.FullName
223
- $result = $i ::TryParse($Node , [Globalization.NumberStyles ]::Any , [Globalization.CultureInfo ]::InvariantCulture, [ref ]$parsedValue )
222
+ $result = $i ::TryParse($Node , [Globalization.NumberStyles ]::Float , [Globalization.CultureInfo ]::InvariantCulture, [ref ]$parsedValue )
224
223
if ( $result ) {
225
224
return $parsedValue
226
225
}
0 commit comments