Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
NamespaceCache.cs
Go to the documentation of this file.
3
5
6internal sealed class NamespaceCache
7{
8 private sealed class NamespaceDataBuilder
9 {
11
12 public readonly StringHandle Name;
13
14 public readonly string FullName;
15
17
19
21
23
25
35
50
52 {
54 other.Namespaces.AddRange(Namespaces);
55 other.TypeDefinitions.AddRange(TypeDefinitions);
56 other.ExportedTypes.AddRange(ExportedTypes);
57 }
58 }
59
61
62 private readonly object _namespaceTableAndListLock = new object();
63
65
67
69
70 internal bool CacheIsRealized => _namespaceTable != null;
71
73 {
74 _metadataReader = reader;
75 }
76
82
88
98
100 {
102 int num = fullNamespaceHandle.GetHeapOffset() - 1;
103 for (int i = 0; i < segmentIndex; i++)
104 {
105 int num2 = _metadataReader.StringHeap.IndexOfRaw(num + 1, '.');
106 if (num2 == -1)
107 {
108 break;
109 }
110 num = num2;
111 }
112 int heapOffset = num + 1;
113 return StringHandle.FromOffset(heapOffset).WithDotTermination();
114 }
115
147
178
193
195 {
196 child.Parent = parent.Handle;
197 parent.Namespaces.Add(child.Handle);
198 }
199
201 {
202 string fullName = realChild.FullName;
205 while (true)
206 {
207 int num = fullName.LastIndexOf('.');
208 string text;
209 if (num == -1)
210 {
211 if (fullName.Length == 0)
212 {
213 return;
214 }
215 text = string.Empty;
216 }
217 else
218 {
219 text = fullName.Substring(0, num);
220 }
222 {
223 break;
224 }
225 if (virtualNamespaces != null)
226 {
228 {
229 if (virtualNamespace.FullName == text)
230 {
232 return;
233 }
234 }
235 }
236 else
237 {
239 }
244 child = namespaceDataBuilder;
245 }
247 }
248
257
278
300
302 {
303 if (_namespaceTable == null)
304 {
306 }
307 }
308}
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void Add(TKey key, TValue value)
ImmutableArray< TypeDefinitionHandle >.Builder TypeDefinitions
ImmutableArray< NamespaceDefinitionHandle >.Builder Namespaces
NamespaceDataBuilder(NamespaceDefinitionHandle handle, StringHandle name, string fullName)
NamespaceDataBuilder SynthesizeNamespaceData(string fullName, NamespaceDefinitionHandle realChild)
void ResolveParentChildRelationships(Dictionary< string, NamespaceDataBuilder > namespaces, out List< NamespaceDataBuilder > virtualNamespaces)
void LinkChildToParentNamespace(Dictionary< string, NamespaceDataBuilder > existingNamespaces, NamespaceDataBuilder realChild, ref List< NamespaceDataBuilder > virtualNamespaces)
void LinkChildDataToParentData(NamespaceDataBuilder child, NamespaceDataBuilder parent)
volatile Dictionary< NamespaceDefinitionHandle, NamespaceData > _namespaceTable
StringHandle GetSimpleName(NamespaceDefinitionHandle fullNamespaceHandle, int segmentIndex=int.MaxValue)
string GetFullName(NamespaceDefinitionHandle handle)
void MergeDuplicateNamespaces(Dictionary< NamespaceDefinitionHandle, NamespaceDataBuilder > table, out Dictionary< string, NamespaceDataBuilder > stringTable)
void PopulateTableWithExportedTypes(Dictionary< NamespaceDefinitionHandle, NamespaceDataBuilder > table)
void PopulateTableWithTypeDefinitions(Dictionary< NamespaceDefinitionHandle, NamespaceDataBuilder > table)
NamespaceData GetNamespaceData(NamespaceDefinitionHandle handle)
ExportedType GetExportedType(ExportedTypeHandle handle)
string GetString(StringHandle handle)
ExportedTypeHandleCollection ExportedTypes
TypeDefinitionHandleCollection TypeDefinitions
TypeDefinition GetTypeDefinition(TypeDefinitionHandle handle)
static void InvalidHandle()
Definition Throw.cs:208
static NamespaceDefinitionHandle FromVirtualIndex(uint virtualIndex)
static NamespaceDefinitionHandle FromFullNameOffset(int stringHeapOffset)
static StringHandle FromOffset(int heapOffset)