Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
AssemblyReference.cs
Go to the documentation of this file.
2
3public readonly struct AssemblyReference
4{
5 private readonly MetadataReader _reader;
6
7 private readonly uint _treatmentAndRowId;
8
9 private static readonly Version s_version_4_0_0_0 = new Version(4, 0, 0, 0);
10
11 private int RowId => (int)(_treatmentAndRowId & 0xFFFFFF);
12
13 private bool IsVirtual => (_treatmentAndRowId & 0x80000000u) != 0;
14
16 {
17 get
18 {
19 if (IsVirtual)
20 {
21 return GetVirtualVersion();
22 }
24 {
25 return s_version_4_0_0_0;
26 }
27 return _reader.AssemblyRefTable.GetVersion(RowId);
28 }
29 }
30
31 public AssemblyFlags Flags
32 {
33 get
34 {
35 if (IsVirtual)
36 {
37 return GetVirtualFlags();
38 }
39 return _reader.AssemblyRefTable.GetFlags(RowId);
40 }
41 }
42
44 {
45 get
46 {
47 if (IsVirtual)
48 {
49 return GetVirtualName();
50 }
51 return _reader.AssemblyRefTable.GetName(RowId);
52 }
53 }
54
56 {
57 get
58 {
59 if (IsVirtual)
60 {
61 return GetVirtualCulture();
62 }
63 return _reader.AssemblyRefTable.GetCulture(RowId);
64 }
65 }
66
68 {
69 get
70 {
71 if (IsVirtual)
72 {
74 }
75 return _reader.AssemblyRefTable.GetPublicKeyOrToken(RowId);
76 }
77 }
78
80 {
81 get
82 {
83 if (IsVirtual)
84 {
85 return GetVirtualHashValue();
86 }
87 return _reader.AssemblyRefTable.GetHashValue(RowId);
88 }
89 }
90
95
96 internal AssemblyReference(MetadataReader reader, uint treatmentAndRowId)
97 {
98 _reader = reader;
99 _treatmentAndRowId = treatmentAndRowId;
100 }
101
110
112 {
113 return s_version_4_0_0_0;
114 }
115
120
125
127 {
128 return index switch
129 {
130 AssemblyReferenceHandle.VirtualIndex.System_ObjectModel => StringHandle.VirtualIndex.System_ObjectModel,
131 AssemblyReferenceHandle.VirtualIndex.System_Runtime => StringHandle.VirtualIndex.System_Runtime,
132 AssemblyReferenceHandle.VirtualIndex.System_Runtime_InteropServices_WindowsRuntime => StringHandle.VirtualIndex.System_Runtime_InteropServices_WindowsRuntime,
133 AssemblyReferenceHandle.VirtualIndex.System_Runtime_WindowsRuntime => StringHandle.VirtualIndex.System_Runtime_WindowsRuntime,
134 AssemblyReferenceHandle.VirtualIndex.System_Runtime_WindowsRuntime_UI_Xaml => StringHandle.VirtualIndex.System_Runtime_WindowsRuntime_UI_Xaml,
135 AssemblyReferenceHandle.VirtualIndex.System_Numerics_Vectors => StringHandle.VirtualIndex.System_Numerics_Vectors,
136 _ => StringHandle.VirtualIndex.System_Runtime_WindowsRuntime,
137 };
138 }
139
141 {
142 return default(StringHandle);
143 }
144
146 {
148 if ((uint)(rowId - 3) <= 1u)
149 {
150 return _reader.AssemblyRefTable.GetPublicKeyOrToken(_reader.WinMDMscorlibRef);
151 }
152 return BlobHandle.FromVirtualIndex(((_reader.AssemblyRefTable.GetFlags(_reader.WinMDMscorlibRef) & AssemblyFlags.PublicKey) == 0) ? BlobHandle.VirtualIndex.ContractPublicKeyToken : BlobHandle.VirtualIndex.ContractPublicKey, 0);
153 }
154
156 {
157 return default(BlobHandle);
158 }
159
164}
AssemblyName GetAssemblyName(StringHandle nameHandle, Version version, StringHandle cultureHandle, BlobHandle publicKeyOrTokenHandle, AssemblyHashAlgorithm assemblyHashAlgorithm, AssemblyFlags flags)
static AssemblyReferenceHandle FromRowId(int rowId)
CustomAttributeHandleCollection GetVirtualCustomAttributes()
CustomAttributeHandleCollection GetCustomAttributes()
StringHandle.VirtualIndex GetVirtualNameIndex(AssemblyReferenceHandle.VirtualIndex index)
AssemblyReference(MetadataReader reader, uint treatmentAndRowId)
static BlobHandle FromVirtualIndex(VirtualIndex virtualIndex, ushort virtualValue)
Definition BlobHandle.cs:39
static StringHandle FromVirtualIndex(VirtualIndex virtualIndex)