internal object GetDefaultValue(bool raw)
{
object missing = null;
if (!this.m_noDefaultValue)
{
if (this.ParameterType == typeof(DateTime))
{
if (raw)
{
CustomAttributeTypedArgument argument = CustomAttributeData.Filter(CustomAttributeData.GetCustomAttributes(this), typeof(DateTimeConstantAttribute), 0);
if (argument.ArgumentType != null)
{
return(new DateTime((long)argument.Value));
}
}
else
{
object[] customAttributes = this.GetCustomAttributes(typeof(DateTimeConstantAttribute), false);
if ((customAttributes != null) && (customAttributes.Length != 0))
{
return(((DateTimeConstantAttribute)customAttributes[0]).Value);
}
}
}
if (!System.Reflection.MetadataToken.IsNullToken(this.m_tkParamDef))
{
missing = MdConstant.GetValue(this.m_scope, this.m_tkParamDef, this.ParameterType.GetTypeHandleInternal(), raw);
}
if (missing == DBNull.Value)
{
if (raw)
{
IList <CustomAttributeData> attrs = CustomAttributeData.GetCustomAttributes(this);
CustomAttributeTypedArgument argument2 = CustomAttributeData.Filter(attrs, s_CustomConstantAttributeType, "Value");
if (argument2.ArgumentType == null)
{
argument2 = CustomAttributeData.Filter(attrs, s_DecimalConstantAttributeType, "Value");
if (argument2.ArgumentType == null)
{
for (int i = 0; i < attrs.Count; i++)
{
if (attrs[i].Constructor.DeclaringType == s_DecimalConstantAttributeType)
{
ParameterInfo[] parameters = attrs[i].Constructor.GetParameters();
if (parameters.Length != 0)
{
if (parameters[2].ParameterType == typeof(uint))
{
IList <CustomAttributeTypedArgument> constructorArguments = attrs[i].ConstructorArguments;
CustomAttributeTypedArgument argument3 = constructorArguments[4];
int lo = (int)((uint)argument3.Value);
CustomAttributeTypedArgument argument4 = constructorArguments[3];
int mid = (int)((uint)argument4.Value);
CustomAttributeTypedArgument argument5 = constructorArguments[2];
int hi = (int)((uint)argument5.Value);
CustomAttributeTypedArgument argument6 = constructorArguments[1];
byte num5 = (byte)argument6.Value;
CustomAttributeTypedArgument argument7 = constructorArguments[0];
byte scale = (byte)argument7.Value;
argument2 = new CustomAttributeTypedArgument(new decimal(lo, mid, hi, num5 != 0, scale));
}
else
{
IList <CustomAttributeTypedArgument> list3 = attrs[i].ConstructorArguments;
CustomAttributeTypedArgument argument8 = list3[4];
int num7 = (int)argument8.Value;
CustomAttributeTypedArgument argument9 = list3[3];
int num8 = (int)argument9.Value;
CustomAttributeTypedArgument argument10 = list3[2];
int num9 = (int)argument10.Value;
CustomAttributeTypedArgument argument11 = list3[1];
byte num10 = (byte)argument11.Value;
CustomAttributeTypedArgument argument12 = list3[0];
byte num11 = (byte)argument12.Value;
argument2 = new CustomAttributeTypedArgument(new decimal(num7, num8, num9, num10 != 0, num11));
}
}
}
}
}
}
if (argument2.ArgumentType != null)
{
missing = argument2.Value;
}
}
else
{
object[] objArray2 = this.GetCustomAttributes(s_CustomConstantAttributeType, false);
if (objArray2.Length != 0)
{
missing = ((CustomConstantAttribute)objArray2[0]).Value;
}
else
{
objArray2 = this.GetCustomAttributes(s_DecimalConstantAttributeType, false);
if (objArray2.Length != 0)
{
missing = ((DecimalConstantAttribute)objArray2[0]).Value;
}
}
}
}
if ((missing == DBNull.Value) && this.IsOptional)
{
missing = Type.Missing;
}
}
return(missing);
}