public static List<BaseItem> ExecuteFunction(AhkContentSource source) { ExecuteFunctionAndWaitForResult(source); List<string> result = GetMessageFileContents(); var items = new List<BaseItem>(); DateTime timeStamp = DateTime.MaxValue; for (int i = 0; i < result.Count; i += 2) { if (i >= result.Count - 1) { break; } timeStamp = timeStamp.AddTicks(-1); var executableItem = new ExecutableItem { Name = result[i], LastAccess = timeStamp }; executableItem.Arguments.Add(new StringValue { Value = result[i + 1] }); items.Add(executableItem); } return items; }
public void Execute(ExecutableItem item) { string[] arguments = item.Arguments.Select(x => x.InteropValue?.Trim('"')).ToArray(); foreach (IPlugin plugin in _plugins.Where(x => x.Id == item.ExecutingMethodName)) { plugin.Execute(arguments); } }
private void OnExecutingManagedAction(ExecutableItem executableItem) { ActionType actionType = GetActionType(executableItem); if (actionType == ActionType.ExecutePlugin) { PluginsCollection.Instance.Execute(executableItem); } else if (actionType == ActionType.AddNewMenuEntry) { FormFactory.Instance<AddFileItemForm>().Show(); } if (actionType == ActionType.CreateApplicationMenu) { var createApplicationMenuForm = FormFactory.Instance<CreateApplicationMenuForm>(); createApplicationMenuForm.ContextRegex = ApplicationContext; createApplicationMenuForm.Show(); } }
private string GetExecutingMethodName(ExecutableItem executableItem) { if (executableItem.ExecutingMethodName != null) { return executableItem.ExecutingMethodName; } return State.ActiveMenu?.ExecutingMethodName; }
private List<AbstractValue> GetExecutableItemArguments(ExecutableItem executableItem) { if (executableItem is FileItem) { return new List<AbstractValue> { new StringValue { Value = ((FileItem)executableItem).FilePath } }; } return executableItem.Arguments; }
private ActionType GetActionType(ExecutableItem executableItem) { if (executableItem.ActionType != ActionType.None) { return executableItem.ActionType; } if (executableItem.ParentMenu != null) { return executableItem.ParentMenu.ActionType; } return ActionType.None; }