diff options
author | csharptest <roger@csharptest.net> | 2011-05-20 15:15:34 -0500 |
---|---|---|
committer | rogerk <devnull@localhost> | 2011-05-20 15:15:34 -0500 |
commit | 71f662c33e9938951eec3da97140aed25aa815d7 (patch) | |
tree | c322e13686cad5c8bff9e54d7585fc8e4adf6537 /src/ProtoGen.Test/TempFile.cs | |
parent | d965c666ecf405f4e997ab251e72551508a14678 (diff) | |
download | protobuf-71f662c33e9938951eec3da97140aed25aa815d7.tar.gz protobuf-71f662c33e9938951eec3da97140aed25aa815d7.tar.bz2 protobuf-71f662c33e9938951eec3da97140aed25aa815d7.zip |
reformatted all code to .NET standard formatting
Diffstat (limited to 'src/ProtoGen.Test/TempFile.cs')
-rw-r--r-- | src/ProtoGen.Test/TempFile.cs | 113 |
1 files changed, 59 insertions, 54 deletions
diff --git a/src/ProtoGen.Test/TempFile.cs b/src/ProtoGen.Test/TempFile.cs index e41b591b..74a183f5 100644 --- a/src/ProtoGen.Test/TempFile.cs +++ b/src/ProtoGen.Test/TempFile.cs @@ -1,54 +1,59 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Text; - -namespace Google.ProtocolBuffers.ProtoGen -{ - class ProtoFile : TempFile - { - public ProtoFile(string filename, string contents) - : base(filename, contents) - { - } - } - class TempFile : IDisposable - { - private string tempFile; - - public static TempFile Attach(string path) - { - return new TempFile(path, null); - } - - protected TempFile(string filename, string contents) { - tempFile = filename; - if (contents != null) - { - File.WriteAllText(tempFile, contents, new UTF8Encoding(false)); - } - } - - public TempFile(string contents) - : this(Path.GetTempFileName(), contents) - { - } - - public string TempPath { get { return tempFile; } } - - public void ChangeExtension(string ext) - { - string newFile = Path.ChangeExtension(tempFile, ext); - File.Move(tempFile, newFile); - tempFile = newFile; - } - - public void Dispose() - { - if (File.Exists(tempFile)) - { - File.Delete(tempFile); - } - } - } -} +using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Text;
+
+namespace Google.ProtocolBuffers.ProtoGen
+{
+ internal class ProtoFile : TempFile
+ {
+ public ProtoFile(string filename, string contents)
+ : base(filename, contents)
+ {
+ }
+ }
+
+ internal class TempFile : IDisposable
+ {
+ private string tempFile;
+
+ public static TempFile Attach(string path)
+ {
+ return new TempFile(path, null);
+ }
+
+ protected TempFile(string filename, string contents)
+ {
+ tempFile = filename;
+ if (contents != null)
+ {
+ File.WriteAllText(tempFile, contents, new UTF8Encoding(false));
+ }
+ }
+
+ public TempFile(string contents)
+ : this(Path.GetTempFileName(), contents)
+ {
+ }
+
+ public string TempPath
+ {
+ get { return tempFile; }
+ }
+
+ public void ChangeExtension(string ext)
+ {
+ string newFile = Path.ChangeExtension(tempFile, ext);
+ File.Move(tempFile, newFile);
+ tempFile = newFile;
+ }
+
+ public void Dispose()
+ {
+ if (File.Exists(tempFile))
+ {
+ File.Delete(tempFile);
+ }
+ }
+ }
+}
\ No newline at end of file |