Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ GetEditor()

virtual ? object System.ComponentModel.PropertyDescriptor.GetEditor ( Type editorBaseType)
inlinevirtualinherited

Definition at line 171 of file PropertyDescriptor.cs.

172 {
173 object obj = null;
174 AttributeCollection attributes = Attributes;
175 if (_editorTypes != null)
176 {
177 for (int i = 0; i < _editorCount; i++)
178 {
179 if (_editorTypes[i] == editorBaseType)
180 {
181 return _editors[i];
182 }
183 }
184 }
185 if (obj == null)
186 {
187 for (int j = 0; j < attributes.Count; j++)
188 {
189 if (!(attributes[j] is EditorAttribute editorAttribute))
190 {
191 continue;
192 }
193 Type typeFromName = GetTypeFromName(editorAttribute.EditorBaseTypeName);
194 if (editorBaseType == typeFromName)
195 {
196 Type typeFromName2 = GetTypeFromName(editorAttribute.EditorTypeName);
197 if (typeFromName2 != null)
198 {
199 obj = CreateInstance(typeFromName2);
200 break;
201 }
202 }
203 }
204 if (obj == null)
205 {
206 obj = TypeDescriptor.GetEditor(PropertyType, editorBaseType);
207 }
208 if (_editorTypes == null)
209 {
210 _editorTypes = new Type[5];
211 _editors = new object[5];
212 }
213 if (_editorCount >= _editorTypes.Length)
214 {
215 Type[] array = new Type[_editorTypes.Length * 2];
216 object[] array2 = new object[_editors.Length * 2];
217 Array.Copy(_editorTypes, array, _editorTypes.Length);
218 Array.Copy(_editors, array2, _editors.Length);
220 _editors = array2;
221 }
222 _editorTypes[_editorCount] = editorBaseType;
224 }
225 return obj;
226 }
virtual AttributeCollection Attributes
Type? GetTypeFromName([DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] string? typeName)

References System.ComponentModel.PropertyDescriptor._editorCount, System.ComponentModel.PropertyDescriptor._editors, System.ComponentModel.PropertyDescriptor._editorTypes, System.array, System.ComponentModel.MemberDescriptor.Attributes, System.Array.Copy(), System.ComponentModel.AttributeCollection.Count, System.Reflection.CreateInstance, System.ComponentModel.TypeDescriptor.GetEditor(), System.ComponentModel.PropertyDescriptor.GetTypeFromName(), System.obj, and System.ComponentModel.PropertyDescriptor.PropertyType.