Ejemplo n.º 1
0
 public Form1()
 {
     InitializeComponent();
     log("Started PuppetMaster");
     int port = int.Parse(ConfigurationManager.AppSettings["PuppetMasterPort"]);
     string channelURI = Utility.setupChannel(port);
     PuppetMasterRemote pm = new PuppetMasterRemote(channelURI,this);
     _pm = pm;
     //we need to register each remote object
     string service = ConfigurationManager.AppSettings["PuppetMasterService"];
     ObjRef o = RemotingServices.Marshal(pm, service, typeof(PuppetMaster));
     pm.URI = string.Format("{0}/{1}", channelURI, service);
     logFormat("Created PuppetMaster at \"{0}\"", pm.URI);
 }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Started PuppetMaster");
            int port = int.Parse(ConfigurationManager.AppSettings["PuppetMasterPort"]);
            string channelURI = Utility.setupChannel(port);
            PuppetMasterRemote pm = new PuppetMasterRemote(channelURI);
            //we need to register each remote object
            string service = ConfigurationManager.AppSettings["PuppetMasterService"];
            ObjRef o = RemotingServices.Marshal(pm, service, typeof(PuppetMaster));
            pm.URI = string.Format("{0}/{1}", channelURI, service);
            Console.WriteLine("Created PuppetMaster at \"{0}\"", pm.URI);

            Console.WriteLine("Press key to leave");
            Console.Read();
            // quick way to close all windows
            foreach(Process p in pm.processes)
            {
                try {
                    p.Kill();
                }
                catch (System.InvalidOperationException) { }
            }
        }