Server.Network.PacketReader.ReadString C# (CSharp) Méthode

ReadString() public méthode

public ReadString ( ) : string
Résultat string
		public string ReadString()
		{
			StringBuilder sb = new StringBuilder();

			int c;

			while ( m_Index < m_Size && (c = m_Data[m_Index++]) != 0 )
				sb.Append( (char)c );

			return sb.ToString();
		}

Same methods

PacketReader::ReadString ( int fixedLength ) : string

Usage Example

        private static void BountyEntryResponse( NetState ns, PacketReader pvSrc )
        {
            Mobile from = ns.Mobile;
            if ( from == null )
                return;
            Mobile killer = World.FindMobile( (Serial)pvSrc.ReadInt32() );
            byte typeid = pvSrc.ReadByte();
            byte index = pvSrc.ReadByte();
            bool cancel = pvSrc.ReadByte() == 0;
            short responseLen = pvSrc.ReadInt16();
            string resp = pvSrc.ReadString();

            if ( killer != null && !cancel )
            {
                int bounty = Utility.ToInt32( resp );
                if ( bounty > 5000 )
                    bounty = 5000;
                bounty = from.BankBox.ConsumeUpTo( typeof( Gold ), bounty, true );

                killer.Kills++;
                if ( killer is PlayerMobile && bounty > 0 )
                {
                    PlayerMobile kpm = (PlayerMobile)killer;
                    kpm.Bounty += bounty;
                    killer.SendAsciiMessage( "{0} has placed a bounty of {1}gp on your head!", from.Name, bounty );
                    if ( kpm.Bounty >= 5000 && kpm.Kills > 1 && kpm.BankBox.Items.Count > 0 && kpm.Karma <= (int)Noto.Dark )
                    {
                        killer.SayTo( killer, true, "A bounty hath been issued for thee, and thy worldly goods are hereby confiscated!" );
                        kpm.Bounty += EmptyAndGetGold( killer.BankBox.Items );
                    }
                }
            }

            SendNext( from );
        }
All Usage Examples Of Server.Network.PacketReader::ReadString