Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
FDscend authored Feb 16, 2024
1 parent 0c33cec commit 03b81c3
Show file tree
Hide file tree
Showing 16 changed files with 877 additions and 515 deletions.
82 changes: 79 additions & 3 deletions ChangeCharForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

28 changes: 28 additions & 0 deletions ChangeCharForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,5 +83,33 @@ private void button1_Click(object sender, EventArgs e)

SetjsonFun(PresetFile, js);
}

private void addListChar_Click(object sender, EventArgs e)
{
string textFrom = addFrom.Text;
string textTo = addTo.Text;

if (textFrom.Length == 0) MessageBox.Show("From 字符串不能为空");
else
{
JObject js = ImportJSON(PresetFile);
((JArray)js["data"]).Add(
new JObject()
{
{ "from", textFrom},
{ "to", textTo },
{ "checked", 1 }
}
);

SetjsonFun(PresetFile, js);

checkedListBox1.Items.Add(textFrom + " -> " + textTo, true);

addFrom.Text = "";
addTo.Text = "";
}

}
}
}
105 changes: 99 additions & 6 deletions CharMatchForm.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 37 additions & 1 deletion CharMatchForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public CharMatchForm()
bool ck;
if (jsob["checked"].ToString() == "1") ck = true;
else ck = false;
checkedListBox1.Items.Add(jsob["name"], ck);
checkedListBox1.Items.Add(String.Format("{0,6}", jsob["name"]) + "\t" + jsob["left"] + " " + jsob["right"], ck);
}
}

Expand Down Expand Up @@ -154,5 +154,41 @@ private void button1_Click(object sender, EventArgs e)

SetjsonFun(PresetFile, js);
}

private void addListChar_Click(object sender, EventArgs e)
{
string textLeft = addLeft.Text;
string textRight = addRight.Text;
string textName = addName.Text;


if (textLeft.Length == 0) MessageBox.Show("Left 不能为空");
else if (textLeft.Length != 1) MessageBox.Show("Left 应当为单个字符");
else if (textRight.Length == 0) MessageBox.Show("Right 不能为空");
else if (textRight.Length != 1) MessageBox.Show("Right 应当为单个字符");
else if (textName.Length == 0) MessageBox.Show("Name 不能为空");
else
{
JObject js = ImportJSON(PresetFile);

((JArray)js["data"]).Add(
new JObject()
{
{"name", textName },
{"left", textLeft },
{"right", textRight },
{"checked", 1 }
}
);

SetjsonFun(PresetFile, js);

checkedListBox1.Items.Add(String.Format("{0,6}", textName) + "\t" + textLeft + " " + textRight, true);

addLeft.Text = "";
addRight.Text = "";
addName.Text = "";
}
}
}
}
Loading

0 comments on commit 03b81c3

Please sign in to comment.