From 5dba4e859e2806ce74d806fbd5dda37b7fa628d5 Mon Sep 17 00:00:00 2001 From: Roy Ben-Shabat Date: Wed, 16 May 2018 13:57:15 +0300 Subject: Improved Tango Build Engine VS Extension. Added HardwareSpeedSensor to DB Entities & PMR. Added progress to proto folder compiler. --- .../Tango.Protobuf/CompilerProgressEventArgs.cs | 15 +++++++++++++++ Software/Visual_Studio/Tango.Protobuf/IProtoCompiler.cs | 5 +++++ Software/Visual_Studio/Tango.Protobuf/ProtoCompiler.cs | 17 +++++++++++++++++ .../Visual_Studio/Tango.Protobuf/Tango.Protobuf.csproj | 1 + 4 files changed, 38 insertions(+) create mode 100644 Software/Visual_Studio/Tango.Protobuf/CompilerProgressEventArgs.cs (limited to 'Software/Visual_Studio/Tango.Protobuf') 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 @@ -11,6 +11,11 @@ namespace Tango.Protobuf /// public interface IProtoCompiler : IDisposable { + /// + /// Occurs when the compiler has made some progress. + /// + event EventHandler CompilationProgress; + /// /// Compiles the specified .proto message file. /// 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; + + /// + /// Occurs when the compiler has made some progress. + /// + public event EventHandler CompilationProgress; /// /// 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 /// 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 @@ + -- cgit v1.3.1