示例#1
0
        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);
     }
 }
示例#3
0
        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();
            }
        }
示例#4
0
 private string GetExecutingMethodName(ExecutableItem executableItem)
 {
     if (executableItem.ExecutingMethodName != null)
     {
         return executableItem.ExecutingMethodName;
     }
     return State.ActiveMenu?.ExecutingMethodName;
 }
示例#5
0
 private List<AbstractValue> GetExecutableItemArguments(ExecutableItem executableItem)
 {
     if (executableItem is FileItem)
     {
         return new List<AbstractValue>
         {
             new StringValue { Value = ((FileItem)executableItem).FilePath }
         };
     }
     return executableItem.Arguments;
 }
示例#6
0
 private ActionType GetActionType(ExecutableItem executableItem)
 {
     if (executableItem.ActionType != ActionType.None)
     {
         return executableItem.ActionType;
     }
     if (executableItem.ParentMenu != null)
     {
         return executableItem.ParentMenu.ActionType;
     }
     return ActionType.None;
 }