System.Web.Compilation.TemplateControlCompiler.ProcessPropertiesAndFields C# (CSharp) Method

ProcessPropertiesAndFields() private method

private ProcessPropertiesAndFields ( ControlBuilder builder, MemberInfo member, string id, string attValue, string prefix ) : bool
builder System.Web.UI.ControlBuilder
member System.Reflection.MemberInfo
id string
attValue string
prefix string
return bool
		bool ProcessPropertiesAndFields (ControlBuilder builder, MemberInfo member, string id,
						 string attValue, string prefix)
		{
			int hyphen = id.IndexOf ('-');
			bool isPropertyInfo = (member is PropertyInfo);
			bool isDataBound = BaseParser.IsDataBound (attValue);
			bool isExpression = !isDataBound && BaseParser.IsExpression (attValue);
			Type type;
			if (isPropertyInfo) {
				type = ((PropertyInfo) member).PropertyType;
			} else {
				type = ((FieldInfo) member).FieldType;
			}

			if (InvariantCompareNoCase (member.Name, id)) {
				if (isDataBound)
					RegisterBindingInfo (builder, member.Name, ref attValue);				

				if (!IsWritablePropertyOrField (member))
					return false;
				
				AddCodeForPropertyOrField (builder, type, member.Name, attValue, member, isDataBound, isExpression);
				return true;
			}
			
			if (hyphen == -1)
				return false;

			string prop_field = id.Replace ('-', '.');
			string [] parts = prop_field.Split (new char [] {'.'});
			int length = parts.Length;
			
			if (length < 2 || !InvariantCompareNoCase (member.Name, parts [0]))
				return false;

			if (length > 2) {
				MemberInfo sub_member = GetFieldOrProperty (type, parts [1]);
				if (sub_member == null)
					return false;

				string new_prefix = prefix + member.Name + ".";
				string new_id = id.Substring (hyphen + 1);
				return ProcessPropertiesAndFields (builder, sub_member, new_id, attValue, new_prefix);
			}

			MemberInfo subpf = GetFieldOrProperty (type, parts [1]);
			if (!(subpf is PropertyInfo))
				return false;

			PropertyInfo subprop = (PropertyInfo) subpf;
			if (subprop.CanWrite == false)
				return false;

			bool is_bool = (subprop.PropertyType == typeof (bool));
			if (!is_bool && attValue == null)
				return false; // Font-Size -> Font-Size="" as html

			string val = attValue;
			if (attValue == null && is_bool)
				val = "true"; // Font-Bold <=> Font-Bold="true"

			if (isDataBound)
				RegisterBindingInfo (builder, prefix + member.Name + "." + subprop.Name, ref attValue);

			AddCodeForPropertyOrField (builder, subprop.PropertyType,
						   prefix + member.Name + "." + subprop.Name,
						   val, subprop, isDataBound, isExpression);

			return true;
		}
TemplateControlCompiler