Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ SmallestNumeric()

object System.Data.ConstNode.SmallestNumeric ( object constant)
inlineprivate

Definition at line 166 of file ConstNode.cs.

167 {
168 if (constant == null)
169 {
170 return 0;
171 }
172 if (constant is string s)
173 {
174 if (int.TryParse(s, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out var result))
175 {
176 return result;
177 }
178 if (long.TryParse(s, NumberStyles.Integer, NumberFormatInfo.InvariantInfo, out var result2))
179 {
180 return result2;
181 }
182 if (double.TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, NumberFormatInfo.InvariantInfo, out var result3))
183 {
184 return result3;
185 }
186 }
187 else if (constant is IConvertible convertible)
188 {
189 try
190 {
192 }
193 catch (ArgumentException e)
194 {
195 ExceptionBuilder.TraceExceptionWithoutRethrow(e);
196 }
197 catch (FormatException e2)
198 {
199 ExceptionBuilder.TraceExceptionWithoutRethrow(e2);
200 }
201 catch (InvalidCastException e3)
202 {
203 ExceptionBuilder.TraceExceptionWithoutRethrow(e3);
204 }
205 catch (OverflowException e4)
206 {
207 ExceptionBuilder.TraceExceptionWithoutRethrow(e4);
208 }
209 try
210 {
212 }
213 catch (ArgumentException e5)
214 {
215 ExceptionBuilder.TraceExceptionWithoutRethrow(e5);
216 }
217 catch (FormatException e6)
218 {
219 ExceptionBuilder.TraceExceptionWithoutRethrow(e6);
220 }
221 catch (InvalidCastException e7)
222 {
223 ExceptionBuilder.TraceExceptionWithoutRethrow(e7);
224 }
225 catch (OverflowException e8)
226 {
227 ExceptionBuilder.TraceExceptionWithoutRethrow(e8);
228 }
229 try
230 {
232 }
233 catch (ArgumentException e9)
234 {
235 ExceptionBuilder.TraceExceptionWithoutRethrow(e9);
236 }
237 catch (FormatException e10)
238 {
239 ExceptionBuilder.TraceExceptionWithoutRethrow(e10);
240 }
241 catch (InvalidCastException e11)
242 {
243 ExceptionBuilder.TraceExceptionWithoutRethrow(e11);
244 }
245 catch (OverflowException e12)
246 {
247 ExceptionBuilder.TraceExceptionWithoutRethrow(e12);
248 }
249 }
250 return constant;
251 }

References System.Globalization.NumberFormatInfo.InvariantInfo, System.s, and System.Data.ExceptionBuilder.TraceExceptionWithoutRethrow().

Referenced by System.Data.ConstNode.ConstNode().