|
|
@ -61,6 +61,16 @@ namespace Google.ProtocolBuffers |
|
|
|
Print(message, generator); |
|
|
|
Print(message, generator); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
|
|
|
|
/// Outputs a textual representation of the Protocol Message builder supplied into |
|
|
|
|
|
|
|
/// the parameter output. |
|
|
|
|
|
|
|
/// </summary> |
|
|
|
|
|
|
|
public static void Print(IBuilder builder, TextWriter output) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
TextGenerator generator = new TextGenerator(output, "\n"); |
|
|
|
|
|
|
|
Print(builder, generator); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/// <summary> |
|
|
|
/// <summary> |
|
|
|
/// Outputs a textual representation of <paramref name="fields" /> to <paramref name="output"/>. |
|
|
|
/// Outputs a textual representation of <paramref name="fields" /> to <paramref name="output"/>. |
|
|
|
/// </summary> |
|
|
|
/// </summary> |
|
|
@ -77,6 +87,13 @@ namespace Google.ProtocolBuffers |
|
|
|
return text.ToString(); |
|
|
|
return text.ToString(); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public static string PrintToString(IBuilder builder) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
StringWriter text = new StringWriter(); |
|
|
|
|
|
|
|
Print(builder, text); |
|
|
|
|
|
|
|
return text.ToString(); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public static string PrintToString(UnknownFieldSet fields) |
|
|
|
public static string PrintToString(UnknownFieldSet fields) |
|
|
|
{ |
|
|
|
{ |
|
|
|
StringWriter text = new StringWriter(); |
|
|
|
StringWriter text = new StringWriter(); |
|
|
@ -93,6 +110,15 @@ namespace Google.ProtocolBuffers |
|
|
|
PrintUnknownFields(message.UnknownFields, generator); |
|
|
|
PrintUnknownFields(message.UnknownFields, generator); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void Print(IBuilder message, TextGenerator generator) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
foreach (KeyValuePair<FieldDescriptor, object> entry in message.AllFields) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
PrintField(entry.Key, entry.Value, generator); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
PrintUnknownFields(message.UnknownFields, generator); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
internal static void PrintField(FieldDescriptor field, object value, TextGenerator generator) |
|
|
|
internal static void PrintField(FieldDescriptor field, object value, TextGenerator generator) |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (field.IsRepeated) |
|
|
|
if (field.IsRepeated) |
|
|
|