GoBang/FrClient.cs

(开头部分) 11KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.Net;
using System.Net.Sockets;
using System.Threading;

namespace GoBang
{
    public partial class FrClient : Form
    {
        #region 变量

        private TcpClient client;
        private NetworkStream netStream;
        public FrMain m;
        private bool control = false;

        #endregion

        #region 私有方法

        /// <summary>
        /// 信息发送函数
        /// </summary>
        /// <param name="n"></param>
        public void getin1(string n)
        {
            netStream = client.GetStream();
            string send = n + "\r\n";
            byte[] messsageByte = System.Text.Encoding.BigEndianUnicode.GetBytes(send.ToCharArray());
            netStream.Write(messsageByte, 0, messsageByte.Length);
            netStream.Flush();
        }

        /// <summary>
        /// 接收与解析函数,客户端核心,原理与服务器端同
        /// </summary>
        private void receive()
        {
            while (!control)
            {

                netStream = client.GetStream();
                byte[] messsageByte = new Byte[64];
                netStream.Read(messsageByte, 0, messsageByte.Length);
                string readNessage = System.Text.Encoding.BigEndianUnicode.GetString(messsageByte);
                string d;

                //截取前4个字符判断当前字符串类型
                d = readNessage.Substring(0, 4);

                //d=="wja;" 表示接收为玩家姓名,取后4字符
                //d=="xia1" 表示黑棋先手
                //d=="xia0" 表示白棋先手
                //d=="gin;" 接收重新开始信息
                //d=="hei;" 接收黑棋下子信息
后面还有 213 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。