Files
Hippolyzer/pyogp/lib/base/message/message_template_builder.pyc

47 lines
6.5 KiB
Plaintext
Raw Normal View History

<EFBFBD><EFBFBD>
5ӉHc@stddkZddklZlZlZddklZlZlZl Z ddk
l Z de fd<00><00>YZ dS(i<><69><EFBFBD><EFBFBD>N(tMsgDatat MsgBlockDatatMsgVariableData(tMsgTypet MsgBlockTypet MsgFrequencytsizeof(t
DataPackertMessageTemplateBuildercBsMeZdZd<00>Zd<00>Zd<00>Zd<00>Zd<00>Zd<00>Zd<00>Z RS(s<> This class builds messages at its high level, that is, keeping
that data in data structure form. A serializer should be used on
the message produced by this so that it can be sent over a network. cCsF||_d|_d|_d|_d|_d|_t<00>|_dS(Nt( t template_listtNonetcurrent_templatet current_msgt current_blockt cur_msg_nametcur_block_nameRtpacker(tselft template_dict((s\c:\builds\latest_pyogp\src\pyogp.lib.base\pyogp\lib\base\message\message_template_builder.pyt__init__s      cCs<>d}d}|idjodSn|ii}||7}|t|<00>7}xF|ii<00>D]5}|i||i<00>\}}||7}||7}qZW||fS(s\ Builds the message by serializing the data. Creates a packet ready
to be sent. R iN(R R t msg_num_hextlent
get_blockst build_blockR (Rt
msg_buffertbytest pack_freq_numtblockt packed_blockt
block_size((s\c:\builds\latest_pyogp\src\pyogp.lib.base\pyogp\lib\base\message\message_template_builder.pyt build_messages
 

cCsnd}d}|i|i<00>}t|<00>}|d}|itijoK|i|ijo4td|idt|<00>d|id<17><00>q<>n|iti jo'|t
i d|i<00>7}|d7}nx<>|D]<5D>}x<>|i <00>D]v} |i | i<00>}
|
i} | d jo1td
|
id |id |id <17><00>n|
itijo<>|i |
i<00>i} | djo|t
i d| <00>7}ne| djo|t
i d| <00>7}n>| djo|t
i d| <00>7}ntdt| <00><17><00>|| 7}n|
idjoF| djo9|ii|
i|
i<00>} || 7}|t| <00>7}q<>q<>Wq<57>W||fS(NR isBlock sM is type MBT_MULTIPLE but only has data stored for s out of its s blockss>Bii<><69><EFBFBD><EFBFBD>s Variable s
in block s of message s& wasn"t set prior to buildMessage callis>His>Is\Attempting to build variable with unknown size of (t get_blocktnameRttypeRt MBT_MULTIPLEt block_numbert Exceptiontstrt MBT_VARIABLEtstructtpackt get_variablest get_variabletsizeRt MVT_VARIABLEtdataR Rt pack_data(Rttemplate_blockt message_datat block_bufferRt
block_listt block_countt message_blockRtvtvariabletvar_sizet data_sizeR.((s\c:\builds\latest_pyogp\src\pyogp.lib.base\pyogp\lib\base\message\message_template_builder.pyR<sL 
5       
cCse|i||_t|<00>|_||_x6|ii<00>D]%}t|i<00>}|ii|<00>q8WdS(s<> Creates a new packet where data can be added to it. Note, the variables
are added when they are used, or data added to them, so to make sure
no bad data is sent over the network. N( R
R RR RRRR!t add_block(Rt message_nameRt
block_data((s\c:\builds\latest_pyogp\src\pyogp.lib.base\pyogp\lib\base\message\message_template_builder.pyt new_messagexs cCs<>||iijodSn|ii|<00>}|ii|<00>d}|idjo_d|_||_||_x9|i<00>D]+}t|i |i
<00>}|ii |<00>q{WdSn<53>|i
t i jotd<00><00>n7|i
t ijo#|i|ijotd<00><00>n|id7_t|<00>|_|ii|i<00>||_x9|i<00>D]+}t|i |i
<00>}|ii |<00>qRWdS(Niis=ERROR: can"t have more than 1 block when its supposed to be 1s)ERROR: we are about to exceed block total(R t block_mapR R R$RRR*RR!R"t add_variableRt
MBT_SINGLER%R#RR:(Rt
block_nameR0R<R7tvar_data((s\c:\builds\latest_pyogp\src\pyogp.lib.base\pyogp\lib\base\message\message_template_builder.pyt
next_block<63>s4      cCs |idjotd<00><00>n|idjotd<00><00>n|ii|i<00>i|<00>}|djotd<00><00>nt|<00>}|ti jo/t
|<00>}|i }|ii |||<00>nC|i |||<00>tjotd<00><00>n|ii |||<00>dS(s<> the data type is passed in to make sure that the programmer is aware of
what type (and therefore size) of the data that is being passed in. s(Attempting to add data to a null messages&Attempting to add data to a null blocksVariable is not in the blocks1Variable size isn"t the same as the template sizeN(R R R%RR RR+RRR-RR,tadd_datat#_MessageTemplateBuilder__check_sizetFalse(Rtvar_nameR.t data_typettemplate_variableR,R9((s\c:\builds\latest_pyogp\src\pyogp.lib.base\pyogp\lib\base\message\message_template_builder.pyRD<00>s    cCsG|i|ii|i<00>}|i|<00>i}||jotSntS(N(R
RR RR+R,RFtTrue(RRGR.R9RR,((s\c:\builds\latest_pyogp\src\pyogp.lib.base\pyogp\lib\base\message\message_template_builder.pyt __check_size<7A>s
 (
t__name__t
__module__t__doc__RRRR=RCRDRE(((s\c:\builds\latest_pyogp\src\pyogp.lib.base\pyogp\lib\base\message\message_template_builder.pyR s < ) "(R(t'pyogp.lib.base.message.message_templateRRRt$pyogp.lib.base.message.message_typesRRRRt"pyogp.lib.base.message.data_packerRtobjectR(((s\c:\builds\latest_pyogp\src\pyogp.lib.base\pyogp\lib\base\message\message_template_builder.pys<module>s "