| 123456789101112131415161718192021222324252627282930313233343536373839 |
- using Infrastructure;
- using LitJson;
- using Services;
- namespace Util
- {
- public class LogicHelper
- {
- public static void GetLogicJsonData(int projectId)
- {
- var logicProjectService = App.GetService<ILogicProjectService>();
- var logicProject = logicProjectService.GetById(projectId);
- if(logicProject == null)
- {
- return;
- }
- string jsonData = logicProject.setData;
- if(string.IsNullOrEmpty(jsonData))
- {
- return;
- }
- JsonData jsonDataObj = JsonMapper.ToObject(jsonData);
- JsonData nodes = jsonDataObj["nodes"]; // 节点数据
- foreach(JsonData node in nodes)
- {
- JsonData id = node["id"];
- JsonData type = node["type"];
- }
- Dictionary<string, string> nodeDict = new Dictionary<string, string>();
- JsonData edges = jsonDataObj["edges"]; // 边数据
- foreach(JsonData edge in edges)
- {
- JsonData source = edge["source"];
- JsonData target = edge["target"];
- nodeDict.Add(source.ToString(), target.ToString());
- }
- }
- }
- }
|