当前位置: 首页>>代码示例>>C#>>正文


C# PacketReader.ReadBoolean方法代码示例

本文整理汇总了C#中System.IO.PacketReader.ReadBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.ReadBoolean方法的具体用法?C# PacketReader.ReadBoolean怎么用?C# PacketReader.ReadBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.PacketReader的用法示例。


在下文中一共展示了PacketReader.ReadBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ReadPacket

        public void ReadPacket(PacketReader reader)
        {
            //TODO: Make
            var offset = 0x2A;
            File.WriteAllBytes("AvatarProfileResponsePacket dump", ((MemoryStream)reader.BaseStream).ToArray());
            Unknown1 = reader.ReadInt32();
            UserID1 = reader.ReadInt64();
            UserID2 = reader.ReadInt64();
            if (reader.ReadBoolean())
            {
                Clan = new Clan();
                Clan.ID = reader.ReadInt64();
                Clan.Name = reader.ReadString();
                Clan.Badge = reader.ReadInt32();
                reader.ReadInt32();
                Clan.Level = reader.ReadInt32();
                offset += 1;
            }
            if (Unknown2 = reader.ReadBoolean())
            {
                Unknown3 = reader.ReadInt64();
                offset += 1;
            }

            reader.Seek(offset, SeekOrigin.Current);
            Unknown4 = reader.ReadInt32();
            AllianceCastleLevel = reader.ReadInt32(); // -1 if not constructed
            AllianceCastleUnitCapacity = reader.ReadInt32();
            AllianceCastleUnitCount = reader.ReadInt32();
            TownHallLevel = reader.ReadInt32();
            Username = reader.ReadString();
            FacebookID = reader.ReadString();
            Level = reader.ReadInt32();
            Experience = reader.ReadInt32();
            Gems = reader.ReadInt32(); // they seemed randomized or scrambled for non local player
            Gems1 = reader.ReadInt32();
            Unknown5 = reader.ReadInt32();
            Unknown6 = reader.ReadInt32();
            Trophies = reader.ReadInt32();
            AttackWon = reader.ReadInt32();
            AttackLost = reader.ReadInt32(); // randomized
            DefenseWon = reader.ReadInt32();
            DefenseLost = reader.ReadInt32(); // randomized
        }
开发者ID:maithanhtan,项目名称:CoCSharp,代码行数:44,代码来源:AvatarProfileResponsePacket.cs

示例2: OnServerInfo

		private static void OnServerInfo(Client client, PacketReader reader){
			//服务器信息
			Program.Config.ChatPort = reader.ReadInt32();
			Program.Config.DuelPort = reader.ReadInt32();
			Program.Config.NeedAuth = reader.ReadBoolean();
            client.Pwd = reader.ReadUnicode(32);
#if DEBUG
			MessageBox.Show(Program.Config.ChatPort+":"+Program.Config.DuelPort+":"+Program.Config.NeedAuth + ":" + client.Pwd);
#endif
            client.OnLoginOk();
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:11,代码来源:ClientEvent.cs

示例3: ServerSetWarMode

 private static void ServerSetWarMode( PacketReader p, PacketHandlerEventArgs args )
 {
     World.Player.Warmode = p.ReadBoolean();
 }
开发者ID:herculesjr,项目名称:razor,代码行数:4,代码来源:Handlers.cs

示例4: MobileStatus

        private static void MobileStatus( PacketReader p, PacketHandlerEventArgs args )
        {
            Serial serial = p.ReadUInt32();
            Mobile m = World.FindMobile( serial );
            if ( m == null )
                World.AddMobile( m = new Mobile( serial ) );

            m.Name = p.ReadString( 30 );

            m.Hits = p.ReadUInt16();
            m.HitsMax = p.ReadUInt16();

            p.ReadBoolean();//CanBeRenamed

            byte type = p.ReadByte();

            if ( m == World.Player && type != 0x00 )
            {
                PlayerData player = (PlayerData)m;

                player.Female = p.ReadBoolean();

                int oStr = player.Str, oDex = player.Dex, oInt = player.Int;

                player.Str = p.ReadUInt16();
                player.Dex = p.ReadUInt16();
                player.Int = p.ReadUInt16();

                if ( player.Str != oStr && oStr != 0 && Config.GetBool( "DisplaySkillChanges" ) )
                    World.Player.SendMessage( MsgLevel.Force, LocString.StrChanged, player.Str - oStr > 0 ? "+" : "", player.Str - oStr, player.Str );

                if ( player.Dex != oDex && oDex != 0 && Config.GetBool( "DisplaySkillChanges" ) )
                    World.Player.SendMessage( MsgLevel.Force, LocString.DexChanged, player.Dex - oDex > 0 ? "+" : "", player.Dex - oDex, player.Dex );

                if ( player.Int != oInt && oInt != 0 && Config.GetBool( "DisplaySkillChanges" ) )
                    World.Player.SendMessage( MsgLevel.Force, LocString.IntChanged, player.Int - oInt > 0 ? "+" : "", player.Int - oInt, player.Int );

                player.Stam = p.ReadUInt16();
                player.StamMax = p.ReadUInt16();
                player.Mana = p.ReadUInt16();
                player.ManaMax = p.ReadUInt16();

                player.Gold = p.ReadUInt32();
                player.AR = p.ReadUInt16(); // ar / physical resist
                player.Weight = p.ReadUInt16();

                if ( type >= 0x03 )
                {
                    if ( type > 0x04 )
                    {
                        player.MaxWeight = p.ReadUInt16();

                        p.ReadByte(); // race?
                    }

                    player.StatCap = p.ReadUInt16();

                    if ( type > 0x03 )
                    {
                        player.Followers = p.ReadByte();
                        player.FollowersMax = p.ReadByte();

                        player.FireResistance = p.ReadInt16();
                        player.ColdResistance = p.ReadInt16();
                        player.PoisonResistance = p.ReadInt16();
                        player.EnergyResistance = p.ReadInt16();

                        player.Luck = p.ReadInt16();

                        player.DamageMin = p.ReadUInt16();
                        player.DamageMax = p.ReadUInt16();

                        player.Tithe = p.ReadInt32();
                    }
                }

                ClientCommunication.RequestTitlebarUpdate();

                ClientCommunication.PostHitsUpdate();
                ClientCommunication.PostStamUpdate();
                ClientCommunication.PostManaUpdate();

                Engine.MainWindow.UpdateTitle(); // update player name
            }
        }
开发者ID:herculesjr,项目名称:razor,代码行数:85,代码来源:Handlers.cs

示例5: OnInfo

		//登录
		private static void OnInfo(Session session, PacketReader packet)
		{
			string name = packet.ReadUnicode(20);
			string pwd = packet.ReadUnicode(32);//md5
			//登录
			bool force = packet.ReadBoolean();
			if (Login(name, pwd))
			{
				session.Name = name;
				session.IsPause = false;
				//返回聊天端口,对战端口
				if (session.Server != null)
				{
					lock (session.Server.Clients)
					{
						Session old;
						if (session.Server.Clients.TryGetValue(session.Name, out old))
						{
							if (force)
							{
								old.SendError("[err]你的账号在其他地方登录");
								old.Name = "";
								//   old.Close();
							}
							else
							{
								session.IsLogin = false;
								session.IsPause = true;
								session.SendError("[err]已经登录");
								return;
							}
						}
						session.CreateToken(name, pwd);
						session.Server.SendToken(session.Name, session.Token);
						session.IsLogin = true;
						session.Server.Clients[session.Name]=session;
						session.Server.OnSendServerInfo(session);
						session.Server.server_OnPlayerJoin(session.ServerInfo, session.Name, null);
						if (!string.IsNullOrEmpty(session.Server.Tip))
						{
							session.SendServerMsg(session.Server.Tip);
						}
					}
				}
			}
			else {
				session.SendError("[err]认证失败");
			}
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:50,代码来源:ClinetEvent.cs

示例6: OnRoomList

		private static void OnRoomList(Session session, PacketReader packet)
		{
			bool nolock = packet.ReadBoolean();
			bool nostart = packet.ReadBoolean();
			session.IsPause = false;
			if (session.Server != null)
			{
				session.Server.OnRoomList(session, nolock, nostart);
			}
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:10,代码来源:ClinetEvent.cs

示例7: ReadPacket

        public void ReadPacket(PacketReader reader)
        {
            LastVisit = TimeSpan.FromSeconds(reader.ReadInt32());

            //Unknown1 = reader.ReadInt();
            reader.Seek(4, SeekOrigin.Current);

            TimeStamp = reader.ReadInt64();
            UserID = reader.ReadInt64();
            ShieldDuration = TimeSpan.FromSeconds(reader.ReadInt32());

            //Unknown2 = reader.ReadLong();
            reader.Seek(8, SeekOrigin.Current);
            Compressed = reader.ReadBoolean();
            Home = new Village();
            Home.ReadFromPacketReader(reader);

            //Unknown4 = reader.ReadInt();
            reader.Seek(4, SeekOrigin.Current);

            //UserID2 = reader.ReadLong();
            //UserID3 = reader.ReadLong();
            reader.Seek(16, SeekOrigin.Current);

            if ((HasClan = reader.ReadBoolean()))
            {
                Clan = new Clan()
                {
                    ID = reader.ReadInt64(),
                    Name = reader.ReadString(),
                    Badge = reader.ReadInt32(),
                };
                Level = reader.ReadInt32(); // member status?
                Level = reader.ReadInt32();
            }

            if (reader.ReadBoolean())
                reader.Seek(8, SeekOrigin.Current);
            if (reader.ReadBoolean())
                reader.Seek(8, SeekOrigin.Current);

            //Unknown5 = (byte)reader.ReadByte();
            //Unknown6 = reader.ReadInt();
            //Unknown7 = reader.ReadLong();
            //Unknown8 = reader.ReadLong();
            reader.Seek(4, SeekOrigin.Current);

            AllianceCastleLevel = reader.ReadInt32();
            AllianceCastleCapacity = reader.ReadInt32();
            AllianceCastleUsed = reader.ReadInt32();
            TownHallLevel = reader.ReadInt32();
            Username = reader.ReadString();
            FacebookID = reader.ReadInt32();
            Level = reader.ReadInt32();
            Experience = reader.ReadInt32();
            Gems = reader.ReadInt32();
            //Gems1 = reader.ReadInt();

            //Unknown9 = reader.ReadLong();
            reader.Seek(12, SeekOrigin.Current);

            TrophiesCount = reader.ReadInt32();
            AttackWon = reader.ReadInt32();
            AttackLost = reader.ReadInt32();
            DefenceWon = reader.ReadInt32();
            DefenceLost = reader.ReadInt32();

            reader.Seek(21, SeekOrigin.Current);

            HasName = reader.ReadBoolean();

            reader.Seek(16, SeekOrigin.Current);
        }
开发者ID:jibinthomas007,项目名称:CoCSharp,代码行数:73,代码来源:OwnHomeDataPacket.cs

示例8: ReadPacket

        public void ReadPacket(PacketReader reader)
        {
            var offset = 0x2A;
            LastVisit = TimeSpan.FromSeconds(reader.ReadInt32());
            Unknown1 = reader.ReadInt32();
            Timestamp = DateTimeConverter.FromUnixTimestamp(reader.ReadInt32());
            Unknown2 = reader.ReadInt32();
            UserID = reader.ReadInt64();
            ShieldDuration = TimeSpan.FromSeconds(reader.ReadInt32());
            Unknown3 = reader.ReadInt32();
            Unknown4 = reader.ReadInt32();
            Compressed = reader.ReadBoolean();
            Home = new Village();
            Home.Read(reader);

            Avatar = new Avatar();
            // Seems like a whole object
            Unknown6 = reader.ReadInt32();
            UserID1 = reader.ReadInt64();
            UserID2 = reader.ReadInt64();
            Avatar.ID = UserID1;

            switch (reader.ReadByte())
            {
                case 0:
                    break;

                case 1:
                    Avatar.Clan = new Clan();
                    Avatar.Clan.ID = reader.ReadInt64();
                    Avatar.Clan.Name = reader.ReadString();
                    Avatar.Clan.Badge = reader.ReadInt32();
                    reader.ReadInt32();
                    Avatar.Clan.Level = reader.ReadInt32();
                    offset += 1;
                    break;

                case 2: // clanless but clan castle built?
                    var lel = reader.ReadInt64();
                    break;
            }

            if (Unknown7 = reader.ReadBoolean())
                Unknown8 = reader.ReadInt64();

            if (Unknown9 = reader.ReadBoolean())
                Unknown10 = reader.ReadInt64();

            reader.Seek(offset, SeekOrigin.Current);
            Unknown11 = reader.ReadInt32();
            AllianceCastleLevel = reader.ReadInt32(); // -1 if not constructed
            AllianceCastleUnitCapacity = reader.ReadInt32();
            AllianceCastleUnitCount = reader.ReadInt32();
            Avatar.TownHallLevel = reader.ReadInt32();
            Avatar.Username = reader.ReadString();
            FacebookID = reader.ReadString();
            Avatar.Level = reader.ReadInt32();
            Avatar.Experience = reader.ReadInt32();
            Avatar.Gems = reader.ReadInt32();
            Gems1 = reader.ReadInt32();
            Unknown14 = reader.ReadInt32();
            Unknown15 = reader.ReadInt32();
            Avatar.Trophies = reader.ReadInt32();
            Avatar.AttacksWon = reader.ReadInt32();
            Avatar.AttacksLost = reader.ReadInt32();
            Avatar.DefencesWon = reader.ReadInt32();
            Avatar.DefencesLost = reader.ReadInt32();
            Unknown16 = reader.ReadInt32();
            Unknown17 = reader.ReadInt32();
            Unknown18 = reader.ReadInt32();
            if (Unknown19 = reader.ReadBoolean())
                Unknown20 = reader.ReadInt64();
            Unknown21 = reader.ReadByte();
            Unknown22 = reader.ReadInt32();
            Unknown23 = reader.ReadInt32();
            Unknown24 = reader.ReadInt32();
            Unknown25 = reader.ReadInt32();

            var count1 = reader.ReadInt32();
            for (int i = 0; i < count1; i++)
            {
                var id = reader.ReadInt32(); // resource id from resources.csv
                var capacity = reader.ReadInt32();
            }

            var count2 = reader.ReadInt32();
            for (int i = 0; i < count2; i++)
            {
                var id = reader.ReadInt32(); // resource id from resources.csv
                var amount = reader.ReadInt32();
            }

            var count3 = reader.ReadInt32();
            for (int i = 0; i < count3; i++)
            {
                var id = reader.ReadInt32(); // unit id from characters.csv
                var amount = reader.ReadInt32();
            }

            var count4 = reader.ReadInt32();
//.........这里部分代码省略.........
开发者ID:castelbuilder123,项目名称:CoCSharp,代码行数:101,代码来源:OwnHomeDataPacket.cs

示例9: ServerSetWarMode

 private static void ServerSetWarMode( PacketReader p )
 {
     World.Player.Warmode = p.ReadBoolean();
 }
开发者ID:herculesjr,项目名称:razor,代码行数:4,代码来源:Handlers.cs

示例10: MobileStatus

        private static void MobileStatus( PacketReader p )
        {
            Serial serial = p.ReadUInt32();
            Mobile m = World.FindMobile( serial );
            if ( m == null )
                World.AddMobile( m = new Mobile( serial ) );

            m.Name = p.ReadString( 30 );

            m.Hits = p.ReadUInt16();
            m.HitsMax = p.ReadUInt16();

            p.ReadBoolean();//CanBeRenamed

            byte type = p.ReadByte();

            if ( m == World.Player && type != 0x00 )
            {
                PlayerData player = (PlayerData)m;

                player.Female = p.ReadBoolean();

                player.Str = p.ReadUInt16();
                player.Dex = p.ReadUInt16();
                player.Int = p.ReadUInt16();

                player.Stam = p.ReadUInt16();
                player.StamMax = p.ReadUInt16();
                player.Mana = p.ReadUInt16();
                player.ManaMax = p.ReadUInt16();

                player.Gold = p.ReadUInt32();
                player.AR = p.ReadUInt16(); // ar / physical resist
                player.Weight = p.ReadUInt16();

                if ( type == 0x03 || type == 0x04 )
                {
                    player.StatCap = p.ReadUInt16();
                    player.Followers = p.ReadByte();
                    player.FollowersMax = p.ReadByte();

                    if ( type == 0x04 )
                    {
                        /*m_Stream.Write( (short) beheld.FireResistance ); // Fire
                        m_Stream.Write( (short) beheld.ColdResistance ); // Cold
                        m_Stream.Write( (short) beheld.PoisonResistance ); // Poison
                        m_Stream.Write( (short) beheld.EnergyResistance ); // Energy
                        m_Stream.Write( (short) 0 ); // Luck
                        m_Stream.Write( (short) 0 ); // Damage min
                        m_Stream.Write( (short) 0 ); // Damage max*/
                        p.Seek( 14, SeekOrigin.Current );
                        player.Tithe = p.ReadInt32();
                    }
                }
            }
        }
开发者ID:herculesjr,项目名称:razor,代码行数:56,代码来源:Handlers.cs

示例11: ReadPacket

        public void ReadPacket(PacketReader reader)
        {
            Unknown1 = reader.ReadInt32();
            Unknown2 = reader.ReadInt32();
            UserID = reader.ReadInt64();
            Shield = TimeSpan.FromSeconds(reader.ReadInt32());
            Unknown3 = reader.ReadInt32();
            Unknown4 = reader.ReadInt32();
            Compressed = reader.ReadBoolean();
            Home = new Village();
            Home.Read(reader);
            Unknown5 = reader.ReadInt32();

            UserID1 = reader.ReadInt64();
            UserID2 = reader.ReadInt64();

            var offset = 0x2A;
            bool isClan = reader.ReadBoolean();
            if (isClan)
            {
                Clan = new Clan();
                Clan.ID = reader.ReadInt64();
                Clan.Name = reader.ReadString();
                Clan.Badge = reader.ReadInt32();
                Unknown6 = reader.ReadInt32();
                Clan.Level = reader.ReadInt32();
                offset += 1;
            }

            bool Unknown7 = reader.ReadBoolean();
            if (Unknown7)
                Unknown8 = reader.ReadInt64();

            bool Unknown9 = reader.ReadBoolean();
            if (Unknown9)
                Unknown10 = reader.ReadInt64();

            reader.Seek(offset, SeekOrigin.Current);
            Unknown11 = reader.ReadInt32();
            Unknown12 = reader.ReadInt32();
            Unknown13 = reader.ReadInt32();

            ClanUnits = reader.ReadInt32();
            TownHall = reader.ReadInt32();
            Username = reader.ReadString();
            FacebookID = reader.ReadString();
            Stars = reader.ReadInt32();
            Points = reader.ReadInt32();

            Unknown14 = reader.ReadInt32();
            Unknown15 = reader.ReadInt32();
            Unknown16 = reader.ReadInt32();
            Unknown17 = reader.ReadInt32();

            Trophies = reader.ReadInt32();
            AttacksWon = reader.ReadInt32();
            Unknown18 = reader.ReadInt32();
            DefenseWon = reader.ReadInt32();
            Unknown19 = reader.ReadInt32();

            Unknown20 = reader.ReadInt32();
            Unknown21 = reader.ReadInt32();
            Unknown22 = reader.ReadInt32();

            bool Unknown23 = reader.ReadBoolean();
            if (Unknown23)
                Unknown24 = reader.ReadInt64();

            Unknown25 = reader.ReadByte();
            Unknown26 = reader.ReadInt32();
            Unknown27 = reader.ReadInt32();
            Unknown28 = reader.ReadInt32();
            Unknown29 = reader.ReadInt32();

            var count = reader.ReadInt32(); //storage
            for (int i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var capacity = reader.ReadInt32();
            }

            count = reader.ReadInt32(); //resources
            for (int i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var capacity = reader.ReadInt32();
            }

            count = reader.ReadInt32(); //units
            for (int i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var capacity = reader.ReadInt32();
            }

            count = reader.ReadInt32(); //spells
            for (int i = 0; i < count; i++)
            {
                var id = reader.ReadInt32();
                var capacity = reader.ReadInt32();
//.........这里部分代码省略.........
开发者ID:maithanhtan,项目名称:CoCSharp,代码行数:101,代码来源:VisitHomeResponsePacket.cs

示例12: OnRoomCreate

		private static void OnRoomCreate(Client client, PacketReader reader){
			//房间创建
			int port = reader.ReadInt32();
			bool needauth = reader.ReadBoolean();
			string room = reader.ReadUnicode(20);
			string banlist = reader.ReadUnicode(20);
			string info = reader.ReadUnicode(40);
			GameConfig2 config = new GameConfig2();
			config.Parse(info);
			config.Name = room;
			config.NeedAuth = needauth;
			config.DeulPort = port;
			config.BanList = banlist;
            config.RoomString = info;
            client.ServerRoomCreate(config);
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:16,代码来源:ClientEvent.cs

示例13: OnServerClose

		private static void OnServerClose(Client client, PacketReader reader){
			int port = reader.ReadInt32();
			int nport=reader.ReadInt32();
			Program.Config.DuelPort = nport;
			Program.Config.NeedAuth = reader.ReadBoolean();
			client.ServerClose(port);
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:7,代码来源:ClientEvent.cs

示例14: OnRoomList

		private static void OnRoomList(Client client, PacketReader reader){
			int count = reader.ReadInt32();
			List<GameConfig2> configs=new List<GameConfig2>();
			for(int i=0;i<count;i++){
                int port = reader.ReadInt32();
                bool needauth = reader.ReadBoolean();
                string name = reader.ReadUnicode(20);
				string banlist = reader.ReadUnicode(20);
				string info = reader.ReadUnicode(20);
                bool start = reader.ReadBoolean();
                GameConfig2 config =new GameConfig2();
				config.Parse(info);
				config.Name = name;
				config.BanList = banlist;
				config.DeulPort = port;
				config.NeedAuth = needauth;
                config.IsStart = start;
                config.RoomString = info;
				configs.Add(config);
			}
			client.ServerRoomList(configs);
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:22,代码来源:ClientEvent.cs

示例15: OnInfo

		private static void OnInfo(DuelServer server, PacketReader packet){
			int Port = packet.ReadInt32();
			bool NeedAuth = packet.ReadBoolean();
			server.Init(Port, NeedAuth);
			Logger.Info("duel server port="+Port+",needauth="+NeedAuth);
		}
开发者ID:247321453,项目名称:YgoServer,代码行数:6,代码来源:ServerEvent.cs


注:本文中的System.IO.PacketReader.ReadBoolean方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。