Esempio n. 1
0
 static void Main(string[] args)
 {
     while (true)
     {
         Console.Write(">>>");
         string code = Console.ReadLine();
         if (code.ToLower() == "quit")
         {
             break;
         }
         IConsoleServer proxy = ServUtils.CreateClient <IConsoleServer, WSDualHttpBinding, Pyconsole>("http://localhost/pycad/servers/console");
         string         res   = proxy.Exec(code);
         if (!string.IsNullOrEmpty(res))
         {
             res += "\r\n";
         }
         Console.Write(res);
     }
 }
Esempio n. 2
0
        public void Read()
        {
            string result   = "\n";
            string previous = null;
            string current  = null;

            for (int count = 0; count < 2 || previous != "" && current != ""; count++)
            {
                previous = current;
                current  = Console.ReadLine();
                result  += "\n" + current;
            }
            result.TrimEnd(' ', '\n');
            IConsoleServer proxy = ServUtils.CreateClient <IConsoleServer, WSDualHttpBinding, Pyconsole>("http://localhost/pycad/servers/console");
            string         res   = proxy.Exec(result);

            if (!string.IsNullOrEmpty(res))
            {
                res += "\r\n";
            }
            Console.Write(res);
        }
Esempio n. 3
0
 public ConfigurationManager(IConsoleServer consoleServer)
 {
     BasePath = @"..\XRouter\Test.Integration\Data\";
     this.consoleServer = consoleServer;
 }
Esempio n. 4
0
        /// <summary>
        /// Modifies the current XRouter configuration with a custom message
        /// flow and XML resource storage.
        /// </summary>
        public void ReplaceConfiguration(
            IConsoleServer consoleServer,
            MessageFlowConfiguration messageFlow,
            XElement xrm,
            AdapterConfiguration[] adapters)
        {
            // load current configuration
            var configuration = consoleServer.GetConfiguration();
            var xConfig = configuration.Content.XDocument;

            if (adapters != null)
            {
                // remove all adapters
                xConfig.XPathSelectElement("/configuration/components/gateway/adapters").RemoveNodes();

                var gateway = xConfig.XPathSelectElements("/configuration/components/gateway").FirstOrDefault();
                if (gateway != null)
                {
                    string gatewayName = gateway.Attribute("name").Value;
                    foreach (var adapter in adapters)
                    {
                        configuration.SaveAdapterConfiguration(adapter);
                    }
                }
            }

            // remove all message flows
            xConfig.XPathSelectElement("/configuration/messageflows").RemoveNodes();

            // update current message flow
            configuration.UpdateMessageFlow(messageFlow);

            // remove all previous XRM items
            xConfig.XPathSelectElement("/configuration/xml-resource-storage").RemoveNodes();

            // add needed XRM items
            configuration.SaveXrmContent(xrm);

            // update the configuration
            consoleServer.ChangeConfiguration(configuration);
        }