예제 #1
0
		private void start()
		{
			if (!var.isConfigurationReady()) return;
			var.saveControls(gbStatus);
			
			// Prepare PHP for use with Nginx and Apache
            PHPConfig php = new PHPConfig(var);
            if (!php.isPHPReady()) return;
            

        	if (cbApache.Checked)
        	{
	            MPApache mp = new MPApache();
	            mp.attachVar(var);
				mp.attach(getColorLabel(cbApache));
				mp.start();
				listMP.Add(mp);
        	}
        	if (cbNginx.Checked)
        	{
	    		int phpThreads = var.getInt("PHP","numPHPThreads");
	    		int phpPort = var.getInt("PHP","numPHPPort");
	    		
	    		MPNginx mp = new MPNginx();
	    		mp.attachVar(var);
	    		mp.attach(getColorLabel(cbNginx));
	    		
	    		for (int i = phpPort; i < phpPort  +phpThreads ;i++)
	    		{
	    			ManagedProcess map = new ManagedProcess();
	    			map.attachVar(var);
	    			map.start(var.strPHPNTSCGIFilePath,"-b 127.0.0.1:" + i, var.strPHPNTSFolderPath, i);
	    			mp.bind(map);
	    		}
				
				mp.start();
				listMP.Add(mp);
        	}

            if (cbMongoDB.Checked)
            {
	            MPMongoDB mp = new MPMongoDB();
	            mp.attachVar(var);
				mp.attach(getColorLabel(cbMongoDB));
				mp.start();
				listMP.Add(mp);
            }        	
            if (cbMySQL.Checked)
            {
	            MPMySQL mp = new MPMySQL();
	            mp.attachVar(var);
				mp.attach(getColorLabel(cbMySQL));
				mp.start();
				listMP.Add(mp);
            }
            
            if (cbMemcached.Checked)
            {
	            MPMemcached mp = new MPMemcached();
	            mp.attachVar(var);
				mp.attach(getColorLabel(cbMemcached));
				mp.start();
				listMP.Add(mp);
            }
            
            if (listMP.Count>0)
            {
            	btnStartStop.Text = strStop;
            	gbStatus.Enabled = false;
            }
		}
예제 #2
0
        private void start()
        {
            if (!var.isConfigurationReady())
            {
                return;
            }
            var.saveControls(gbStatus);

            // Prepare PHP for use with Nginx and Apache
            PHPConfig php = new PHPConfig(var);

            if (!php.isPHPReady())
            {
                return;
            }


            if (cbApache.Checked)
            {
                MPApache mp = new MPApache();
                mp.attachVar(var);
                mp.attach(getColorLabel(cbApache));
                mp.start();
                listMP.Add(mp);
            }
            if (cbNginx.Checked)
            {
                int phpThreads = var.getInt("PHP", "numPHPThreads");
                int phpPort    = var.getInt("PHP", "numPHPPort");

                MPNginx mp = new MPNginx();
                mp.attachVar(var);
                mp.attach(getColorLabel(cbNginx));

                for (int i = phpPort; i < phpPort + phpThreads; i++)
                {
                    ManagedProcess map = new ManagedProcess();
                    map.attachVar(var);
                    map.start(var.strPHPNTSCGIFilePath, "-b 127.0.0.1:" + i, var.strPHPNTSFolderPath, i);
                    mp.bind(map);
                }

                mp.start();
                listMP.Add(mp);
            }

            if (cbMongoDB.Checked)
            {
                MPMongoDB mp = new MPMongoDB();
                mp.attachVar(var);
                mp.attach(getColorLabel(cbMongoDB));
                mp.start();
                listMP.Add(mp);
            }
            if (cbMySQL.Checked)
            {
                MPMySQL mp = new MPMySQL();
                mp.attachVar(var);
                mp.attach(getColorLabel(cbMySQL));
                mp.start();
                listMP.Add(mp);
            }

            if (cbMemcached.Checked)
            {
                MPMemcached mp = new MPMemcached();
                mp.attachVar(var);
                mp.attach(getColorLabel(cbMemcached));
                mp.start();
                listMP.Add(mp);
            }

            if (listMP.Count > 0)
            {
                btnStartStop.Text = strStop;
                gbStatus.Enabled  = false;
            }
        }