diff --git a/Netch/Forms/MainForm.cs b/Netch/Forms/MainForm.cs index af146549cb..6911edc99e 100644 --- a/Netch/Forms/MainForm.cs +++ b/Netch/Forms/MainForm.cs @@ -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 { diff --git a/Netch/Forms/Mode/Process.cs b/Netch/Forms/Mode/Process.cs index bed3dc1867..397be8c061 100644 --- a/Netch/Forms/Mode/Process.cs +++ b/Netch/Forms/Mode/Process.cs @@ -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); // 如果文件已存在,返回 diff --git a/Netch/Resources/zh-CN b/Netch/Resources/zh-CN index 016c48aadc..6cbc64ed53 100644 --- a/Netch/Resources/zh-CN +++ b/Netch/Resources/zh-CN @@ -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": "使用选中的服务器更新订阅",