Exemple #1
0
        private JSONModel PrepareModel()
        {
            JSONModel model = new JSONModel();

            model.LoadJSONFromURL(testURL);
            return(model);
        }
        public bool Process(string input)
        {
            if (input == "x" || input == "m")
            {
                controller.SubProcessingComplete();
                return(false);
            }
            else if (input == "p")
            {
                string jsonString = model.ToString();
                if (jsonString != null)
                {
                    Console.WriteLine(jsonString);
                }

                PrintInstructions();
                return(false);
            }
            else
            {
                if (input == "d")
                {
                    input = defaultURL;
                }

                try
                {
                    model.LoadJSONFromURL(input);
                    Console.WriteLine("-------------------------");
                    Console.WriteLine(string.Format("Json Loaded from {0}", input));
                    Console.WriteLine("-------------------------");
                    controller.SubProcessingComplete();
                    return(false);
                }
                catch (Exception e)
                {
                    PrintErrorText(input, e);
                }

                PrintErrorText(input, null);
                return(false);
            }
        }