forked from Xamla/ROS.NET
-
Notifications
You must be signed in to change notification settings - Fork 2
/
ActionFileParser.cs
53 lines (41 loc) · 1.42 KB
/
ActionFileParser.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using FauxMessages;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace YAMLParser
{
public class ActionFileParser
{
private ILogger Logger { get; } = ApplicationLogging.CreateLogger<ActionFileParser>();
private List<MsgFileLocation> actionFileLocations;
public ActionFileParser(List<MsgFileLocation> actionFileLocations)
{
this.actionFileLocations = actionFileLocations;
}
public List<ActionFile> GenerateRosMessageClasses()
{
var actionMessages = GenerateMessageFiles();
return actionMessages;
}
private List<ActionFile> GenerateMessageFiles()
{
var result = new List<ActionFile>();
// Generate message files
foreach(var fileLocation in actionFileLocations)
{
result.Add(new ActionFile(fileLocation));
}
// Resolve type dependencies between message files
Logger.LogInformation($"Start parsing action files");
foreach (var messageFile in result)
{
Logger.LogInformation($"Parse action file: {messageFile.Name}");
messageFile.ParseAndResolveTypes();
}
Logger.LogInformation($"Parsing of action files completed");
return result;
}
}
}