From d6343be707cb6a067fe2b5ccc2efd7848072d17c Mon Sep 17 00:00:00 2001 From: Jon Skeet Date: Wed, 12 Nov 2008 23:39:44 +0000 Subject: Refactored options --- src/ProtoGen/Generator.cs | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/ProtoGen/Generator.cs') 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. /// 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); -- cgit v1.2.3