public override object[] GetCustomAttributes(bool inherit) { return(RubricInfo.GetCustomAttributes(inherit)); }
public override object[] GetCustomAttributes(Type attributeType, bool inherit) { return(RubricInfo.GetCustomAttributes(attributeType, inherit)); }
public override object[] GetCustomAttributes(bool inherit) { if (RubricAttributes != null) { return(RubricAttributes); } RubricAttributes = new object[0]; if (RubricInfo != null) { var attrib = RubricInfo.GetCustomAttributes(inherit); if (attrib != null) { if (RubricType.IsArray || RubricType == typeof(string)) { if (attrib.Where(r => r is MarshalAsAttribute).Any()) { attrib.Cast <MarshalAsAttribute>().Select(a => RubricSize = a.SizeConst).ToArray(); return(RubricAttributes = attrib); } else { RubricAttributes.Concat(attrib).ToArray(); } } else { return(RubricAttributes.Concat(attrib).ToArray()); } } } if (RubricType == typeof(string)) { if (RubricSize < 1) { RubricSize = 16; } return(new[] { new MarshalAsAttribute(UnmanagedType.ByValTStr) { SizeConst = RubricSize } }); } else if (RubricType.IsArray) { if (RubricSize < 1) { RubricSize = 8; } if (RubricType == typeof(byte[])) { return(RubricAttributes.Concat(new[] { new MarshalAsAttribute(UnmanagedType.ByValArray) { SizeConst = RubricSize, ArraySubType = UnmanagedType.U1 } }).ToArray()); } if (RubricType == typeof(char[])) { return(RubricAttributes.Concat(new[] { new MarshalAsAttribute(UnmanagedType.ByValArray) { SizeConst = RubricSize, ArraySubType = UnmanagedType.U1 } }).ToArray()); } if (RubricType == typeof(int[])) { return(RubricAttributes.Concat(new[] { new MarshalAsAttribute(UnmanagedType.ByValArray) { SizeConst = RubricSize / 4, ArraySubType = UnmanagedType.I4 } }).ToArray()); } if (RubricType == typeof(long[])) { return(RubricAttributes.Concat(new[] { new MarshalAsAttribute(UnmanagedType.ByValArray) { SizeConst = RubricSize / 8, ArraySubType = UnmanagedType.I8 } }).ToArray()); } if (RubricType == typeof(float[])) { return(RubricAttributes.Concat(new[] { new MarshalAsAttribute(UnmanagedType.ByValArray) { SizeConst = RubricSize / 4, ArraySubType = UnmanagedType.R4 } }).ToArray()); } if (RubricType == typeof(double[])) { return(RubricAttributes.Concat(new[] { new MarshalAsAttribute(UnmanagedType.ByValArray) { SizeConst = RubricSize / 8, ArraySubType = UnmanagedType.R8 } }).ToArray()); } } return(null); }