Skip to content

Commit

Permalink
🐛 修复了一个允许创建空文件名模式的bug
Browse files Browse the repository at this point in the history
🎨 现在只允许修改进程加速的模式
💬 更新部分中文翻译
  • Loading branch information
AmazingDM committed Feb 6, 2020
1 parent b4199ab commit 61666a1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
16 changes: 10 additions & 6 deletions Netch/Forms/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1123,15 +1123,19 @@ private void SaveProfile(int index)
private void EditModePictureBox_Click(object sender, EventArgs e)
{
// 当前ModeComboBox中至少有一项
if (ModeComboBox.Items.Count>0 && ModeComboBox.SelectedIndex != -1)
if (ModeComboBox.Items.Count > 0 && ModeComboBox.SelectedIndex != -1)
{
SaveConfigs();
var selectedMode = (Models.Mode)ModeComboBox.SelectedItem;
//Process.Start(Environment.CurrentDirectory + "\\mode\\" + selectedMode.FileName + ".txt");
Mode.Process process = new Mode.Process(selectedMode);
process.Text = "Edit Process Mode";
process.Show();
Hide();
// 只允许修改进程加速的模式
if (selectedMode.Type == 0)
{
//Process.Start(Environment.CurrentDirectory + "\\mode\\" + selectedMode.FileName + ".txt");
Mode.Process process = new Mode.Process(selectedMode);
process.Text = "Edit Process Mode";
process.Show();
Hide();
}
}
else
{
Expand Down
5 changes: 5 additions & 0 deletions Netch/Forms/Mode/Process.cs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,11 @@ private void ControlButton_Click(object sender, EventArgs e)

if (!string.IsNullOrWhiteSpace(RemarkTextBox.Text))
{
if (Global.Settings.ModeFileNameType == 0 && string.IsNullOrWhiteSpace(FilenameTextBox.Text))
{
MessageBox.Show(Utils.i18N.Translate("Please enter a mode filename"), Utils.i18N.Translate("Information"), MessageBoxButtons.OK, MessageBoxIcon.Information);
return;
}
var ModeFilename = Path.Combine("mode", FilenameTextBox.Text);

// 如果文件已存在,返回
Expand Down
2 changes: 2 additions & 0 deletions Netch/Resources/zh-CN
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@
"Mode updated successfully": "模式修改成功",
"Unable to add empty rule": "无法添加空规则",
"Please enter a mode remark": "请输入模式的备注",
"File already exists.\n Please Change the filename": "文件名已存在,请修改文件名",
"Please enter a mode filename": "请输入模式的文件名",

"Link": "链接",
"Use Selected Server To Update Subscription": "使用选中的服务器更新订阅",
Expand Down

0 comments on commit 61666a1

Please sign in to comment.