public void Init( body2_SC_POST_ADDRESS_BOOK info) { Color textColor = ( true == info.bConnect) ? Color.black : Color.gray; nameText.Text = info.szCharName; nameText.Color = textColor; levelText.Text = info.nLevel.ToString(); levelText.Color = textColor; switch( info.eClass) { case eCLASS.DIVINEKNIGHT: classText.Text = AsTableManager.Instance.GetTbl_String(1054); break; case eCLASS.MAGICIAN: classText.Text = AsTableManager.Instance.GetTbl_String(1055); break; case eCLASS.CLERIC: classText.Text = AsTableManager.Instance.GetTbl_String(1057); break; case eCLASS.HUNTER: classText.Text = AsTableManager.Instance.GetTbl_String(1056); break; case eCLASS.ASSASSIN: classText.Text = AsTableManager.Instance.GetTbl_String(1058); break; default: classText.Text = "Error"; break; } classText.Color = textColor; }
public new void PacketBytesToClass( byte[] data) { Type infotype = this.GetType(); FieldInfo headerinfo = null; int index = ParsePacketHeader( data); // eResult byte[] result = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "eResult", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, result, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( result, 0)); index += sizeof( Int32); // eType byte[] type = new byte[ sizeof( Int32)]; headerinfo = infotype.GetField( "eType", BINDING_FLAGS_PIG); Buffer.BlockCopy( data, index, type, 0, sizeof( Int32)); headerinfo.SetValue( this, BitConverter.ToInt32( type, 0)); index += sizeof( Int32); // nMaxPage headerinfo = infotype.GetField( "nMaxPage", BINDING_FLAGS_PIG); headerinfo.SetValue( this, data[ index++]); // nCnt headerinfo = infotype.GetField( "nCnt", BINDING_FLAGS_PIG); headerinfo.SetValue( this, data[ index++]); // body body = new body2_SC_POST_ADDRESS_BOOK[ nCnt]; for( int i = 0; i < nCnt; i++) { body[i] = new body2_SC_POST_ADDRESS_BOOK(); index = body[i].PacketBytesToClass( data, index); } }