Пример #1
0
        public ICommand ResolveCommand(JObject joCommand)
        {
            ICommand result = null;

            var commandName = JSONUtil.GetCommandName(joCommand);

            if (commandName == null)
            {
                return(null);
            }
            if (commandName == "load-json")
            {
                result = new LoadJSON();
            }
            else if (commandName == "save-json")
            {
                result = new SaveJSON();
            }
            else if (commandName == "prompt")
            {
                result = new PromptCommand();
            }
            else if (commandName == "run-script")
            {
                result = new RunScript();
            }
            else if (commandName == "communicate")
            {
                result = new Communicate();
            }
            else if (commandName == "say")
            {
                result = new Communicate();
            }
            //else if (commandName == "run-rules") { return new RunRules(); }
            else if (commandName == "assert")
            {
                return(new Assert());
            }
            else if (commandName == "store")
            {
                return(new Store());
            }

            return(result);
        }
        //public IConnection ProvideConnection(JObject envConfig)
        //{
        //    IConnection result = null;

        //    if (envConfig.Type == "Microsoft.CommonDataService")
        //    {
        //        result = new CDSConnection(envConfig);
        //    }

        //    return result;
        //}

        public ICommand ResolveCommand(JObject joCommand)
        {
            ICommand result = null;

            var commandName = JSONUtil.GetCommandName(joCommand);

            if (commandName == null)
            {
                return(null);
            }
            if (commandName == "cds-entity")
            {
                result = new CDSCreateEntity();
            }
            else if (commandName == "cds-field")
            {
                result = new CDSCreateField();
            }
            else if (commandName == "cds-fields")
            {
                result = new CDSCreateFields();
            }
            else if (commandName == "cds-import-solution")
            {
                result = new CDSImportSolution();
            }
            else if (commandName == "cds-import-data")
            {
                result = new CDSImportData();
            }
            else if (commandName == "cds-update-data")
            {
                result = new CDSUpdateData();
            }
            else if (commandName == "cds-retrieve-data")
            {
                result = new CDSRetrieveData();
            }
            else if (commandName == "cds-retrieve")
            {
                result = new CDSRetrieve();
            }
            else if (commandName == "bing-websearch")
            {
                result = new SearchBing();
            }
            //else if (commandName == "excel-load") { result = new Office.LoadExcel(); }
            else if (commandName == "sharepoint-download")
            {
                result = new Office.SharePointDownload();
            }
            else if (commandName == "word-export")
            {
                result = new Office.WordExport();
            }
            else if (commandName == "excel-export")
            {
                result = new Office.ExcelExport();
            }

            return(result);
        }