Example #1
0
        private string getexeforaction(Customaction action)
        {
            string exename = "";
            int    osver   = System.Environment.OSVersion.Version.Major;

            if (action.name == Customaction.REGSVR_32 || action.name == Customaction.UNREGSVR_32)
            {
                exename = Environment.ExpandEnvironmentVariables((osver > 5) ? @"%windir%\SysWOW64\regsvr32.exe" : @"%Windir%\system32\regsvr32.exe");
            }
            else if (action.name == Customaction.REGSVR_64 || action.name == Customaction.UNREGSVR_64)
            {
                exename = Environment.ExpandEnvironmentVariables((osver > 5) ? @"%windir%\system32\regsvr32.exe" : @"");
            }
            else if (action.name == Customaction.REGEDT_32)
            {
                exename = Environment.ExpandEnvironmentVariables((osver > 5) ? @"%windir%\SysWOW64\regedit.exe" : @"%Windir%\regedit.exe");
            }
            else if (action.name == Customaction.CSCRIPT_32)
            {
                exename = Environment.ExpandEnvironmentVariables((osver > 5) ? @"%windir%\SysWOW64\cscript.exe" : @"%Windir%\system32\cscript.exe");
            }
            else
            {
                exename = Environment.ExpandEnvironmentVariables(action.executable);
            }

            return(exename);
        }
Example #2
0
 private void populate(Customaction action, bool bview)
 {
     if (bview)
     {
         txtname.Text              = action.name;
         txtargs.Text              = action.args;
         txtexename.Text           = action.executable;
         chkfolder.Checked         = action.folderlevel;
         chkleaf.Checked           = action.leaflelvel;
         txtfilter.Text            = action.filter;
         cmbpriority.SelectedIndex = action.priority;
         chkgrp.Checked            = action.grpaction;
         chkwfe.Checked            = action.wfe;
         chkInstall.Checked        = action.binstall;
         chkuinstall.Checked       = action.buninstall;
         txttooltip.Text           = action.tooltip;
     }
     else
     {
         action.name        = txtname.Text;
         action.args        = txtargs.Text;
         action.executable  = txtexename.Text;
         action.folderlevel = chkfolder.Checked;
         action.leaflelvel  = chkleaf.Checked;
         action.filter      = txtfilter.Text;
         action.priority    = cmbpriority.SelectedIndex;
         action.grpaction   = chkgrp.Checked;
         action.wfe         = chkwfe.Checked;
         action.binstall    = chkInstall.Checked;
         action.buninstall  = chkuinstall.Checked;
         action.tooltip     = txttooltip.Text;
     }
 }
Example #3
0
 private void btnnew_Click(object sender, EventArgs e)
 {
     curaction = new Customaction();
     populate(curaction, true);
     txtname.Enabled          = true;
     btnupdate.Enabled        = true;
     cmbActions.SelectedIndex = -1;
     groupBox1.Enabled        = true;
 }
Example #4
0
 private void cmbActions_SelectedIndexChanged(object sender, EventArgs e)
 {
     if (cmbActions.SelectedIndex == -1)
     {
         return;
     }
     curaction = actions[(string)cmbActions.Items[cmbActions.SelectedIndex]];
     populate(curaction, true);
     btnupdate.Enabled = true;
     txtname.Enabled   = false;
     groupBox1.Enabled = !curaction.builtin;
 }
Example #5
0
 private void button1_Click(object sender, EventArgs e)
 {
     nodeactions.Clear();
     for (int x = 0; x < dataGridView1.Rows.Count; ++x)
     {
         if ((bool)dataGridView1.Rows[x].Cells[0].Value)
         {
             Customaction a = allactions[(string)dataGridView1.Rows[x].Cells[1].Value].clone();
             if (dataGridView1.Rows[x].Cells[2].Value != null)
             {
                 a.args = (string)dataGridView1.Rows[x].Cells[2].Value;
             }
             nodeactions.Add(a.name, a);
         }
     }
 }
Example #6
0
        private bool Validate(Customaction action)
        {
            if (action.name == "")
            {
                MessageBox.Show("name is blank");
                return(false);
            }
            else if (!action.folderlevel && !action.leaflelvel)
            {
                MessageBox.Show("at least folder or leaf should be checked");
                return(false);
            }

            else if (!action.binstall && !action.buninstall)
            {
                MessageBox.Show("at least install or uninstall should be checked");
                return(false);
            }

            return(true);
        }