Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ByteArrayHeaderParser.cs
Go to the documentation of this file.
2
4
6{
7 internal static readonly ByteArrayHeaderParser Parser = new ByteArrayHeaderParser();
8
10 : base(supportsMultipleValues: false)
11 {
12 }
13
14 public override string ToString(object value)
15 {
16 return Convert.ToBase64String((byte[])value);
17 }
18
19 public override bool TryParseValue([NotNullWhen(true)] string value, object storeValue, ref int index, [NotNullWhen(true)] out object parsedValue)
20 {
21 parsedValue = null;
22 if (string.IsNullOrEmpty(value) || index == value.Length)
23 {
24 return false;
25 }
26 string text = value;
27 if (index > 0)
28 {
29 text = value.Substring(index);
30 }
31 try
32 {
33 parsedValue = Convert.FromBase64String(text);
34 index = value.Length;
35 return true;
36 }
37 catch (FormatException ex)
38 {
39 if (System.Net.NetEventSource.Log.IsEnabled())
40 {
42 }
43 }
44 return false;
45 }
46}
static string ToBase64String(byte[] inArray)
Definition Convert.cs:2675
static unsafe byte[] FromBase64String(string s)
Definition Convert.cs:2904
virtual string Message
Definition Exception.cs:100
static readonly ByteArrayHeaderParser Parser
override bool TryParseValue([NotNullWhen(true)] string value, object storeValue, ref int index, [NotNullWhen(true)] out object parsedValue)
static readonly System.Net.NetEventSource Log
static void Error(object thisOrContextObject, FormattableString formattableString, [CallerMemberName] string memberName=null)
static string net_http_parser_invalid_base64_string
Definition SR.cs:66
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
Definition SR.cs:7