Skip to content

Commit

Permalink
防止因为快捷发送区数据错误而导致打开软件崩溃 fix #20
Browse files Browse the repository at this point in the history
  • Loading branch information
chenxuuu committed May 28, 2020
1 parent 8a7476d commit 3e2d874
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions llcom/Model/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,22 @@ class Settings
public void UpdateQuickSend()
{
toSendDatas.Clear();
JObject jo = (JObject)JsonConvert.DeserializeObject(_quickData);
foreach (var i in jo["data"])
{
if (i["commit"] == null)
i["commit"] = "发送";
if ((bool)i["hex"])
toSendDatas.Add("H" + (string)i["text"]);
else
toSendDatas.Add("S" + (string)i["text"]);
try
{
JObject jo = (JObject)JsonConvert.DeserializeObject(_quickData);
foreach (var i in jo["data"])
{
if (i["commit"] == null)
i["commit"] = "发送";
if ((bool)i["hex"])
toSendDatas.Add("H" + (string)i["text"]);
else
toSendDatas.Add("S" + (string)i["text"]);
}
}
catch
{
quickData = "{\"data\":[{\"id\":1,\"text\":\"example string\",\"hex\":false},{\"id\":2,\"text\":\"lua可通过接口获取此处数据\",\"hex\":false},{\"id\":3,\"text\":\"aa 01 02 0d 0a\",\"hex\":true},{\"id\":4,\"text\":\"此处数据会被lua处理\",\"hex\":false}]}";
}
}

Expand Down

0 comments on commit 3e2d874

Please sign in to comment.