aboutsummaryrefslogtreecommitdiff
path: root/src/ProtoGen/MessageGenerator.cs
diff options
context:
space:
mode:
authorcsharptest <roger@csharptest.net>2011-09-09 18:14:40 -0500
committerrogerk <devnull@localhost>2011-09-09 18:14:40 -0500
commit3c6e93283a90b2d5c944a02bba3f1606272d762d (patch)
tree30b73c9442bf14a96ef3c1181deefad61eaa6e4d /src/ProtoGen/MessageGenerator.cs
parent8f0dcf3df1548a1eff0bed54a9b992f55b8f72d5 (diff)
downloadprotobuf-3c6e93283a90b2d5c944a02bba3f1606272d762d.tar.gz
protobuf-3c6e93283a90b2d5c944a02bba3f1606272d762d.tar.bz2
protobuf-3c6e93283a90b2d5c944a02bba3f1606272d762d.zip
Completed addition and testing of new add_serializable option.
Diffstat (limited to 'src/ProtoGen/MessageGenerator.cs')
-rw-r--r--src/ProtoGen/MessageGenerator.cs10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/ProtoGen/MessageGenerator.cs b/src/ProtoGen/MessageGenerator.cs
index 01d47ce2..83004da9 100644
--- a/src/ProtoGen/MessageGenerator.cs
+++ b/src/ProtoGen/MessageGenerator.cs
@@ -165,9 +165,13 @@ namespace Google.ProtocolBuffers.ProtoGen
{
return SourceGenerators.CreateFieldGenerator(fieldDescriptor, FieldOrdinal(fieldDescriptor));
}
-
+
public void Generate(TextGenerator writer)
{
+ if (Descriptor.File.CSharpOptions.AddSerializable)
+ {
+ writer.WriteLine("[global::System.SerializableAttribute()]");
+ }
writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]",
@@ -554,6 +558,10 @@ namespace Google.ProtocolBuffers.ProtoGen
writer.WriteLine(" return (Builder) new Builder().MergeFrom(prototype);");
writer.WriteLine("}");
writer.WriteLine();
+ if (Descriptor.File.CSharpOptions.AddSerializable)
+ {
+ writer.WriteLine("[global::System.SerializableAttribute()]");
+ }
writer.WriteLine("[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]");
writer.WriteLine("[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]");
writer.WriteLine("[global::System.CodeDom.Compiler.GeneratedCodeAttribute(\"{0}\", \"{1}\")]",