void LoadDefaultProviders() { UniversalTypeDescriptorProvider utd = new UniversalTypeDescriptorProvider(TypeDescriptor.GetProvider(typeof(object))); utd.Suspended = true; utd.AddUniversalTypeDescriptor(typeof(Vector2), new TypeConverterAttribute(typeof(Vector2Converter))); utd.AddUniversalTypeDescriptor(typeof(Vector3), new TypeConverterAttribute(typeof(Vector3Converter))); utd.AddUniversalTypeDescriptor(typeof(Vector4), new TypeConverterAttribute(typeof(Vector4Converter))); utd.AddUniversalTypeDescriptor(typeof(Quaternion), new TypeConverterAttribute(typeof(QuaternionConverter))); utd.AddUniversalTypeDescriptor(typeof(Matrix3), new EditorAttribute(typeof(MatrixEditor), typeof(UITypeEditor))); utd.AddUniversalTypeDescriptor(typeof(Matrix4), new EditorAttribute(typeof(MatrixEditor), typeof(UITypeEditor))); utd.AddUniversalTypeDescriptor(typeof(ColourValue), new TypeConverterAttribute(typeof(ColourValueConverter)), new EditorAttribute(typeof(ColourValueEditor), typeof(UITypeEditor))); utd.AddUniversalTypeDescriptor(typeof(AxisAlignedBox), new TypeConverterAttribute(typeof(AxisAlignedBoxConverter))); TypeDescriptor.AddProvider(utd, typeof(Vector2)); TypeDescriptor.AddProvider(utd, typeof(Vector3)); TypeDescriptor.AddProvider(utd, typeof(Vector4)); TypeDescriptor.AddProvider(utd, typeof(Quaternion)); TypeDescriptor.AddProvider(utd, typeof(Matrix3)); TypeDescriptor.AddProvider(utd, typeof(Matrix4)); TypeDescriptor.AddProvider(utd, typeof(ColourValue)); TypeDescriptor.AddProvider(utd, typeof(AxisAlignedBox)); providers.Add(new KeyValuePair <Type, TypeDescriptionProvider>(typeof(Vector2), utd)); providers.Add(new KeyValuePair <Type, TypeDescriptionProvider>(typeof(Vector3), utd)); providers.Add(new KeyValuePair <Type, TypeDescriptionProvider>(typeof(Vector4), utd)); providers.Add(new KeyValuePair <Type, TypeDescriptionProvider>(typeof(Quaternion), utd)); providers.Add(new KeyValuePair <Type, TypeDescriptionProvider>(typeof(Matrix3), utd)); providers.Add(new KeyValuePair <Type, TypeDescriptionProvider>(typeof(Matrix4), utd)); providers.Add(new KeyValuePair <Type, TypeDescriptionProvider>(typeof(ColourValue), utd)); providers.Add(new KeyValuePair <Type, TypeDescriptionProvider>(typeof(AxisAlignedBox), utd)); utd.Suspended = false; DefaultTypeDescriptorProvider = utd; }
void LoadFallbackProviders() { Assembly ass = Assembly.GetAssembly(typeof(Mogre.Root)); Type[] mogreTypes = ass.GetTypes(); UniversalTypeDescriptorProvider utd = new UniversalTypeDescriptorProvider(TypeDescriptor.GetProvider(typeof(object))); utd.Suspended = true; foreach (Type type in mogreTypes) { if (type.IsEnum || type.IsNotPublic) { continue; } if (type.IsValueType) { utd.AddUniversalTypeDescriptor(type, new TypeConverterAttribute(typeof(TypeConverter)), new EditorAttribute(typeof(FieldsEditor), typeof(UITypeEditor))); } else if (type.IsClass) { utd.AddUniversalTypeDescriptor(type, new TypeConverterAttribute(typeof(ExpandableObjectConverter))); } else { continue; } TypeDescriptor.AddProvider(utd, type); providers.Add(new KeyValuePair <Type, TypeDescriptionProvider>(type, utd)); } utd.Suspended = false; FallbackTypeDescriptorProvider = utd; }