Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Task/tsp 836 include Lua 5.0 library definitions #11

Merged
10 changes: 8 additions & 2 deletions Json_parser/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
//using static jsonToLuaParser.Utility;
using static jsonToLuaParser.Utility;
namespace jsonToLuaParser
Expand Down Expand Up @@ -33,7 +34,11 @@ static void Main(string[] args)
{
parse_commands_josn(base_lib_dir, file);
}


// Copy tsp-lua-5.0 definations
Directory.CreateDirectory(Path.Combine(base_lib_dir, "tsp-lua-5.0"));
var lua_definations_file_path = Path.Combine(base_lib_dir, "tsp-lua-5.0");
CopyStaticFiles("tsp-lua-5.0", lua_definations_file_path);
}

static void parse_commands_josn(string base_lib_dir, string json_file_path)
Expand Down Expand Up @@ -188,7 +193,8 @@ static void parse_commands_josn(string base_lib_dir, string json_file_path)
}

var nodeTable_str = @"{" + string.Join(",\n ", nodeTable) + "\n}";
var nodeTableDetails = $"---@meta\n\n---@class model{file_name}\nmodel{file_name} = {nodeTable_str}" +
var node_class_name = Regex.Replace(file_name, @"[^a-zA-Z0-9_]", "");
var nodeTableDetails = $"---@meta\n\n---@class model{node_class_name}\nmodel{node_class_name} = {nodeTable_str}" +
$"\n--#region node details\n--#endregion";

Directory.CreateDirectory(Path.Combine(base_lib_dir, model));
Expand Down
Loading
Loading