From 914f4db513477d9aff726546bac47545195a3e37 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Thu, 16 Nov 2017 13:38:56 +0200 Subject: Rename "Visual Studio" to "Visual_Studio" Rename "External Repositories" to "External_Repositories". --- .../Tango.Protobuf/CompilerFileResult.cs | 81 ++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 Software/Visual_Studio/Tango.Protobuf/CompilerFileResult.cs (limited to 'Software/Visual_Studio/Tango.Protobuf/CompilerFileResult.cs') diff --git a/Software/Visual_Studio/Tango.Protobuf/CompilerFileResult.cs b/Software/Visual_Studio/Tango.Protobuf/CompilerFileResult.cs new file mode 100644 index 000000000..244ee3857 --- /dev/null +++ b/Software/Visual_Studio/Tango.Protobuf/CompilerFileResult.cs @@ -0,0 +1,81 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Text; +using System.Threading.Tasks; +using Tango.Logging; + +namespace Tango.Protobuf +{ + /// + /// Represents an file compilation result. + /// + /// + public class CompilerFileResult : ICompilerResult + { + /// + /// Gets the result language. + /// + public CompilerLanguage Language { get; private set; } + + /// + /// Gets the result name. + /// + public String Name { get; private set; } + + /// + /// Gets the result source path. + /// + public String SourcePath { get; private set; } + + /// + /// Gets the file content. + /// + public String Content { get; private set; } + + /// + /// Gets or sets the relative file path. + /// + internal String RelativePath { get; private set; } + + /// + /// Initializes a new instance of the class. + /// + /// The language. + /// The source path. + /// Name of the file. + /// File contents. + public CompilerFileResult(CompilerLanguage language, String sourcePath, String fileName, String relativePath, String content) + { + Language = language; + SourcePath = sourcePath; + Name = fileName; + RelativePath = relativePath; + Content = content; + } + + /// + /// Saves the result to the specified folder. + /// + /// The folder. + public void Save(String folder) + { + LogManager.Log("Saving " + Path.Combine(folder, Name) + "..."); + + Directory.CreateDirectory(folder); + File.WriteAllText(Path.Combine(folder, Name), Content); + } + + /// + /// Returns a that represents this instance. + /// + /// + /// A that represents this instance. + /// + public override string ToString() + { + return Name; + } + } +} -- cgit v1.3.1