Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ModelScope.cs
Go to the documentation of this file.
3
5
6internal sealed class ModelScope
7{
8 private readonly TypeScope _typeScope;
9
11
13
15
20
21 [RequiresUnreferencedCode("calls GetTypeModel")]
23 {
24 return GetTypeModel(type, directReference: true);
25 }
26
27 [RequiresUnreferencedCode("calls GetTypeDesc")]
29 {
31 {
32 return value;
33 }
35 switch (typeDesc.Kind)
36 {
37 case TypeKind.Enum:
38 value = new EnumModel(type, typeDesc, this);
39 break;
40 case TypeKind.Primitive:
41 value = new PrimitiveModel(type, typeDesc, this);
42 break;
43 case TypeKind.Array:
44 case TypeKind.Collection:
45 case TypeKind.Enumerable:
46 value = new ArrayModel(type, typeDesc, this);
47 break;
48 case TypeKind.Root:
49 case TypeKind.Struct:
50 case TypeKind.Class:
51 value = new StructModel(type, typeDesc, this);
52 break;
53 default:
54 if (!typeDesc.IsSpecial)
55 {
57 }
58 value = new SpecialModel(type, typeDesc, this);
59 break;
60 }
62 return value;
63 }
64
65 [RequiresUnreferencedCode("calls GetArrayTypeDesc")]
80}
bool TryGetValue(TKey key, [MaybeNullWhen(false)] out TValue value)
void Add(TKey key, TValue value)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string XmlUnsupportedTypeKind
Definition SR.cs:1398
Definition SR.cs:7
readonly Dictionary< Type, TypeModel > _models
Definition ModelScope.cs:10
ModelScope(TypeScope typeScope)
Definition ModelScope.cs:16
TypeModel GetTypeModel(Type type)
Definition ModelScope.cs:22
readonly Dictionary< Type, TypeModel > _arrayModels
Definition ModelScope.cs:12
ArrayModel GetArrayModel(Type type)
Definition ModelScope.cs:66
TypeModel GetTypeModel(Type type, bool directReference)
Definition ModelScope.cs:28
TypeDesc GetArrayTypeDesc(Type type)
Definition TypeScope.cs:280
TypeDesc GetTypeDesc(string name, string ns)
Definition TypeScope.cs:224