aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Tango.Protobuf
diff options
context:
space:
mode:
authorRoy Ben-Shabat <Roy@Twine-s.com>2018-07-26 16:02:44 +0300
committerRoy Ben-Shabat <Roy@Twine-s.com>2018-07-26 16:02:44 +0300
commit9283a0917dc29aba1e89bf40bc59f255f73cec48 (patch)
tree03677bcdf84f75451009b727b5a9a6e17396d54d /Software/Visual_Studio/Tango.Protobuf
parentd70d3466cd6e67e2b87af4865ee6e629d2edb4ca (diff)
downloadTango-9283a0917dc29aba1e89bf40bc59f255f73cec48.tar.gz
Tango-9283a0917dc29aba1e89bf40bc59f255f73cec48.zip
Refactored proto C compiler to enable cross directory messages.
Refactored tech motors and dispensers to use types from hardware.
Diffstat (limited to 'Software/Visual_Studio/Tango.Protobuf')
-rw-r--r--Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs24
1 files changed, 20 insertions, 4 deletions
diff --git a/Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs b/Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs
index 1a8dc632f..91f8d1502 100644
--- a/Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs
+++ b/Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs
@@ -67,13 +67,29 @@ namespace Tango.Protobuf.Compilers
{
String str = File.ReadAllText(file);
- foreach (String dir in directories.Select(x => Path.GetFileName(x)))
+ var lines = str.ToLines();
+
+ lines.RemoveAll(x => x.Contains("package "));
+
+ for (int i = 0; i < lines.Count; i++)
{
- str = str.Replace(dir + ".", "");
+ if (!lines[i].Contains("import ") || lines[i].StartsWith("//"))
+ {
+ string[] wordsAndComments = lines[i].Split('/');
+
+ string lineWords = wordsAndComments.FirstOrDefault();
+
+ string[] words = lineWords.Split(' ');
+
+ for (int j = 0; j < words.Length; j++)
+ {
+ words[j] = words[j].Split('.').LastOrDefault();
+ }
+
+ lines[i] = String.Join(" ", words);
+ }
}
- var lines = str.ToLines();
- lines.RemoveAll(x => x.Contains("package "));
str = String.Join(Environment.NewLine, lines);
File.WriteAllText(file, str);
}