public override void Run() { if (string.IsNullOrEmpty(path)) { return; } bool perform = true; programName = string.Empty; if (FileOperations.DirectoryExists(path) && (FileOperations.GetFilesCount(path) > 0)) { Manager.SuppressHookMessage(true); try { LiveFolder liveFolder = new LiveFolder(this.Manager.Handle, this.path); try { perform = liveFolder.Execute(); if (perform) { programName = liveFolder.Items[liveFolder.SelectedItem].FileName; } } finally { liveFolder.Dispose(); } } finally { Manager.SuppressHookMessage(false); } } if (perform) { base.Run(); Thread t = new Thread(new ThreadStart(ExecuteAsync)); t.Name = "KrentoExecutor"; t.IsBackground = true; t.Start(); Thread.Sleep(0); } }
/// <summary> /// Runs this target. The file or URL linked to the stone will be executed /// </summary> public override void Run() { bool perform = true; string args; string fullName = FileOperations.StripFileName(targetName); if (string.IsNullOrEmpty(fullName)) { Configure(); //base.Run(); return; } if (!FileOperations.IsValidPathName(fullName)) { base.Run(); return; } if (NativeMethods.FileExtensionIs(fullName, ".circle")) { Manager.ReplaceCurrentCircle(fullName); return; } programName = fullName; if (targetName.Contains("##")) { ArgumentDialog ad = new ArgumentDialog(); Manager.SuppressHookMessage(true); try { ad.Location = this.Location; if (!string.IsNullOrEmpty(argumentDescription)) { ad.Description = argumentDescription; } if (ad.ShowDialog() == DialogResult.OK) { args = ad.Argument; } else { args = string.Empty; perform = false; } if (string.IsNullOrEmpty(args)) { args = string.Empty; } } finally { Manager.SuppressHookMessage(false); } programName = programName.Replace("##", args); } else { if (FileOperations.FileIsLink(fullName)) { string linkTarget = FileOperations.ExtractFileNameFromShellLink(fullName); if (FileOperations.DirectoryExists(linkTarget)) { fullName = linkTarget; } } if (FileOperations.DirectoryExists(fullName) && (FileOperations.GetFilesCount(fullName) > 0)) { Manager.SuppressHookMessage(true); try { LiveFolder liveFolder = new LiveFolder(this.Manager.Handle, fullName); try { perform = liveFolder.Execute(); if (perform) { programName = liveFolder.Items[liveFolder.SelectedItem].FileName; } } finally { liveFolder.Dispose(); } } finally { Manager.SuppressHookMessage(false); } } } if (perform) { PerformExecution(); } }