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

◆ SmallestDecimal()

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

Definition at line 103 of file ConstNode.cs.

104 {
105 if (constant == null)
106 {
107 return 0.0;
108 }
109 if (constant is string s)
110 {
111 if (decimal.TryParse(s, NumberStyles.Number, NumberFormatInfo.InvariantInfo, out var result))
112 {
113 return result;
114 }
115 if (double.TryParse(s, NumberStyles.Float | NumberStyles.AllowThousands, NumberFormatInfo.InvariantInfo, out var result2))
116 {
117 return result2;
118 }
119 }
120 else if (constant is IConvertible convertible)
121 {
122 try
123 {
125 }
126 catch (ArgumentException e)
127 {
128 ExceptionBuilder.TraceExceptionWithoutRethrow(e);
129 }
130 catch (FormatException e2)
131 {
132 ExceptionBuilder.TraceExceptionWithoutRethrow(e2);
133 }
134 catch (InvalidCastException e3)
135 {
136 ExceptionBuilder.TraceExceptionWithoutRethrow(e3);
137 }
138 catch (OverflowException e4)
139 {
140 ExceptionBuilder.TraceExceptionWithoutRethrow(e4);
141 }
142 try
143 {
145 }
146 catch (ArgumentException e5)
147 {
148 ExceptionBuilder.TraceExceptionWithoutRethrow(e5);
149 }
150 catch (FormatException e6)
151 {
152 ExceptionBuilder.TraceExceptionWithoutRethrow(e6);
153 }
154 catch (InvalidCastException e7)
155 {
156 ExceptionBuilder.TraceExceptionWithoutRethrow(e7);
157 }
158 catch (OverflowException e8)
159 {
160 ExceptionBuilder.TraceExceptionWithoutRethrow(e8);
161 }
162 }
163 return constant;
164 }

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

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