public ActionResult Install() { session.Log("installing perl file associations"); FileAssociation.EnsureAssociationsSet(associations()); session.Log("updating PATHEXT"); var oldPathExt = Environment.GetEnvironmentVariable("PATHEXT", EnvironmentVariableTarget.Machine); var exts = String.Join(";", oldPathExt.Split(';').Concat(PathExtensions).Distinct().ToArray()); if (exts != oldPathExt) { Environment.SetEnvironmentVariable("PATHEXT", exts, EnvironmentVariableTarget.Machine); } session.Log("install cmd-prompt shortcut"); ActionResult result = CmdPromptShortcut(); if (result.Equals(ActionResult.Failure)) { session.Log("Could not create Command Prompt shortcut"); // Do not fail if we cannot create shortcut return(ActionResult.Success); } session.Log("Install Documentation link"); DocumentationShortcut(); return(ActionResult.Success); }
private void btnAssociateNow_Click(object sender, EventArgs e) { if (FileAssociation.IsApplicationProgramAlreadyAssociatedWith()) { DialogResult dr1 = MessageBox.Show("The application program extenseions were already associated with! " + "Do you want to replace or refresh the file association again?", "File Association", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (dr1 == DialogResult.No) { return; } } DialogResult dr = MessageBox.Show("Proceed association on the system?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation); if (dr == DialogResult.Yes) { FileAssociation.EnsureAssociationsSet(); MessageBox.Show("File association done!", "File Association", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }