Esempio n. 1
0
        public JObject Prompt(CommandEngine commandEngine)
        {
            JObject jCommand = new JObject();

            jCommand.Add("command", "load-json");

            commandEngine.PromptForArgument(jCommand, "file");
            commandEngine.PromptForArgument(jCommand, "set");

            return(jCommand);
        }
Esempio n. 2
0
        ///// <summary>
        ///// Formats the JSON string by adding line breaks and indents.
        ///// </summary>
        ///// <param name="json">The raw JSON string.</param>
        ///// <returns>The formatted JSON string.</returns>
        //static string JsonPrettyPrint(string json)
        //{
        //    if (string.IsNullOrEmpty(json))
        //        return string.Empty;

        //    json = json.Replace(Environment.NewLine, "").Replace("\t", "");

        //    StringBuilder sb = new StringBuilder();
        //    bool quote = false;
        //    bool ignore = false;
        //    char last = ' ';
        //    int offset = 0;
        //    int indentLength = 2;

        //    foreach (char ch in json)
        //    {
        //        switch (ch)
        //        {
        //            case '"':
        //                if (!ignore) quote = !quote;
        //                break;
        //            case '\\':
        //                if (quote && last != '\\') ignore = true;
        //                break;
        //        }

        //        if (quote)
        //        {
        //            sb.Append(ch);
        //            if (last == '\\' && ignore) ignore = false;
        //        }
        //        else
        //        {
        //            switch (ch)
        //            {
        //                case '{':
        //                case '[':
        //                    sb.Append(ch);
        //                    sb.Append(Environment.NewLine);
        //                    sb.Append(new string(' ', ++offset * indentLength));
        //                    break;
        //                case ']':
        //                case '}':
        //                    sb.Append(Environment.NewLine);
        //                    sb.Append(new string(' ', --offset * indentLength));
        //                    sb.Append(ch);
        //                    break;
        //                case ',':
        //                    sb.Append(ch);
        //                    sb.Append(Environment.NewLine);
        //                    sb.Append(new string(' ', offset * indentLength));
        //                    break;
        //                case ':':
        //                    sb.Append(ch);
        //                    sb.Append(' ');
        //                    break;
        //                default:
        //                    if (quote || ch != ' ') sb.Append(ch);
        //                    break;
        //            }
        //        }
        //        last = ch;
        //    }
        //    return sb.ToString().Trim();
        //}

        public JObject Prompt(CommandEngine commandEngine)
        {
            JObject jCommand = new JObject();

            jCommand.Add("command", "bing-websearch");

            commandEngine.PromptForArgument(jCommand, "search-term");
            commandEngine.PromptForArgument(jCommand, "set");

            return(jCommand);
        }
Esempio n. 3
0
        public JObject Prompt(CommandEngine commandEngine)
        {
            JObject command = new JObject();

            command.Add("command", "save-json");

            commandEngine.PromptForArgument(command, "file");
            commandEngine.PromptForArgument(command, "source");
            commandEngine.PromptForArgument(command, "item");
            commandEngine.PromptForArgument(command, "mode");

            return(command);
        }
Esempio n. 4
0
        public JObject Prompt(CommandEngine commandEngine)
        {
            JObject command = new JObject();

            command.Add("command", "cds-retrieve-data");

            commandEngine.PromptForArgument(command, "entity");
            commandEngine.PromptForArgument(command, "fields");
            commandEngine.PromptForArgument(command, "into");
            commandEngine.PromptForArgument(command, "env");

            return(command);
        }
Esempio n. 5
0
        public JObject Prompt(CommandEngine commandEngine)
        {
            JObject command = new JObject();

            command.Add("command", "communicate");

            commandEngine.PromptForArgument(command, "text");

            return(command);
        }
Esempio n. 6
0
        public JObject Prompt(CommandEngine commandEngine)
        {
            JObject command = new JObject();

            command.Add("command", "run-script");

            commandEngine.PromptForArgument(command, "script");

            return(command);
        }
Esempio n. 7
0
        public JObject Prompt(CommandEngine commandEngine)
        {
            JObject jCommand = new JObject();

            jCommand.Add("command", "assert");

            JObject inputPortion = new JObject();

            commandEngine.PromptForArgument(inputPortion, "input");

            jCommand.Add("query", inputPortion);
            return(jCommand);
        }