Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ToolboxItemAttribute.cs
Go to the documentation of this file.
2
4
5[AttributeUsage(AttributeTargets.All)]
7{
8 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
10
11 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
12 private readonly string _toolboxItemTypeName;
13
14 public static readonly ToolboxItemAttribute Default = new ToolboxItemAttribute("System.Drawing.Design.ToolboxItem, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a");
15
16 public static readonly ToolboxItemAttribute None = new ToolboxItemAttribute(defaultType: false);
17
18 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
20 {
21 get
22 {
23 if (_toolboxItemType == null && _toolboxItemTypeName != null)
24 {
25 try
26 {
28 }
29 catch (Exception innerException)
30 {
32 }
33 }
34 return _toolboxItemType;
35 }
36 }
37
38 [DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)]
39 public string ToolboxItemTypeName => _toolboxItemTypeName ?? string.Empty;
40
41 public override bool IsDefaultAttribute()
42 {
43 return Equals(Default);
44 }
45
46 public ToolboxItemAttribute(bool defaultType)
47 {
48 if (defaultType)
49 {
50 _toolboxItemTypeName = "System.Drawing.Design.ToolboxItem, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a";
51 }
52 }
53
54 public ToolboxItemAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] string toolboxItemTypeName)
55 {
56 _toolboxItemTypeName = toolboxItemTypeName ?? throw new ArgumentNullException("toolboxItemTypeName");
57 }
58
59 public ToolboxItemAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type toolboxItemType)
60 {
61 if (toolboxItemType == null)
62 {
63 throw new ArgumentNullException("toolboxItemType");
64 }
65 _toolboxItemType = toolboxItemType;
67 }
68
69 public override bool Equals([NotNullWhen(true)] object? obj)
70 {
71 if (obj == this)
72 {
73 return true;
74 }
75 if (obj is ToolboxItemAttribute toolboxItemAttribute)
76 {
77 return toolboxItemAttribute.ToolboxItemTypeName == ToolboxItemTypeName;
78 }
79 return false;
80 }
81
82 public override int GetHashCode()
83 {
84 if (_toolboxItemTypeName != null)
85 {
86 return _toolboxItemTypeName.GetHashCode();
87 }
88 return base.GetHashCode();
89 }
90}
ToolboxItemAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] string toolboxItemTypeName)
static readonly ToolboxItemAttribute None
ToolboxItemAttribute([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] Type toolboxItemType)
static readonly ToolboxItemAttribute Default
override bool Equals([NotNullWhen(true)] object? obj)
static string Format(string resourceFormat, object p1)
Definition SR.cs:118
static string ToolboxItemAttributeFailedGetType
Definition SR.cs:66
Definition SR.cs:7
static ? Type GetType(string typeName, bool throwOnError, bool ignoreCase)
Definition Type.cs:408
string? AssemblyQualifiedName
Definition Type.cs:45