Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
Int64NumberHeaderParser.cs
Go to the documentation of this file.
2
4
6{
7 internal static readonly Int64NumberHeaderParser Parser = new Int64NumberHeaderParser();
8
10 : base(supportsMultipleValues: false)
11 {
12 }
13
14 public override string ToString(object value)
15 {
16 return ((long)value).ToString(NumberFormatInfo.InvariantInfo);
17 }
18
19 protected override int GetParsedValueLength(string value, int startIndex, object storeValue, out object parsedValue)
20 {
21 parsedValue = null;
22 int numberLength = HttpRuleParser.GetNumberLength(value, startIndex, allowDecimal: false);
23 if (numberLength == 0 || numberLength > 19)
24 {
25 return 0;
26 }
27 long result = 0L;
28 if (!HeaderUtilities.TryParseInt64(value, startIndex, numberLength, out result))
29 {
30 return 0;
31 }
32 parsedValue = result;
33 return numberLength;
34 }
35}
static bool TryParseInt64(string value, int offset, int length, out long result)
static readonly Int64NumberHeaderParser Parser
override int GetParsedValueLength(string value, int startIndex, object storeValue, out object parsedValue)
static int GetNumberLength(string input, int startIndex, bool allowDecimal)