aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Protobuf
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-05-16 13:57:15 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-05-16 13:57:15 +0300
commit5dba4e859e2806ce74d806fbd5dda37b7fa628d5 (patch)
tree4e5bf391476a7dfc2c1cd13d020a2e581bd7e032 /Software/Visual_Studio/Tango.Protobuf
parentfe19ef2694d92c91a493b9f3d1f41bc57ebbe6a2 (diff)
downloadTango-5dba4e859e2806ce74d806fbd5dda37b7fa628d5.tar.gz
Tango-5dba4e859e2806ce74d806fbd5dda37b7fa628d5.zip
Improved Tango Build Engine VS Extension.
Added HardwareSpeedSensor to DB Entities & PMR. Added progress to proto folder compiler.
Diffstat (limited to 'Software/Visual_Studio/Tango.Protobuf')
-rw-r--r--Software/Visual_Studio/Tango.Protobuf/CompilerProgressEventArgs.cs15
-rw-r--r--Software/Visual_Studio/Tango.Protobuf/IProtoCompiler.cs5
-rw-r--r--Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs17
-rw-r--r--Software/Visual_Studio/Tango.Protobuf/Tango.Protobuf.csproj1
4 files changed, 38 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Tango.Protobuf/CompilerProgressEventArgs.cs b/Software/Visual_Studio/Tango.Protobuf/CompilerProgressEventArgs.cs
new file mode 100644
index 000000000..bd56d360f
--- /dev/null
+++ b/Software/Visual_Studio/Tango.Protobuf/CompilerProgressEventArgs.cs
@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tango.Protobuf
+{
+ public class CompilerProgressEventArgs : EventArgs
+ {
+ public int Current { get; set; }
+ public int Total { get; set; }
+ public String File { get; set; }
+ }
+}
diff --git a/Software/Visual_Studio/Tango.Protobuf/IProtoCompiler.cs b/Software/Visual_Studio/Tango.Protobuf/IProtoCompiler.cs
index 65b07786f..15d65b767 100644
--- a/Software/Visual_Studio/Tango.Protobuf/IProtoCompiler.cs
+++ b/Software/Visual_Studio/Tango.Protobuf/IProtoCompiler.cs
@@ -12,6 +12,11 @@ namespace Tango.Protobuf
public interface IProtoCompiler : IDisposable
{
/// <summary>
+ /// Occurs when the compiler has made some progress.
+ /// </summary>
+ event EventHandler<CompilerProgressEventArgs> CompilationProgress;
+
+ /// <summary>
/// Compiles the specified .proto message file.
/// </summary>
/// <param name="inputFile">.proto file to compile</param>
diff --git a/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs b/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs
index d58d21ea9..2e51de6df 100644
--- a/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs
+++ b/Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs
@@ -21,6 +21,13 @@ namespace Tango.Protobuf
private const String COMPILERS_FOLDER_NAME = "ProtoCompilers"; //Compilers folder name.
protected String _compilersPath; //Compilers folder path.
private LogManager logManager = LogManager.Default;
+ private int _currentProgress;
+ private int _totalProgress;
+
+ /// <summary>
+ /// Occurs when the compiler has made some progress.
+ /// </summary>
+ public event EventHandler<CompilerProgressEventArgs> CompilationProgress;
/// <summary>
/// Gets the compiler language.
@@ -57,6 +64,13 @@ namespace Tango.Protobuf
{
logManager.Log("Compiling file " + inputFile);
+ CompilationProgress?.Invoke(this, new CompilerProgressEventArgs()
+ {
+ Current = _currentProgress++,
+ Total = _totalProgress,
+ File = inputFile,
+ });
+
var tmpPath = TemporaryManager.Default.CreateFolder();
logManager.Log("Temp path: " + tmpPath);
@@ -159,6 +173,9 @@ namespace Tango.Protobuf
/// </returns>
public virtual CompilerFolderResult CompileFolder(string sourceFolder, params String[] includeFolders)
{
+ _currentProgress = 0;
+ _totalProgress = Directory.GetFiles(sourceFolder, "*.proto", SearchOption.AllDirectories).Length;
+
if (!UsesDefaultStructure)
{
logManager.Log("Compiling folder: " + sourceFolder);
diff --git a/Software/Visual_Studio/Tango.Protobuf/Tango.Protobuf.csproj b/Software/Visual_Studio/Tango.Protobuf/Tango.Protobuf.csproj
index efade39c9..f45a082e4 100644
--- a/Software/Visual_Studio/Tango.Protobuf/Tango.Protobuf.csproj
+++ b/Software/Visual_Studio/Tango.Protobuf/Tango.Protobuf.csproj
@@ -47,6 +47,7 @@
<Compile Include="CompilerException.cs" />
<Compile Include="CompilerFactory.cs" />
<Compile Include="CompilerFolderResult.cs" />
+ <Compile Include="CompilerProgressEventArgs.cs" />
<Compile Include="Compilers\CCompiler.cs" />
<Compile Include="Compilers\CppCompiler.cs" />
<Compile Include="Compilers\CSharpCompiler.cs" />