Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches
ToolboxItemFilterAttribute.cs
Go to the documentation of this file.
2
4
5[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = true)]
7{
8 private string _typeId;
9
10 public string FilterString { get; }
11
13
14 public override object TypeId => _typeId ?? (_typeId = GetType().FullName + FilterString);
15
16 public ToolboxItemFilterAttribute(string filterString)
17 : this(filterString, ToolboxItemFilterType.Allow)
18 {
19 }
20
21 public ToolboxItemFilterAttribute(string filterString, ToolboxItemFilterType filterType)
22 {
23 FilterString = filterString ?? string.Empty;
24 FilterType = filterType;
25 }
26
27 public override bool Equals([NotNullWhen(true)] object? obj)
28 {
29 if (obj == this)
30 {
31 return true;
32 }
33 if (obj is ToolboxItemFilterAttribute { FilterType: var filterType } toolboxItemFilterAttribute && filterType.Equals(FilterType))
34 {
35 return toolboxItemFilterAttribute.FilterString.Equals(FilterString);
36 }
37 return false;
38 }
39
40 public override int GetHashCode()
41 {
42 return FilterString.GetHashCode();
43 }
44
45 public override bool Match([NotNullWhen(true)] object? obj)
46 {
47 if (obj is ToolboxItemFilterAttribute toolboxItemFilterAttribute)
48 {
49 return toolboxItemFilterAttribute.FilterString.Equals(FilterString);
50 }
51 return false;
52 }
53
54 public override string ToString()
55 {
57 }
58}
override bool Match([NotNullWhen(true)] object? obj)
override bool Equals([NotNullWhen(true)] object? obj)
ToolboxItemFilterAttribute(string filterString, ToolboxItemFilterType filterType)
static ? string GetName(Type enumType, object value)
Definition Enum.cs:281