Commit 12f0460a authored by Jon Skeet's avatar Jon Skeet

Effectively revert previous change to Generator.cs

parent 7ac20214
...@@ -93,25 +93,9 @@ namespace Google.ProtocolBuffers.ProtoGen { ...@@ -93,25 +93,9 @@ namespace Google.ProtocolBuffers.ProtoGen {
/// </summary> /// </summary>
private void Generate(FileDescriptor descriptor) { private void Generate(FileDescriptor descriptor) {
UmbrellaClassGenerator ucg = new UmbrellaClassGenerator(descriptor); UmbrellaClassGenerator ucg = new UmbrellaClassGenerator(descriptor);
string tempFile = Path.GetTempFileName(); using (TextWriter textWriter = File.CreateText(GetOutputFile(descriptor))) {
try { TextGenerator writer = new TextGenerator(textWriter);
using (Stream fstream = File.Open(GetOutputFile(descriptor), FileMode.OpenOrCreate, FileAccess.Write, FileShare.Read)) { ucg.Generate(writer);
using (TextWriter textWriter = File.CreateText(tempFile)) {
TextGenerator writer = new TextGenerator(textWriter);
ucg.Generate(writer);
}
fstream.SetLength(0);
using (TextReader input = new StreamReader(tempFile))
using (TextWriter output = new StreamWriter(fstream)) {
string line;
while (null != (line = input.ReadLine()))
output.WriteLine(line);
}
}
}
finally {
if (File.Exists(tempFile))
File.Delete(tempFile);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment