1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
E´zNc@sddlZddlTddlZddlZddlZd„Zd„Zd„Zd„Zd„Z    d„Z
d    „Z d
„Z d „Z d „Zd „Zd„Zd„Zdadad„Zd„Zd„ZeejjdeejjdƒƒdS(iÿÿÿÿN(t*cCs|tjd|ƒ7}|S(NtB(tstructtpack(tbuftvalue((s.\\RouterInfo.pyt    WriteBYTE
scCs|tjd|ƒ7}|S(NtH(RR(RR((s.\\RouterInfo.pyt    WriteWORDscCs|tjd|ƒ7}|S(NtI(RR(RR((s.\\RouterInfo.pyt
WriteDWORDscCs|tjd|ƒ7}|S(Ntf(RR(RR((s.\\RouterInfo.pyt
WriteFloatscCs|tjd|ƒ7}|S(Ntd(RR(RR((s.\\RouterInfo.pyt WriteDoublescCs|tjd||ƒ7}|S(Ns%ds(RR(RtlenR((s.\\RouterInfo.pyt WriteStringscCs-tjd||ƒ}|d7}|d|fS(NRii(Rt unpack_from(RtpostcurValue((s.\\RouterInfo.pytReadBYTE$s
cCs-tjd||ƒ}|d7}|d|fS(NRii(RR(RRR((s.\\RouterInfo.pytReadWORD)s
cCs-tjd||ƒ}|d7}|d|fS(NR    ii(RR(RRR((s.\\RouterInfo.pyt    ReadDWORD.s
cCs-tjd||ƒ}|d7}|d|fS(NR ii(RR(RRR((s.\\RouterInfo.pyt    ReadFloat3s
cCs-tjd||ƒ}|d7}|d|fS(NR ii(RR(RRR((s.\\RouterInfo.pyt
ReadDouble8s
cCs1tjd|||ƒ}||7}|d|fS(Ns%dsi(RR(RRt_lenR((s.\\RouterInfo.pyt
ReadString=s
cCs%|}d}d}yùt||ƒ\}}|dkr?dGH|St||ƒ\}}||t|ƒkrsdGH|St||ƒ\}}t||ƒ\}}t||ƒ\}}t||ƒ\}}t||ƒ\}}t||t|ƒ|ƒ\}}t|ƒ}WntjƒGH|SX|S(NtiiÿÌsPackHead not the 0xCCFFsPackLen Wrong!(RRRRRtstrt    tracebackt
format_exc(tdataRtrecvdataRtPackHeadtpacklentcurPack((s.\\RouterInfo.pyt    PackParseBs. " Ric
Csid}t|dƒ}t|dƒ}t|dƒ}t|dƒ}t|dƒ}t|dƒ}t|dƒ}t|ƒ}d}t||ƒ}||}d}d}t||ƒ}||}d}xtrddGH|j|ƒd    GH|jtƒ}|sqÈnt|ƒ}    |    |kr#d
GHqÈny|j    t
|    ƒƒWnd t GHt j d ƒdSXd GHPqÈWdS(NRiiiii%iÿÌsÇëÇó°æ±¾ÖС£¡£¡£¡£s½ÓÊÜ°æ±¾ÖС£¡£¡£¡£sÊý¾Ý²»ÍêÕû,Öؽӡ£¡£¡£¡£sWrite %s failedtpausesWrite SoftVersion OK(R
RRRtTruetsendtrecvtBUFSIZR$twriteRt fullfilenametostsystem(
tsClienttfResultRtdatalentheadt
__PackHeadR!R tdataRecvt
resultData((s.\\RouterInfo.pytGetServerVersioncsH 
 
            c
Csid}t|dƒ}t|dƒ}t|dƒ}t|dƒ}t|dƒ}t|dƒ}t|dƒ}t|ƒ}d}t||ƒ}||}d}d}t||ƒ}||}d}xtrddGH|j|ƒd    GH|jtƒ}|sqÈnt|ƒ}    |    |kr#d
GHqÈny|j    t
|    ƒƒWnd t GHt j d ƒdSXd GHPqÈWdS(NRiiiii)iÿÌsÇëÇó·ÖÏßIDÖС£¡£¡£¡£s½ÓÊÜ·ÖÏßIDÖС£¡£¡£¡£sÊý¾Ý²»ÍêÕû,Öؽӡ£¡£¡£¡£sWrite %s failedR%sWrite LineID OK(R
RRRR&R'R(R)R$R*RR+R,R-(
R.R/RR0R1R2R!R R3R4((s.\\RouterInfo.pyt    GetLineID‘sH 
 
            cCs
|G|GHtjjtjƒdƒs5tjdƒny#tjƒdattdƒ}WndtGHtjdƒdSX|}|}||f}y tt    t
ƒ}|j |ƒWn$d||fGHtjdƒdSXt ||ƒt ||ƒ|jƒ|jƒdS(Ns//RouterInfoResulttRouterInfoResults\RouterInfoResult\Result.txttwsCan not open %s in w modeR%s+Can't Connect To Server. IP = %s, Port = %s(R,tpathtisdirtgetcwdtmakedirsR+topenR-tsockettAF_INETt SOCK_STREAMtconnectR5R6tclose(tIPtPorttfiletHOSTtPORTtADDRt
tcpCliSock((s.\\RouterInfo.pytprocessÂs2             
 
ii(R,R>RtbinasciiRRRR
R RRRRRRRRR$R+R)R5R6RJtsystargvtint(((s.\\RouterInfo.pyt<module>s. 
                                                           .    1    #