本文整理汇总了C#中PacketReader.ReadUTF8StringSafe方法的典型用法代码示例。如果您正苦于以下问题:C# PacketReader.ReadUTF8StringSafe方法的具体用法?C# PacketReader.ReadUTF8StringSafe怎么用?C# PacketReader.ReadUTF8StringSafe使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PacketReader
的用法示例。
在下文中一共展示了PacketReader.ReadUTF8StringSafe方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Realm_HandleRequestSession
/// <summary>
///
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
public static void Realm_HandleRequestSession( NetState netState, PacketReader packetReader )
{
RealmExtendData extendData = netState.GetComponent<RealmExtendData>( RealmExtendData.COMPONENT_ID );
if ( extendData == null )
{
Debug.WriteLine( "Realm_PacketHandlers.Realm_HandleRequestSession(...) - extendData == null error!" );
return;
}
if ( extendData.IsLoggedIn == false )
{
Debug.WriteLine( "Realm_PacketHandlers.Realm_HandleRequestSession(...) - extendData.IsLoggedIn == false error!" );
return;
}
uint iSerial = packetReader.ReadUInt32();
string strAccountName = packetReader.ReadUTF8StringSafe();
WowAccount wowAccount = WowAccountHandler.GetAccount( strAccountName );
if ( wowAccount == null )
{
netState.Send( new Realm_RequestSessionResultError( iSerial ) );
return;
}
SecureRemotePassword srp = SrpHandler.GetSRP( strAccountName );
if ( srp == null )
{
netState.Send( new Realm_RequestSessionResultError( iSerial ) );
return;
}
netState.Send( new Realm_RequestSessionResult( iSerial, wowAccount, srp ) );
}
示例2: ReadAuthLogonChallenge
/// <summary>
///
/// </summary>
/// <param name="packetReader"></param>
/// <returns></returns>
public static AuthLogonChallenge ReadAuthLogonChallenge( PacketReader packetReader )
{
AuthLogonChallenge authLogonChallenge = new AuthLogonChallenge();
authLogonChallenge.CommandID = packetReader.ReadByte();
authLogonChallenge.ErrorInfo = packetReader.ReadByte();
authLogonChallenge.PackSize = packetReader.ReadUInt16();
packetReader.ReadBuffer( ref authLogonChallenge.m_iGameName, 0, 4 );
authLogonChallenge.GameName = authLogonChallenge.m_iGameName.ConvertToString();
authLogonChallenge.Version1 = packetReader.ReadByte();
authLogonChallenge.Version2 = packetReader.ReadByte();
authLogonChallenge.Version3 = packetReader.ReadByte();
authLogonChallenge.Build = packetReader.ReadUInt16();
packetReader.ReadBuffer( ref authLogonChallenge.m_iPlatform, 0, 4 );
authLogonChallenge.Platform = authLogonChallenge.m_iPlatform.ConvertToString();
packetReader.ReadBuffer( ref authLogonChallenge.m_iOS, 0, 4 );
authLogonChallenge.OS = authLogonChallenge.m_iOS.ConvertToString();
packetReader.ReadBuffer( ref authLogonChallenge.m_iCountry, 0, 4 );
authLogonChallenge.Country = authLogonChallenge.m_iCountry.ConvertToString();
authLogonChallenge.TimeZoneBias = packetReader.ReadUInt32();
authLogonChallenge.IP = packetReader.ReadUInt32();
authLogonChallenge.AccountNameLength = packetReader.ReadByte();
// 不用了
//packetReader.ReadBuffer( ref authLogonChallenge.m_iAccountName, 0, authLogonChallenge.AccountNameLength );
//authLogonChallenge.AccountName = Utility.ByteArrayToString( authLogonChallenge.AccountName, 0, authLogonChallenge.AccountNameLength );
authLogonChallenge.AccountName = packetReader.ReadUTF8StringSafe();
return authLogonChallenge;
}
示例3: ReadWorldAuthSession
/// <summary>
///
/// </summary>
/// <param name="packetReader"></param>
/// <returns></returns>
public static AuthSession ReadWorldAuthSession( PacketReader packetReader )
{
AuthSession worldAuthSession = new AuthSession();
worldAuthSession.m_iClientBuild = packetReader.ReadUInt32();
worldAuthSession.m_iUnknown = packetReader.ReadUInt32();
worldAuthSession.m_strAccountName = packetReader.ReadUTF8StringSafe();
worldAuthSession.m_iClientSeed = packetReader.ReadUInt32();
packetReader.ReadBuffer( ref worldAuthSession.m_byteDigest, 0, 20 );
worldAuthSession.m_RealSize = packetReader.ReadUInt32();
if ( worldAuthSession.m_RealSize <= 0 )
{
Debug.WriteLine( "AuthSession.ReadWorldAuthSession(...) - worldAuthSession.m_RealSize <= 0 error!" );
return worldAuthSession;
}
if ( packetReader.Position + 5 > packetReader.Size )
{
Debug.WriteLine( "AuthSession.ReadWorldAuthSession(...) - packetReader.Position + 5 > packetReader.Size error!" );
return worldAuthSession;
}
byte[] outBuffer = null;
bool bIsOK = MemoryZip.ZlibDecompressor( packetReader.Buffer, (int)packetReader.Position, (int)packetReader.Size - (int)packetReader.Position, out outBuffer );
if ( bIsOK == false )
{
Debug.WriteLine( "AuthSession.ReadWorldAuthSession(...) - bIsOK == false error!" );
return worldAuthSession;
}
worldAuthSession.m_AddonInfo = new Word_AddonInfo( outBuffer );
return worldAuthSession;
}
示例4: World_HandleCharCreate
/// <summary>
///
/// </summary>
/// <param name="netState"></param>
/// <param name="packetReader"></param>
internal static void World_HandleCharCreate( NetState netState, PacketReader packetReader )
{
WorldExtendData extendData = netState.GetComponent<WorldExtendData>( WorldExtendData.COMPONENT_ID );
if ( extendData == null )
{
Debug.WriteLine( "World_PacketHandlers.World_HandleCharEnum(...) - extendData == null error!" );
return;
}
if ( extendData.IsLoggedIn == false )
{
Debug.WriteLine( "World_PacketHandlers.World_HandleCharEnum(...) - extendData.IsLoggedIn == false error!" );
return;
}
string strName = packetReader.ReadUTF8StringSafe();
byte iRace = packetReader.ReadByte();
byte iClass = packetReader.ReadByte();
byte iGender = packetReader.ReadByte();
byte iSkin = packetReader.ReadByte();
byte iFace = packetReader.ReadByte();
byte iHairStyle = packetReader.ReadByte();
byte iHairColor = packetReader.ReadByte();
byte iFacialHair = packetReader.ReadByte();
byte iOutFitId = packetReader.ReadByte();
if ( WorldPacketHandlers.VerifyName( strName ) == false )
{
netState.Send( new Word_CharCreateResponseError( ResponseCodes.CHAR_CREATE_NAME_IN_USE ) );
return;
}
if ( ProcessServer.WowZoneCluster.World.GlobalPlayerInfo.GetPlayerInfo( strName ) != null )
{
netState.Send( new Word_CharCreateResponseError( ResponseCodes.CHAR_CREATE_NAME_IN_USE ) );
return;
}
WowCharacterCreateInfo wowCharacterCreateInfo = ProcessServer.WowZoneCluster.World.GlobalCreateInfo.GetCreateInfo( iRace, iClass );
if ( wowCharacterCreateInfo == null )
{
netState.Send( new Word_CharCreateResponseError( ResponseCodes.CHAR_CREATE_NAME_IN_USE ) );
return;
}
if ( ( iRace == WowRace.BloodElf || iRace == WowRace.Draenei ) &&
extendData.CommonData.IsTBC == false )
{
netState.Send ( new Word_CharCreateResponseError ( ResponseCodes.CHAR_CREATE_NAME_IN_USE ) );
return;
}
WowCharacterLevelInfo[] wowCharacterLevelInfo = ProcessServer.WowZoneCluster.World.GlobalLevelInfo.GetLevelInfo( iRace, iClass );
if ( wowCharacterLevelInfo == null )
{
netState.Send( new Word_CharCreateResponseError( ResponseCodes.CHAR_CREATE_NAME_IN_USE ) );
return;
}
WowCharacter wowPlayerInfo = new WowCharacter();
wowPlayerInfo.Serial = 0;
wowPlayerInfo.IsTBC = extendData.CommonData.IsTBC;
wowPlayerInfo.AccountGuid = extendData.CommonData.AccountsGuid;
wowPlayerInfo.Name = strName;
wowPlayerInfo.Race = iRace;
wowPlayerInfo.Class = iClass;
wowPlayerInfo.Gender = iGender;
wowPlayerInfo.Skin = iSkin;
wowPlayerInfo.Face = iFace;
wowPlayerInfo.HairStyle = iHairStyle;
wowPlayerInfo.HairColor = iHairColor;
wowPlayerInfo.FacialHair = iFacialHair;
wowPlayerInfo.X = wowCharacterCreateInfo.PositionX;
wowPlayerInfo.Y = wowCharacterCreateInfo.PositionY;
wowPlayerInfo.Z = wowCharacterCreateInfo.PositionZ;
wowPlayerInfo.MapId = wowCharacterCreateInfo.Map;
wowPlayerInfo.ZoneId = wowCharacterCreateInfo.Zone;
wowPlayerInfo.BindX = 0;
wowPlayerInfo.BindY = 0;
wowPlayerInfo.BindZ = 0;
wowPlayerInfo.BindMapId = 0;
wowPlayerInfo.BindZoneId = 0;
ChrRacesEntry chrRacesEntry = DBCInstances.ChrRacesEntry.LookupIDEntry( iRace );
if ( chrRacesEntry == null )
{
netState.Send( new Word_CharCreateResponseError( ResponseCodes.CHAR_CREATE_NAME_IN_USE ) );
return;
}
if ( chrRacesEntry.m_TeamId == 7 )
//.........这里部分代码省略.........
示例5: Word_AddonInfo
/// <summary>
///
/// </summary>
public Word_AddonInfo( byte[] unPacked )
: base( (long)WordOpCode.SMSG_ADDON_INFO, 0 )
{
WriterStream.Write( (ushort)0 /* 2 + 4 */ ); // Size
WriterStream.Write( (ushort)WordOpCode.SMSG_ADDON_INFO ); // ID
//////////////////////////////////////////////////////////////////////////
string name = string.Empty;
ushort Enable = 0; // based on the parsed files from retool
uint crc = 0;
uint unknown = 0;
PacketReader packetReader = new PacketReader( unPacked, unPacked.Length, 0 );
while ( packetReader.Position < packetReader.Size )
{
name = packetReader.ReadUTF8StringSafe();
Enable = packetReader.ReadUInt16();
crc = packetReader.ReadUInt32();
unknown = packetReader.ReadUInt32();
if ( name == null || name == string.Empty )
continue;
LOGs.WriteLine( LogMessageType.MSG_HACK, "Word_AddonInfo...... {0} {1} {2} {3} {4} {5}", name, Enable, crc, unknown, packetReader.Position, packetReader.Size );
// Hacky fix, Yea I know its a hacky fix I will make a proper handler one's I got the crc crap
//if ( crc != 0x4C1C776D ) // CRC of public key version 2.0.1
{
//LOGs.WriteLine( LogMessageType.MSG_HACK, "Word_AddonInfo...... 0 " );
//WriterStream.Write( PublicKey, 0, PublicKey.Length/*264 大小*/ ); // part of the hacky fix
}
//else
{
LOGs.WriteLine( LogMessageType.MSG_HACK, "Word_AddonInfo...... 1 " );
WriterStream.Write( (byte)0x02 );
WriterStream.Write( (byte)0x01 );
WriterStream.Write( (byte)0x00 );
WriterStream.Write( (uint)0x00 );
WriterStream.Write( (byte)0x00 );
}
}
//////////////////////////////////////////////////////////////////////////
WriterStream.Seek( 0, SeekOrigin.Begin );
WriterStream.Write( (ushort)ByteOrder.NetToHost( (ushort)( WriterStream.Length - 2/*Size本身的大小*/ ) ) );
}