FRBDK/Glue/GlueSaveClasses/Models/TypeConverters/FloatRectangleTypeConverter.cs
/// <summary>Converts the specified object to the specified type.</summary>
/// <returns>The converted object.</returns>
/// <param name="context">A <see cref="T:System.ComponentModel.ITypeDescriptorContext" /> that can be used to get additional information about the environment this converter is being called from. This may be null, so you should always check. Also, properties on the context object may also return null. </param>
/// <param name="culture">An <see cref="T:System.Globalization.CultureInfo" /> that contains culture specific information, such as the language, calendar, and cultural conventions associated with a specific culture. It is based on the RFC 1766 standard. </param>
/// <param name="value">The object to convert. </param>
/// <param name="destinationType">The type to convert the object to. </param>
/// <exception cref="T:System.NotSupportedException">The conversion cannot be completed.</exception>
/// <filterpriority>1</filterpriority>
Converts the specified object to the specified type.
Converts the specified object to the specified type .
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
		{
			if (destinationType == null)
			{
				throw new ArgumentNullException("destinationType");
			}
			if (value is FloatRectangle)
			{
				if (destinationType == typeof(string))
				{
					FloatRectangle rectangle = (FloatRectangle)value;
					if (culture == null)
					{
						culture = CultureInfo.CurrentCulture;
					}
					string separator = culture.TextInfo.ListSeparator + " ";
					TypeConverter converter = TypeDescriptor.GetConverter(typeof(float));
					string[] array = new string[4];
					int num = 0;
					array[num++] = converter.ConvertToString(context, culture, rectangle.X);
					array[num++] = converter.ConvertToString(context, culture, rectangle.Y);
					array[num++] = converter.ConvertToString(context, culture, rectangle.Width);
					array[num++] = converter.ConvertToString(context, culture, rectangle.Height);
					return string.Join(separator, array);
				}
				if (destinationType == typeof(InstanceDescriptor))
				{
					FloatRectangle rectangle2 = (FloatRectangle)value;
					ConstructorInfo constructor = typeof(FloatRectangle).GetConstructor(new Type[]
					{
						typeof(float),
						typeof(float),
						typeof(float),
						typeof(float)
					});
					if (constructor != null)
					{
						return new InstanceDescriptor(constructor, new object[]
						{
							rectangle2.X,
							rectangle2.Y,
							rectangle2.Width,
							rectangle2.Height
						});
					}
				}
			}
			return base.ConvertTo(context, culture, value, destinationType);
		}
public override object ConvertTo ( ITypeDescriptorContext context , CultureInfo culture , object value , Type destinationType ) { if ( destinationType == null ) { throw new ArgumentNullException ( " " ) ; } if ( value is FloatRectangle ) { if ( destinationType == typeof ( string ) ) { FloatRectangle rectangle = ( FloatRectangle ) value ; if ( culture == null ) { culture = CultureInfo . CurrentCulture ; } string separator = culture . TextInfo . ListSeparator + " " ; TypeConverter converter = TypeDescriptor . GetConverter ( typeof ( float ) ) ; string [ ] array = new string [ 4 ] ; int num = 0 ; array [ num ++ ] = converter . ConvertToString ( context , culture , rectangle . X ) ; array [ num ++ ] = converter . ConvertToString ( context , culture , rectangle . Y ) ; array [ num ++ ] = converter . ConvertToString ( context , culture , rectangle . Width ) ; array [ num ++ ] = converter . ConvertToString ( context , culture , rectangle . Height ) ; return string . Join ( separator , array ) ; } if ( destinationType == typeof ( InstanceDescriptor ) ) { FloatRectangle rectangle2 = ( FloatRectangle ) value ; ConstructorInfo constructor = typeof ( FloatRectangle ) . GetConstructor ( new Type [ ] { typeof ( float ) , typeof ( float ) , typeof ( float ) , typeof ( float ) } ) ; if ( constructor != null ) { return new InstanceDescriptor ( constructor , new object [ ] { rectangle2 . X , rectangle2 . Y , rectangle2 . Width , rectangle2 . Height } ) ; } } } return base . ConvertTo ( context , culture , value , destinationType ) ; }
Converts the specified object to the specified type.
Converts the specified object to the specified type .
The converted object.
The converted object .
The conversion cannot be completed.
The conversion cannot be completed .
context
ITypeDescriptorContext
A  that can be used to get additional information about the environment this converter is being called from. This may be null, so you should always check. Also, properties on the context object may also return null.
A that can be used to get additional information about the environment this converter is being called from . This may be null so you should always check . Also properties on the context object may also return null .
culture
CultureInfo
An  that contains culture specific information, such as the language, calendar, and cultural conventions associated with a specific culture. It is based on the RFC 1766 standard.
An that contains culture specific information such as the language calendar and cultural conventions associated with a specific culture . It is based on the RFC 1766 standard .
value
object
The object to convert.
The object to convert .
destinationType
Type
The type to convert the object to.
The type to convert the object to .
filterpriority
None