예제 #1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            string ext = txtExt.Text.Trim();

            if (string.IsNullOrEmpty(ext))
            {
                return;
            }
            if (lboxLangList.SelectedIndex == -1)
            {
                Utility.Error("No language selected.");
                return;
            }

            if (!ext.StartsWith("."))
            {
                ext = "." + ext;
            }
            ext = ext.ToLower();
            if (TagParser.Ext2Lang.ContainsKey(ext))
            {
                Utility.Error("Extension '{0}' has mapped to {1}", ext, TagParser.Ext2Lang[ext]);
                return;
            }
            TagParser.Ext2Lang[ext] = (Language)lboxLangList.SelectedItem;
            TagParser.SaveExt2LanguageMap();
            lboxExtList.Items.Add(ext);
            txtExt.Text = "";
        }
예제 #2
0
        private void btnDelete_Click(object sender, EventArgs e)
        {
            if (lboxExtList.SelectedIndex == -1)
            {
                return;
            }
            string ext = (string)lboxExtList.SelectedItem;

            TagParser.Ext2Lang.Remove(ext);
            TagParser.SaveExt2LanguageMap();
            lboxExtList.Items.RemoveAt(lboxExtList.SelectedIndex);
        }