diff options
author | Jon Skeet <skeet@pobox.com> | 2008-11-12 23:39:44 +0000 |
---|---|---|
committer | Jon Skeet <skeet@pobox.com> | 2008-11-12 23:39:44 +0000 |
commit | d6343be707cb6a067fe2b5ccc2efd7848072d17c (patch) | |
tree | ea4821795bcd032c0bc82461b699c5cef86c42ab /src/ProtoGen/Generator.cs | |
parent | 60c059b8f0b2b01fba14c537e370b56445437510 (diff) | |
download | protobuf-d6343be707cb6a067fe2b5ccc2efd7848072d17c.tar.gz protobuf-d6343be707cb6a067fe2b5ccc2efd7848072d17c.tar.bz2 protobuf-d6343be707cb6a067fe2b5ccc2efd7848072d17c.zip |
Refactored options
Diffstat (limited to 'src/ProtoGen/Generator.cs')
-rw-r--r-- | src/ProtoGen/Generator.cs | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/src/ProtoGen/Generator.cs b/src/ProtoGen/Generator.cs index b447d42f..f7a82cca 100644 --- a/src/ProtoGen/Generator.cs +++ b/src/ProtoGen/Generator.cs @@ -30,11 +30,8 @@ namespace Google.ProtocolBuffers.ProtoGen { foreach (string inputFile in options.InputFiles) { FileDescriptorSet descriptorProtos; ExtensionRegistry extensionRegistry = ExtensionRegistry.CreateInstance(); - extensionRegistry.Add(CSharpOptions.CSharpUmbrellaClassname); - extensionRegistry.Add(CSharpOptions.CSharpMultipleFiles); - extensionRegistry.Add(CSharpOptions.CSharpNamespace); - extensionRegistry.Add(CSharpOptions.CSharpNestClasses); - extensionRegistry.Add(CSharpOptions.CSharpPublicClasses); + extensionRegistry.Add(CSharpFileOptions.CSharpOptions); + extensionRegistry.Add(CSharpFieldOptions.CSharpOptions); using (Stream inputStream = File.OpenRead(inputFile)) { descriptorProtos = FileDescriptorSet.ParseFrom(inputStream, extensionRegistry); } @@ -51,12 +48,9 @@ namespace Google.ProtocolBuffers.ProtoGen { /// already have been resolved. /// </summary> private void Generate(FileDescriptor descriptor) { - string umbrellaClass = DescriptorUtil.GetUmbrellaClassName(descriptor); - string ns = DescriptorUtil.GetNamespace(descriptor); - using (TextWriter textWriter = File.CreateText(Path.Combine(options.OutputDirectory, umbrellaClass + ".cs"))) { - TextGenerator writer = new TextGenerator(textWriter); - - UmbrellaClassGenerator ucg = new UmbrellaClassGenerator(descriptor); + UmbrellaClassGenerator ucg = new UmbrellaClassGenerator(descriptor); + using (TextWriter textWriter = File.CreateText(Path.Combine(options.OutputDirectory, descriptor.CSharpOptions.UmbrellaClassname + ".cs"))) { + TextGenerator writer = new TextGenerator(textWriter); ucg.Generate(writer); /* GenerateSiblings(umbrellaSource, descriptor, descriptor.MessageTypes); |