Пример #1
0
        public static IKeyAction GetKeyActionFromActionType(ActionTypes type, IAddOptions options, string GUID = "")
        {
            IKeyAction res = null;

            switch (type)
            {
            case ActionTypes.OpenProcess:
                res = new OpenProcessAction(options as OpenProcessOptions, GUID);
                break;

            case ActionTypes.ScreenCapture:
                res = new ScreenCaptureAction(options as ScreenCaptureOptions, GUID);
                break;

            case ActionTypes.KillProcess:
                res = new KillProcessAction(options as KillProcessOptions, GUID);
                break;

            case ActionTypes.DeleteFiles:
                res = new DeleteFilesAction(options as DeleteFilesOptions, GUID);
                break;

            case ActionTypes.CycleProfile:
                res = new CycleProfileAction(options as CycleProfileOptions, GUID);
                break;

            case ActionTypes.ShowHideProcess:
                res = new ShowHideProcessAction(options as AddOptions.ShowHideProcessOptions, GUID);
                break;

            default:
                throw new ArgumentException($"DEV ERROR: could not create key action from factory of type {type}.");
            }
            return(res);
        }
Пример #2
0
        public static IKeyAction GetKeyActionFromPropertyMap(Dictionary <string, string> propertyMap)
        {
            IKeyAction  res  = null;
            ActionTypes type = (ActionTypes)Enum.Parse(typeof(ActionTypes), propertyMap["Type"], true);

            switch (type)
            {
            case ActionTypes.OpenProcess:
                res = new OpenProcessAction(propertyMap);
                break;

            case ActionTypes.ScreenCapture:
                res = new ScreenCaptureAction(propertyMap);
                break;

            case ActionTypes.KillProcess:
                res = new KillProcessAction(propertyMap);
                break;

            case ActionTypes.DeleteFiles:
                res = new DeleteFilesAction(propertyMap);
                break;

            case ActionTypes.CycleProfile:
                res = new CycleProfileAction(propertyMap);
                break;

            case ActionTypes.ShowHideProcess:
                res = new ShowHideProcessAction(propertyMap);
                break;

            default:
                throw new ArgumentException($"DEV ERROR: could not create key action from factory of type {type}.");
            }
            return(res);
        }