aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Protobuf
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-02-28 11:42:21 +0200
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-02-28 11:42:21 +0200
commitc726e1f7697d9f0fe8cff387dc64dd00c4980b82 (patch)
tree52d91153ee05a32a8ffcd42c4a9220cb7a517bca /Software/Visual_Studio/Tango.Protobuf
parent2f70caaf340063f90529c3302f2f2a78dda9d40c (diff)
downloadTango-c726e1f7697d9f0fe8cff387dc64dd00c4980b82.tar.gz
Tango-c726e1f7697d9f0fe8cff387dc64dd00c4980b82.zip
Change LogManager to Instance.
Diffstat (limited to 'Software/Visual_Studio/Tango.Protobuf')
-rw-r--r--Software/Visual_Studio/Tango.Protobuf/CompilerFactory.cs8
-rw-r--r--Software/Visual_Studio/Tango.Protobuf/CompilerFileResult.cs4
-rw-r--r--Software/Visual_Studio/Tango.Protobuf/CompilerFolderResult.cs2
-rw-r--r--Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs33
4 files changed, 26 insertions, 21 deletions
diff --git a/Software/Visual_Studio/Tango.Protobuf/CompilerFactory.cs b/Software/Visual_Studio/Tango.Protobuf/CompilerFactory.cs
index 7c0ee54a4..d0a81a5c6 100644
--- a/Software/Visual_Studio/Tango.Protobuf/CompilerFactory.cs
+++ b/Software/Visual_Studio/Tango.Protobuf/CompilerFactory.cs
@@ -21,7 +21,7 @@ namespace Tango.Protobuf
/// <exception cref="ArgumentException">Could not locate protobuf compiler for language " + language.ToString()</exception>
public static IProtoCompiler CreateCompiler(CompilerLanguage language)
{
- LogManager.Log("Generating protobuf compiler for " + language.ToString() + "...");
+ LogManager.Default.Log("Generating protobuf compiler for " + language.ToString() + "...");
foreach (var cType in typeof(CompilerFactory).Assembly.GetTypes().Where(x => x.IsClass && !x.IsAbstract && typeof(IProtoCompiler).IsAssignableFrom(x)))
{
@@ -29,7 +29,7 @@ namespace Tango.Protobuf
if (instance.Language == language) return instance;
}
- throw LogManager.Log(new ArgumentException("Could not locate protobuf compiler for language " + language.ToString()));
+ throw LogManager.Default.Log(new ArgumentException("Could not locate protobuf compiler for language " + language.ToString()));
}
/// <summary>
@@ -57,7 +57,7 @@ namespace Tango.Protobuf
/// <exception cref="ArgumentException">Could not locate protobuf compiler for language " + language.ToString()</exception>
public static IProtoCompiler CreateCompiler(String language)
{
- LogManager.Log("Generating protobuf compiler for " + language.ToString() + "...");
+ LogManager.Default.Log("Generating protobuf compiler for " + language.ToString() + "...");
CompilerLanguage lan = (CompilerLanguage)Enum.Parse(typeof(CompilerLanguage), language, true);
@@ -67,7 +67,7 @@ namespace Tango.Protobuf
if (instance.Language == lan) return instance;
}
- throw LogManager.Log(new ArgumentException("Could not locate protobuf compiler for language " + language.ToString()));
+ throw LogManager.Default.Log(new ArgumentException("Could not locate protobuf compiler for language " + language.ToString()));
}
}
}
diff --git a/Software/Visual_Studio/Tango.Protobuf/CompilerFileResult.cs b/Software/Visual_Studio/Tango.Protobuf/CompilerFileResult.cs
index feef53b9a..096caaa21 100644
--- a/Software/Visual_Studio/Tango.Protobuf/CompilerFileResult.cs
+++ b/Software/Visual_Studio/Tango.Protobuf/CompilerFileResult.cs
@@ -14,6 +14,8 @@ namespace Tango.Protobuf
/// <seealso cref="Tango.Protobuf.ICompilerResult" />
public class CompilerFileResult : ICompilerResult
{
+ private LogManager logManager = LogManager.Default;
+
/// <summary>
/// Gets the result language.
/// </summary>
@@ -61,7 +63,7 @@ namespace Tango.Protobuf
/// <param name="folder">The folder.</param>
public void Save(String folder)
{
- LogManager.Log("Saving " + Path.Combine(folder, Name) + "...");
+ logManager.Log("Saving " + Path.Combine(folder, Name) + "...");
Directory.CreateDirectory(folder);
File.WriteAllText(Path.Combine(folder, Name), Content);
diff --git a/Software/Visual_Studio/Tango.Protobuf/CompilerFolderResult.cs b/Software/Visual_Studio/Tango.Protobuf/CompilerFolderResult.cs
index 9fa7e7d95..1b2f29151 100644
--- a/Software/Visual_Studio/Tango.Protobuf/CompilerFolderResult.cs
+++ b/Software/Visual_Studio/Tango.Protobuf/CompilerFolderResult.cs
@@ -14,6 +14,8 @@ namespace Tango.Protobuf
/// <seealso cref="Tango.Protobuf.ICompilerResult" />
public class CompilerFolderResult : ICompilerResult
{
+ private LogManager LogManager = LogManager.Default;
+
/// <summary>
/// Initializes a new instance of the <see cref="CompilerFolderResult"/> class.
/// </summary>
diff --git a/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs b/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs
index d2bfde75c..a9322f495 100644
--- a/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs
+++ b/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs
@@ -19,6 +19,7 @@ namespace Tango.Protobuf
{
private const String COMPILERS_FOLDER_NAME = "ProtoCompilers"; //Compilers folder name.
protected String _compilersPath; //Compilers folder path.
+ private LogManager logManager = LogManager.Default;
/// <summary>
/// Gets the compiler language.
@@ -53,33 +54,33 @@ namespace Tango.Protobuf
/// </returns>
public virtual IEnumerable<CompilerFileResult> CompileFile(string inputFile)
{
- LogManager.Log("Compiling file " + inputFile);
+ logManager.Log("Compiling file " + inputFile);
String tmpPath = PathHelper.GetTempFolderPath();
- LogManager.Log("Temp path: " + tmpPath);
+ logManager.Log("Temp path: " + tmpPath);
String importsString = "--proto_path \"" + Path.GetDirectoryName(inputFile) + "\" ";
- LogManager.Log("Added import string: " + importsString);
+ logManager.Log("Added import string: " + importsString);
foreach (var path in ImportsFolders)
{
String importStr = "--proto_path \"" + path + "\" ";
importsString += importStr;
- LogManager.Log("Added import string: " + importStr);
+ logManager.Log("Added import string: " + importStr);
}
Process p = new Process();
- LogManager.Log("Compilers folder path: " + _compilersPath);
+ logManager.Log("Compilers folder path: " + _compilersPath);
p.StartInfo.WorkingDirectory = _compilersPath;
String oldCurrentDirectory = Environment.CurrentDirectory;
Environment.CurrentDirectory = _compilersPath;
p.StartInfo.FileName = GetProtoCompilerName();
- LogManager.Log("Protobuf executable path: " + p.StartInfo.FileName);
+ logManager.Log("Protobuf executable path: " + p.StartInfo.FileName);
p.StartInfo.Arguments = String.Format(
"{0} {1}=\"{2}\" \"{3}\"",
@@ -88,7 +89,7 @@ namespace Tango.Protobuf
tmpPath,
inputFile);
- LogManager.Log("Final arguments:\n" + p.StartInfo.Arguments);
+ logManager.Log("Final arguments:\n" + p.StartInfo.Arguments);
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
@@ -98,7 +99,7 @@ namespace Tango.Protobuf
p.StartInfo.RedirectStandardOutput = true;
- LogManager.Log("Executing compilation...");
+ logManager.Log("Executing compilation...");
p.Start();
p.WaitForExit(5000);
@@ -110,7 +111,7 @@ namespace Tango.Protobuf
if (!String.IsNullOrWhiteSpace(error))
{
var lines = error.Split(new[] { '\r', '\n' });
- throw LogManager.Log(new CompilerException() { Issues = lines.Where(x => x.Length > 0).ToList() });
+ throw logManager.Log(new CompilerException() { Issues = lines.Where(x => x.Length > 0).ToList() });
}
List<CompilerFileResult> results = new List<CompilerFileResult>();
@@ -124,14 +125,14 @@ namespace Tango.Protobuf
if (PathHelper.TryDeleteFolder(tmpPath))
{
- LogManager.Log("Removed temp path: " + tmpPath);
+ logManager.Log("Removed temp path: " + tmpPath);
}
else
{
- LogManager.Log("Could not remove temp path: " + tmpPath);
+ logManager.Log("Could not remove temp path: " + tmpPath);
}
- LogManager.Log(Path.GetFileName(inputFile) + "compiled!");
+ logManager.Log(Path.GetFileName(inputFile) + "compiled!");
return results;
}
@@ -159,13 +160,13 @@ namespace Tango.Protobuf
{
if (!UsesDefaultStructure)
{
- LogManager.Log("Compiling folder: " + sourceFolder);
+ logManager.Log("Compiling folder: " + sourceFolder);
ImportsFolders.Clear();
ImportsFolders.AddRange(Directory.GetDirectories(sourceFolder, "*.*", SearchOption.AllDirectories));
var result = CompileFolder(sourceFolder, sourceFolder);
- LogManager.Log(Path.GetFileName(sourceFolder) + "compiled!");
+ logManager.Log(Path.GetFileName(sourceFolder) + "compiled!");
return OnPostProcessFolderCompilation(result);
}
@@ -223,7 +224,7 @@ namespace Tango.Protobuf
/// </returns>
private CompilerFolderResult CompileFolderDefault(string sourceFolder)
{
- LogManager.Log("Compiling folder: " + sourceFolder);
+ logManager.Log("Compiling folder: " + sourceFolder);
Dictionary<string, CompilerFileResult> fileResults = new Dictionary<string, CompilerFileResult>();
ImportsFolders.Clear();
@@ -248,7 +249,7 @@ namespace Tango.Protobuf
PathHelper.TryDeleteFolder(tempPath);
- LogManager.Log(Path.GetFileName(sourceFolder) + "compiled!");
+ logManager.Log(Path.GetFileName(sourceFolder) + "compiled!");
return OnPostProcessFolderCompilation(result);
}