-
-
Notifications
You must be signed in to change notification settings - Fork 316
Expand file tree
/
Copy pathIl2CppParameterReflectionData.cs
More file actions
42 lines (33 loc) · 1.23 KB
/
Copy pathIl2CppParameterReflectionData.cs
File metadata and controls
42 lines (33 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
using System.Reflection;
using System.Text;
using LibCpp2IL.BinaryStructures;
#pragma warning disable 8618
namespace LibCpp2IL.Reflection;
public class Il2CppParameterReflectionData
{
public string ParameterName;
public Il2CppType RawType;
public Il2CppTypeReflectionData Type;
public ParameterAttributes Attributes;
public DefaultValue? DefaultValue;
public int ParameterIndex;
public bool IsRefOrOut => Attributes.HasFlag(ParameterAttributes.Out) || RawType.Byref == 1;
public override string ToString()
{
var result = new StringBuilder();
if (Attributes.HasFlag(ParameterAttributes.Out))
result.Append("out ");
else if (Attributes.HasFlag(ParameterAttributes.In))
result.Append("in ");
else if (RawType.Byref == 1)
result.Append("ref ");
result.Append(Type).Append(" ");
if (string.IsNullOrEmpty(ParameterName))
result.Append("param_").Append(ParameterIndex);
else
result.Append(ParameterName);
if (Attributes.HasFlag(ParameterAttributes.HasDefault) && DefaultValue != null)
result.Append(" = ").Append(DefaultValue.ToString());
return result.ToString();
}
}