168 lines
7.0 KiB
C#
168 lines
7.0 KiB
C#
using System;
|
|
|
|
namespace System.ComponentModel
|
|
{
|
|
/// <summary>Specifies the default value for a property.</summary>
|
|
// Token: 0x0200006E RID: 110
|
|
[AttributeUsage(AttributeTargets.All)]
|
|
public class DefaultValueAttribute : Attribute
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.DefaultValueAttribute" /> class using a <see cref="T:System.Boolean" /> value.</summary>
|
|
/// <param name="value">A <see cref="T:System.Boolean" /> that is the default value. </param>
|
|
// Token: 0x060003FF RID: 1023 RVA: 0x0000C1E0 File Offset: 0x0000A3E0
|
|
public DefaultValueAttribute(bool value)
|
|
{
|
|
this.DefaultValue = value;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.DefaultValueAttribute" /> class using an 8-bit unsigned integer.</summary>
|
|
/// <param name="value">An 8-bit unsigned integer that is the default value. </param>
|
|
// Token: 0x06000400 RID: 1024 RVA: 0x0000C1F4 File Offset: 0x0000A3F4
|
|
public DefaultValueAttribute(byte value)
|
|
{
|
|
this.DefaultValue = value;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.DefaultValueAttribute" /> class using a Unicode character.</summary>
|
|
/// <param name="value">A Unicode character that is the default value. </param>
|
|
// Token: 0x06000401 RID: 1025 RVA: 0x0000C208 File Offset: 0x0000A408
|
|
public DefaultValueAttribute(char value)
|
|
{
|
|
this.DefaultValue = value;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.DefaultValueAttribute" /> class using a double-precision floating point number.</summary>
|
|
/// <param name="value">A double-precision floating point number that is the default value. </param>
|
|
// Token: 0x06000402 RID: 1026 RVA: 0x0000C21C File Offset: 0x0000A41C
|
|
public DefaultValueAttribute(double value)
|
|
{
|
|
this.DefaultValue = value;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.DefaultValueAttribute" /> class using a 16-bit signed integer.</summary>
|
|
/// <param name="value">A 16-bit signed integer that is the default value. </param>
|
|
// Token: 0x06000403 RID: 1027 RVA: 0x0000C230 File Offset: 0x0000A430
|
|
public DefaultValueAttribute(short value)
|
|
{
|
|
this.DefaultValue = value;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.DefaultValueAttribute" /> class using a 32-bit signed integer.</summary>
|
|
/// <param name="value">A 32-bit signed integer that is the default value. </param>
|
|
// Token: 0x06000404 RID: 1028 RVA: 0x0000C244 File Offset: 0x0000A444
|
|
public DefaultValueAttribute(int value)
|
|
{
|
|
this.DefaultValue = value;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.DefaultValueAttribute" /> class using a 64-bit signed integer.</summary>
|
|
/// <param name="value">A 64-bit signed integer that is the default value. </param>
|
|
// Token: 0x06000405 RID: 1029 RVA: 0x0000C258 File Offset: 0x0000A458
|
|
public DefaultValueAttribute(long value)
|
|
{
|
|
this.DefaultValue = value;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.DefaultValueAttribute" /> class.</summary>
|
|
/// <param name="value">An <see cref="T:System.Object" /> that represents the default value. </param>
|
|
// Token: 0x06000406 RID: 1030 RVA: 0x0000C26C File Offset: 0x0000A46C
|
|
public DefaultValueAttribute(object value)
|
|
{
|
|
this.DefaultValue = value;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.DefaultValueAttribute" /> class using a single-precision floating point number.</summary>
|
|
/// <param name="value">A single-precision floating point number that is the default value. </param>
|
|
// Token: 0x06000407 RID: 1031 RVA: 0x0000C27C File Offset: 0x0000A47C
|
|
public DefaultValueAttribute(float value)
|
|
{
|
|
this.DefaultValue = value;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.DefaultValueAttribute" /> class using a <see cref="T:System.String" />.</summary>
|
|
/// <param name="value">A <see cref="T:System.String" /> that is the default value. </param>
|
|
// Token: 0x06000408 RID: 1032 RVA: 0x0000C290 File Offset: 0x0000A490
|
|
public DefaultValueAttribute(string value)
|
|
{
|
|
this.DefaultValue = value;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.ComponentModel.DefaultValueAttribute" /> class, converting the specified value to the specified type, and using an invariant culture as the translation context.</summary>
|
|
/// <param name="type">A <see cref="T:System.Type" /> that represents the type to convert the value to. </param>
|
|
/// <param name="value">A <see cref="T:System.String" /> that can be converted to the type using the <see cref="T:System.ComponentModel.TypeConverter" /> for the type and the U.S. English culture. </param>
|
|
// Token: 0x06000409 RID: 1033 RVA: 0x0000C2A0 File Offset: 0x0000A4A0
|
|
public DefaultValueAttribute(Type type, string value)
|
|
{
|
|
try
|
|
{
|
|
if (type.IsEnum)
|
|
{
|
|
this.DefaultValue = Enum.Parse(type, value);
|
|
}
|
|
else if (type == typeof(TimeSpan))
|
|
{
|
|
this.DefaultValue = TimeSpan.Parse(value);
|
|
}
|
|
else
|
|
{
|
|
this.DefaultValue = Convert.ChangeType(value, type, null);
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the default value of the property this attribute is bound to.</summary>
|
|
/// <returns>An <see cref="T:System.Object" /> that represents the default value of the property this attribute is bound to.</returns>
|
|
// Token: 0x17000112 RID: 274
|
|
// (get) Token: 0x0600040A RID: 1034 RVA: 0x0000C32C File Offset: 0x0000A52C
|
|
public virtual object Value
|
|
{
|
|
get
|
|
{
|
|
return this.DefaultValue;
|
|
}
|
|
}
|
|
|
|
/// <summary>Sets the default value for the property to which this attribute is bound.</summary>
|
|
/// <param name="value">The default value.</param>
|
|
// Token: 0x0600040B RID: 1035 RVA: 0x0000C334 File Offset: 0x0000A534
|
|
protected void SetValue(object value)
|
|
{
|
|
this.DefaultValue = value;
|
|
}
|
|
|
|
/// <summary>Returns whether the value of the given object is equal to the current <see cref="T:System.ComponentModel.DefaultValueAttribute" />.</summary>
|
|
/// <returns>true if the value of the given object is equal to that of the current; otherwise, false.</returns>
|
|
/// <param name="obj">The object to test the value equality of. </param>
|
|
// Token: 0x0600040C RID: 1036 RVA: 0x0000C340 File Offset: 0x0000A540
|
|
public override bool Equals(object obj)
|
|
{
|
|
DefaultValueAttribute defaultValueAttribute = obj as DefaultValueAttribute;
|
|
if (defaultValueAttribute == null)
|
|
{
|
|
return false;
|
|
}
|
|
if (this.DefaultValue == null)
|
|
{
|
|
return defaultValueAttribute.Value == null;
|
|
}
|
|
return this.DefaultValue.Equals(defaultValueAttribute.Value);
|
|
}
|
|
|
|
// Token: 0x0600040D RID: 1037 RVA: 0x0000C384 File Offset: 0x0000A584
|
|
public override int GetHashCode()
|
|
{
|
|
if (this.DefaultValue == null)
|
|
{
|
|
return base.GetHashCode();
|
|
}
|
|
return this.DefaultValue.GetHashCode();
|
|
}
|
|
|
|
// Token: 0x0400014B RID: 331
|
|
private object DefaultValue;
|
|
}
|
|
}
|