diff options
Diffstat (limited to 'Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs')
| -rw-r--r-- | Software/Visual_Studio/Tango.Protobuf/Compilers/CCompiler.cs | 24 |
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); } |
