Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
RuntimeTypeMetadataUpdateHandler.cs
Go to the documentation of this file.
2
4
6{
7 [UnconditionalSuppressMessage("ReflectionAnalysis", "IL2026:RequiresUnreferencedCode", Justification = "Clearing the caches on a Type isn't affected if a Type is trimmed, or has any of its members trimmed.")]
8 public static void ClearCache(Type[] types)
9 {
10 if (RequiresClearingAllTypes(types))
11 {
12 Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
13 foreach (Assembly assembly in assemblies)
14 {
15 if (SkipAssembly(assembly))
16 {
17 continue;
18 }
19 try
20 {
21 Type[] types2 = assembly.GetTypes();
22 foreach (Type type in types2)
23 {
25 }
26 }
28 {
29 }
30 }
31 }
32 else
33 {
34 foreach (Type type2 in types)
35 {
36 ClearCache(type2);
37 }
38 }
39 }
40
41 private static bool SkipAssembly(Assembly assembly)
42 {
43 return typeof(object).Assembly == assembly;
44 }
45
46 private static void ClearCache(Type type)
47 {
49 }
50
51 private static bool RequiresClearingAllTypes([NotNullWhen(false)] Type[] types)
52 {
53 if (types == null)
54 {
55 return true;
56 }
57 foreach (Type type in types)
58 {
59 if (!type.IsSealed)
60 {
61 return true;
62 }
63 }
64 return false;
65 }
66}
static AppDomain CurrentDomain
Definition AppDomain.cs:28
virtual Type[] GetTypes()
Definition Assembly.cs:237
static bool RequiresClearingAllTypes([NotNullWhen(false)] Type[] types)