Example #1
0
        public override bool configure(ResourceFinder rf)
        {
            Time.turboBoost();
            Console.WriteLine("----------------------------------");
            Console.WriteLine("Convergence Divergence Zone Module");
            Console.WriteLine("----------------------------------");

            bool loadingFromWeights = rf.check("load");

            period           = rf.check("period", new Value(100)).asInt();
            broadcastDisplay = !rf.check("noDisplay");
            Console.Write("Running every " + period + " ms");

            if (loadingFromWeights)
            {
                Console.Write("Loading MMCM from weights file...");
                string weightFile = rf.find("load").asString().c_str();
                string path       = rf.findFile(weightFile).c_str();
                Console.WriteLine(path);
                cvz = CVZFactory.Create(path);
            }
            else
            {
                cvz = CVZFactory.Create(rf);
            }

            //Open the RPC communication
            rpc.open("/" + cvz.name + "/rpc");
            attach(rpc);

            return(true);
        }
Example #2
0
        static void Main(string[] args)
        {
            Network.init();
            Console.WriteLine("----------------------------------");
            Console.WriteLine("Convergence Divergence Zone Module");
            Console.WriteLine("----------------------------------");

            ResourceFinder rf = new ResourceFinder();

            rf.setDefaultContext("MMCM/conf");

            //Workaround the "--from" issue
            bool   loadingFromWeights = false;
            string configFile         = "defaultMap.ini";

            for (int i = 0; i < args.Count(); i++)
            {
                if (args[i] == "--from")
                {
                    configFile = args[i + 1];
                }
                if (args[i] == "--load")
                {
                    loadingFromWeights = true;
                    configFile         = args[i + 1];
                }
            }

            if (!loadingFromWeights)
            {
                rf.setDefaultConfigFile(configFile);
            }

            SVector argsVect = new SVector(args);

            rf.configure("MMCM_ROOT", argsVect);

            IConvergenceZone cvz = null;

            if (loadingFromWeights)
            {
                Console.Write("Loading MMCM from weights file...");
                string path = rf.findFile(configFile).c_str();
                Console.WriteLine(path);
                cvz = CVZFactory.Create(path);
            }
            else
            {
                cvz = CVZFactory.Create(rf);
            }

            Application.EnableVisualStyles();
            MMCM_ControlPanel form = new MMCM_ControlPanel(cvz as CVZ_MMCM);

            Application.Run(form);
        }