找回密碼
 立即注册

CSUpdate.exe源代码

[複製鏈接]
洛小枫 發表於 2018-1-26 20:48:40 | 顯示全部樓層 |閱讀模式

0 e7 V3 _; g% h! G
  1. / RevApp.cpp : Defines the class behaviors for the application.% F( L& l- C3 H
  2. //
    * h0 k7 x/ n: \$ p

  3. 3 E8 x. s  H! b% R5 Y3 n  B$ @
  4. #include "stdafx.h"- [4 {2 {1 e# N
  5. 1 I- Q% t  r6 _$ n
  6. //#define UNICODE/ c) W* y) }- P: w/ V$ j* H! E
  7. //#include <gdiplus.h>4 A- E' D! p& ~8 H$ p: X4 J( F
  8. //using namespace Gdiplus;
    2 o# c  {9 L2 _5 U3 I, [5 M

  9. % L+ n& \( _9 r, k* d* V. k, s
  10. #include "RevApp.h"! p) E3 E# F! C; x
  11. #include "RevAppDlg.h"
    . l' O1 G- m$ o4 _
  12. ( {! B" M2 P; w$ r9 R; V9 \7 U; E
  13. #pragma warning(disable:4786)
    : D7 T( R" Q% h8 y
  14. #include <map>
    : d* b) L" [; `- g3 e: |3 k3 i
  15. #include <list>
    # M- b9 e! n. C! ^! m- [1 s$ r
  16. #include <direct.h>
    / z( ?- h' @) I/ p
  17. 3 n% r7 n8 }# S# ]
  18. #ifdef _DEBUG( T4 u/ |3 x+ I4 K
  19. #define new DEBUG_NEW9 M8 m' i0 o, F
  20. #undef THIS_FILE+ W2 B: b' q5 _+ Z8 H1 v
  21. static char THIS_FILE[] = __FILE__;
    & i% B" n; S# N7 ]' Q
  22. #endif4 B* b# U5 R' r4 K0 A
  23. #include "SkinResDef.h"
    9 ^9 R, Q' D% j$ P* m" H
  24. #include "ChangeBG.h"
    ( z. d! ^9 x% B2 j$ \$ b
  25. #include "AFXINET.H"3 c- L3 k  b* x) U! E3 e
  26. ! e8 i* C- Z+ @6 m
  27. #define TRADITIONAL_CHINESE 0
    * i  y! W5 o: A9 N* _1 e
  28. #define SIMPLIFY_CHINESE 1' W# J5 d: W6 n% r- O3 p
  29. #define ENGLISH 2
    : P8 M  j  K% S. \
  30. int m_iLanguage = ENGLISH;
    5 ?) C. N8 u# r! l& ]
  31. /////////////////////////////////////////////////////////////////////////////
    * a! t- |2 r4 T* h# U7 g- ^- e
  32. // CRevAppApp
    # e& J' b+ P& Q& V
  33. / o4 `5 I- g6 t! ^/ |7 ?, z
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)  @4 y7 F# ~# Y( O) t$ N
  35.         //{{AFX_MSG_MAP(CRevAppApp)4 `/ l; [4 Y% r& s. G; F0 H  @
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.+ B3 T1 S: @) B. u8 L* E: H
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!
    7 i  y# c- E' n! }
  38.         //}}AFX_MSG7 ]  m$ G% `) @) r) v
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)
    ! y3 X  G( E! [, |  ]
  40. END_MESSAGE_MAP()
    2 m# |2 D: v+ ]' A
  41. , t; m9 Q9 F; }! u" J, V/ O3 r
  42. /////////////////////////////////////////////////////////////////////////////
    2 @3 U% m- t5 s! [$ I  f
  43. // CRevAppApp construction, b  I0 A$ L, M4 q
  44. , h( |) s# T2 x7 n( q, P
  45. CRevAppApp::CRevAppApp()
    : A# Q9 a4 z# r) k/ w" q6 T& _2 p
  46. {& w: ?! k& S% Y
  47.         // TODO: add construction code here,
    * d4 e2 t8 e2 n: I: P. I
  48.         // Place all significant initialization in InitInstance
    ' k  r3 W) o" ?, {7 n* {! t- M
  49.   bDisplayIsBig5=FALSE;# D' Z: E; n+ E$ |+ F& ~
  50.   bRestartUpdater=FALSE;
    4 v' ~, u  E6 O8 B6 e' P
  51.   bFinishUpdated=FALSE;
    , ~. W* J/ `2 B
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;
    1 P" f6 a, I3 |, g! b
  53.   InitChangeDataBig52GBKS();
    . T6 a0 B. m& n+ q( X
  54.   InitChangeDataGBKS2Big5();; X; K! _4 B! F, O3 `
  55.         //
    5 ?* Q0 L) b* W8 W0 a8 N: S# d$ a
  56.         bClickRunExe = FALSE;
    # a: N0 P& u8 g9 E
  57.         /// b) Y, `8 t( l, E( p6 y' I- B. I
  58. }
    / V5 Z" J! T0 v

  59. 7 @6 e+ R5 [$ ?% H& j
  60. CRevAppApp::~CRevAppApp()
    + P2 g$ Z4 {' s7 y
  61. {
    ! [) [# ?# {! o& B0 ?4 j# c
  62.         // TODO: add construction code here,
    1 O1 Q& q+ }+ t( ]: w
  63.         // Place all significant initialization in InitInstance
    & K' S$ m& ]$ @4 O
  64.   EndChangeData();' h3 b: ~! B# l4 S
  65. }$ S  @9 p7 d3 m/ l5 |( h0 `+ h
  66. * N5 @4 M  r9 a) A# F
  67. /////////////////////////////////////////////////////////////////////////////1 ?$ Y9 Q: k( o- |
  68. // The one and only CRevAppApp object
    9 a) d* ?1 Y5 i( |
  69. 5 M4 Z8 u1 K9 }1 m# s( K& w* Y3 A. A
  70. CRevAppApp theApp;
    : y* v3 x4 h/ T# L& N" L0 i
  71. 8 K5 F5 n& w0 w
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)
    + X" ~2 G4 d5 |( {7 j9 q
  73. {3 ?/ d- x8 Q. t
  74.   int iEOF=0;
    , [+ u( R. g1 m$ Y( @
  75.   char szTempName[MAX_PATH];) _: }3 J: E3 H) T  r, T. `- ^  Q
  76.   *szFileName=0;
    / w- d: t& l+ z, z, e: P9 E
  77.   iEOF=fscanf(fp,"%s",szTempName);% [5 E9 c# K5 s5 u4 x7 P
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')& C$ U  Q# V  R6 S
  79.   {
      ]  n* i% |4 r  J' y0 |9 T* g
  80.     strcpy(szFileName,&szTempName[1]);
    1 `6 C% _3 O; N. x. w( \
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)
    : K8 o5 w( }5 O' d! ]5 U
  82.     {2 H: E/ F  h: C! a
  83.       iEOF=fscanf(fp,"%s",szTempName);5 I) N& O% \8 H* L( K
  84.       strcat(szFileName," ");
    2 c8 E% K% ^+ }! g$ j
  85.       strcat(szFileName,szTempName);! @$ K, u; t2 F3 Z% d9 P& x  N
  86.     }5 {$ r$ @, P% z: `$ s! u) Q
  87.     if(strlen(szFileName)>=1)6 _7 V8 a& M7 h* h% e
  88.     {
    / }  E9 s' R* V* O& O! Z
  89.       szFileName[strlen(szFileName)-1]=0;/ s% ?, P( [  J2 j" L  l
  90.     }, _% }6 Z2 N# `1 M
  91.   }7 X/ W3 P" ?8 {/ Y) O
  92.   return szFileName;$ [- u9 M; D. m" y( `- g
  93. }
    5 X, |* i$ e+ }
  94. + j0 z+ L7 k7 E' P, v
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)/ }4 W) u2 p) t1 D; P
  96. {0 S0 c1 B8 |, K7 e! J0 i0 ~
  97.   FILE *fp;
    + {! i4 Z  @6 \0 e
  98.   char *key=NULL;
    3 \! s9 |6 H: y- M6 }# @
  99.   char version[MAX_PATH];& S8 n+ K9 w; j2 T* [& t4 R
  100.   LPUPDATEFILE file,olds;
    " k8 n8 O  q& A1 ?, b
  101.   std::map<CString,LPUPDATEFILE>::iterator p;4 I- c1 `! e) U% q  K8 d4 }. A6 {

  102.   d5 B* z, G$ C! p5 r! O
  103.   UpdateList.clear();+ Q& b/ K0 N4 o$ K# g, u" E
  104.   UpdateFile.clear();
    9 A7 T  {$ O3 k
  105.   if(GetFileAttributes(filename)==-1) return false;% }7 V" z; ~+ f* [: [6 H4 j
  106.   if(!(fp=fopen(filename,"r"))) return false;" m: E; A: L, Z- {! W, R% R1 t
  107.   fscanf(fp,"%s",version);  c5 A0 y' @& ], `. K1 |  ^; r  j' l
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }4 G7 }2 D0 o/ Z0 J! D
  109.   while(fscanf(fp,"%s",version)!=EOF)0 n5 I  b$ q3 x- k  C- i
  110.   {" j4 O$ C% G" V4 Y4 N
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));! R3 I& `6 X+ O, g# r
  112.     fscanf(fp,"%s",file->path);
      T1 e' u4 h+ X  {/ G; \2 S
  113.     ReadFileNames(fp,file->file);
      K8 F" V3 R+ L1 D1 j5 |9 N1 S
  114.     strcpy(file->full,".");
    ( o- k( `) n3 r! i- u. Q$ U% x+ \
  115.     strcat(file->full,file->path);, p" {6 X4 ?" h( N2 E1 t
  116.     strcat(file->full,file->file);8 m" X# v: L% x1 g6 O' ~
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())7 m# N* K6 H- x# U4 W
  118.     {
    9 s) @: z. j8 K! {5 s/ Y
  119.       file->vers=(float)atof(version);
    - }5 J! W: Z5 D; @9 {9 k9 y6 _
  120.       UpdateList.push_back(file->full);
    * r4 W! L! y  x& g; f' e6 [
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));
    6 t" @* @! |( o+ A2 r
  122.     }
    2 N/ t  U# R9 n5 j) A
  123.     else
    : ?& D4 i8 ~# \" F4 @& {) V* `
  124.     {0 M  M3 R7 ~. f. g5 J& \
  125.       olds=(*p).second;
    " i6 \+ @- W! D
  126.       if(olds->vers<(float)atof(version))
    7 r3 Z) q4 Q) f% x: a
  127.       {* v9 }$ Z) M, B. m4 S  g
  128.         olds->vers=(float)atof(version);
    7 z0 A3 N5 r- q; K% \
  129.       }3 f" D) l7 d  t: L
  130.       free(file);
    3 N2 J8 U" g$ f; z4 i
  131.     }: p  Z5 V* v! Y; ]& l$ U
  132.   }6 B7 ^% H3 W9 g* Y% `# f5 q
  133.   fclose(fp);
    + C5 H8 A9 f3 ?! p( ]. }/ ]. e
  134.   return true;
    & d8 s: }1 R) ^) U8 Y. }+ W
  135. }) z, o9 I8 N: k% T( Q% t# K* n
  136. - S+ S4 E% Y( G2 v
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)
    & v6 x) P: @& J0 S0 H
  138. {
    7 K- e7 |7 }7 r! t5 B
  139.   TCHAR  szFull[MAX_PATH];
    * R) H: i+ ^8 F% E: p7 E/ y9 G
  140.   TCHAR *token,*inter;9 w3 V* I5 P6 K. m# h" p0 U) m
  141.   *szPath=0;
    : h4 K' h$ C3 d" q6 _
  142.   strcpy(szFull,szFullPath);+ w+ q% B* Z. d
  143.   token=strtok(szFull,"\\/");
    ( s# \, o! G1 R$ g( O3 l( S
  144.   inter=token;# U$ K8 S2 y) C( X, P5 g  j2 n
  145.   while(token=strtok(NULL,"\\/"))
    2 s, O. L0 f; R7 |" \1 H, m  u3 o
  146.   {
      I# V* P% f* F
  147.     strcat(szPath,inter);2 T* R+ d% s3 k7 p
  148.     strcat(szPath,"\");0 f% L* X, T( K- C% }3 @# N! o6 M
  149.     inter=token;- U& Q+ w  R* s6 k
  150.   }
    " @# {6 _# J  Q0 J
  151.   return strlen(szPath);
    * U4 Y: W6 H. E0 i" T* D5 K
  152. }7 D  F: r  D1 ~0 J2 y9 F

  153. . ]5 }2 |/ o2 _6 J) s6 a  a8 Z
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase)
    4 W& s6 ~* y# Q6 t
  155. {: z, D" H( i$ S3 g5 _8 J
  156.   DWORD attrib=GetFileAttributes(Target);
    7 V' V: M* z4 M& n, G2 a! {" }7 p
  157.   if(attrib!=-1)
    # a  }6 X; i0 r- u8 p
  158.   {! K7 W  i8 L1 S1 Z' c. `' e+ t
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY)); z/ _' @! f+ b' l( i- a
  160.     {4 O7 |5 v4 w* y
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);
    % E0 r1 q3 D" S: U- O
  162.       SetFileAttributes(Target,attrib);+ |; O8 L; H. Q% l+ a7 u- o; S
  163.     }
    # x  I( n& F5 h# e% i" T' z
  164.   }" R  d; ^9 m) ]3 W
  165.   CopyFile(Source,Target,Erase);
    4 u: k) f; F/ `' [
  166. }
    0 q1 E3 ?% ?+ Y* Q+ i

  167. & T# _9 J/ \1 ~- l8 \, q
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)  r. H$ ]) F0 `: w
  169. {, O& K* t& V8 m, Y
  170.      FILE *fp;
    . Q+ f! B5 r- Z  s3 G1 x2 l! H4 S
  171.      char  szBuffer[8192];+ C/ x, S9 B  z/ S  p% M& W
  172.   va_list  argptr;
    " o3 b0 \" Z" C# j

  173. , k; f, R- d5 c, q+ _
  174.         va_start(argptr,message);0 E$ r9 E* J, d* _
  175.         vsprintf(szBuffer,message,argptr);  s8 h% G: j! X" q5 S0 b  E
  176.         va_end(argptr);
    3 e1 O) ~5 E' `" o
  177.   fp=fopen(FileName,"a");
    9 a. `. ?+ X2 Z! _, \) a0 o
  178.   if(fp)
    7 z1 ^( D3 y2 x9 G$ h+ K
  179.   {8 V5 H2 k. h% {; Z# M
  180.     fprintf(fp,szBuffer);
    ! a2 E/ ~0 J; {/ {( U- C
  181.     fclose(fp);/ m' K5 y2 q; ?  S% }
  182.           _flushall();
    ! k# [" [0 Q* P
  183.   }
    : ]9 o- |; F1 W+ c# `9 }) q
  184. }
    3 ]; d6 I, I- E' B2 ~

  185. ) J7 c. Y4 `( P
  186. BOOL CRevAppApp::Fclearf(char *FileName)- m: {( {; B$ R+ a
  187. {$ o4 y! _$ I8 ^( `
  188.      FILE *fp;& y3 w# I7 F) |( B) q  c' ^5 d
  189.     DWORD  attrib;
    ) a& o$ n/ W2 b" c1 M/ S
  190.   attrib=GetFileAttributes(FileName);
    " U1 l3 V7 i2 V* U
  191.   if(attrib!=-1)
    8 h5 y; h, c& q/ d6 z
  192.   {) x5 [6 }1 }/ Y- M. B9 |: z
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);; f7 ~1 N; g0 H
  194.     if(!SetFileAttributes(FileName,attrib))8 c2 o5 b( P6 Q3 k& r
  195.     {+ c; a4 Q" N/ P$ }! D
  196.       return FALSE;$ o$ ?* R1 {* D& ]9 ]
  197.     }* b& x. }6 p9 U) o7 i" b
  198.   }) v: p0 q# K2 i3 L
  199.   fp=fopen(FileName,"wb");- F, D* e. }. f6 s: E2 w
  200.   if(fp)4 S$ U, P2 c+ E( e
  201.   {/ u6 H5 W# O4 B) B+ C* ^
  202.     fclose(fp);# j* B% Y. l8 F! a  D
  203.   }" _" _; i0 b3 W! |
  204.   return TRUE;
    1 w5 U# O. ?7 `$ T: h9 m
  205. }
    & T+ B- A* U5 Q& q# L: D  F1 J$ p

  206. 9 H3 Y0 i' w5 v* x6 ~0 U
  207. BOOL CRevAppApp::UpdateLocalVersion(void)
      h8 `2 m  t0 R2 B
  208. {4 o6 h2 C" b( L6 _' P
  209.   char filename[MAX_PATH];+ u; B3 W6 ?) s+ n9 M$ R* `2 t
  210.   LPUPDATEFILE file,olds;! O' m1 C" z, \% A
  211.   std::map<int,CString>::iterator i;
    1 K( r+ F* c& @, G* c& b6 g) l/ Q* p
  212.   std::map<CString,LPUPDATEFILE>::iterator p;. N$ ^) t# C  d/ h1 f
  213.   std::list<CString>::iterator l;4 \; B6 f9 S* R/ A' R

  214. , b. z/ M( P% Q  O
  215.   if(bFirstUpdate)* e, f  l4 S" z8 C) m6 h
  216.   {
    1 M" u' o6 Y4 l$ k
  217.     dwCurrFile=0;
    7 ~& K9 p' ?7 o. B+ s  ]+ N4 m
  218.     bFirstUpdate=FALSE;% L$ `; C/ u# n- B# ]8 J
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())( B/ h6 [( [1 H$ X' S! J& d6 Z
  220.     {
    - O. `7 B% g6 d* a4 p: t
  221.       dwTotalFiles=UpdateLocal.size();* T9 Q7 h* m2 w9 W9 |- g) {
  222.       dwDownLoaded=0;
    9 a' T( ~1 {, i  D3 _3 X9 L8 F8 h
  223.       bSilentStep=FALSE;  c& F4 F# n' i: b/ Z1 y
  224.       bCompressed=TRUE;
    $ N$ n8 j1 R  h4 B0 B- x
  225.       strExtLocal.Empty();" H# V& v8 [+ |/ C
  226.       strFullName=(*i).second;5 f/ h$ v+ \; D/ d
  227.       dwProgramState=AP_CONNECT;
    " x+ z7 t$ t* a
  228.       return TRUE;
    3 w% V* ^+ d. N0 _) X, V
  229.     }! p  w0 j3 W) q* ?$ i
  230.   }
    4 V% ~7 x. K7 B, ~4 K
  231.   else if(bRestartUpdater==FALSE)6 [# F6 c% e% a1 l$ M# z0 ?2 B
  232.   {& G% w5 z, A8 k5 s: e" _0 v
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end())3 o' A- R: b: j- ?- @; q
  234.     {
    7 W) ]/ s7 j1 T5 j8 J1 t5 T+ J! }/ L0 L
  235.       file=(*p).second;. i+ Z( F( e9 L& G  A+ d9 E
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())9 Q( ^, a9 h4 y
  237.       {
    ' T0 R+ _6 A+ N) s
  238.         olds=(*p).second;" O- e- M8 n( Y
  239.         olds->vers=file->vers;, m9 t& P8 ~) _, I" o8 L' O* |
  240.       }# y  l. L# O4 X7 T
  241.       else
    2 g4 B+ ?4 ^, H+ @1 C  m
  242.       {" E* d  G1 |& o$ @" \
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    0 r/ ?) z, t; |4 `; }
  244.         memcpy(olds,file,sizeof(UPDATEFILE));
    # J9 V& F, i- R
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));
    " u4 d/ L4 V! K8 h0 j
  246.       }
    ! ]) _- I: v( d6 z/ T/ X
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");4 w, A( l. ?  n" r$ I7 k$ `
  248.       sprintf(filename,"(%s)",file->file);% Z' m7 ^5 V' @% u: O. E1 c9 S* H
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);' j( N# @5 }% t8 i$ J3 M+ |3 C5 Y
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }
    + \) Y5 ]( f- N/ Q- Q& A3 G
  251.     }) u& x: \; H  W6 ~
  252.     dwCurrFile++;; q0 K+ V  [& I# Z5 D) n, A6 X7 D$ q) c' P
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    , o$ j- _3 i2 }  j; @" C& ^2 O
  254.     {0 O' M3 k9 \: Q! q% M) D
  255.       bSilentStep=FALSE;  M0 B& [. V) p" |
  256.       bCompressed=TRUE;6 @3 V' Q2 h. y6 P+ H
  257.       strExtLocal.Empty();
    % B0 M+ q" Y6 r5 U) V
  258.       strFullName=(*i).second;
    . U3 R; C( Q% ^! N% a. u, l+ D$ J; Z2 b
  259.       dwProgramState=AP_CONNECT;
    7 ?9 N5 |& Q( w* H- E* K
  260.       return TRUE;
    + t9 j) Y/ i7 t: y3 ]
  261.     }
    ( j" ]- V( `* p1 c6 N1 R
  262.     if(!bRestartUpdater)( S1 @; b% q  O/ ^
  263.     {0 |1 k+ `; q" e# |$ W6 w
  264.       int iCurrSize,iFileSize;8 b/ z3 b8 I, n4 Y) Y% H4 i, x
  265.       iCurrSize=0;
    3 a5 P' ~, f0 f9 g' k
  266.       iFileSize=UpdateList2.size();) f* w- e! P9 {) n/ G. Z" D: Z
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");
    $ ~0 b1 ~8 l4 j
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");
    6 v" _/ l+ q; H' \0 \6 q3 y9 B
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");% Z+ l- `* O$ T: q, n
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    2 \; a# t% b' }8 e# c
  271.       Fclearf(".\\update.dat");& E8 p7 G! H1 C' a/ M
  272.       Fprintf(".\\update.dat","Bloodyf\n");
    ) v1 L7 d/ j+ b  W
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)% |- T1 Q/ _# O: S5 d  i4 G8 L
  274.       {
    ) F1 N9 u2 ~" R; Y" C1 n
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())
    6 Z- {0 c$ a  Z  @
  276.         {
    4 f$ C1 y* U# L) Z; @
  277.           file=(*p).second;
    0 j& o1 C, U( j1 F
  278.           sprintf(filename,"(%s)",file->file);  t* C! l& ]9 [4 T3 o) p
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    9 F$ L2 E6 z' b" q
  280.           iCurrSize++;
    3 |" {" R) x1 W. E; m
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));% c6 v$ M& w7 i8 E. w5 c1 U
  282.         }" }# l& A$ M+ d
  283.       }
    6 Q! Y% X& |3 `/ n$ {- e) `
  284.       unlink(".\\update.txt");
    - i3 H. R! e# }  b
  285.       unlink(".\\update.tmp");; O& R7 ?3 |  t& `: @
  286.       Fclearf(".\\checkversion.dat");' V( |$ n  e$ W+ W. K) W
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);: p( E% I" I$ Y9 H! K6 l9 o
  288.       if(UpdateLocal.size()); f# {" X) r' P7 V  P+ G
  289.       {+ F5 B! p5 }7 P1 I* Z5 O
  290.         UpdateLocal.clear();
    9 l# v( _6 x3 m/ _' V2 ~
  291.       }
    & O2 i# O0 N7 {
  292.       if(UpdateFile3.size())
    ( e: p  B! d" `0 v
  293.       {
    / i5 m" D8 \. i$ Y
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)3 z" X% b* [$ A# v/ m
  295.         {
    1 h# o; W: C2 w
  296.           file=(*p).second;
    8 t1 |: I- Q3 k4 d/ E
  297.           free(file);
    9 ~! X* l, s9 |
  298.         }/ I7 h: i9 D) Y
  299.         UpdateFile3.clear();
    ( ~: A$ x5 ]7 E) E, n0 G
  300.         UpdateList3.clear();
    7 U; v+ y1 y  B* N3 ^( W
  301.       }* Z; j# X) m1 v, A0 O
  302.       if(UpdateFile2.size())
    # t+ J2 d% g' ]
  303.       {
    ! j7 e9 l0 i( q4 K; `. K+ X
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)  s" p, _$ J' r
  305.         {. g+ `* E; S7 q5 S+ y7 ]( g5 E+ @
  306.           file=(*p).second;
    , R% i+ o# p7 b5 G
  307.           free(file);: C* V- k) u' n' R# x7 Z9 P3 ]
  308.         }8 \, a- U- L$ P- Y) Z
  309.         UpdateFile2.clear();
    6 a4 K; ~2 G. c1 R$ A- I/ L
  310.         UpdateList2.clear();+ k! J' n; I! S
  311.       }
    $ m& L" y$ \- d2 h9 p" r+ V% a" I
  312.       if(UpdateFile1.size())$ T  u7 x" i# p% c
  313.       {, i  i: y6 R- _; Z2 S0 l: R
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    - r  L& ^7 D( N& Z
  315.         {
      {' y' s" f- K5 m6 ~  D8 u) H
  316.           file=(*p).second;
      R. s* i& h9 B0 ?2 c9 ]- v
  317.           free(file);
    ; o# E% r$ F/ c! n
  318.         }6 l* r$ c" i6 s4 @/ e% b
  319.         UpdateFile1.clear();& _4 a4 R, L  ]
  320.         UpdateList1.clear();9 W; V+ k# N6 {; A6 T  u% a5 {" o
  321.       }% u7 ^' c% X7 V" Z
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    . r2 d, g/ P. Y) q$ M  ^
  323.     }
    3 _7 Q% y1 f, b, [
  324.   }
    1 K. i5 ~! U' w" K6 s; X4 b5 A# R
  325.   return FALSE;/ C& c; C) Z! g1 M  T( D1 r
  326. }
    ' [" T7 o" H4 ^

  327. $ U2 D4 E0 c* l" U0 p. Y
  328. void CRevAppApp::ClearAll(void)/ `" O; K3 d, Q
  329. {- a/ n0 P7 D7 ~) q& S8 X
  330.   LPUPDATEFILE file;3 C! H8 }2 D3 d2 X7 k
  331.   std::map<CString,LPUPDATEFILE>::iterator p;! e1 `9 L6 f: R5 Y( M) ]9 g
  332. 2 u, e0 L0 }1 ?- _
  333.   if(UpdateLocal.size())5 `- u! [# {0 q3 |) U) V/ k
  334.   {
    ; c" B% E( z3 }5 _/ Z4 A' l: x
  335.     UpdateLocal.clear();  j7 @- U6 I  Z9 z! _
  336.   }; x: Q/ ?/ F1 P) f, ]: `: W
  337.   if(UpdateFile3.size())
    4 k& ^. j5 f% w9 q- k% h2 Q
  338.   {( s& ]$ j$ P1 R; k: V
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)5 h5 o& _, Z( G5 f" p! T
  340.     {+ I0 X1 {* b1 l5 b
  341.       file=(*p).second;
      F8 t0 {: T  C
  342.       free(file);
    3 o4 f9 r0 ]0 j5 }" K  d
  343.     }
    5 R- j5 T+ E" \' b6 l1 K( D
  344.     UpdateFile3.clear();9 m) @  O& \7 |* Z2 b% `! b
  345.     UpdateList3.clear();
    & X( Z( ^, g' k4 S0 A) z- y; D
  346.   }
    # H8 v" K, d6 f3 O& H. ^8 ^) F( T. o
  347.   if(UpdateFile2.size())
    ) B1 B' i) h+ u; S  h4 q
  348.   {& G+ d1 c6 ]% q! I; t
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)3 B0 Y" l4 i1 Q* }* z; r9 ^' P
  350.     {- h# \; k1 {- N9 m2 ^/ r
  351.       file=(*p).second;; I  t" K' S' \1 Z+ {, G
  352.       free(file);0 m1 A8 p1 S; ?  g+ M0 c* X
  353.     }
    . p) e, w2 u3 j4 U3 ?# K. M# ]
  354.     UpdateFile2.clear();
    8 i. f! t7 |; u' C- H+ D
  355.     UpdateList2.clear();
    5 L) c5 x4 R& }
  356.   }
    0 u* x: L9 U: l& F
  357.   if(UpdateFile1.size())
    # v6 S9 ]. D) H4 H& x
  358.   {/ u9 ]& ?: d9 F0 y7 U. ~
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    0 G- G! Q* B( \/ b" u+ h2 }9 V
  360.     {
    2 J/ [+ a) j$ x. @/ }" p9 s+ A
  361.       file=(*p).second;& D$ t9 t6 A* u- s! i
  362.       free(file);
    : |- ?- d% o6 a( u5 t% {
  363.     }) c& M- h/ R2 t/ Y
  364.     UpdateFile1.clear();
    4 A3 ^: _: S8 J& s6 S" W4 O- k
  365.     UpdateList1.clear();4 I+ d3 U+ F$ @. n! [5 F" ]
  366.   }
    , x$ O6 h$ t( H2 `) M
  367. }  
    ; C7 ?7 T2 @9 B2 i$ `% k0 X
  368.   % r& e- \+ G$ z
  369. BOOL CRevAppApp::CheckLocalVersion(void)1 O6 \& U" Y3 S2 u8 h, M6 M; B
  370. {
    " h" \2 n, F( h' b' v$ ?
  371.   int c;% W) V9 U( {; o; i! G) m; {9 R( Z3 \! r
  372.   LPUPDATEFILE file1,file2;
      Z/ @6 R4 P! s7 y$ V% f- U
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;
    2 `! Y0 {  a1 g
  374.   std::list<CString>::iterator l;. U3 d) J$ p; j5 {
  375. 0 }% E* \' E' E0 b& _
  376.   UpdateLocal.clear();! v2 `# g  A# i% j3 U/ [$ Y. ^
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);0 U3 j* N% z+ v* R) ^
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);
    , Y8 T5 C2 L2 _8 }8 Z0 u; A
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);5 J5 [; p- W) e" o8 g& v2 B! c2 x
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);. L5 s) Y! K  w9 I$ @1 N. K
  381.   if(UpdateFile3.size()), {3 ~/ S, ^" X+ A0 S! I" s  }) |
  382.   {3 Z( w0 c- \6 }0 j
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++), w5 Q. E  G, C, Y1 v: h" ~
  384.     {
    ! y( h& b, Y9 t0 `  Q6 [5 Y
  385.       file2=(LPUPDATEFILE)(*i).second;
    8 |0 I7 g) `. \8 O7 p
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())! C7 g7 _, ^5 ~/ i7 X
  387.       {3 O1 N. G. v. g6 O7 C
  388.         file1=(LPUPDATEFILE)(*p).second;  X  {* s7 A" _( a, w
  389.         file1->vers=file2->vers;
    , f: N! l- ^* m1 o3 J; k$ w
  390.       }
    ; d7 K- S" z  M* w
  391.       else
    1 v: _+ D4 h6 D6 j9 W
  392.       {5 e/ _& q3 M1 e4 ?, V6 d
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));: g! {5 s' I) l  b0 x
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));
    ' i+ g! E" ~3 s( `
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));
    $ k# W* ?8 G; U
  396.       }
    , Y9 y" ^3 {9 m* [. s
  397.     }% Z0 K; U' T: _5 u2 f
  398.   }
    / ]0 [# g: d1 N; r& d" H) e: N+ D
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++), L. P& Q) F1 K3 ]* M! T# k, ]2 B
  400.   {) i* b# ^% K8 R2 Q5 V; Y
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())5 i/ q/ ?; d0 N& n! I' ^
  402.     {
    , `! z( j# p$ s
  403.       file2=(LPUPDATEFILE)(*i).second;1 `' h$ R9 [( g
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    ( x3 O4 t  r$ d! q& E
  405.       {3 ^9 E* z* H  k. I+ ^
  406.         file1=(LPUPDATEFILE)(*p).second;  V& |% w. f/ x* T2 \& O5 a
  407.         if(file1->vers!=file2->vers)
    4 h* P$ ^. U" f
  408.         {! G7 H, v+ z/ J( r/ P
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));3 |, j) U7 {# q$ p
  410.           c++;/ w! m$ \. N5 O6 g4 o
  411.         }6 p0 o& M0 J4 e+ }1 B) d6 s; W) M
  412.       }3 l6 ]$ m/ b; Z& R. f* y
  413.       else
    $ `" z+ Q2 B% M( Y" M" w! Y/ W
  414.       {
    ) w0 o; S3 \$ S: H9 T
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));6 L- I+ ]# y1 H
  416.         c++;
    2 V/ m+ Z) X& w# A4 U  S* k. T
  417.       }
    ! `, e: o& ^: K+ }
  418.     }" k! R$ {( k/ q& N* t2 K% l
  419.   }9 r5 I7 g/ d0 j" V' |: c
  420.   unlink(".\\DownLoad\\update.txt");
    1 e$ q$ F* }; X' [8 M0 v4 [
  421.   if(UpdateLocal.size()) return TRUE;( t2 e! K* k' x
  422.   else                   return FALSE;+ t+ z+ {% _6 L5 K! U$ q# ?
  423. }' t, `: d& _. o+ @2 V8 Z# V
  424. , W6 Z$ t. V# T" d7 y8 |
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/". B' E' N1 f' x( V4 _
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn": Y! s4 S" i2 N$ h9 _& R
  427. . X$ L) v- r: B9 ~! E) J
  428. 3 r0 ]  B9 N% V1 `2 ~- e- q5 x
  429. - m: A% |. G& `. L8 D5 G
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile)- @$ q9 O6 U4 t$ k6 H& I
  431. {
    * M! }& W5 @$ [: u+ _
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;6 W+ t5 t3 k/ R8 R0 O2 y; y+ {
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)( I4 }: R  w5 E
  434.   {9 `" b+ M0 J- v/ e" |, N$ N" T
  435.     char szLanguage[50];
    0 r. K$ r; N6 s$ s5 r
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    ' G9 z3 ]/ S. f
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;; P( N6 _* n0 E( [0 e
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;' u% D: {. M! _* ^. h  \1 k3 C
  439.     else                                   m_iLanguage=ENGLISH;
    - ^& Y9 C/ Z" d+ n$ q; `% z
  440.     char szRegister[100];
    : i- L+ L' N# m( J% z' H# P
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    + K6 w$ y' {9 x: @
  442.     strRegsName=szRegister;1 N/ ]3 @7 i$ D- K7 q+ c
  443.     char szPatchURL[100];
    # W. z- p5 \: n& c2 D
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");; K8 H3 l: U% [  j$ T
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);( K6 \; t6 l0 G: `" }
  446.   }/ e$ ?) w0 u, Y1 K7 y0 z
  447.   else
    6 h0 |2 x2 i3 L  j* T2 ]
  448.   {
    5 o+ H) H: A+ l
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);0 e& U$ J& d8 x! ~
  450.     strRegsName=DEFAULT_REG_URL;9 @" j+ X/ g' v% A
  451.   }
    - W( l5 s3 Z( a* v5 Y7 C" B1 t8 f3 [
  452.   if(GetFileAttributes("hosts.ini")!=-1): V% G* V; p6 x( e* Z
  453.   {+ E7 ^  H* v# k. J- K
  454.     char szIP[50];+ W; G2 P/ ]: J
  455.     char szDIR[300];
    % J1 B$ V/ `" F, m, \
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))$ l$ c  W; ]' ~/ X7 R4 p
  457.     {
    0 Q! b! u7 G2 S: T7 P0 Q# p
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");% u4 c$ P! h1 g; d
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");
    , d7 ^9 b8 Y$ J2 f- @7 y7 q
  460.       strHostName=szIP;- s' w/ J! H. X) D( A& s
  461.       strHostPath.Format("/%s",szDIR);2 _( A! b" e3 d( j
  462.     }
    ! T# ~1 k( R) j4 |6 q8 ]
  463.     else; S- G. L' I& t- t" M
  464.     {
    4 a) A' }4 ^8 N9 F& b6 v
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    ; O, h* i  R$ C  ~1 u. D, U; Z/ @
  466.       {
    - a0 W$ C, g( b1 V" O7 l: k
  467.         char szLanguage[50];
    6 [, x. @: ]& B0 H6 d/ ]4 w
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    # O" P; Q' Y; _; Z
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;4 ?6 o0 O6 B' Z9 ]& c
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;! D6 f' ]2 Y4 |: d
  471.         else                                   m_iLanguage=ENGLISH;6 _8 X, L" S8 [& }* ?
  472.         char szRegister[100];
    7 t* d) m+ t" L. U2 N5 I2 ^
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");1 c5 Y0 T6 t2 u7 T# e6 q; S
  474.         strRegsName=szRegister;0 B: A3 ~$ T4 `" i  i. |
  475.         char szPatchURL[100];
    7 u: a! Z9 E; Y7 _) ~
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");- f) p1 R, E  J0 v# Y
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);1 E: l; y  o& N9 P# G) D% y
  478.       }
    8 a; r. Q8 }, s3 B" D* f& I
  479.       else7 b5 g. H) Z1 o- j
  480.       {
    ; w$ `# T+ X! L
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);4 D5 H# ?4 l& a( t
  482.         strRegsName=DEFAULT_REG_URL;
    4 R$ P5 F2 F  S7 p
  483.       }+ K/ y) ?8 T9 q" ~1 U0 _% P$ B
  484.     }
    / I2 I6 ?$ r% f: a; v( e3 V
  485.   }
    3 y) C2 f7 O8 R5 Q3 Z" z) L
  486.   return true;
    1 ^1 D2 R. ^# w2 _
  487. }
    4 c; r8 _2 B# s) w7 R
  488. ) A7 J$ y0 }2 `& c8 ]5 f
  489. #include ".\ZLib\unzip.h". Q! R9 r1 F3 @' ^3 a0 L5 [. T" I! L
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);
    # o) o/ C0 r3 T6 ^9 G  r
  491. /////////////////////////////////////////////////////////////////////////////
    / t9 [8 T: @" G
  492. // CRevAppApp initialization
    % w0 J# M  T& b; @
  493. 2 S4 f. h/ U5 L/ L0 j( _  G
  494. BOOL CRevAppApp::InitInstance()
    ) E; j2 P5 O9 P4 n
  495. {
    : U3 e( g5 X" F- M& f5 K/ _0 G. z
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];& O# K; W3 g. g4 y' H4 `2 Q* U' S
  497. ( |7 t1 k7 \5 Z6 w- b
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);
    4 }2 `: U- q" ]" v
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))3 b& f( X, C, L
  500.   {
    / B9 N- q! L1 g/ r
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");& l% u2 [5 x/ u7 O) N: Y) z
  502.     GetPathFromFullPath(szPathTarget,szPathSource);  D% ]% j" Y6 ?, L# s  H: z3 ^6 e
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))* k2 W% |. D! d
  504.     {1 W3 m% h7 f  Q
  505.       strcpy(szPath,szPathTarget);" T1 `! j  b6 B3 D
  506.       SetCurrentDirectory(szPath);7 s( @& X, O. L( H
  507.     }0 p1 P' T/ h! D/ p  g
  508.   }
    9 i% L8 F, h' N
  509. #ifdef _DEBUG8 W. s  `  i% V# a8 t' D
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12)), y3 l4 _' P  ]
  511. #else6 {3 K+ E, _) g0 k4 x8 x: h
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    6 E1 ~% i% o4 D
  513. #endif
    2 V% ~" u( n5 I8 \/ B3 y* [1 l
  514.   {
    2 o/ C- l& P! K8 O
  515.     char tempFileName[MAX_PATH];
    + H* v+ ]* S5 I! e) {' K2 y* E5 q
  516.     strcpy(tempFileName,szPathSource);
    , n/ R5 d8 s  C. c
  517.     tempFileName[strlen(szPathSource)-12]=0;
    8 c* e$ x) K& w# X# {3 C; Z
  518.     strcat(tempFileName,"\\$CSUpdate.exe");: }) `, n# N/ [( z# Q
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);
    / I- Y' V% @! O  B
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);
    3 N. r2 t/ x) ^: a
  521.     return TRUE;
    * E; Z6 q" S* C% F
  522.   }" I; j. g9 U4 g8 p5 m7 X
  523.   // Nuke 0118: Delete run.exe
    / y  d6 H: N5 Z# X0 o" m4 x+ }
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );
    ) ~- h# l5 r" a; w
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");/ f: P2 Z8 O/ p3 V' Z& X. F9 r) ~
  526.   if(!ReadCfgFile("Config.ini"))1 [# g, l$ K- I, a
  527.   {
    ) `: t6 f1 e* x- _- j7 j, i
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);9 K$ g& E* @; S
  529.     return TRUE;' B: G$ O! d% W8 n, |6 d. l
  530.   }
    # O7 f8 V, O4 w, y# ^' \& |; W
  531.   HANDLE mutex;) q1 n+ q) S' y7 A1 P! n' ?; h
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))+ G( D2 h8 w  ]2 k
  533.   {0 R% Y  P4 m4 P
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)5 l4 S3 w  x6 I0 Y
  535.     {
    : a6 Y  B6 F5 ?5 @& \
  536.       CloseHandle(mutex);5 f: V. i$ \" |1 M
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);
    6 K8 I  V9 d) s7 P4 W# P2 I
  538.       return TRUE;
    ! s  l/ s/ P# t9 n& S2 O" V2 J
  539.     }2 h+ Y1 s6 J4 z0 h+ l" M3 T
  540.   }  ) d- p* \  X4 ~  |; V3 m
  541.   CloseHandle(mutex);
      k/ U+ O7 w' W8 N4 v
  542. 1 ~; n& W6 s6 y1 ~
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);
    ( j  Z8 g/ D8 M/ y

  544. , Z, |! ?9 r5 n: }
  545.         AfxEnableControlContainer();6 G/ y) w4 Z, @( A

  546. 0 Y( B& Y# k5 c4 @% `5 \% T
  547.   bCanUpdate=FALSE;
    % R0 P3 m, c* Z+ Q$ p8 m1 y
  548.   dwStartUpSteps=1;' j7 I& \+ {- ]; C  `' G* q- S( O
  549.   dwProgramState=AP_NOTHING;" S' E% V1 f0 W$ ~) P

  550. 6 M( U  p7 Z/ ~3 L; g6 G
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);
    * y& v* s( R' F+ \

  552. ! q! f4 X5 G' w* q. W
  553.         // Standard initialization# U" u5 h- b' s" {- W9 P; B
  554.         // If you are not using these features and wish to reduce the size- u, n5 x8 }& _8 J6 n
  555.         //  of your final executable, you should remove from the following; s9 |6 ~% k2 \7 e
  556.         //  the specific initialization routines you do not need.
    0 S& B2 ^/ k3 H( X) k7 N; f* Y
  557. 1 ^9 C6 ^7 F/ a
  558. #ifdef _AFXDLL3 b. V( t" Z7 P6 ^& b- D" W3 {
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL
    % ~- ~3 z0 i* a/ _0 m0 ^) w
  560. #else
    ! r  R0 u# z9 C9 J
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically1 u) _6 i( V$ T/ h$ D' c! j0 }
  562. #endif; R  G$ c3 K5 o0 I/ e) q, R
  563. 8 @; b$ n9 T  U- {
  564.   dlg=new CRevAppDlg;! t/ P- d+ ]) D- g4 F
  565.   dlg->Create(IDD_REVAPP_DIALOG);
    3 V$ V1 i6 w4 S8 V
  566.   dlg->ShowWindow(SW_SHOWNORMAL);
    1 A* A  `% f+ _% `; d
  567.   m_pMainWnd=dlg;
    2 I+ A5 ~3 I+ W1 N
  568. & l$ X  }# ^& U* v/ u4 c
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);
    9 V# I8 B+ }. G2 c
  570. 2 ^. Y: w9 M, M/ \
  571. //  GdiplusStartupInput gdiplusStartupInput;  P8 G3 {% ]" W" f0 a/ _
  572. //  ULONG_PTR gdiplusToken;& z. Z; v, ?3 q! D4 c" \% m$ @/ `- N
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);
    % A4 Q8 F" V3 f* G. ]( `$ s6 u
  574. 9 ^1 B* q9 h% G) B) |' Y
  575. //        CRevAppDlg dlg;: }8 \+ V. U0 {6 M/ c
  576. //        int nResponse = dlg.DoModal();
    7 o  R& T: |, |& X9 v
  577. //        if (nResponse == IDOK)
    . i; n/ D# J5 p. S7 T. O- S
  578. //        {
    ( J! t) z, c3 k" s
  579. //                // TODO: Place code here to handle when the dialog is
    % f: f* v! k! T% B: g) V+ j3 ?
  580. //                //  dismissed with OK$ t, R$ @- E/ q
  581. //        }7 I, a# K! ~8 `7 e5 H& @! [4 K
  582. //        else if (nResponse == IDCANCEL)3 n8 w7 ?  i6 G; Z1 M+ h
  583. //        {
    * s" w, B* A' s4 V& Y7 \' z
  584. //                // TODO: Place code here to handle when the dialog is$ `( e# f& X. L$ {$ d, _
  585. //                //  dismissed with Cancel* N9 f& U2 \! \
  586. //        }1 F) _- h) D8 U3 w
  587. ' T' E  s7 R8 A. S* ]. S
  588.         // Since the dialog has been closed, return FALSE so that we exit the+ }2 w* u( [0 C9 N) |7 o
  589.         //  application, rather than start the application's message pump." t' i% D- R( p, r, }. Y
  590.         return TRUE;. Q6 q' }) T; O  a8 F
  591. }
    6 H- E% ?8 ]% f4 R

  592. # z4 g1 H7 k5 M! M$ e+ f# d+ X
  593. char *CRevAppApp::strtok3(char *pSource,char *token)
    4 T! C( U0 }3 L4 }7 V
  594. {
    4 b6 Q5 H0 m; k4 R" A% @9 ~
  595.   int i;7 y; i+ U& d! t0 ?' x. w: L4 ]
  596.   char *szRet;' ]9 f7 l$ H; d& K* z3 [

  597. ) g3 Q3 g& R7 Q& N: D) K$ u, ]2 L6 R) `
  598.   if(pSource) { itoken=0; sztoken=pSource; }
    ) W- w) T! s6 N
  599.   if(sztoken)! p8 R; O, B6 c
  600.   {
    ; @% Q  Y$ v! _
  601.     szRet=&sztoken[itoken];
    ! T5 W8 z- [  v: I7 |1 r: t
  602.     while(sztoken[itoken])# k- s* U3 H% m. k6 H
  603.     {4 O' b$ X, X' k6 f0 W- L
  604.       for(i=0;i<(int)strlen(token);i++)  l5 S3 P% |$ ?3 D7 i
  605.       {8 W* ?% L8 B- D, }
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])# W2 n. j3 p' o0 b! G/ R+ z
  607.         {
    2 R6 p1 v) l& g- U( f% \# j, ?
  608.           sztoken[itoken++]=0;
    - ?; v) Z* g; x0 k
  609.           sztoken[itoken++]=0;/ r0 U- p+ c+ i+ \9 F
  610.           return szRet;
    6 M3 z- x* {* b; X/ ]) t
  611.         }  b" U3 p4 x3 l' G+ m, W  d
  612.       }  }' k  w4 I' ^5 w7 ^8 F
  613.       itoken++;9 o* D2 ?, w4 u! E
  614.     }. i& k& l3 \4 |1 t) H# Z% `( q2 l
  615.   }
    & E9 d& }, O' w$ R. x
  616.   return NULL;( n2 |9 b" g  W/ e' Q+ G6 g
  617. }
    9 N: }" w- R/ ~, U7 E

  618. 9 o9 ?4 ]- |9 J) [, f
  619. void ProcessProc(long Total,long Current)" W, Y3 M7 j/ U. c3 U
  620. {
    & h' l4 T( B3 K9 q
  621.         MSG msg;3 X- n: P5 \9 M$ M( O6 U- M" k
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);
    # b! q+ Z2 I" N* `- M- n  Y% C+ y
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));% G% {7 K% a0 N
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))" j# i/ [5 ]: h: c# {
  625.         {
    ! X' I/ r$ C% y: M: i
  626.                 if(!GetMessage(&msg,NULL,0,0))% d2 R" g4 L, {1 A& r
  627.                 {, I! ]) w: t4 g$ g
  628.                         return;
    : q: L* U7 X9 b4 P, X3 t% j
  629.                 }
    3 E; D% S' w$ k  |3 L/ E" r: }
  630.                 TranslateMessage(&msg);9 [9 g: e7 \+ k4 m
  631.                 DispatchMessage(&msg);
    - k5 t3 j+ d* w  {5 t+ k
  632.         }        * c  ]/ k+ U  h6 r3 W
  633. }3 H$ C7 o! B; n1 A# [5 d! o2 S
  634. 2 t! d0 a9 a+ d  D) w, J3 Z
  635. BOOL bFirstChar=TRUE;& `8 ?2 T. r% i! H( h5 m7 E5 t
  636. 0 K1 C+ ~4 h0 M1 n9 f
  637. BOOL CRevAppApp::OnIdle(LONG lCount), r* ], H, k/ f' b- B7 {
  638. {3 Z  p% `* p, N* D& Q
  639.         // TODO: Add your specialized code here and/or call the base class5 ^" {- i) w& \, a) g3 T, h
  640.   switch(dwProgramState)/ B) L9 n+ W! H5 W; G3 O/ W
  641.   {8 }; Q/ I8 Z& e+ r# P
  642.   case AP_NOTHING:
      P2 n; s; L9 ?1 O+ ^" T1 x- p
  643.     switch(dwStartUpSteps); \* g# K' H- W
  644.     {
    - |/ V0 X4 o; j; a+ [
  645.     case 1:
    ( e: l, W' F+ t/ S4 F+ {
  646.       {
    7 ~# S6 S& d: ~1 y, @1 ~  O: j) C
  647.         int i;
    4 C5 x; }( B- C0 e
  648.         CDC *pCDC=dlg->GetDC();
    3 G# x: n, f4 I6 i
  649.         HDC hdcwnd=pCDC->m_hDC;
    8 V# D5 n9 N: Q! @+ U6 m
  650. //        Graphics graphics(hdcwnd);
    , e9 l! I0 {2 O' Y* n
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");
    , g, u8 V5 b7 @6 q
  652. //        INT iWidth=bitmap.GetWidth();
    6 b; O6 R/ w# y. k
  653. //        INT iHeight=bitmap.GetHeight();
    1 H. r$ ^( X6 w% Q
  654. //        Color color,colorTemp;  ?! d9 t) |+ C# V9 K; B
  655. //        for(INT iRow=0;iRow<iHeight;iRow++)4 f$ ^9 U: N; w. X% t6 S
  656. //        {5 R7 i; l  }# T9 S
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)( [$ @4 b; B. u" K( O' |/ z, j7 ^
  658. //          {+ U, g. J& K& o7 G
  659. //            bitmap.GetPixel(iColumn,iRow,&color);
    % l1 w+ B0 x3 t2 }( l- ]
  660. //            colorTemp.SetValue(color.MakeARGB(" [% o$ W1 z6 [5 L
  661. //              (BYTE)(255*iColumn/iWidth),; G, S0 h6 M$ v' [' V3 n6 p0 Z3 p
  662. //              color.GetRed(),: J& w$ f7 f" x$ v: B% ^5 L
  663. //              color.GetGreen(),
    1 ?8 J. h3 s, @
  664. //              color.GetBlue()));
    6 G1 [3 A) W: C: j
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);! D" \4 ]- w1 M# Y
  666. //          }
    * Y5 J% ?: O4 Q0 B( m- w
  667. //        }1 W- z3 S+ T6 A7 B
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);7 y$ V2 i4 s, q6 e
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    ; H" i! @( M$ }3 ^; D
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");
    : j) W) d' o7 i3 R& r+ I
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    - b  {1 _6 ^' Q) S- `. I* f
  672.         for(i=0;i<240;i+=8)6 V1 {# I4 Y7 g) |, Y) ^
  673.         {* b+ N% L) S' H% b$ @
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    # }' W; o4 a8 Z: [; t! X, N$ o0 w
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
      _& F5 F8 O  x8 l- ]6 ]
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    4 S" g- T1 J% Z6 [% d$ j8 q
  677.           Sleep(33);
    ( r- f& D% B. s; Z' S% Z0 B
  678.         }: y, I1 i, C4 h4 p) z7 W1 x
  679.         Sleep(1000);
    ( w0 l. X: s9 G3 j  n' O3 H
  680.         for(i=240;i>0;i-=8)! F8 C+ M! F+ M0 A! \
  681.         {
    3 e% h" n/ W! a  x9 u' _
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    ) y, {/ R$ Z1 o
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);# a4 o. t& M; C* o
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    3 S4 n( M- S' u( R
  685.           Sleep(33);) B+ M3 H9 Q9 y& H- V; D
  686.         }: T* L: t+ T9 D; Z
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);
    + \+ g7 b6 E9 d6 N
  688.         dlg->ReleaseDC(pCDC);' X: e# h8 T" w; N
  689.         DeleteDC(hdctar);: f" i9 k0 I- y8 E' v+ F4 H
  690.         DeleteDC(hdcsrc);
    0 l( H2 g4 a, _0 L- @9 w
  691.         DeleteDC(hdcorg);( D  B' n6 S, }* C9 y
  692.       }1 g) }# e' Y5 l3 F. @
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);
    % x$ A7 C: n/ e4 x9 I3 H, B
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");
    3 i0 W+ {) e$ k( c8 t
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");: d7 J& r9 u: [5 h; O; k! W" s2 o
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");
    : f# C+ K) \: l, a; r" ^2 M
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);+ h) [+ [+ Y% x+ G
  698.       if(!Dn.Connected())4 b. P) ?* m+ _' Z, Z4 o( B1 J
  699.       {
    - |  A5 c1 S( Y- p* P
  700.         dwTotalFiles=1;+ h9 x& j2 a+ H' W2 j6 m$ q
  701.         dwDownLoaded=0;9 c) V7 }& p1 W$ [
  702.         bSilentStep=TRUE;+ w6 p8 f  ]5 R4 P+ N
  703.         bCompressed=FALSE;
    4 [/ S- C" |7 ]) F
  704.         strExtLocal.Empty();, z( ^/ u4 [) P6 U( n5 a! n: j# u& s! Q
  705.         strFullName="readme.txt";$ W; l6 [4 s" i' Z  w
  706.         dwProgramState=AP_CONNECT;
    3 J7 u3 A  M2 \4 c- f" G
  707.       }7 h0 d* o* Y8 I$ R) v1 g
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();1 T! t0 b3 u$ h& i
  709.       dwStartUpSteps=2;
    9 D# y  b! H7 h+ _$ B+ P
  710.       break;- F/ c. l3 Y7 b9 g
  711.     case 2:/ E4 f) R$ \! c/ |8 H/ }, Y) c
  712.       {8 n9 ~, C: O7 A! L* O# S+ {4 ?4 w' G
  713.         int iEOF;% S  W9 u$ q8 Y; ?5 x
  714.         FILE *fp;
    6 S5 V4 [8 B6 L; f8 C
  715.         char szString[512];
    6 \1 h. J: b- P  I4 y
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");2 _) _+ h9 z  ~- L
  717.         if(fp)3 L8 k& ]1 S* R  B& D
  718.         {
    ) R6 x% W* l& P/ U7 J
  719.           do4 O7 U- w1 U" S3 M( z& d
  720.           {% I0 O9 x- F1 G4 n1 B
  721.             iEOF=fscanf(fp,"%s",szString);
    / \- g! P0 p" [
  722.             if(strlen(szString))
    $ B/ B& r7 Q  X& y  y
  723.             {" ^3 Y* ~* t# q! M8 D
  724.               if(bFirstChar)4 R/ k* {* _7 G) f* J+ j
  725.               {% o4 K6 T  M# H1 O, k
  726.                 bFirstChar=FALSE;
    ! F: |4 o7 P: o2 E9 k4 E* P( C
  727.                 bConnectIsBig5=FALSE;
    + t1 [7 u, \5 l
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;
    ) S& A2 K6 ]+ k" w2 E& p$ V' q& q
  729.               }, Q$ B1 }& P5 {  b5 j$ l. l/ T  L
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));
    & Y: j: O5 T; t
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));- j( ~0 \. \5 y  L! h
  732.               dlg->m_ListText.AddString(szString);
    * l3 B9 H% o  B: s* y
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    ' A: A& o  a- W: B' z, H
  734.               *szString=0;
    6 f6 b( s  u1 u8 F& Y9 I
  735.             }
    0 L# P7 j- H! Y8 @$ b! p
  736.           } while(iEOF!=EOF);
    / _6 z' s/ n4 \) D2 Z" [
  737.           fclose(fp);: \* _3 b. p6 d$ [- c
  738.           unlink(".\\DownLoad\\readme.txt");
    ; k5 q1 l: h0 u$ S
  739.           dwStartUpSteps=3;
    1 ^* _# X0 n- B0 ]) p% N
  740.         }
    3 u. N8 T2 A" u
  741.       }/ X) d6 y/ u/ @
  742.       break;$ e5 V  a- c# [" n# i
  743.     case 3:
    : h, p+ s( Z( Q9 {$ V
  744.       if(!Dn.Connected())9 v- K: Q. ?4 u5 P& F) R
  745.       {
    5 n. Q7 {9 g! ?$ {7 o
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);8 i" A6 v0 I0 G* X; V& |
  747.         dwTotalFiles=1;; U/ F. c6 C3 b) k$ w2 G! h
  748.         dwDownLoaded=0;9 N# Z" }" S: O5 p
  749.         bSilentStep=TRUE;1 {2 D; r, W# v6 o2 p9 G" ~* b
  750.         bCompressed=FALSE;
    ) Y1 H: D1 r" O* \# a, u
  751.         strExtLocal.Empty();0 L% G; m/ Q+ P
  752.         strFullName="checkversion.txt";
    8 @' ^3 k: z- S6 `: x3 P+ b# t- I
  753.         dwProgramState=AP_CONNECT;
    2 N6 b$ S7 Q! O3 t4 `* K" b1 x
  754.       }& ^. |* L1 B! W5 V
  755.       dwStartUpSteps=4;
    3 n2 @; {/ b) a7 p6 m6 d
  756.       break;
    ) z) r% R7 u* ^* ^7 H" m
  757.     case 4:
    ! A2 {& F  u# S% Z% L& M9 B
  758.       {; Y0 C4 t# @: c8 C& s. W$ y
  759.         FILE *fp;% _- V8 }/ X, K; G( J
  760.         char szString1[128];  I$ `7 O; p. I/ z, C" l6 a" I! z. n
  761.         char szString2[128];
    3 n- L" F. J: p  m
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");
    3 |! P+ `/ q& j( m, }  |
  763.         if(fp)
    4 E1 ?  n" e8 E# N+ l, O: {
  764.         {
    # X9 K! \: B  R$ X3 {" e
  765.           fscanf(fp,"%s",szString1);3 p" C/ t% \$ H
  766.           fclose(fp);6 N  e7 X2 c+ ^" Z3 j3 H( i
  767.           fCheckVersion=atof(szString1);" \( s, q+ A, x# D) u( H
  768.           fp=fopen(".\\checkversion.dat","r");
    # Y. [; G. ~- {* t
  769.           if(fp)7 t! |' @! i% H/ \' Z8 W1 m
  770.           {
    ) i5 _, X5 q7 X' `. k4 N
  771.             fscanf(fp,"%s",szString2);) L2 g, L) K! o7 R. b& D* W0 m
  772.             fclose(fp);) p  {. D( ^" n1 `
  773.             if(atof(szString1)!=atof(szString2))& k2 {- j- W1 M, H
  774.             {+ F: M% d. L2 Y0 t: s0 i& X
  775.               if(!Dn.Connected())
    1 D& L+ q3 P# A% r2 j- a
  776.               {
    & a. E1 c* u; G! T( {% {1 K( z
  777.                 bFirstUpdate=TRUE;: i0 F  ^1 K- s: ?' M3 h
  778.                 dwTotalFiles=1;
    % [& ?) m+ ~) Y6 |, t/ G: Y  @
  779.                 dwDownLoaded=0;/ [' l: Y& `% D7 S) i; {
  780.                 bSilentStep=FALSE;
    5 `- g8 ^" K' E# Z
  781.                 bCompressed=TRUE;
    : C) p2 R5 {; i
  782.                 strExtLocal=".\\DownLoad\";
    0 I5 t( m4 R- v2 L" }4 g  \
  783.                 strFullName="update.txt";
    4 L4 l. K2 }  Y4 {) R! J" O+ ?7 A
  784.                 dwProgramState=AP_CONNECT;& I% g  D' {* y+ M2 R* }  m
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");' X$ q, V; }  w1 M
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    ! g9 }; ~" W) X5 v" _
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");& m6 J  C9 x( Q6 O9 W5 ]

  788. - a$ A9 p& l- f: K! l
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);% t& B# U7 e3 p; h& T8 P6 E% v% U
  790.                 unlink(".\\DownLoad\\checkversion.txt");. B  e% P% |! K, H, u7 e
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)
    ' _$ s; l- N! a5 B2 F
  792.                 {
    , y% b! w* v, X
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");( c/ V: Y; B8 c) Z8 t
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");/ G  m: y2 X4 h) z5 g: R  r5 x$ a7 L
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");, s- ~. t- a; D. u2 w( p7 ~
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    - k* x5 l, C1 k" y  V1 n% }1 V+ [
  797. + L2 S4 {+ o8 w% G/ \
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");+ _/ P7 {' ~7 c( O
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");# S& ]+ I9 i* g; [5 `1 v8 ^2 Y
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");' y3 m$ g7 [! x8 T
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    % Y) O1 z- A2 e. t! [; B' K% i% T
  802.                 }# V# f" h$ K8 T$ n. K7 T0 H) K
  803.                 dwStartUpSteps=5;; D) d, [/ l/ ?, D* D2 E
  804.               }
    3 a) v+ g4 `/ o/ @" M! G
  805.             }
    : ]$ d% |# x6 z, h
  806.             else
    " G6 W3 d2 g0 x8 h
  807.             {7 Q" d' d3 h8 T0 `. Z8 k
  808.               unlink(".\\DownLoad\\checkversion.txt");  U: }6 {' {' Q1 x* P
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");& K3 C  N0 m. r$ a1 a
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    1 Z" U1 f0 ]) }5 W; I8 B- g
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");$ ~+ a- W. t( I6 Z3 t" p/ L4 V' t. x

  812.   U) E- N5 e& S- e) _
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    % m* w+ w( R% S/ ]1 t! n' ?% {, O
  814.               dwStartUpSteps=99;8 C- z7 P- C0 ?+ A# d: I& r% O
  815.               bFinishUpdated=TRUE;
    * k9 G, f, n! F$ `4 T/ a% ]
  816.               bCanUpdate=TRUE;! j. E8 s2 j& I! P2 `0 X0 f8 K
  817.             }2 V1 l- [& ]  A
  818.           }3 f$ @. t" a3 r* _0 K% N- A
  819.           else# ?# V2 U8 ^! c$ ^
  820.           {  @! v& h; P- `
  821.             if(!Dn.Connected())
    $ O" i* c7 T. R4 N
  822.             {
    - R. x  a7 h' j( s) ]( W8 P
  823.               bFirstUpdate=TRUE;4 @* n& K+ f% {8 C( ]3 ~
  824.               dwTotalFiles=1;7 w' r, k) K* c1 O- R
  825.               dwDownLoaded=0;% P" p4 j$ q& r0 H; ?- [- ~
  826.               bSilentStep=FALSE;& [& A# K! I+ X6 o- P0 J1 k
  827.               bCompressed=TRUE;
    # f8 h* @1 @% Z2 w9 B# N$ ]1 f
  828.               strExtLocal=".\\DownLoad\";  J  [- S: x; u$ b- t' W) M3 b
  829.               strFullName="update.txt";% s; S3 u$ W8 n
  830.               dwProgramState=AP_CONNECT;
    " U( e6 E/ F7 N
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");2 v" X. U' @, x: A* ]& H/ w  K2 ~
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");2 X' q0 _7 m2 o
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");
    * R( S0 e" ?8 K! h5 @; P
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);; ~7 ^& ]. u9 F1 {6 x7 k
  835.               unlink(".\\DownLoad\\checkversion.txt");/ ^, Y8 P0 h0 G9 T" M! G" R3 ?0 _
  836.               if(GetFileAttributes("Wsa.zip" )!=-1)  N7 C! W$ j# ~9 K5 l% f
  837.               {# r1 s8 f% ?( F$ X' u2 D) O
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");* E* ^) w4 C. X' E; G. c
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");
    * E/ A4 k. S$ e
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");5 O/ e. g  R$ W8 w% M6 m5 R
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);: i! W0 l5 ^8 C% M
  842.                
    ' W# v3 @3 S( c
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    2 L4 n: I* }$ p9 z
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    / m- T& ~2 h& F6 k( l
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");
    % C6 P7 F- f0 ]) v
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    : y. V9 z. W- d, H5 z1 U; L
  847.               }, b5 y/ P' p" }5 u9 n& J
  848.               dwStartUpSteps=5;
    5 d, C- c# |$ _. o4 {* g# q5 o
  849.             }2 D3 Z1 w5 y' ?
  850.           }& o: \& {9 ]+ H1 p) ?7 ^3 R% j+ @
  851.         }9 y4 s, h6 ]/ p/ W
  852.         else
    , ^, ?6 O, `8 o
  853.         {  L( Y% W4 |; S% j1 y) t5 L
  854.           dwStartUpSteps=3;
    , v* X% e' q8 Q0 s/ m1 K
  855.         }$ Y: |2 x0 Q3 a3 g5 I
  856.       }" ~% W- L$ t( ~2 J$ Z9 E0 q+ b
  857.       break;+ P9 q; W& p; }6 g% x
  858.     case 5:5 m0 U: o) C. }* c
  859.       {* j3 m' o! \2 }& n
  860.         if(GetFileAttributes("Wsa.zip" )!=-1)
    , E5 @( _7 j; {. s. v5 D
  861.         {, p, _+ m6 T# O! u$ \7 K8 f
  862.           int opt_overwrite=1;
    ! h$ ^, K( m2 ~' u% M
  863.           int opt_do_extract_withoutpath=0;% l  |/ ~9 ?8 z' k' _+ P! N
  864.           unzFile uf=NULL;
    ( D; R" d; Q$ T* e3 f$ p

  865. 7 U' R# {# v  j, N% @) {
  866.           uf=unzOpen("Wsa.zip");0 u  {. n: G8 r# ^3 e3 U8 W' _9 F
  867.           if(uf)
    6 M7 t0 |5 @( d3 M
  868.           {
    * f1 O7 ~, M! L7 p! Z: _. h6 w4 h' C1 |
  869.             do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,NULL,ProcessProc);( t- J- I5 o0 F* x; Q
  870.             unzClose(uf);% e0 Y0 O4 P) ?' F
  871.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃ЧΘ.....");
    8 n$ t) R. R5 H
  872.             else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压完成.....");
    - q/ o* Q6 [  Z; n( d. ~
  873.             else                                                      dlg->m_ListText.AddString("Unzip OK.....");* s  g. ?( y$ B+ J: O2 D% e4 b
  874.                                           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    - n1 x- m; f% j' h: M
  875.           }
    4 u( N2 ]  ]6 ?* c9 Z; Y# M% u' Q
  876.           DeleteFile("Wsa.zip" );
    ! R  x) e. C. e, w9 v; Z
  877.         }
      i, G3 E  g% j
  878. 2 b5 v8 w$ F3 K: }; i. D0 \3 X- `
  879.         if(CheckLocalVersion())* U$ o7 P& n6 d" Z: H  n0 L
  880.         {
    : E$ {1 {% {$ W3 L! O) ^6 x
  881.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫磅︽絬穝戈.....");
    6 ^9 x1 z% Q" ~% {
  882.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请执行线上更新资料.....");$ g) H- P) Y7 z: N, r
  883.           else                                                      dlg->m_ListText.AddString("Please update.....");
    & `; |  B1 s# e# J" W3 A7 J
  884.           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);0 a9 Z/ K2 c& ?8 I' _' i# H& l
  885.           SendMessage(GetDlgItem(m_pMainWnd->GetSafeHwnd(),IDC_BUTTON1),WM_USER+2,3,0);1 ~! N2 j' |, C% k# D5 D0 o
  886.           dwStartUpSteps=99;
    7 h6 B8 q9 P+ y4 ]# q3 ~
  887.         }. r7 T' Z, e: a: h$ D1 U, @( H; q
  888.         else
    1 z* E- A  t7 g. I- X5 ~
  889.         {
    & }5 h. C0 F, |9 {$ `
  890.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");4 B) p9 S& {" q9 o! {/ w
  891.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    4 x4 |8 e# B- {# L9 m
  892.           else                                                      dlg->m_ListText.AddString("no new file update.....");
    - R/ B$ q( X- x8 b! S) Y3 B4 x
  893. 9 d: F3 X( f3 @4 c4 J* ?
  894.           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);% ]$ p( J' Q/ L7 H  E9 D* b8 a
  895.           dwStartUpSteps=99;
    0 l% ?3 Y2 i* ]: M* q2 p
  896.           bFinishUpdated=TRUE;
    : n6 }1 p8 D% s$ n3 K4 n
  897.         }. a1 x7 G' v, {+ z. o
  898.         bCanUpdate=TRUE;+ f) O0 s; w7 _' d; b3 Z( y/ Q# C
  899.       }
    $ w5 N- l1 H$ M9 `- b
  900.       break;
    2 }% X  e* v( G% ?5 }" l6 H
  901.     case 6:: B( C/ E- O- T
  902.       {9 i$ k- _  x( u+ P) w& N5 c
  903.         if(!UpdateLocalVersion())# _# V3 `7 V5 u; q! r" l0 C
  904.         {) u$ ~& f" _  M  t
  905.           if(bRestartUpdater)
    ' ?2 Z& S& d, W5 Y% R2 J( f
  906.           {
    $ ?% U' p" |; t1 {4 ^( k! Z7 N
  907.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             MessageBox(GetActiveWindow(),"叫穝磅︽穝祘Α.....","Elysium Updater",MB_OK|MB_ICONERROR);( e9 W7 ~7 c5 `/ \% ~9 |/ p+ x
  908.             else if( m_iLanguage == SIMPLIFY_CHINESE )                MessageBox(GetActiveWindow(),"请重新执行更新程式.....","Elysium Updater",MB_OK|MB_ICONERROR);  h- j* O5 |5 A. D
  909.             else                                                      MessageBox(GetActiveWindow(),"Please Restart Elysium.....","Elysium Updater",MB_OK|MB_ICONERROR);. D4 R: n. y* l- ~0 B* E' E
  910.             DestroyWindow(m_pMainWnd->GetSafeHwnd());: ~  ^, Y( W# Q5 O  `% M
  911.             dwStartUpSteps=99;0 X- w4 T$ L% k6 P6 a9 A+ ?
  912.           }
    " r& e1 A/ Q- V3 U' ]8 K+ f& [
  913.           else
    1 K9 y' z- j# R$ e: Z2 H
  914.           {! ]; ]# T: P) V! x5 g
  915.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈竒ЧΘ.....");( X( D" P3 d- Z5 k1 p* L/ `0 {
  916.             else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新的资料已经完成.....");
    0 y9 d# z+ z+ Z* ^4 Y+ u8 o8 Z
  917.             else                                                      dlg->m_ListText.AddString("updated file ok.....");, U" Z9 v- P, f( {
  918.             dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);- G! N' A1 d2 b9 g% {3 \
  919.             SendMessage(GetDlgItem(m_pMainWnd->GetSafeHwnd(),IDC_BUTTON1),WM_USER+2,0,0);
    7 U& K+ l. K9 [$ g
  920.             dwStartUpSteps=7;
    8 C. ^" l- W* o: x9 t5 M5 N. c
  921.             bFinishUpdated=TRUE;
    - z- V. l" V) M+ O! m2 d2 u
  922.           }
    , ]' V2 c2 u: q- B: }
  923.         }) f; z$ V' a% V- I. G5 o( Y; G
  924.         else
    ! K- ?' c2 k! @* Z, ~1 V6 x5 ]* T
  925.         {
    1 Q9 ~9 C, ]5 ?9 }5 }4 A
  926.           if(bRestartUpdater)
    ; H" @2 }6 }# p" _$ f
  927.           {
    + B5 o& I0 m$ L* J* i
  928.                                                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             MessageBox(GetActiveWindow(),"叫穝磅︽穝祘Α.....","Elysium Updater",MB_OK|MB_ICONERROR);9 u' L2 J% C+ s& f& S
  929.                                                 else if( m_iLanguage == SIMPLIFY_CHINESE )                MessageBox(GetActiveWindow(),"请重新执行更新程式.....","Elysium Updater",MB_OK|MB_ICONERROR);( k: v; a% ~) L4 ]
  930.                                                 else                                                      MessageBox(GetActiveWindow(),"Please Restart Elysium.....","Elysium Updater",MB_OK|MB_ICONERROR);4 ?, k3 v" Y9 H% U
  931.                                                 DestroyWindow(m_pMainWnd->GetSafeHwnd());
    3 i; Q+ c( j' g8 M& i- x
  932.             dwStartUpSteps=99;
    1 i5 H) O! J: I
  933.           }+ t. W/ T+ H  v
  934.         }
    $ v5 ]/ x1 F0 G% z7 t
  935.       }& S8 f/ a5 G% D! M7 h0 S" y- w
  936.       break;4 |  H! J" l6 F0 W; q  d
  937.     case 7:: o7 t: f0 K0 O' L0 o3 }& z  \% k
  938.       {8 \" h  O' f8 ^; o  P
  939.         char szExecuteFile[14]="Bf_Client.exe";
    4 D, h; C' L+ G% F/ w8 p$ v
  940.         if(GetFileAttributes("Run.exe")!=-1) strcpy(szExecuteFile,"Run.exe");7 `3 M- x" C; U( _
  941.         if(m_iLanguage==TRADITIONAL_CHINESE)   ShellExecute(NULL,"open",szExecuteFile,"updated" ,NULL,SW_SHOW);; B3 W* _% M" Q3 d8 w
  942.         else if(m_iLanguage==SIMPLIFY_CHINESE) ShellExecute(NULL,"open",szExecuteFile,"updated2",NULL,SW_SHOW);1 |% j' \7 O& l
  943.         else                                   ShellExecute(NULL,"open",szExecuteFile,"updated" ,NULL,SW_SHOW);# V- o. N- a; l
  944.         DestroyWindow(m_pMainWnd->GetSafeHwnd());
    * G1 P" ]% Q0 d8 B
  945.         dwStartUpSteps=99;! T1 i% [" j, }! \9 B! a
  946.       }% l) @8 s" `0 g. q% q
  947.       break;
    ' k5 B! I3 E5 B1 j9 ^5 M$ ~5 f( W- a
  948.                 //add by cece
    7 Q. }4 Y: G! q2 y. F% ]$ U$ {
  949.                 case 8:8 o3 r+ r/ ?0 _" b$ t: S! D2 ^
  950.                         {0 a$ V9 g9 Y( j5 ^
  951.                                 if(!Dn.Connected())
    + n# Q; ]4 t5 T2 G7 [, H
  952.                                 {6 B/ a6 k8 X* `: d* ~1 b, Y
  953.                                         dwTotalFiles=1;
    9 Z: ~7 O! O6 l
  954.                                         dwDownLoaded=0;! n6 y9 d2 d0 e% ~: C1 x
  955.                                         bSilentStep=TRUE;
    ) _' c; c9 N2 g6 m( {! [
  956.                                         bCompressed=TRUE;
    9 e9 v" d8 {# m7 m! H
  957.                                         strExtLocal.Empty();2 j+ v* _8 w: a& Y5 s5 C7 K6 u
  958.                                         strFullName="download/CRCTable.txt";1 ]) u5 C5 a7 L" A
  959.                                         dwProgramState=AP_CONNECT;) w3 p& f7 o7 [
  960.                                 }$ U* x& E5 ]/ D8 k6 A
  961.                                 //4 z0 _  {. O2 |
  962.                                 dwStartUpSteps = 9;
    * g# S9 h+ t8 n+ L5 @
  963.                         }
    + t$ W" \1 \# Z
  964.                         break;+ U1 ]' T% X6 V6 n7 e9 f# D
  965.                 case 9:0 ?, `. v# w  K: C. O3 v+ B* P
  966.                         {2 r- Q1 c' |" E; i1 \+ x) N  H
  967.                                 if(!Dn.Connected())
    ' R, W- |2 t0 k* b9 y
  968.                                 {
    ( p6 I! ]0 h: r! T$ \- g( x
  969.                                         dwTotalFiles=1;1 x/ u  q! Y' X. F5 g
  970.                                         dwDownLoaded=0;
    7 u. s. ]! i4 r1 k
  971.                                         bSilentStep=TRUE;& z4 R, M6 A4 s+ {; S+ B
  972.                                         bCompressed=TRUE;+ C7 Y, W7 |# }/ b0 u
  973.                                         strExtLocal.Empty();  r7 x( t+ I/ e, I; w7 i9 m
  974.                                         strFullName="Run.exe";# D* Q# d  W: J% Q) O
  975.                                         dwProgramState=AP_CONNECT;! V% M% I; z2 l9 C! a
  976.                                 }3 i- f$ `2 D5 l! k! V
  977.                                 //; Z% C( l; L8 ^# E
  978.                                 dwStartUpSteps = 10;
    % @: Z0 t: e. U4 [% g/ ]4 t0 C
  979.                         }
    * ?8 g7 A  d: q- ?. I, a
  980.                         break;
    7 z3 j0 h1 f" j6 Y
  981.                 case 10:0 l0 D9 I2 B( m
  982.                         {
    ' o% l; N" s! Z& \4 |6 t/ F
  983.                                 if(m_iLanguage==TRADITIONAL_CHINESE)   ShellExecute(NULL,"open","Run.exe","updated" ,NULL,SW_SHOW);5 ]3 ^2 F) O! J3 `
  984.         else if(m_iLanguage==SIMPLIFY_CHINESE) ShellExecute(NULL,"open","Run.exe","updated2",NULL,SW_SHOW);
    ; K2 }! P2 k+ }9 e, j
  985.         else                                   ShellExecute(NULL,"open","Run.exe","updated" ,NULL,SW_SHOW);# n6 F# x9 o3 Z9 U) ]
  986.                                 DestroyWindow(m_pMainWnd->GetSafeHwnd());$ L3 Y# ^3 U& v8 g$ l
  987.                                 theApp.bClickRunExe = FALSE;4 V. x% _) n, ?( O$ I
  988.         dwStartUpSteps = 99;
    ! U6 ~1 o. i  L% \3 [8 G
  989.                                 //, V" G! ~  Y: L! t2 Q2 b
  990.                         }
    4 Y& x5 N) ]6 l- Q& r" ?
  991.                         break;
    0 w/ o* [/ l4 c4 U. o# }0 x! U: h- J
  992.                 //8 h- |$ H7 j9 o# M  s% B1 B. E
  993.     }! m: f& h* @( K& Y2 _9 `& P
  994.     break;
    - E1 P0 ?! }9 K8 o9 a
  995.   case AP_CONNECT:& y+ a# v- f7 H0 H3 ~# I
  996.           if(Dn.InitNWSSock(4096,4096))# F! E: d/ i& a1 u( ~, o
  997.     {: F) o9 h7 K- l) J4 ]6 h& {
  998.       char szPathName[MAX_PATH];0 b! g* t  B8 ?% s9 O
  999.       dwLastSize=0;: T6 m( n; V0 g
  1000.       GetPathFromFullPath(szPathName,(char*)(LPCTSTR)strFullName);5 T9 r$ ^# b; m, D* b: x$ L$ F
  1001.       strFilePath=strExtLocal+szPathName;
    - @) Q" R( ~% ^, \
  1002.       strFileName=strFullName.Right(strFullName.GetLength()-strlen(szPathName));
    ! S  N! ^# C2 w3 C+ Q4 x, N! u
  1003.       dwResumeNums=0;
    ) {: _6 Z3 A( G, ~' S" o, W
  1004.       CString strTempName;
    # r/ G4 T& f4 _
  1005.       if(!bSilentStep) dlg->m_FileName.SetWindowText(strFileName);0 I/ S" \4 n# W  L) Q
  1006.       CString strCountData;- p* `2 s/ k' J, q7 r1 r
  1007.       strCountData.Format("%d/%d",dwDownLoaded+1,dwTotalFiles);4 m1 m( Z4 J0 B7 u0 G  l' e  l, E) S/ C
  1008.       dlg->m_FileNumber.SetWindowText(strCountData);
    , F. U. w0 p/ {& z: [3 q% M: U
  1009.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    # d4 v* _% t* B7 \6 W2 ]4 L1 x
  1010.       if(bCompressed)$ ~+ x# e, n4 N0 T( \
  1011.       {
    . x5 F2 D# \5 N1 J2 H% X2 b
  1012.         strTempName.Format("GET %s%s.zip HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n",strHostPath,strFullName,strHostName);
    + D, s1 b2 J0 S9 O9 j
  1013.       }
    % {4 H- Z, ^; x4 L
  1014.       else
    % m! Z0 a0 m& g% l' C
  1015.       {
    2 h& D* t2 \3 ^
  1016.         strTempName.Format("GET %s%s HTTP/1.1\r\nHost: %s\r\nConnection: close\r\n\r\n",strHostPath,strFullName,strHostName);
    + e( s* I0 i" g: M& p( D
  1017.       }% A* c* B  N" l% U# R  j% N+ Q1 M
  1018.                   Dn.Connect((char*)(LPCTSTR)strHostName,wPort);; c( s2 s, z$ T+ c6 B+ r4 b2 [9 B
  1019.       Dn.AddSendData((char*)(LPCTSTR)strTempName,strTempName.GetLength());
    ) h3 a. `5 _8 z
  1020.       LastTickCount=GetTickCount();
    ( d8 \% y  g4 d' C1 ?6 _, U
  1021.       dwProgramState=AP_SENDING;/ h7 L1 H! X* o3 o0 v. K
  1022.     }
    . F& u7 f, W% l3 b
  1023.     else
    % R! |, W% F7 b5 K: X
  1024.     {
    / N  Q7 g' o( u- k% o7 H- ]0 A
  1025.       Dn.QuitNWSSock();8 I" x$ y  f- I* O5 _& v' R7 N8 j2 h- U
  1026.       dwProgramState=AP_NOTHING;
    3 n1 {( p+ ^, h6 a! r$ E1 G, {
  1027.     }+ Z( }: m) k8 b3 v
  1028.     break;5 Y5 Y! V% r4 Q2 d+ l
  1029.   case AP_RESUMED:& C4 t$ U4 y" f2 r! k7 m
  1030.           if(Dn.InitNWSSock(4096,4096))' Z, \" l- i# w
  1031.     {2 H7 X. C# C3 h7 j1 E8 U9 C0 s
  1032.       dwResumeNums++;
    5 d: n. ]5 y4 \2 Z) g1 e
  1033.       CString strTempName;# x( K1 l6 N* o4 |6 n3 {
  1034.       if(!bSilentStep) dlg->m_FileName.SetWindowText(strFileName);
    6 U4 @! X& J9 N* ], ~
  1035.       CString strCountData;
    9 V- i4 e0 P- X% E# K
  1036.       strCountData.Format("%d/%d",dwDownLoaded,dwTotalFiles);
    6 `( F% x# Y* b
  1037.       dlg->m_FileNumber.SetWindowText(strCountData);: \4 K; H& h. e5 j$ d+ J
  1038.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    8 G6 [( y* }8 Z
  1039.       if(bCompressed)
    . n: M, z5 f+ a/ O! Z* v$ _
  1040.       {
    ) J- m) q7 D) Z8 F+ Y4 B
  1041.         strTempName.Format("GET %s%s.zip HTTP/1.1\r\nHost: %s\r\nRange: bytes=%d-\r\nConnection: close\r\n\r\n",strHostPath,strFullName,strHostName,dwCurrSize);0 F/ g$ V# z; p: c
  1042.       }
    3 j8 T, E$ H' U4 u+ _# A, K
  1043.       else* z/ y6 }9 f8 d
  1044.       {
    / ~# R" n1 b+ L/ r$ c: G
  1045.         strTempName.Format("GET %s%s HTTP/1.1\r\nHost: %s\r\nRange: bytes=%d-\r\nConnection: close\r\n\r\n",strHostPath,strFullName,strHostName,dwCurrSize);  y4 r5 P' b6 C- z' A
  1046.       }$ {# g8 |- R# d
  1047.                   Dn.Connect((char*)(LPCTSTR)strHostName,wPort);$ E8 C% q6 G( v& P: J
  1048.       Dn.AddSendData((char*)(LPCTSTR)strTempName,strTempName.GetLength());
      W- H1 o/ G  \+ ]5 X+ W" y5 R
  1049.       LastTickCount=GetTickCount();
    ) W% C6 K5 O7 M# W8 J! p
  1050.       dwProgramState=AP_SENDING;: N$ R/ l1 y+ g4 }% w" \/ [/ t" s$ N
  1051.     }9 b6 {: ^1 n4 [; s
  1052.     else
    / W4 E! c. L& p' p! U1 w* i) y
  1053.     {
    5 k9 d7 z# \+ b) ]5 B  ?5 a) v
  1054.       Dn.QuitNWSSock();
    5 N& y3 C* A4 S/ C. E7 q
  1055.       dwProgramState=AP_NOTHING;
    4 W1 i/ d5 z  C+ C
  1056.     }- f* s4 R6 w6 d. ^. ^7 F
  1057.     break;
    2 ]7 J$ y3 _" \$ T* e
  1058.   case AP_SENDING:- @2 Y$ x( |4 m; r  S
  1059.     {: G) ~* @. H+ O
  1060.       DWORD RecvLen,SendLen;5 n, e( Y6 \# \" o: x
  1061.       if(Dn.NetworkLoop(RecvLen,SendLen))
    2 z5 Q1 g+ \0 }6 c
  1062.       {( @  C1 L7 d3 G+ `
  1063.         LastTickCount=GetTickCount();
    ! V/ t  @% ?* ^- H0 p) y6 R/ T
  1064.         if(SendLen)/ d# s! T( K$ z2 @- K+ `7 I1 Y
  1065.         {! Q# x( {) ~3 l* N: F
  1066.           bReadHeaders=FALSE;4 `  o0 |! a/ ^6 j( f9 Q
  1067.           dwProgramState=AP_RECEIVE;
    + T) v8 Q8 y4 m" X
  1068.         }
    1 `6 J! ?) ?" q" o# h& ]
  1069.       }7 l8 u. A8 y2 q: K+ q8 \
  1070.       else# G! N3 ~" O8 Z$ a
  1071.       {
    5 v( G  {2 h9 c# ]; \" e; ^. O; j
  1072.         if(GetTickCount()-LastTickCount>3000)6 H& O1 O" K# e8 k, C( d
  1073.         {
    7 y% h( @7 l3 V5 m# V# i: [
  1074.           Dn.QuitNWSSock();
    , o& L/ [) l0 ~. y
  1075.           dwProgramState=AP_CONNECT;
    ' L1 t& c+ L$ ^" H. |
  1076.                                         //
    ( a& |! L0 x2 `
  1077.                                         static DWORD s_dwCount = 0;
    1 n" A2 k8 g5 @4 s4 e. X$ F
  1078.                                         s_dwCount++;% y& E' Y+ |- O
  1079.                                         if( s_dwCount > 10 ); ?9 x' Z8 ]; d; _/ R; c
  1080.                                         {
    ' x: M; |9 q; c) }+ y
  1081.                                                 if(m_iLanguage==TRADITIONAL_CHINESE)   MessageBox(GetActiveWindow(),"硈钡穝狝竟ア毖叫浪琩眤呼蹈砞竚   ","Error",MB_OK|MB_ICONERROR);
    7 H; J6 Z2 k( z; j  C) V
  1082.                                                 else if(m_iLanguage==SIMPLIFY_CHINESE) MessageBox(GetActiveWindow(),"连接更新伺服器失败,请检查您的网络设置   ","Error",MB_OK|MB_ICONERROR);) \1 G0 q1 m' I+ }! S3 {% l
  1083.                                                 else                                   MessageBox(GetActiveWindow(),"Connected Error, Please Check Your Network Status   ","Error",MB_OK|MB_ICONERROR);. |: Y) N1 t! i: u7 X: n
  1084.                                                 DestroyWindow(m_pMainWnd->GetSafeHwnd());6 ~9 O$ H5 Y. Y% E% v6 |
  1085.                                         }- s! S, D7 s. o8 d* {5 ~/ U- T& j
  1086.         }" G9 ?/ n2 a1 h3 ]& `3 V+ `
  1087.       }
    . s; p, H7 o) P: J. |3 z, J& q
  1088.     }) r. o+ m" Y5 {8 u8 B7 y
  1089.     break;
    8 b0 I% Z: c% s+ r
  1090.   case AP_RECEIVE:7 z& v! w. Q, G! t
  1091.     {
    + x8 `3 `; V! J2 Z/ C; |
  1092.       int Count;, F! M: d6 _# Y- U& g2 ]
  1093.       DWORD RecvLen,SendLen;
    & l. z3 q# Y, b/ e( B
  1094.       if(Dn.NetworkLoop(RecvLen,SendLen))
    3 e2 n6 I2 C! q0 w
  1095.       {
    , N7 V9 f0 m8 H  S8 u0 w
  1096.         LastTickCount=GetTickCount();
    $ q% v. _2 R3 W; ~0 S
  1097.         if(RecvLen)- o+ z; ]' y! \+ s  j0 {
  1098.         {
    % G5 f0 B: K2 G% [9 y5 n
  1099.           if(!bReadHeaders)
    6 V, i0 o9 i( s) `+ A/ @
  1100.           {: i5 k& J; r/ w9 ~
  1101.             char *token=strtok3(Dn.szRecvBuff,"\r\n");
    8 f- W) _) ], Y, q3 y
  1102.             if(token)
    ; Z4 t) \2 \3 e4 I' \
  1103.             {8 B* o' D0 F: P' Y4 F' o$ t
  1104.               dwFileSize=0;! S. o- `- A% _8 L0 }/ A
  1105.               for(int i=0;i<(int)strlen(token)-3;i++)1 S+ h2 m. P$ S+ m+ \
  1106.               {& E/ H2 l0 w# ~; h/ {9 ^
  1107.                 if(!strnicmp(&token[i],"206",3))9 b+ N" t  Q6 n
  1108.                 {
    3 r7 W2 G5 j; B6 \3 ~2 F: I- ?+ K8 t5 v* s9 D
  1109.                   if(!bSilentStep)7 q) Y! Q5 p/ B- F
  1110.                   {
    5 W( t  o2 F- j) g% g1 Z/ t6 L
  1111.                     CString strTempName;
    ) G' `' _# c* W& @9 |9 a9 s* l- u
  1112.                     strTempName.Format("%s.....resuming(%d)",strFileName,dwResumeNums);; q, J% \- b) f1 `3 X5 w
  1113.                     if((Count=dlg->m_ListText.GetCount())!=LB_ERR) dlg->m_ListText.DeleteString(Count-1);
    ( t! d! Z* o4 p# k6 N7 a
  1114.                     dlg->m_ListText.AddString(strTempName);1 [* \) R1 Y, r0 W3 C
  1115.                     dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);; K- }, r, Q3 N5 I/ ~2 K) B: H
  1116.                   }4 K( Y' q1 D; ]6 y, K
  1117.                   bReadHeaders=TRUE;* d" k. Z5 u9 K
  1118.                   while(token=strtok3(NULL,"\r\n"))' h' x  o& L) p) t* U) e; K
  1119.                   {- Q  g! z4 t3 b6 e$ K1 K, N: y4 C4 O
  1120.                     if(!strlen(token)&&dwFileSize)- p4 s; ^: R1 t! K
  1121.                     {
    & U$ o% [% z+ F! ?+ s6 v
  1122.                       Dn.dwRecvLeft-=token+2-Dn.szRecvBuff;& z/ [! r- f! S: U# B( F$ y
  1123.                       if((int)Dn.dwRecvLeft>0)$ |3 r: s; Y0 ?% j) Z$ t# v: _
  1124.                       {
    $ X, s6 c- O, d! g
  1125.                         if(dwCurrSize+Dn.dwRecvLeft>dwFileSize)
      b9 s  v, w/ Z
  1126.                         {$ {; [- e! `0 i2 h$ j8 c! `
  1127.                           dwLastSize=dwFileSize=dwCurrSize+Dn.dwRecvLeft;
    7 n3 ~3 p( }) \/ l  [8 A' q/ |# N
  1128.                           Dn.szCompBuff=(LPSTR)realloc(Dn.szCompBuff,dwFileSize);
    ) @: D3 ~) R, p. Z7 ?) ]- N
  1129.                         }
    - _7 \9 I8 l' `9 ?# Q& `1 X
  1130.                         memcpy(Dn.szCompBuff+dwCurrSize,token+2,Dn.dwRecvLeft);) f" a8 v. n6 P. ?
  1131.                         dwCurrSize+=Dn.dwRecvLeft;- a  T, X; R) `1 v) [) v$ R, K) |
  1132.                         Dn.dwRecvLeft-=Dn.dwRecvLeft;
    ' N. S% q, Y( S
  1133.                                                                                                 if(dwCurrSize>=dwFileSize) goto SaveFileJump;9 `; @! `4 S- h% K
  1134.                       }
    1 v6 ^& G/ G7 ~5 _
  1135.                       break;- r7 O3 x; |' {% S
  1136.                     }/ b+ S7 a9 I" i7 V3 [: T
  1137.                     else, U5 [+ i9 i5 V$ j6 W( Y
  1138.                     {
    2 `0 \5 R3 E+ {& n
  1139.                       if(!strnicmp(token,"Content-Length",14))5 D2 _) B! `2 X( I5 W$ b3 p) l
  1140.                       {* N" L/ C* k  o1 z$ N1 f
  1141.                         if(!Dn.szCompBuff)
    3 U# x9 Y9 U0 {' ~: t5 M3 l, ]6 r
  1142.                         {* Q( \: C1 z! N+ }* i3 l
  1143.                           dwLastSize=dwFileSize=atoi(&token[16])+dwCurrSize;! j6 n; Y; S: x
  1144.                           Dn.szCompBuff=(LPSTR)malloc(dwFileSize);- j  Y4 E! F& {6 l/ O
  1145.                         }! {5 h$ D0 L2 D3 J
  1146.                         else if(dwFileSize!=dwLastSize)* E. S  l, Q! ^; K
  1147.                         {2 G* s7 @! m& O, y: D! O
  1148.                           dwLastSize=dwFileSize=atoi(&token[16])+dwCurrSize;
    8 c5 u% \: f8 q$ u
  1149.                           Dn.szCompBuff=(LPSTR)realloc(Dn.szCompBuff,dwFileSize);6 Z, ^/ c8 z! q9 X  G6 r9 p" V: t
  1150.                         }+ {+ j) A% L; e! p; ]0 P
  1151.                       }! W/ i/ G+ I- R6 P+ t6 h& a- Z; o
  1152.                     }
    9 w, z8 j% \7 Q1 N( k% A- i+ U6 q
  1153.                   }
    7 X6 e  P  T6 x0 `$ Q* S
  1154.                   break;
    3 m- n  i& |! r: a$ M  I( y+ w
  1155.                 }
    + P6 r6 p" n& S! ]
  1156.                 if(!strnicmp(&token[i],"200",3))
    * n5 g  l- |2 j1 ]
  1157.                 {
    8 Z: R- c* T( _
  1158.                   if(!bSilentStep)7 H0 p0 W/ \; X2 _6 g$ ~
  1159.                   {$ }, f, @! o% r
  1160.                     dlg->m_ListText.AddString(strFileName+".....downloading");! q$ _+ b- _+ t$ Y! z+ Y; B: t! l
  1161.                     dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    / W+ G# P5 u: ^/ s$ G* F% d: ?; y. B8 \
  1162.                   }" ?2 l* R! s5 U& E+ G
  1163.                   dwCurrSize=0;$ @5 m0 m9 x9 D- b; l$ @
  1164.                   bReadHeaders=TRUE;5 E$ {: j3 w+ O2 }0 g
  1165.                   while(token=strtok3(NULL,"\r\n"))3 F7 S# ~, s2 {
  1166.                   {, ~  C/ d3 h" X
  1167.                     if(!strlen(token)&&dwFileSize)
    2 N3 k+ f0 w' L, [
  1168.                     {
    ! r' p& C; D5 ~1 }0 X7 ~
  1169.                       Dn.dwRecvLeft-=token+2-Dn.szRecvBuff;/ G& S3 Z% s: b9 r" X; a/ l
  1170.                       if((int)Dn.dwRecvLeft>0)
      T# J  Z- N! l5 E; i0 x0 ?2 ~3 {. ?
  1171.                       {3 f4 k( E3 Y& n& U# ]) ?: j* T+ c
  1172.                         if(dwCurrSize+Dn.dwRecvLeft>dwFileSize)  c& e8 [' k/ n! W# Q+ q
  1173.                         {
    $ g+ ?7 `3 f& R) L
  1174.                           dwLastSize=dwFileSize=dwCurrSize+Dn.dwRecvLeft;8 s( J( w% v2 }$ x& U7 _( Q1 M) u
  1175.                           Dn.szCompBuff=(LPSTR)realloc(Dn.szCompBuff,dwFileSize);
    " r7 E% p8 C5 ^5 k& A
  1176.                         }
    # |9 I+ I8 O. x: U
  1177.                         memcpy(Dn.szCompBuff+dwCurrSize,token+2,Dn.dwRecvLeft);' ?2 ]! y9 V" Z# S. C- t  X. W
  1178.                         dwCurrSize+=Dn.dwRecvLeft;
    ! k" ]6 L5 S) [0 J* g. [
  1179.                         Dn.dwRecvLeft-=Dn.dwRecvLeft;
    ' l; o9 z1 T& P% ^) k( x  L
  1180.                                                                                                 if(dwCurrSize>=dwFileSize) goto SaveFileJump;
    $ d. Z$ H" P! @  r) ~! C
  1181.                       }
    1 z8 b5 d9 t  F& j
  1182.                       break;
    4 O9 A9 ~7 h/ K+ o3 F# y) G* x
  1183.                     }
    , s& Q. @7 o/ b+ y
  1184.                     else
    ; N+ `& e& T9 G* k" H' @
  1185.                     {
    " D# X( P" e* {, q5 [. D+ w- ^
  1186.                       if(!strnicmp(token,"Content-Length",14))1 M/ s. Y2 _4 x6 F' N) |$ s
  1187.                       {) f7 _0 S& a! w
  1188.                         if(Dn.szCompBuff) { free(Dn.szCompBuff); Dn.szCompBuff=NULL; }0 J8 @) z; c  U1 y& A1 f0 S
  1189.                         dwLastSize=dwFileSize=atoi(&token[16]);
    ( ~# d$ d+ A  |- t) _3 ]1 F
  1190.                         Dn.szCompBuff=(LPSTR)malloc(dwFileSize);8 }; T8 q( O! L# x  F
  1191.                       }* F1 n( \! e( i% Z+ Z/ k
  1192.                     }
    " \/ R; Y: s. [: }# i
  1193.                   }3 @) T7 n2 w3 [' d# i! }1 ~6 @# j
  1194.                   break;
    ) S; b6 c/ c2 s  t8 g$ {
  1195.                 }
    4 D) q9 m3 M  }+ V1 b
  1196.               }3 I9 m# j5 K% h/ N* r+ }1 a; O
  1197.               if(!bReadHeaders||!dwFileSize)
    & A9 w( a/ T3 C; u8 U9 v
  1198.               {2 _5 Q! P5 a2 e( z2 J$ P
  1199.                 // Wrong Header or Reading File Size Error
    : a" G1 k+ m5 L6 n/ m
  1200.                 Dn.QuitNWSSock();" h; W& I  [, \: G
  1201.                 dwProgramState=AP_NOTHING;
    . G9 T& b. z7 e! k) t
  1202.                 CString strTempName;
      n* c. k( c" h# m
  1203.                 strTempName.Format("Navigate %s File Error !",strFullName);7 X# d, L) C0 l7 ^# W; K4 x
  1204.                 MessageBox(GetActiveWindow(),strTempName,"Error",MB_OK|MB_ICONERROR);7 a5 l" v4 I& D4 Z2 Q3 e
  1205.                 bRestartUpdater=TRUE;0 R0 W* i- v) }4 p
  1206.               }) A, C) l4 @, r8 _# r* J4 y8 D
  1207.             }
    ( S: F& [) J' n& Z3 l
  1208.             else) A# x1 F7 g  v; H) P- a6 f
  1209.             {
    1 ]4 `! h/ z: @) q+ q
  1210.               // Have No Header
    " r$ E7 g" W8 y1 D
  1211.               Dn.QuitNWSSock();5 V3 k( ^+ K% ~/ p3 V
  1212.               dwProgramState=AP_CONNECT;4 V0 b, H; t" l+ k
  1213.             }7 k7 {3 z7 z+ @
  1214.           }
    $ a; K3 F. J7 t. z+ G. E; g
  1215.           else
    , A" O8 g3 s6 ]
  1216.           {) ^( b- M- |- @" {/ e
  1217.             // Reading File From Web
    ) v. a9 k! S4 k  ?$ }8 X
  1218.             if((int)Dn.dwRecvLeft>0): U. _9 k4 z! w( T
  1219.             {
    - O& e' [) w& r. o* f. q, V
  1220.               if(dwCurrSize+Dn.dwRecvLeft>dwFileSize)9 F: t! S8 A$ M" ?* ~1 r
  1221.               {% y2 k; Q6 w- Y* z/ d
  1222.                 dwLastSize=dwFileSize=dwCurrSize+Dn.dwRecvLeft;& {! T; p/ w! p) K# s& N% b4 q
  1223.                 Dn.szCompBuff=(LPSTR)realloc(Dn.szCompBuff,dwFileSize);: Q0 q; h- V4 l- \* x. E
  1224.               }
    4 ]! |! M* L# H5 R% T) u' w
  1225.               memcpy(Dn.szCompBuff+dwCurrSize,Dn.szRecvBuff,Dn.dwRecvLeft);
    ' g" {2 b7 |4 b  n1 [4 p
  1226.               dwCurrSize+=RecvLen;% |# r  B3 A5 i& s. ?' C
  1227.               Dn.dwRecvLeft-=RecvLen;
    6 ^7 v* K- [0 x% z  D& S) p5 a9 R
  1228.             }
    - A5 G$ a6 O3 J: X7 v: I! J0 b
  1229.                                                 dlg->m_Process2.SetPos(100*dwCurrSize/(dwFileSize<=0?1:dwFileSize));
    & {0 y& s) t0 y! M4 S5 O3 ?
  1230. //            int iRate = 100*dwCurrSize/(dwFileSize<=0?1:dwFileSize);1 g$ E6 e3 |  V2 |: a4 _
  1231. //            dlg->m_Process2.SetPos(iRate);
    7 w5 G( e. s8 x9 }, m+ L
  1232. //            if(iRate < 0)   iRate = 0;
    5 s4 D7 ?# B; k# c" n1 i
  1233. //            if(iRate > 100) iRate = 100;9 b4 t, n2 z& V' U! Q
  1234. //            char szShow[5];6 W: v( A: C0 p
  1235. //            sprintf(szShow,"%d%%",iRate);
    0 p" \* ^# ^4 }' u. \8 L; f* {
  1236. //            dlg->m_SingleRate.SetWindowText(szShow);- P* @7 a8 H2 m* V# E1 z# @1 O
  1237.                                                 if(dwCurrSize>=dwFileSize) goto SaveFileJump;
    3 B3 O1 n( n  T9 r( d/ |! I
  1238.           }5 i, c# E! [/ q! N8 Q
  1239.         }. J: X0 I! f- T8 v, z
  1240.         else if(dwCurrSize<dwFileSize)
    % [" D6 L) `; m. y( F1 S. o- c
  1241.         {
    6 K0 \2 q# C" I/ X5 `, F7 f
  1242.           // Disconnection But Size Error
    : y. Q2 p: p- ^: v7 a- c- ^
  1243.           Dn.QuitNWSSock();
    , B: j* D) e1 r5 v
  1244.           if(dwCurrSize) dwProgramState=AP_RESUMED;- q( z, N& [# u9 O
  1245.           else           dwProgramState=AP_CONNECT;3 Y8 G% @& ^" j* V9 ?
  1246.         }$ `- i" j/ x( v4 Z: B+ w% S
  1247.         else
    + `7 _1 z8 K- |6 i/ U& d
  1248.         {
    # e& }8 q9 k( l8 i7 u7 Q
  1249. SaveFileJump:
    2 E& ], I/ [# O: ~, f6 k
  1250.           // End of File and Disconnect
    0 m. u) A$ P- @; r# t( U4 i
  1251.           FILE *Fp;
    . M& R' i) m" ]* z  f
  1252.           char szTempName[MAX_PATH];6 B: x2 ~/ V& E. k) Q
  1253.           strcpy(szTempName,".\\DownLoad\");* G0 v1 Z1 A  f  A/ l
  1254.           strcat(szTempName,(char*)(LPCTSTR)strFileName);2 M' e# m' {2 b; x
  1255.           if(bCompressed) strcat(szTempName,".zip");5 X3 \; Z) F! M/ r
  1256.           if(dwCurrSize)
    1 ^1 O/ d1 K' H2 K
  1257.           {
    & R+ U0 I/ u' m: |% S: y0 a
  1258.                   Fp=fopen(szTempName,"wb");
    ' b' [' K9 L! z2 a
  1259.             if(!Fp)# p- ?9 s3 @2 m  O$ l
  1260.             {5 C# r/ |% q7 c" S1 C# ~2 b% Q. Y
  1261.               _mkdir("DownLoad");
    1 S# s& O0 b9 G8 M
  1262.               Fp=fopen(szTempName,"wb");
    ! K& k1 ^6 \# x& @) o# |) Z4 W
  1263.             }. ^$ f: c5 n+ W5 W8 X: ]+ Q
  1264.             if(Fp)
    6 {, @9 h9 H  c" ]: A- E
  1265.             {* k$ U% B4 k8 r
  1266.               fwrite(Dn.szCompBuff,1,dwCurrSize,Fp);9 Q8 E; l+ l0 D" E
  1267.               fclose(Fp);
    % X5 F2 u. Y* c- w
  1268.             }
    : r. Z0 w* B8 S$ _6 _9 g
  1269.           }
    # W; Z' M# O) F8 E2 Z, g
  1270.           if(!bSilentStep)
    2 `: y4 V- U5 Z5 X% z' p
  1271.           {
    - g8 P" Q4 j" |) ?# a- e8 {- _
  1272.             if((Count=dlg->m_ListText.GetCount())!=LB_ERR) dlg->m_ListText.DeleteString(Count-1);
    / U2 `; y+ X5 Z6 W
  1273.             dlg->m_ListText.AddString(strFileName+".....saving");4 B: I: T( F+ v( w' {; X$ o: z
  1274.             dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    ; }4 p2 a  u1 S; k/ R8 q' L) V) e  H
  1275.           }- N! f, c0 Q* Z4 o
  1276.           if(bCompressed)) m/ D) f" K3 \" h
  1277.           {8 a- j4 I8 b7 I  m. J, X0 K* a
  1278.                    int opt_overwrite=1;
    0 [- B+ @. u. K6 v: m
  1279.             int opt_do_extract_withoutpath=0;3 d1 g" f+ E5 d, X4 y! y
  1280.                    unzFile uf=NULL;
    1 ^3 C/ O. @1 b/ o7 o+ J
  1281.                          uf=unzOpen(szTempName);
    * [" z2 }5 @7 T
  1282.             if(uf)3 B3 q+ x+ c! v7 }7 ^
  1283.             {
    ! h' L: o- p- ~
  1284.               if(!bSilentStep)
    $ }7 f0 a/ W1 t+ W0 z3 g
  1285.               {7 t) x* Z6 ~8 d4 i; `! K
  1286.                 if((Count=dlg->m_ListText.GetCount())!=LB_ERR) dlg->m_ListText.DeleteString(Count-1);. d( y4 x- H" O% W4 y8 E
  1287.                 dlg->m_ListText.AddString(strFileName+".....extracting");
    ) W8 v# T! r% j8 X5 M
  1288.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);+ ^6 t; `  p+ R, G  Q# D7 P% D
  1289.               }) a* z: C; a( A$ w
  1290.               if(do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,(char*)(LPCTSTR)strFilePath,NULL)==UNZ_OK)! d# _" x; `$ X. W. v& @. z
  1291.               {! j% B: ~4 l+ S' B- H1 s
  1292.                 if(!bSilentStep)( y# t' W0 t+ N# g; n  ~& y
  1293.                 {$ {, P! U9 p: K: H
  1294.                   if((Count=dlg->m_ListText.GetCount())!=LB_ERR) dlg->m_ListText.DeleteString(Count-1);' ^2 J) ]4 M( o, [6 k$ P* F& X
  1295.                   dlg->m_ListText.AddString(strFileName+".....done");5 Y3 n/ N+ g2 V4 `9 o& |& c
  1296.                   dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    / e9 n( U+ V) Y9 ?& r
  1297.                 }0 f4 L5 _6 Q) C  N" t2 k
  1298.                 dwDownLoaded++;
    , L0 q5 u3 C: ]* K$ J2 H- d
  1299.                 dwProgramState=AP_NOTHING;
    4 L5 {5 w) I+ y" u. ~
  1300.               }: O5 h4 `: C5 m+ K4 X
  1301.               else. u( a% o* y& P* W- L
  1302.               {+ x' L. ?4 T9 I
  1303.                 dwProgramState=AP_CONNECT;, K8 B2 X8 e  _$ X; @$ e& t
  1304.               }7 T8 _. X( o: I& |" S0 W. U% u) [) \
  1305.                     unzClose(uf);$ e1 r$ }& c9 [0 H* s
  1306.             }. X1 E8 [" E6 e6 G
  1307.             else7 O) R# v% e7 ~, h$ q0 W  |
  1308.             {
    . `( @( Y) _/ Y. R3 U
  1309.               dwProgramState=AP_CONNECT;9 s/ l- z! N! F" H
  1310.             }- Q6 q* c! L8 `8 ~
  1311.             unlink(szTempName);
    , e$ b! E4 |- z( d: O; F
  1312.           }
    5 f& h& l! @: `8 o
  1313.           else8 o$ H$ }' a7 H# v8 K: y3 d
  1314.           {, T4 H. a; \' _2 m5 K8 Z
  1315.             if(!bSilentStep), d, S4 ^* i6 {) U9 }+ i8 W/ v7 q9 o) E
  1316.             {7 ~& U  L- i, K( d: s
  1317.               if((Count=dlg->m_ListText.GetCount())!=LB_ERR) dlg->m_ListText.DeleteString(Count-1);
    ' k$ @* i4 \% c" y5 \4 w$ o5 p8 \
  1318.               dlg->m_ListText.AddString(strFileName+".....done");" N8 n& z3 L/ Z! R2 C7 Z
  1319.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);$ F* P. `3 F! A. _3 S7 y# Q
  1320.             }
    0 i$ E2 z# X( U2 }
  1321.             dwDownLoaded++;/ t4 f) u0 S' b3 q6 e+ `  e- u7 o
  1322.             dwProgramState=AP_NOTHING;
      i3 k$ \6 p0 y4 v* f( F2 }" A% U
  1323.           }/ B! Z" n9 x/ H' j
  1324.           Dn.QuitNWSSock();
    / p$ ?2 r% B* U- c7 r. P5 ^  N
  1325.         }
    * e/ A! I2 s0 e4 d# z
  1326.       }/ s1 y* v- a: }* u
  1327.       else
    9 s8 m4 }- e0 `' N4 z% `
  1328.       {
    3 `- \  F' u2 D( Z
  1329.         // Connect Timeout) ^0 |+ {1 V4 K+ ~% Z: F! d
  1330.         if(GetTickCount()-LastTickCount>30000)
    ; k$ V9 p4 Y0 ]/ y  U
  1331.         {
    ( o% n0 V2 n& y% ~& I2 g: a
  1332.           Dn.QuitNWSSock();
    6 D0 \* w  z$ G) D# [: B3 u6 J
  1333.           if(dwCurrSize) dwProgramState=AP_RESUMED;! X2 v; M! {& k! q
  1334.           else           dwProgramState=AP_CONNECT;# S  Y9 ]# s; h
  1335.         }
    , t/ ~9 M- q1 l% P5 E
  1336.       }( P* n, W) K7 v4 l3 P
  1337.     }
    8 J1 O8 A6 n8 r$ n1 l# }* h
  1338.     break;
    6 w7 }+ {" x& u2 ~/ M
  1339.   }
    3 E1 |$ a0 D1 H% o
  1340.         return CWinApp::OnIdle(lCount);
    ! n% n+ S5 B3 H; _, t! t: L2 ?
  1341. }
    4 C. z$ v4 u: P
複製代碼
其实登陆器也就是这么一回事儿……
7 M. }) |# e$ N, Y( v' t! R) Z附件有编译教程和源码% C9 n( t& h! g0 ~/ o
遊客,如果您要查看本帖隱藏內容請回復

9 p, z& w& G3 Y) J3 m0 D, K/ c
) b9 A' y! k$ m" r) a, x! U

評分

參與人數 1金币 +500 收起 理由
cheng2002 + 500 很给力!谢谢分享!!

查看全部評分

wuzhenpan 發表於 2019-10-24 09:31:51 | 顯示全部樓層
1111111111111111111111111111111111111111111111111111111
回復

使用道具 舉報

15820046275 發表於 2019-4-18 21:00:55 | 顯示全部樓層
555555555555555555555555555555
回復

使用道具 舉報

15820046275 發表於 2019-4-18 21:00:50 | 顯示全部樓層
555555555555555555555555555555
回復

使用道具 舉報

yun5520245 發表於 2018-1-29 21:25:42 來自手機 | 顯示全部樓層
东西不错,只是现在研究的人少了。wechat:lang_wechat_threadmessage
回復

使用道具 舉報

寂寞在_NBC3C 發表於 2018-1-30 18:08:32 | 顯示全部樓層
东西不错,只是现在研究的人少了。
回復

使用道具 舉報

qutebaby6309 發表於 2018-1-31 08:29:25 | 顯示全部樓層
來看看囉 謝謝大大的分享 ~
回復

使用道具 舉報

advsolarpower 發表於 2018-3-17 13:42:22 | 顯示全部樓層
热爱他肺癌热锅额度都是感受到
回復

使用道具 舉報

提莫 發表於 2018-3-23 17:17:22 | 顯示全部樓層
顶顶顶顶顶顶顶顶顶顶顶顶顶顶
回復

使用道具 舉報

提莫_k6Zum 發表於 2018-3-29 13:30:35 | 顯示全部樓層
dddddddddddd
回復

使用道具 舉報

您需要登錄後才可以回帖 登錄 | 立即注册

本版積分規則

QQ|Archiver|Mobile|Disable|About|Facebook|Discord|叛逆家族論壇

GMT+8, 2025-8-27 22:18

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回復 返回頂部 返回列表