예제 #1
0
        void PacketFormat(out ServerRule[] serverRules, byte[] receivePacketBytes)
        {
            using (MemoryStream stream = new MemoryStream(receivePacketBytes))
            {
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    reader.ReadBytes(11);

                    int ruleCount = reader.ReadInt16();
                    serverRules = new ServerRule[ruleCount];//jvxf2m1

                    for (int i = 0; i < ruleCount; i++)
                    {
                        int    ruleNameLength = reader.ReadByte();
                        byte[] ruleName       = reader.ReadBytes(ruleNameLength);

                        int    ruleValueLength = reader.ReadByte();
                        byte[] ruleValue       = reader.ReadBytes(ruleValueLength);

                        serverRules[i] = new ServerRule(Encoding.Default.GetString(ruleName), Encoding.Default.GetString(ruleValue));
                    }
                }
            }
        }
예제 #2
0
파일: ServerQuery.cs 프로젝트: owwo/trash
        void PacketFormat(out ServerRule[] serverRules, byte[] receivePacketBytes)
        {
            using (MemoryStream stream = new MemoryStream(receivePacketBytes))
            {
                using (BinaryReader reader = new BinaryReader(stream))
                {
                    reader.ReadBytes(11);

                    int ruleCount = reader.ReadInt16();
                    serverRules = new ServerRule[ruleCount];//jvxf2m1

                    for (int i = 0; i < ruleCount; i++)
                    {
                        int ruleNameLength = reader.ReadByte();
                        byte[] ruleName = reader.ReadBytes(ruleNameLength);

                        int ruleValueLength = reader.ReadByte();
                        byte[] ruleValue = reader.ReadBytes(ruleValueLength);

                        serverRules[i] = new ServerRule(Encoding.Default.GetString(ruleName), Encoding.Default.GetString(ruleValue));
                    }
                }
            }
        }