|
3 | 3 | using System.Collections.Generic;
|
4 | 4 | using System.IO;
|
5 | 5 | using System.Linq;
|
| 6 | +using System.Text.RegularExpressions; |
6 | 7 | //using static jsonToLuaParser.Utility;
|
7 | 8 | using static jsonToLuaParser.Utility;
|
8 | 9 | namespace jsonToLuaParser
|
@@ -33,7 +34,11 @@ static void Main(string[] args)
|
33 | 34 | {
|
34 | 35 | parse_commands_josn(base_lib_dir, file);
|
35 | 36 | }
|
36 |
| - |
| 37 | + |
| 38 | + // Copy tsp-lua-5.0 definations |
| 39 | + Directory.CreateDirectory(Path.Combine(base_lib_dir, "tsp-lua-5.0")); |
| 40 | + var lua_definations_file_path = Path.Combine(base_lib_dir, "tsp-lua-5.0"); |
| 41 | + CopyStaticFiles("tsp-lua-5.0", lua_definations_file_path); |
37 | 42 | }
|
38 | 43 |
|
39 | 44 | static void parse_commands_josn(string base_lib_dir, string json_file_path)
|
@@ -188,7 +193,8 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
|
188 | 193 | }
|
189 | 194 |
|
190 | 195 | var nodeTable_str = @"{" + string.Join(",\n ", nodeTable) + "\n}";
|
191 |
| - var nodeTableDetails = $"---@meta\n\n---@class model{file_name}\nmodel{file_name} = {nodeTable_str}" + |
| 196 | + var node_class_name = Regex.Replace(file_name, @"[^a-zA-Z0-9_]", ""); |
| 197 | + var nodeTableDetails = $"---@meta\n\n---@class model{node_class_name}\nmodel{node_class_name} = {nodeTable_str}" + |
192 | 198 | $"\n--#region node details\n--#endregion";
|
193 | 199 |
|
194 | 200 | Directory.CreateDirectory(Path.Combine(base_lib_dir, model));
|
|
0 commit comments