當前位置: 首頁>>代碼示例>>C#>>正文


C# Network.InMessage類代碼示例

本文整理匯總了C#中SharpTibiaProxy.Network.InMessage的典型用法代碼示例。如果您正苦於以下問題:C# InMessage類的具體用法?C# InMessage怎麽用?C# InMessage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


InMessage類屬於SharpTibiaProxy.Network命名空間,在下文中一共展示了InMessage類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ParseClientSay

        private void ParseClientSay(InMessage message)
        {
            string receiver = null;
            ushort channelId = 0;

            MessageClasses type = (MessageClasses)message.ReadByte();
            switch (type)
            {
                case MessageClasses.PRIVATE_TO:
                case MessageClasses.GAMEMASTER_PRIVATE_TO:
                    receiver = message.ReadString();
                    break;

                case MessageClasses.CHANNEL:
                case MessageClasses.CHANNEL_HIGHLIGHT:
                case MessageClasses.GAMEMASTER_CHANNEL:
                    channelId = message.ReadUShort();
                    break;

                default:
                    break;
            }

            string text = message.ReadString();

            client.Chat.OnPlayerSpeak(receiver, channelId, type, text);
        }
開發者ID:KyLuaa,項目名稱:SharpMapTracker,代碼行數:27,代碼來源:ProtocolWorld.cs

示例2: Enable

		public void Enable()
		{
			client.Rsa = Constants.RSAKey.OpenTibiaM;

			loginClientPort = GetFreePort();
			worldClientPort = GetFreePort(loginClientPort + 1);

			if (!client.IsOpenTibiaServer && client.LoginServers[0].Server == "127.0.0.1")
				loginServers = Client.DefaultServers;
			else
				loginServers = client.LoginServers;

			client.LoginServers = new LoginServer[] { new LoginServer("127.0.0.1", loginClientPort) };
            
            if (client.Version.Number == ClientVersion.Version1011.Number)
                Util.Memory.WriteBytes(client.ProcessHandle, client.MemoryAddresses.ClientProxyCheckFunctionPointer, client.MemoryAddresses.ClientProxyCheckFunctionNOP, 15);

			clientInMessage = new InMessage();
			clientOutMessage = new OutMessage();

			serverInMessage = new InMessage();
			serverOutMessage = new OutMessage();

			StartListen();
		}
開發者ID:KyLuaa,項目名稱:SharpMapTracker,代碼行數:25,代碼來源:Proxy.cs

示例3: Connection

        public Connection(Socket socket, OtItems items)
        {
            this.socket = socket;
            this.items = items;

            message = new InMessage();
            map = new OtMap(items);

            BeginReceive();
        }
開發者ID:sridhar19091986,項目名稱:sharpmaptracker,代碼行數:10,代碼來源:Connection.cs

示例4: OpenTibiaDecrypt

        public static void OpenTibiaDecrypt(InMessage msg)
        {
            if (msg.Size - msg.ReadPosition != 128)
                throw new Exception("Invalid message size.");

            var decrypted = openTibiaDecryptEngine.ProcessBlock(msg.Buffer, msg.ReadPosition, 128);
            var padSize = 128 - decrypted.Length;

            if (padSize > 0)
                Array.Clear(msg.Buffer, msg.ReadPosition, padSize);
            else
                padSize = 0;

            Array.Copy(decrypted, 0, msg.Buffer, msg.ReadPosition + padSize, decrypted.Length);

            if (msg.ReadByte() != 0)
                throw new Exception("Invalid decrypted message.");

            msg.Encrypted = false;
        }
開發者ID:sridhar19091986,項目名稱:sharpmaptracker,代碼行數:20,代碼來源:Rsa.cs

示例5: ParseClientMessage

        public void ParseClientMessage(InMessage message)
        {
            var packetStart = 0;
            try
            {
                packetStart = message.ReadPosition;
                byte cmd = message.ReadByte();

                switch (cmd)
                {
                    case 0x96:
                        ParseClientSay(message);
                        break;
                }

            }
            catch (Exception ex)
            {
                Trace.TraceWarning(ex.Message + "\nPacket Bytes: " + message.Buffer.ToHexString(packetStart, message.ReadPosition - packetStart));
            }
        }
開發者ID:sridhar19091986,項目名稱:sharpmaptracker,代碼行數:21,代碼來源:ProtocolWorld.cs

示例6: Enable

        public void Enable()
        {
            client.Rsa = Constants.RSAKey.OpenTibiaM;

            loginClientPort = GetFreePort();
            worldClientPort = GetFreePort(loginClientPort + 1);

            if (!client.IsOpenTibiaServer && client.LoginServers[0].Server == "localhost")
                loginServers = Client.DefaultServers;
            else
                loginServers = client.LoginServers;

            client.LoginServers = new LoginServer[] { new LoginServer("localhost", loginClientPort) };

            clientInMessage = new InMessage();
            clientOutMessage = new OutMessage();

            serverInMessage = new InMessage();
            serverOutMessage = new OutMessage();

            StartListen();
        }
開發者ID:sridhar19091986,項目名稱:sharpmaptracker,代碼行數:22,代碼來源:Proxy.cs

示例7: Decrypt

        /// <summary>
        /// Decrypts the message
        /// </summary>
        /// <param name="msg">The message to be dencrypted.</param>
        /// <param name="key">The key to be used.</param>
        public static unsafe void Decrypt(InMessage msg, uint[] key)
        {
            if (msg == null)
                throw new Exception("Null message.");

            if (key == null)
                throw new Exception("Null key.");

            if (!msg.Encrypted)
                throw new Exception("Can't dencrypt a dencrypted message.");

            var msgSize = msg.Size - 6;

            if (msg.Size <= 6 || msgSize % 8 > 0)
                throw new Exception("Wrong message size.");

            fixed (byte* bufferPtr = msg.Buffer)
            {
                var words = (uint*)(bufferPtr + 6);

                for (var pos = 0; pos < msgSize / 4; pos += 2)
                {
                    var count = 32;
                    var sum = 0xC6EF3720;

                    while (count-- > 0)
                    {
                        words[pos + 1] -= (words[pos] << 4 ^ words[pos] >> 5) + words[pos] ^ sum
                            + key[sum >> 11 & 3];
                        sum -= DELTA;
                        words[pos] -= (words[pos + 1] << 4 ^ words[pos + 1] >> 5) + words[pos + 1] ^ sum
                            + key[sum & 3];
                    }
                }
            }

            msg.Size = BitConverter.ToUInt16(msg.Buffer, 6) + 2 + 6;
            msg.Encrypted = false;
        }
開發者ID:jrmsjorgesilva,項目名稱:sharpmaptracker,代碼行數:44,代碼來源:Xtea.cs

示例8: ParseClientMessage

        public void ParseClientMessage(InMessage message)
        {
            var packetStart = 0;
            try
            {
                packetStart = message.ReadPosition;
                byte cmd = message.ReadByte();

                switch (cmd)
                {
                    case 0x96:
                        ParseClientSay(message);
                        break;
                    case 0xF4://244
                        ParseClientMarketLeave(message);
                        break;
                    case 0xF5://245
                        ParseClientMarketBrowse(message);
                        break;
                    case 0xF6://246
                        ParseClientMarketCreate(message);
                        break;
                    case 0xF7://247
                        ParseClientMarketCancel(message);
                        break;
                    case 0xF8://248
                        ParseClientMarketAccept(message);
                        break;
                }

            }
            catch (Exception ex)
            {
                Trace.TraceWarning(ex.Message + "\nPacket Bytes: " + message.Buffer.ToHexString(packetStart, message.ReadPosition - packetStart));
            }

        }
開發者ID:KyLuaa,項目名稱:SharpMapTracker,代碼行數:37,代碼來源:ProtocolWorld.cs

示例9: ParseInitialize

        private void ParseInitialize(InMessage message)
        {
            int count = message.ReadUShort();
            for (int i = 0; i < count; i++)
            {
                var creature = new Creature(message.ReadUInt());
                creature.Type = (CreatureType)message.ReadByte();
                creature.Name = message.ReadString();

                //Trace.WriteLine(String.Format("Creature[{0}]: {1}", i, creature.Name));

                creature.Health = message.ReadByte();
                var direction = (Direction)message.ReadByte();
                creature.LookDirection = direction;
                creature.TurnDirection = direction;

                //Outfit
                creature.Outfit = message.ReadOutfit();
                creature.LightLevel = message.ReadByte();
                creature.LightColor = message.ReadByte();
                creature.Speed = message.ReadUShort();
                creature.Skull = message.ReadByte();
                creature.Shield = message.ReadByte();
                creature.Emblem = message.ReadByte();
                creature.IsImpassable = message.ReadByte() == 0x01;

                client.BattleList.AddCreature(creature);
            }

            ParseTibiaPackets(message);
        }
開發者ID:sridhar19091986,項目名稱:sharpmaptracker,代碼行數:31,代碼來源:TibiaCastReader.cs

示例10: ParseServerMoveWest

        private void ParseServerMoveWest(InMessage message)
        {
            var location = new Location(client.PlayerLocation.X - 1, client.PlayerLocation.Y, client.PlayerLocation.Z);
            client.PlayerLocation = location;

            var tiles = new List<Tile>();
            ParseServerMapDescription(message, tiles, location.X - 8, location.Y - 6, location.Z, 1, 14);
            client.Map.OnMapUpdated(tiles);
        }
開發者ID:sridhar19091986,項目名稱:sharpmaptracker,代碼行數:9,代碼來源:ProtocolWorld.cs

示例11: ParseServerOpenChannel

        private void ParseServerOpenChannel(InMessage message)
        {
            var channelId = message.ReadUShort();
            var name = message.ReadString();

            var num = message.ReadUShort();
            for (int i = 0; i < num; i++)
                message.ReadString();
            num = message.ReadUShort();
            for (int i = 0; i < num; i++)
                message.ReadString();
        }
開發者ID:sridhar19091986,項目名稱:sharpmaptracker,代碼行數:12,代碼來源:ProtocolWorld.cs

示例12: ParseServerMarketLeave

 private void ParseServerMarketLeave(InMessage message)
 {
 }
開發者ID:sridhar19091986,項目名稱:sharpmaptracker,代碼行數:3,代碼來源:ProtocolWorld.cs

示例13: ParseServerMoveSouth

        private void ParseServerMoveSouth(InMessage message)
        {
            var location = new Location(client.PlayerLocation.X, client.PlayerLocation.Y + 1, client.PlayerLocation.Z);
            client.PlayerLocation = location;

            var tiles = new List<Tile>();
            ParseServerMapDescription(message, tiles, location.X - 8, location.Y + 7, location.Z, 18, 1);
            client.Map.OnMapUpdated(tiles);
        }
開發者ID:sridhar19091986,項目名稱:sharpmaptracker,代碼行數:9,代碼來源:ProtocolWorld.cs

示例14: ParseServerHouseTextWindow

 private void ParseServerHouseTextWindow(InMessage message)
 {
     var unk = message.ReadByte();
     var windowId = message.ReadUInt();
     var text = message.ReadString();
 }
開發者ID:sridhar19091986,項目名稱:sharpmaptracker,代碼行數:6,代碼來源:ProtocolWorld.cs

示例15: ParseServerMarketEnter

 private void ParseServerMarketEnter(InMessage message)
 {
     message.ReadUInt();
     message.ReadByte();
     var num = message.ReadUShort();
     for (int i = 0; i < num; i++)
         message.ReadUInt();
 }
開發者ID:sridhar19091986,項目名稱:sharpmaptracker,代碼行數:8,代碼來源:ProtocolWorld.cs


注:本文中的SharpTibiaProxy.Network.InMessage類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。