示例#1
0
 public void receive_Over(object sender, CJReceiveOverEvent e)
 {
     log.loging("事件触发啦");
     log.loging(e.sendState.ToString());
     if (e.sendState == SendState.OK)
     {
         log.loging(e.Msg.getMsgDataText());
     }
     //log.loging(e.Msg.data_text);
 }
示例#2
0
 // 获取配置信息
 private static ConfigState getConf()
 {
     try
     {
         xmlDoc.Load(confPath);
     }
     catch
     {
         ConfigState cstmp = initConfFile();
         if (cstmp > ConfigState.WARING)
         {
             return(cstmp);
         }
         xmlDoc.LoadXml(confPath);
     }
     try
     {
         rootNode = xmlDoc.DocumentElement;
         XmlNode node;
         node    = rootNode.SelectSingleNode("Project");
         Author  = node.SelectSingleNode("Author").InnerText;
         Version = node.SelectSingleNode("Version").InnerText;
         Name    = node.SelectSingleNode("Name").InnerText;
         try
         {
             Name = "f**k";
         }
         catch (Exception ex)
         {
             //Name = "f**k";
             MessageBox.Show(ex.Message);
         }
         node = rootNode.SelectSingleNode("Config");
         foreach (XmlNode userNode in node.SelectNodes("Server"))
         {
             ServerIp        = IPAddress.Parse(userNode.SelectSingleNode("IPAddress").InnerText);
             ServerTcpPort   = int.Parse(userNode.SelectSingleNode("PortTcp").InnerText);
             ServerUdpPort   = int.Parse(userNode.SelectSingleNode("PortUdp").InnerText);
             TimeOut         = int.Parse(userNode.SelectSingleNode("TimeOut").InnerText);
             MaxRepeatTimes  = int.Parse(userNode.SelectSingleNode("MaxRepeatTimes").InnerText);
             MaxContextBytes = int.Parse(userNode.SelectSingleNode("MaxContextBytes").InnerText);
         }
     }
     catch (Exception)
     {
         log.loging("读取链接配置文件出现错误", CJLog.LogLevel.COMMON_ERROR);
         return(ConfigState.DEFAULT);
         //System.Environment.Exit(-1);
     }
     return(ConfigState.OK);
 }
示例#3
0
        // 登陆认证
        public void authUser()
        {
            CJMsg msg_send = new CJMsg();

            msg_send.setMsgType(MsgType.C_AUTH);
            msg_send.setMsgToNode(CJConfig.ServerIp.ToString(),
                                  CJConfig.ServerTcpPort,
                                  CJConfig.ServerID,
                                  CJConfig.ServerName);
            msg_send.setMsgFromNode(CJConfig.LocalIp.ToString(),
                                    conn.port_tcp_local,
                                    comboBox1.Text,
                                    "");
            msg_send.addMsgText(textBox2.Text);
            conn.msg_send = msg_send;
            conn.tcp_start();
            conn.tcp_sendMsg();
            log.loging(conn.msg_send.ToString(), CJLog.LogLevel.DEBUG);
        }
示例#4
0
 private void TestForm1_Load(object sender, EventArgs e)
 {
     log = new CJLog(CJLog.LogLevel.ALL, CJLog.LogModel.TEXT_BOX_SHOW);
     log.setControl(textBox1);
     log.loging(conn.ip_server.ToString());
 }