示例#1
0
        public void createProcess(TreeNode site, string role, string name, string s, string url)
        {

            string aux = "LocalPMcreateProcess @ url -> " + url + " site -> " + s;
            Console.WriteLine(aux);
            if (role.Equals("broker"))
            {
                Broker b = new Broker(url, name, s);
                site.setBroker(b);

                string port = (portCounter++).ToString();

                //Process.Start()
                ProcessStartInfo startInfo = new ProcessStartInfo(@"C:\DAD\PubSub_v3.1\Broker\bin\Debug\Broker.exe");
                string[] args = { port, url, name, s };
                startInfo.Arguments = String.Join(";", args);

                Process p = new Process();
                p.StartInfo = startInfo;

                p.Start();
            }
            if (role.Equals("subscriber"))
            {
                Subscriber sub = new Subscriber(url, name, s);
                //site.addSubscriber(sub);

                string port = (portCounter++).ToString();

                ProcessStartInfo startInfo = new ProcessStartInfo(@"C:\DAD\PubSub_v3.1\Subscriber\bin\Debug\Subscriber.exe");
                string[] args = { port, url, name, s };
                startInfo.Arguments = String.Join(";", args);

                Process p = new Process();
                p.StartInfo = startInfo;

                p.Start();
            }
            if (role.Equals("publisher"))
            {
                Publisher p = new Publisher(url, name, s/*, site.getBroker()*/);
                //site.addPublisher(p);

                string port = (portCounter++).ToString();

                ProcessStartInfo startInfo = new ProcessStartInfo(@"C:\DAD\PubSub_v3.1\Publisher\bin\Debug\Publisher.exe");
                string[] args = { port, url, name, s };
                startInfo.Arguments = String.Join(";", args);

                Process pro = new Process();
                pro.StartInfo = startInfo;

                pro.Start();
            }

        }
示例#2
0
 public void createProcess(TreeNode site, string role, string name, string s, string url)
 {
     string aux = "PMcreateProcess @ " + site.ID + " role " + role;
     MessageBox.Show(aux);
     if (role.Equals("broker")) {
         Broker b = new Broker(url, name, s);
         site.setBroker(b);
     }
     if (role.Equals("subscriber"))
     {
         Subscriber sub = new Subscriber(url, name, s);
         site.addSubscriber(sub);
     }
     if (role.Equals("publisher"))
     {
         Publisher p = new Publisher(url, name, s,site.getBroker());
         site.addPublisher(p);
     }
 }