Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
LargeObjectWithParameterizedConstructorConverter.cs
Go to the documentation of this file.
4
6
8{
10 {
11 object value;
12 bool flag = jsonParameterInfo.ConverterBase.TryReadAsObject(ref reader, jsonParameterInfo.Options, ref state, out value);
13 if (flag && (value != null || !jsonParameterInfo.IgnoreDefaultValuesOnRead))
14 {
15 ((object[])state.Current.CtorArgumentState.Arguments)[jsonParameterInfo.ClrInfo.Position] = value;
16 }
17 return flag;
18 }
19
20 protected sealed override object CreateObject(ref ReadStackFrame frame)
21 {
22 object[] array = (object[])frame.CtorArgumentState.Arguments;
24 Func<object[], T> func = (Func<object[], T>)frame.JsonTypeInfo.CreateObjectWithArgs;
25 if (func == null)
26 {
28 }
29 object result = func(array);
30 ArrayPool<object>.Shared.Return(array, clearArray: true);
31 return result;
32 }
33
35 {
36 JsonTypeInfo jsonTypeInfo = state.Current.JsonTypeInfo;
37 if (jsonTypeInfo.ParameterCache == null)
38 {
39 jsonTypeInfo.InitializePropCache();
40 }
42 object[] array = ArrayPool<object>.Shared.Rent(list.Count);
43 for (int i = 0; i < jsonTypeInfo.ParameterCount; i++)
44 {
45 JsonParameterInfo value = list[i].Value;
46 array[value.ClrInfo.Position] = value.DefaultValue;
47 }
49 }
50}
override bool ReadAndCacheConstructorArgument(ref ReadStack state, ref Utf8JsonReader reader, JsonParameterInfo jsonParameterInfo)
static void ThrowNotSupportedException_ConstructorMaxOf64Parameters(Type type)