Exemple #1
0
 /// <summary>
 /// 我要开服(含聊天端口)
 /// </summary>
 /// <param name="pname"></param>
 /// <param name="fpath"></param>
 /// <param name="ptag"></param>
 /// <param name="pexe"></param>
 /// <param name="pmoddir"></param>
 /// <param name="logpath"></param>
 /// <param name="eventpath"></param>
 /// <param name="banlistpath"></param>
 /// <param name="clientname"></param>
 /// <param name="serveraddr"></param>
 /// <param name="serverport"></param>
 /// <param name="clientport"></param>
 /// <returns></returns>
 public static string StartProc(string pname, string fpath, string ptag, string pexe, string pmoddir, string logpath, string eventpath, string banlistpath,
                                string clientname, string serveraddr, string serverport, string clientport)
 {
     if (clientname != null && serveraddr != null && serverport != null && clientport != null)
     {
         myport = int.Parse(clientport);
         if (myport != 0)
         {
             chatservice = new P2PLoader(int.Parse(clientport));
             myname      = clientname;
             cserverip   = getIp(serveraddr);
             cserverport = int.Parse(serverport);
             chatservice.setOnReceiveMsg(onChatMsgReceive);
             chatservice.setOnStopListen(onChatStop);
             chatservice.startListen();
             chatregister();
         }
     }
     return(StartProc(pname, fpath, ptag, pexe, pmoddir, logpath, eventpath, banlistpath));
 }
Exemple #2
0
        void StartCmdClick(object sender, EventArgs e)
        {
            startCmd.Enabled = false;
            if (null == telloController)
            {
                telloController = new P2PLoader();
            }
            telloController.setOnReceiveMsg(onTelloMsg);
            telloController.startListen();
            cmdStoped = false;
            Thread t = new Thread(delegate() {
                try {
                    while (!cmdStoped)
                    {
                        output.Text = "开启命令!";
                        telloController.sendMsg(TELLOMSG.command);
                        Thread.Sleep(3000);
                        isFalse(cmdStoped);
                        output.Text = "起飞!";
                        telloController.sendMsg(TELLOMSG.takeoff);
                        Thread.Sleep(7000);
                        isFalse(cmdStoped);
                        output.Text = "翻滚!";
                        telloController.sendMsg(TELLOMSG.flip + "r");
                        Thread.Sleep(7000);
                        isFalse(cmdStoped);
                        output.Text = "下落!";
                        telloController.sendMsg(TELLOMSG.land);
                        Thread.Sleep(7000);
                    }
                } catch (Exception ue) {
                    output.Text = ue.Message;
                } finally {
                    // do nothing
                }
            });

            t.Start();
        }