コード例 #1
0
        private void editToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (linuxListView.FocusedItem == null)
            {
                return;
            }
            Config.LinuxAlias la = cfg.GetLinuxAlias((int)linuxListView.FocusedItem.Tag);
            if (la == null)
            {
                return;
            }
            LinuxAliasChooser lac = new LinuxAliasChooser(la);

            if (lac.ShowDialog(this) == DialogResult.OK)
            {
                // We must delete the alias involved, however it will not be updated
                string filename = Path.Combine(aliases_location, _normalizeAliasName(la.name));
                try { File.Delete(filename); } catch { }

                la.name           = lac.Alias;
                la.command        = lac.Command;
                la.load_profile   = lac.LoadProfile;
                la.convert_args   = lac.ConvertArgs;
                la.convert_input  = lac.ConvertInput;
                la.convert_output = lac.ConvertOutput;

                // We must delete the alias involved, however it will not be updated
                filename = Path.Combine(aliases_location, _normalizeAliasName(la.name));
                try { File.Delete(filename); } catch { }

                _saveConfig();
                _updateLists();
                _updateAliases();
            }
        }
コード例 #2
0
        private void newToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LinuxAliasChooser lac = new LinuxAliasChooser();

            if (lac.ShowDialog(this) == DialogResult.OK)
            {
                Config.LinuxAlias la = new Config.LinuxAlias();
                la.enabled        = false;
                la.ID             = cfg.NextID();
                la.name           = lac.Alias;
                la.command        = lac.Command;
                la.load_profile   = lac.LoadProfile;
                la.convert_args   = lac.ConvertArgs;
                la.convert_input  = lac.ConvertInput;
                la.convert_output = lac.ConvertOutput;
                cfg.linux_aliases.Add(la);

                _saveConfig();
                _updateLists();
                _updateAliases();
            }
        }