info.Display = this.textBox_display.Text;
info.IconChanged = this.iconChanged;
- foreach (string key in Program.SettingForm.EngineListTmp)
+ if (Program.SettingForm.EngineListTmp.Contains(this.textBox_name.Text) && !Program.SettingForm.EngineDicTmp[this.textBox_name.Text].Removed)
{
- if(info.Name.Equals(key))
- {
- //重複エラー
- }
+ //重複エラー
+ MessageBox.Show("すでに登録されている名前です");
+ return;
+ }
+
+ if (String.IsNullOrEmpty(info.Url))
+ {
+ MessageBox.Show("URLを入力してください", "入力エラー", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
+ }
+
+ if (!info.Url.StartsWith("http://") && !info.Url.StartsWith("https://"))
+ {
+ MessageBox.Show("URLを正しく入力してください", "入力エラー", MessageBoxButtons.OK, MessageBoxIcon.Warning);
+ return;
}
+
if (this.iconChanged)
{
if (!Directory.Exists(Program.EngineIconTmpDir))
private void textBox_name_TextChanged(object sender, EventArgs e)
{
- if (Program.SettingForm.EngineListTmp.Contains(this.textBox_name.Text))
+ if (this.textBox_name.Text[0] == '@')
+ {
+ this.label_engine_duplicate.Text = "※先頭に@は使用できません";
+ this.label_engine_duplicate.Visible = true;
+ this.button_ok.Enabled = false;
+ return;
+ }
+
+ if (Program.SettingForm.EngineListTmp.Contains(this.textBox_name.Text) && !Program.SettingForm.EngineDicTmp[this.textBox_name.Text].Removed)
{
+ this.label_engine_duplicate.Text = "※重複しています";
this.label_engine_duplicate.Visible = true;
this.button_ok.Enabled = false;
}
return false;
}
}
-
-
-
+
public static void WriteCommandList()
{
Program.EngineList.Add(info.Name);
Program.EngineDic.Add(info.Name, info);
- Program.HotKeyEngineDic.Add(info.Shortcut, info);
+ if(info.Shortcut > 0)
+ Program.HotKeyEngineDic.Add(info.Shortcut, info);
}
}
}
string file = Program.EngineIconDir + "\\" + info.Id;
if (File.Exists(file))
File.Delete(file);
+
+ Program.EngineDic.Remove(key);
continue;
}
writer.WriteStartElement("Engine");
/// </summary>
public void ReadEngineList()
{
+ Program.SettingForm.ReadEngineList(false);
+ /*
this.engineListTmp.Clear();
this.engineDicTmp.Clear();
this.engine_iconListBox.Items.Clear();
item.Regex = Program.Ime.GetRomaji(key);
this.engine_iconListBox.Items.Add(item);
}
-
+ */
}
/// <summary>
this.engine_iconListBox.Items.Clear();
foreach (string key in this.engineListTmp)
{
+ if (this.EngineDicTmp[key].Removed)
+ continue;
+
IconListBoxItem item = new IconListBoxItem();
item.Name = key;
item.Text = key;
IconListBoxItem item = (IconListBoxItem)this.engine_iconListBox.Items[srcIndex];
this.engine_iconListBox.Items.RemoveAt(srcIndex);
+ this.engineListTmp.RemoveAt(srcIndex);
if (destIndex > srcIndex)
destIndex--;
this.engine_iconListBox.Items.Insert(destIndex, item);
private void engine_button_delete_Click(object sender, EventArgs e)
{
- int index = this.engine_iconListBox.SelectedIndex;
- this.engineDicTmp[this.engineListTmp[index]].Removed = true;
- this.engineListTmp.RemoveAt(index);
+ string key = this.engine_iconListBox.Text;
+ int index = this.engineListTmp.IndexOf(key);
+ this.engineListTmp[index] = "@" + this.engine_iconListBox.Text;
+
+ EngineInfo info = this.engineDicTmp[key];
+ info.Name = "@" + this.engine_iconListBox.Text;
+ info.Removed = true;
+ this.engineDicTmp.Remove(key);
+ this.EngineDicTmp.Add(info.Name, info);
Program.SettingForm.ReadEngineList(true);
if (this.engine_iconListBox.Items.Count > index)