示例#1
0
文件: Settings.cs 项目: mktm/s3sr
 /// <summary>
 /// Attempt to create a Windows Shell extension for *.s3sr
 /// </summary>
 public static void CreateExtension()
 {
     Settings.RemoveExtension();
     try
     {
         Extension ext = new Extension("mktm.ts3tools.s3sr", "s3sr", "s3sr-script", Application.ExecutablePath + ",0");
         if (ext.CreateExtension())
         {
             ext.AddCommand(new ExtensionCommand(
                 "*Run", "&Run script",
                 new ExtensionShellCommand(Application.ExecutablePath, new string[] { "%1" }),
                 Application.ExecutablePath + ",0")
             );
             ext.AddCommand(new ExtensionCommand(
                  "Configure", "&Configure s3sr",
                  new ExtensionShellCommand(Application.ExecutablePath, new string[] {}),
                  Application.ExecutablePath + ",0")
              );
             ext.CreateCommands();
         }
         ext = null;
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString(), "Exception while Saving", MessageBoxButtons.OK, MessageBoxIcon.Error);
         ExceptionReport.Create(ex, "Exception @ <Settings.CreateExtension>");
         return;
     }
 }