public override string ToString( ) { var stringBuilder = new StringBuilder ( ); foreach (var attribute in this.Attributes) { stringBuilder.AppendLine(attribute.ToString()); } stringBuilder.AppendLine(string.Format("{0} enum {1} : {2}", AccessModifiersExtensions.ToString(AccessModifiers), Value.Name, BaseType.ToString( ).ToLowerInvariant( )).Trim( )); stringBuilder.AppendLine( ); stringBuilder.AppendLine("{"); var isFlags = Attributes.Any(x => x.AttributeType == typeof(FlagsAttribute)); var value = isFlags ? 1 : 0; foreach (var item in ValueNames) { if (item.HasDescription) { stringBuilder.AppendSummary(item.Description); } stringBuilder.AppendLine(string.Format("{0} = {1},", GuerillaCs.ToTypeName(item.Name), value)); value = isFlags ? value << 1 : ++value; } stringBuilder.AppendLine("};"); return(stringBuilder.ToString( ).Trim( )); }
public override string ToString( ) { StringBuilder methodStringBuilder = new StringBuilder( ); var modifiersString = AccessModifiersExtensions.ToString(AccessModifiers); methodStringBuilder.AppendFormat("{0} {1} {2}", modifiersString, Returns, GetMethodSignature( )); if (Wrapper) { var arguments = this.Arguments.SelectMany(x => x.Split(' ')).Where((x, i) => i % 2 == 1).ToArray( ); methodStringBuilder.AppendFormat(": base({0})", GetArguments(arguments)); } methodStringBuilder.AppendLine( ); methodStringBuilder.AppendLine("{"); methodStringBuilder.Append(this.Body); methodStringBuilder.AppendLine( ); methodStringBuilder.AppendLine("}"); return(methodStringBuilder.ToString( ).Trim( )); }
public override string ToString( ) { StringBuilder stringBuilder = new StringBuilder( ); // write Summary if (Value.HasDescription) { stringBuilder.AppendSummary(Value.Description); } // write Attributes foreach (var attribute in Attributes) { stringBuilder.AppendLine(attribute.ToString( )); } var typeString = GetTypeOutput( ); // write Field stringBuilder.AppendLine(string.Format("{0} {1}{2} {3};", AccessModifiersExtensions.ToString(AccessModifiers), typeString, IsArray ? "[]" : "", this.Value.Name)); return(stringBuilder.ToString( ).Trim( )); }