找回密碼
 立即注册

CSUpdate.exe源代码

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

* H- b! d. l% S/ d, d
  1. / RevApp.cpp : Defines the class behaviors for the application.
    & D& K% f1 P& f1 C) X
  2. //
    ' V9 y$ r- R) Z+ W7 I

  3. 2 q+ s# e# r2 V1 H8 B9 B
  4. #include "stdafx.h"
    ) G; D0 U* J7 z# N0 G4 I+ c3 m
  5. 3 u# p$ |3 i/ o6 C( [# F% ~
  6. //#define UNICODE
    8 i' j4 A* m6 O6 a5 b6 [
  7. //#include <gdiplus.h>
    , {+ j  B$ Q: w6 u
  8. //using namespace Gdiplus;
    ' b! g3 \, L: U6 m% K

  9. ) S; E/ _: n5 L, h# @
  10. #include "RevApp.h"
    - j9 O' S9 I8 H5 z
  11. #include "RevAppDlg.h"
    6 g8 n. g( k8 l. _. W1 P; I
  12. " @* }" V" W+ E: v, s; k
  13. #pragma warning(disable:4786)
    , Z" u6 y0 j- O
  14. #include <map>8 U7 {' d# p6 v2 b9 T; i
  15. #include <list>
    # H5 e1 N1 |, @6 V
  16. #include <direct.h>: h1 p; y+ I7 r& \2 P

  17. ! ]+ o. |* m9 ~
  18. #ifdef _DEBUG
    ) b2 q8 C: S2 f% l) i
  19. #define new DEBUG_NEW$ z. x+ C5 S9 f0 y5 Y! n8 K2 U# W
  20. #undef THIS_FILE
    4 i' v& A: o. h9 O* Y
  21. static char THIS_FILE[] = __FILE__;
    3 v3 ~- j( Y7 T  D9 h' _( A
  22. #endif# V0 N- u/ _$ T: _0 T# m+ m
  23. #include "SkinResDef.h"
    1 \1 o1 i$ V1 O/ w' ~3 [2 A
  24. #include "ChangeBG.h"5 c8 a) R6 n( _& y
  25. #include "AFXINET.H"
    : H! T9 u9 @, p- P
  26. ; F5 m9 Y( a2 f8 j* Q
  27. #define TRADITIONAL_CHINESE 0' y* `# c2 J) y( ^: s: C5 W
  28. #define SIMPLIFY_CHINESE 13 Q( X3 A! O  j+ `& B& p, K3 i
  29. #define ENGLISH 2
    : X9 Q  a$ h/ f" I" e
  30. int m_iLanguage = ENGLISH;' y- k8 s+ e3 e( J
  31. /////////////////////////////////////////////////////////////////////////////
    ' F2 A2 U/ K7 ?, ^  Z1 H
  32. // CRevAppApp
    + s1 M3 M' G% ?- }; O7 f, u

  33. ) U( s( B1 v( O9 R7 l# @
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp), `7 ~2 e: T2 O: `- ]" w2 O# r
  35.         //{{AFX_MSG_MAP(CRevAppApp)7 p) R9 w4 p( s5 Q' ]4 F
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.
    . b' L; T  }$ L+ b8 x
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!$ e9 ~* }: U( L3 r% @
  38.         //}}AFX_MSG
    & p( _5 U* h5 P" m1 ^
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)
    & f8 n& n9 g7 @9 U9 p6 u7 ~
  40. END_MESSAGE_MAP()" M" v2 {4 T' w7 Z0 P1 e1 q7 i

  41. ) V4 r( z8 M  p  q2 Y" T7 w0 k
  42. /////////////////////////////////////////////////////////////////////////////
    , a: J9 C. P% M$ s3 U
  43. // CRevAppApp construction6 S4 z) B4 s, o7 V

  44. : q6 L9 Y8 I/ p6 a$ V- _  m, i
  45. CRevAppApp::CRevAppApp(); i1 j  h% z4 P1 A4 A
  46. {
    ' G( Y) H! A/ H5 ^' w$ D7 ~
  47.         // TODO: add construction code here,
    % E5 I: r9 F9 t& i( ^. X. @
  48.         // Place all significant initialization in InitInstance
    1 N# j5 k% \+ n/ A2 P$ f$ t
  49.   bDisplayIsBig5=FALSE;- Y9 R+ w8 i3 U# ?
  50.   bRestartUpdater=FALSE;
    # _' Y. ?% e4 x  q: d5 U0 D
  51.   bFinishUpdated=FALSE;8 W0 x; T8 n4 y: R; u. J! H& u5 n
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;
    4 B7 l: m3 F/ C% i
  53.   InitChangeDataBig52GBKS();
    ' ~9 S0 J3 o; @, P, \& ]
  54.   InitChangeDataGBKS2Big5();
    ) G8 J- d' k# n  P% T
  55.         //3 c. `; s1 Z' W8 X7 x" v# V
  56.         bClickRunExe = FALSE;( ]9 b$ |' f$ _
  57.         //- Q! C  p& u0 d& B- D, D
  58. }5 k5 u4 W, a% c
  59. 7 w) f+ u' ~; k7 L
  60. CRevAppApp::~CRevAppApp(): r- F+ S9 e( j9 Z( L
  61. {
    ' S* o0 H& ]9 o: \: T
  62.         // TODO: add construction code here," j/ {" v+ c7 B' B8 {) m
  63.         // Place all significant initialization in InitInstance+ L* z' a6 a& N; @3 y% a$ F
  64.   EndChangeData();
    , Q  v' {% W& V) z
  65. }
    ) p, z" i, g1 `! M" g' n6 D  s

  66. - S; N  |, |/ E" l. n- d/ ?
  67. /////////////////////////////////////////////////////////////////////////////+ q1 ^$ n0 p! `5 {5 I; G
  68. // The one and only CRevAppApp object
    4 z) K( r9 u) m" \

  69. $ a$ X) R5 j$ z1 h- J0 w
  70. CRevAppApp theApp;
    $ v! f6 A$ X  O9 q' r
  71. 7 S- q  F1 t* d* V
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)
    . @0 v! v  v6 ~% S
  73. {% _0 F2 s" x6 N8 |5 n
  74.   int iEOF=0;
    # j) ~. G1 k9 f# [
  75.   char szTempName[MAX_PATH];
    ' `- @9 ~. d5 c% f# z
  76.   *szFileName=0;0 m: P- d' G" D- G, ~! N7 l
  77.   iEOF=fscanf(fp,"%s",szTempName);. @' S5 U1 w5 _" F1 Y
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')
    2 N3 \% B2 P4 ?1 h- h2 _
  79.   {  z/ [! \( K8 e. s4 V, c
  80.     strcpy(szFileName,&szTempName[1]);3 g+ Q, k: |# i/ g: U( a
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)7 c) E6 ]8 q; j% {6 W1 |
  82.     {
    3 m5 W" H  L% ^+ F' {
  83.       iEOF=fscanf(fp,"%s",szTempName);
    + L1 ]5 n/ I0 I$ p
  84.       strcat(szFileName," ");
    5 ?& H6 ]$ Y2 K
  85.       strcat(szFileName,szTempName);$ d6 ~* Z5 m- i4 R0 X8 V: w& j
  86.     }
    6 T) Z- W9 I, ~5 s- q$ N7 T
  87.     if(strlen(szFileName)>=1)
    6 n2 L" b9 `2 S. B
  88.     {, _2 G; \" n, y
  89.       szFileName[strlen(szFileName)-1]=0;+ [$ q2 j  W2 E
  90.     }
    % A! a% v; o+ Q) {: p# K9 o) t
  91.   }. J, q  c) k" F; p+ L2 U
  92.   return szFileName;
      ^  F1 |0 P# M" [/ o& g3 o
  93. }: H* g: I' j# L5 d$ I
  94. - W& Z' p8 {- Y3 W% x- m
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)+ t2 s+ C, z* ]$ _9 I+ o. m
  96. {  p' n6 r) b4 u' y. C
  97.   FILE *fp;1 q; s- @! ?/ Q9 v/ D/ Q1 G
  98.   char *key=NULL;
    ( d+ W5 Y( |* d
  99.   char version[MAX_PATH];
    2 B2 Z3 ~/ p5 N0 D1 p6 K2 w! [
  100.   LPUPDATEFILE file,olds;+ z7 k5 z3 ~& V1 _" p
  101.   std::map<CString,LPUPDATEFILE>::iterator p;
    9 {# E. n* F% z- q

  102. ! L* p" M3 ?; j  v# o4 g# H
  103.   UpdateList.clear();
    + k: k' f! l% O' W  L4 Q" `
  104.   UpdateFile.clear();* `/ _9 D3 M% z, ?5 [
  105.   if(GetFileAttributes(filename)==-1) return false;+ D8 R3 n4 {) B9 G, @3 a
  106.   if(!(fp=fopen(filename,"r"))) return false;
    ' ]7 b0 H, k; i  p8 b& P
  107.   fscanf(fp,"%s",version);* \* {' [3 ]' q" W+ s0 i
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }
    ) F; ?6 O8 B" F) g: S; u
  109.   while(fscanf(fp,"%s",version)!=EOF)& i: k& V! Z- l8 v7 h9 N6 ]# T
  110.   {
    ' z8 _3 d  `% Q
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    % I; z4 ~- W7 {, W+ S
  112.     fscanf(fp,"%s",file->path);
    # B4 F. ]0 q( }8 Y9 \
  113.     ReadFileNames(fp,file->file);
    - \. j4 c& S7 F; e% v: D+ c
  114.     strcpy(file->full,".");- p2 P* {& {- E4 m
  115.     strcat(file->full,file->path);
    / S& |  t* I: o! b/ c
  116.     strcat(file->full,file->file);! A2 i  ]4 Z1 p. [- L
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())
    ' ^5 a! U2 s5 x  ~+ E, G3 j
  118.     {
    - i) |: C5 N" T% K& S# _& N
  119.       file->vers=(float)atof(version);
    8 _9 P) z% N# d0 n0 q
  120.       UpdateList.push_back(file->full);. c8 {! \) H" }* j* Y
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));
    % G  P0 T+ Z7 V% L9 @# B( I
  122.     }2 A- a9 z6 {& n" B: [8 _
  123.     else
    / y8 p# H7 C: s7 ]
  124.     {, a" f, {* x& z( D
  125.       olds=(*p).second;
    " K. R; L7 k0 T' ?# ?
  126.       if(olds->vers<(float)atof(version))
    & O2 n/ Z# E9 p  X$ [9 j
  127.       {
      K% ?! P& x: d. B7 H* E! _
  128.         olds->vers=(float)atof(version);
    % f% w+ F* n' [# G
  129.       }9 l# F/ u! p6 e, `' }3 B
  130.       free(file);- h; e" G7 s; }  x8 K( a) }5 c" t( ]
  131.     }
      h) O- u  _) i  N# O
  132.   }
    . I+ V' C/ Z, r
  133.   fclose(fp);
    8 h4 {5 {1 z$ `( ]2 P% n! ]
  134.   return true;
    9 ?! l2 I) z6 w$ P# p7 ~
  135. }* Z) J* V, r1 |6 h! N

  136. : v+ o# r6 j& i2 V* Q! l' g
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)
    1 J9 l& R' U5 X
  138. {
    , ~* |- B" m' i- f  ?& y% {1 e
  139.   TCHAR  szFull[MAX_PATH];
    ! O; `+ i9 J/ C$ }
  140.   TCHAR *token,*inter;# }: u5 ~& d2 I0 k/ p! N* I% r
  141.   *szPath=0;" r# Q5 m% A( e! N
  142.   strcpy(szFull,szFullPath);% Y, X3 `: f* I. U5 V! D
  143.   token=strtok(szFull,"\\/");3 _2 R7 V0 T0 _$ N: z: B& A
  144.   inter=token;+ B! d2 |& b/ A
  145.   while(token=strtok(NULL,"\\/"))
    * c+ R- J+ q1 {8 }
  146.   {, {: K, E& `3 S& U( z6 E, x
  147.     strcat(szPath,inter);3 j3 c) z6 n* H8 d, H
  148.     strcat(szPath,"\");
    0 p) ?/ b% G- |2 w" r5 ?) g
  149.     inter=token;
    7 g8 O# Q# ], i9 i
  150.   }
    ' b, Q) S3 V+ Y9 v% h( R
  151.   return strlen(szPath);
    1 p2 o# w9 `! O0 |. ~! W. {! D; t
  152. }! [( e5 d9 x6 t1 T" G, q
  153. , Q6 k$ h& e8 I$ T
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase)# l4 v6 Z2 F# T+ D
  155. {; ]3 I5 f' h+ D- j. }
  156.   DWORD attrib=GetFileAttributes(Target);8 a6 k/ [2 I1 @* g) L
  157.   if(attrib!=-1)1 m) a+ m9 ~9 y- Y7 _" [4 t7 F7 U
  158.   {
      p: q- u1 R& x+ @: @7 e! u
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))
    : h4 T2 W5 b6 P# q9 B
  160.     {
    + Y8 }$ d8 R8 Z3 ?/ X6 l
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);8 O# j* r9 J$ @0 r6 N7 i
  162.       SetFileAttributes(Target,attrib);3 T3 h- u0 ]4 h; l
  163.     }6 o+ i1 m1 Z& R! Y8 K" Q
  164.   }
    7 _+ Z4 G6 Y! H0 f( i6 j
  165.   CopyFile(Source,Target,Erase);
    : H# |. k5 Z& r8 y4 K
  166. }* B; p: I3 h# ]! g0 P4 t. F

  167. 5 K1 o& C# s' w! p1 e4 W
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)
    2 K. d( P. X! u' i6 k& U" g
  169. {
    % B  P* i+ r8 B$ p0 q" l$ l
  170.      FILE *fp;+ \' u- [) l0 c2 X+ M
  171.      char  szBuffer[8192];8 F, f( j; {/ B$ |& a+ o1 \  Z
  172.   va_list  argptr;
    ' a5 U2 Z5 D+ z( ]. M  R, Q

  173. ) s5 H( J4 c8 ^: X9 X' i( Q6 o
  174.         va_start(argptr,message);
    , g9 W! z* u. ^. Z9 j4 y" E1 J
  175.         vsprintf(szBuffer,message,argptr);' b( k& K% U% v; F
  176.         va_end(argptr);
    % J" F& c1 S! B0 u5 d- l
  177.   fp=fopen(FileName,"a");+ ~; ^) M; f+ n, Q" q  D3 A
  178.   if(fp)5 j. S7 Z2 |3 w8 H/ b
  179.   {
    1 @1 o2 d$ X7 ]; [; }, f* O% q2 O
  180.     fprintf(fp,szBuffer);5 c, r* [  }9 T6 P9 |
  181.     fclose(fp);" C6 b# \; o0 R; p% R2 z% E* v
  182.           _flushall();) [9 Y: l0 G/ @5 G7 R: o
  183.   }
      V8 j, z2 c1 D( `* c
  184. }0 K4 Q  s0 t/ W5 Y; a& {) a! a
  185.   I% B5 r# ]4 N5 M
  186. BOOL CRevAppApp::Fclearf(char *FileName)9 B) A0 B* D8 U" G( T
  187. {' s9 S; W& h) ~- k4 z- H
  188.      FILE *fp;
    5 g+ ^6 w, V3 i: }9 c6 U) n
  189.     DWORD  attrib;. ]6 l2 v0 N% d( U
  190.   attrib=GetFileAttributes(FileName);
    6 a& T: z0 I5 C7 ^  V  M
  191.   if(attrib!=-1)
    , s6 s! \9 B5 I
  192.   {" W3 k* }" k% s+ E" h' J; `
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);; F! ]: u. {: b
  194.     if(!SetFileAttributes(FileName,attrib))7 {- S2 U1 |! J; X: c- ~
  195.     {# X  b! E; w; f4 s
  196.       return FALSE;  F- a) r! u! S3 n; G
  197.     }, _9 U: m  l, B9 _: e5 W; V0 ]( M3 }
  198.   }
    / z9 C( g# r# O) u  G
  199.   fp=fopen(FileName,"wb");
    5 A5 _- B: y6 w, f; B+ x' l2 L
  200.   if(fp)3 ^! P' _: n# Q& h; s/ ^- c
  201.   {
    & d* L; p3 j9 n2 r1 q+ Y* V
  202.     fclose(fp);9 k, A9 |% x2 c3 e- {
  203.   }1 _& }' l, y6 u$ O, e* l, h% J
  204.   return TRUE;
    0 W& r0 p2 G. a1 f
  205. }
    ( Z' \, V' U: Z! ]9 r# A1 c3 l

  206. 8 Q2 O" a* D+ h+ s9 ^4 x& h7 a
  207. BOOL CRevAppApp::UpdateLocalVersion(void)
    , F9 W- `5 _4 Z# F5 w
  208. {1 I  j3 W( u# I) y( |! Q
  209.   char filename[MAX_PATH];( E  t1 [- |/ p; U
  210.   LPUPDATEFILE file,olds;
    . ^0 x2 u" U+ X) O" K, y# H. K
  211.   std::map<int,CString>::iterator i;! ^+ b4 S' r; F) ^
  212.   std::map<CString,LPUPDATEFILE>::iterator p;+ C* h' U" ^! V5 |# |# t5 w
  213.   std::list<CString>::iterator l;; ~. C8 N& P7 t
  214. 3 n1 B+ W9 K# f. H1 _
  215.   if(bFirstUpdate)
    8 D* U; o- w/ w! p( b
  216.   {- f: M0 l5 W# U7 X* G
  217.     dwCurrFile=0;
    + A& H# A8 Y6 U% X; O
  218.     bFirstUpdate=FALSE;' ^* M" _; d) ?4 w+ D- h9 R
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    # S/ ~6 B, Y/ y) Q+ M: W& v
  220.     {5 h- S, m: J& D9 y3 ~" r1 A2 o0 y" B% l
  221.       dwTotalFiles=UpdateLocal.size();
    ! A9 h- W! t3 Y: _' J
  222.       dwDownLoaded=0;6 ], J% e# p+ q5 H( j0 I
  223.       bSilentStep=FALSE;" v7 C' L+ l; {6 w$ a
  224.       bCompressed=TRUE;
    6 }5 N: [8 `) P) b, F. x
  225.       strExtLocal.Empty();9 ^( S. P+ b: W
  226.       strFullName=(*i).second;
    + U; M4 M5 n5 \# k% K+ f
  227.       dwProgramState=AP_CONNECT;  p0 _6 S' M! @* b: O
  228.       return TRUE;
    4 u2 }+ ^1 b/ b- E2 b
  229.     }
    - @$ i8 }% \& B- M& J% b
  230.   }
      R+ x( [; u3 x3 }
  231.   else if(bRestartUpdater==FALSE)
    / `9 {( S. ]* \8 q" _9 o/ n
  232.   {
    ( D5 M3 A6 T% r
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end())2 w% x( h' }  u: g0 ^
  234.     {
    / R8 M5 ?2 t" z" [, A; b
  235.       file=(*p).second;9 J8 J6 g. a$ n$ z- u7 {0 ~5 z
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())
    % [% P# i+ P9 w( E1 q- \0 o+ _) C1 o
  237.       {
    & t- @: x6 u7 U. ?
  238.         olds=(*p).second;. p3 D9 D) j. A  u5 m: L- w
  239.         olds->vers=file->vers;7 A5 j" T& M8 |( a
  240.       }
    : A" e0 M( q/ n  d% ?9 F/ K
  241.       else6 P4 g  b6 G9 r- u( ]3 E
  242.       {! g" ^" u$ w8 O- ^, K: ?8 }
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));: R9 V, s$ O; I
  244.         memcpy(olds,file,sizeof(UPDATEFILE));8 Y2 G% V2 n. I8 Y- f( E
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));% U+ V" E, H, Q/ M+ w# I
  246.       }0 o- o) e3 k2 m* X0 y$ m
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");' g& {1 l2 E% K  v+ z) Z
  248.       sprintf(filename,"(%s)",file->file);% z+ O' F1 a4 {6 G
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    ; \. N  \& p& h& l
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }) R) u1 A9 U; a/ c8 d1 P2 w" e
  251.     }
    7 n/ m) D. {  Q7 v5 B' O
  252.     dwCurrFile++;3 _  I6 K' P* ~2 Z, M
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end()): |+ |- \- l+ v6 ~- v0 B% e# Z
  254.     {
    * v( a/ J# C! f$ C$ _3 \9 i
  255.       bSilentStep=FALSE;
    ' O0 x  e* E2 M, H: `
  256.       bCompressed=TRUE;
      ^9 j9 j* H; [. X  h8 e6 b/ T
  257.       strExtLocal.Empty();3 t  z% D$ ]4 N$ w( j. ]
  258.       strFullName=(*i).second;+ g; ^' `4 @, t5 A  V' \0 Q
  259.       dwProgramState=AP_CONNECT;
    ! v; W5 a7 R9 {1 _9 q$ c, c
  260.       return TRUE;
    0 u3 p2 \) N( T5 T/ Q5 ?
  261.     }
    . Y7 a+ W/ E- K# x7 O! J
  262.     if(!bRestartUpdater)$ n3 O) y  ?9 Y3 s
  263.     {+ y& K) b5 Q& r) }3 K
  264.       int iCurrSize,iFileSize;
    + R# |3 ~! l5 t3 E9 n. ~1 Y
  265.       iCurrSize=0;
    . c9 K2 s7 q# r: v
  266.       iFileSize=UpdateList2.size();
    * Q. z, O! z1 ~  B; \/ U
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");# y; T( I1 o0 x& V
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");
    ' ?9 s, j7 J) F0 n
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");
    ; a" f# P- i8 B0 ~
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    # ?! m8 C, }& Z. p3 F
  271.       Fclearf(".\\update.dat");
    $ ~. t3 q5 |( y! W
  272.       Fprintf(".\\update.dat","Bloodyf\n");
    / ]6 T& m7 K# _3 Q; `
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)
    7 Q2 K2 a" @5 z
  274.       {
    & Q9 z0 E. v( B; Y' m
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end()): F0 Y. ]* Z7 Q' N+ k! x- H+ ^
  276.         {1 X$ H) W' G( g! l  Y
  277.           file=(*p).second;) g1 x) |. j% u" @% p6 a$ P
  278.           sprintf(filename,"(%s)",file->file);
    # m1 D" X2 y( h4 q
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);- X: @- w# d) r9 \7 ]- ?4 {* u
  280.           iCurrSize++;
    , `! M3 {! Y0 f7 p2 L& S; i1 |" L
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));
    - U. W/ B% a( F3 n8 p
  282.         }
    , ]8 }0 y0 U+ W
  283.       }
    1 j. e# b$ n" ?: H& j+ k
  284.       unlink(".\\update.txt");
    ( |2 W3 h: e1 L7 W  C* C6 H2 o& L7 ?
  285.       unlink(".\\update.tmp");
    / Y% Q. Z7 c  s
  286.       Fclearf(".\\checkversion.dat");
    ; P$ p5 p0 w/ T9 e' w- Q6 Z
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);
    % M0 H* C$ S; p9 [
  288.       if(UpdateLocal.size())4 O, }, e! \9 D; i# t
  289.       {
    2 k: Q  s# L0 E1 @4 V4 @
  290.         UpdateLocal.clear();2 j: _- X( ?' ~! Q/ v
  291.       }
    2 }* Z) E3 r( o3 y$ @
  292.       if(UpdateFile3.size())5 w8 P: _5 p5 I: q( r( i
  293.       {
      \+ T" {6 F. y- J) `
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)
    ( @$ s& T6 P" ?
  295.         {3 g2 k5 h$ r6 ^) v0 ~# ^
  296.           file=(*p).second;
    ) }2 z; k9 n) \
  297.           free(file);
    ! ?! }% S* z2 t
  298.         }/ Y* H" R- P- U$ X& C; T
  299.         UpdateFile3.clear();3 e* C6 O! q/ w( r1 h1 Z" Y# \
  300.         UpdateList3.clear();4 C; F  x) ~) u+ C
  301.       }
    5 R6 y. ], Y* V0 r7 T3 s8 H, Y
  302.       if(UpdateFile2.size()). m( z; o6 I" M, I. e
  303.       {
    7 B3 z6 T, W% y7 W
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)8 z- u( _; b) S! K. e1 y+ _& V/ r
  305.         {
    ) B( `( y4 d0 b! Q1 L! N& w
  306.           file=(*p).second;
    * T- C/ ~1 F5 y- N' s. ]
  307.           free(file);
    - J8 U& B, Z( `9 |3 o
  308.         }
    % W" L2 B5 G% j/ U! T, X
  309.         UpdateFile2.clear();# o  p* y( k7 X
  310.         UpdateList2.clear();/ l7 w6 D1 |; u' n
  311.       }
    " w$ j  p  `0 u8 k
  312.       if(UpdateFile1.size())) W8 C4 G( w  {, y/ u' w; h
  313.       {
    * ^% {- k. j8 V1 F, t
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    ; b( M; }; O" S
  315.         {
    ! {0 w; `+ P4 X& Z- g3 n5 u
  316.           file=(*p).second;
    # x5 x! Z3 r' J- z1 r+ N
  317.           free(file);" o' j* q2 L" c- L
  318.         }% x) \; l3 s8 u( |
  319.         UpdateFile1.clear();2 A2 _. M1 i3 b& ]8 V/ K* v: n
  320.         UpdateList1.clear();
    4 j: u; G4 P3 s" Q4 Y6 _2 u% C$ x$ M
  321.       }0 \/ Z* U1 C) D1 a: v
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));% s( c: Z8 C% o, t! j. [
  323.     }
    5 j/ z- K- m; w
  324.   }
    # I& v: M; {% K( O. k& g
  325.   return FALSE;
    ! H( m$ K, r4 U' ?, M3 @0 A
  326. }7 @2 T& D  ^1 p, D& t
  327. 8 ?) f5 }! q% S  a' |
  328. void CRevAppApp::ClearAll(void)& |4 A. d  `% Z
  329. {/ f/ _5 V/ q  l. ]( {! d
  330.   LPUPDATEFILE file;" F6 }% Z1 h7 j; m7 G, w  L: u
  331.   std::map<CString,LPUPDATEFILE>::iterator p;" Z: q% q! p; V& @6 l9 [: O
  332. 2 U) {% [9 s" S% V) q+ H
  333.   if(UpdateLocal.size())
    ) Q1 L9 I0 ]- J$ @( P; Q
  334.   {4 _- s* ]$ y3 t8 `$ c
  335.     UpdateLocal.clear();8 a5 \5 l5 u( x. S( v% d' f
  336.   }8 r5 h% h6 i# C0 o- v
  337.   if(UpdateFile3.size())
    7 H3 k+ y9 B1 p4 B6 A
  338.   {
    4 G9 t* Y3 x) ?# y- W: J1 x
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)" i# Y5 l$ ?- @  z
  340.     {
    4 a' f0 ~2 U6 o  l$ K) K/ Q
  341.       file=(*p).second;
      j+ _; L" I2 [% D  I4 [
  342.       free(file);
    1 M  O+ `  W6 ?. u
  343.     }
    - ^; j' j+ \0 c( Q$ y! ?/ y
  344.     UpdateFile3.clear();* G. p1 H: \1 n4 G
  345.     UpdateList3.clear();
    : I' N+ ?0 K" c5 [" {2 i; C
  346.   }. Y+ }4 S. n) H" t5 @  ]
  347.   if(UpdateFile2.size()), ^; e; y- }& o2 M: q0 |) D
  348.   {
    ) P- l6 `2 f2 e) U  h1 Q
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    + B7 G0 \' x3 `6 j
  350.     {
    0 L2 b+ j5 ]0 j; y
  351.       file=(*p).second;! E' T) o8 v) R5 C2 y  k
  352.       free(file);5 Q- P% G6 i2 I" i9 l5 [
  353.     }: [% s$ Q) s5 u" X$ d) ?/ o2 T: B
  354.     UpdateFile2.clear();  [% R# W8 L4 u2 w  S
  355.     UpdateList2.clear();
    6 E0 G. |0 [+ f, ?# ?
  356.   }! [5 Q' {$ m- N
  357.   if(UpdateFile1.size())$ r# k( {7 j8 L# u
  358.   {
    0 A& I9 U  j5 P! y
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    1 \5 M/ ^! y" E' M0 R; L# U; I
  360.     {
    , |6 d. [7 t8 y0 P6 d( o6 B
  361.       file=(*p).second;
    9 u" L* ?7 v: ^
  362.       free(file);
    ; |+ V: t+ c. {& r4 Z* B
  363.     }( M8 q% K- V# x8 ]+ o
  364.     UpdateFile1.clear();
    5 A; U/ I& z/ `; R) |
  365.     UpdateList1.clear();
    8 T; }; m" P) a8 {6 k
  366.   }. S( D8 R% d5 ]8 ?5 \$ }6 G
  367. }  
    ! Z$ Y  E$ u1 j* a3 f5 c/ g) F1 F4 b
  368.   * {3 f3 b, k$ a" G# D
  369. BOOL CRevAppApp::CheckLocalVersion(void)
    7 D: Q) I: R) ?
  370. {
    3 M% H9 I8 J6 J! @! M
  371.   int c;
    1 k6 g$ A$ i7 I+ i- N( N
  372.   LPUPDATEFILE file1,file2;9 \2 w3 k. T5 v$ t0 s
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;
    " A( ?, W7 d/ h# ?! A
  374.   std::list<CString>::iterator l;1 c! s8 ~; w+ `+ ~3 {9 J( a
  375. 3 d2 b* W1 V+ i5 D# l) ^4 Y* B0 G
  376.   UpdateLocal.clear();
    $ f( b+ K! W% M1 S; E' w, C
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);
    $ K% K9 o, r. k. ~1 q6 I
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);" F2 w' ?( k8 ^
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);3 b0 k4 K5 \: D1 ^
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);
    ; J7 o# E5 w( \" C; `; r8 }! ]+ v. S
  381.   if(UpdateFile3.size())
    ; D) O& ?8 g0 `7 z$ n# U
  382.   {5 b+ Z: l" X! @9 ?0 N) Z
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++)9 W8 k+ P) q  |6 o
  384.     {
    9 K. P4 ^! i( v- I* S
  385.       file2=(LPUPDATEFILE)(*i).second;
    6 n& D5 Q' Y2 {, X- {6 `
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())3 `8 G# G" T% `9 E! E0 y5 H: T
  387.       {8 L$ x6 q# f) V& e  T
  388.         file1=(LPUPDATEFILE)(*p).second;& T4 I) I; i+ c. x' n
  389.         file1->vers=file2->vers;
    . F1 d$ m+ }9 @# Q
  390.       }+ Y) n% J5 W  @
  391.       else
    . \! F+ n; e' U4 |! R1 u
  392.       {. l3 n5 S4 @+ Z+ b# F* t4 X
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));( z* x: B% y6 z# ~+ \
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));# I: U9 {% A8 M# j9 F5 p
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));
    ' a' h6 V0 H+ O6 X3 |4 b* N! |
  396.       }
    7 |9 g+ Q4 E! c6 ?* R" |* q( I
  397.     }
    " _' n8 B: n( N, s% ^/ k/ q2 l, z
  398.   }" s6 ~; C& {8 ?1 L$ |
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++)) p9 E  R5 g: r2 J; s
  400.   {
    ) C+ Y6 V" T. A! ^/ E# U
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end()); }3 A1 n& L- F# b2 n6 [# |9 W
  402.     {
    8 m  V6 N" ~& m5 }7 t7 y. X
  403.       file2=(LPUPDATEFILE)(*i).second;
    8 z& O4 i2 T. o$ t& x; S9 Z+ k" f
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())8 [) y8 z  {- P; S" n$ i
  405.       {" T$ X! T) ^) P; \9 N3 r& P  p/ L
  406.         file1=(LPUPDATEFILE)(*p).second;7 n% H& e4 K1 x( P
  407.         if(file1->vers!=file2->vers)1 N0 R# S; U$ s0 E" g' N6 l: y! m0 ~
  408.         {
    6 _' {+ p7 E: z1 S+ G/ V
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));, o1 |! B0 }. I7 V1 w
  410.           c++;- |# S  d, B" X* ]$ g
  411.         }1 Z- y3 P6 o5 n5 K& y
  412.       }; U* [' {+ b- D8 c3 l8 ]
  413.       else
    7 l: b& k- D  c0 h3 H
  414.       {+ g( d# i9 N9 j1 ^/ k( e
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));
    " P% C: u6 f' ?  V/ m
  416.         c++;( \6 [4 a% ~& U6 @/ c3 {
  417.       }! ?  E/ A" Q6 O% u
  418.     }1 a$ i' g7 `- k# n5 m
  419.   }
    3 G8 d& A  F. F7 B$ g" g  I8 d
  420.   unlink(".\\DownLoad\\update.txt");7 v4 x  h  \2 i5 q
  421.   if(UpdateLocal.size()) return TRUE;
    * y3 i/ g, f0 x; J: a' S
  422.   else                   return FALSE;
    * ]& a) G. D2 }( [& j! {" V6 g
  423. }
    3 p! N+ \- A  S7 p/ B

  424. - N1 O& M# D+ n' |0 L7 X
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"
    6 ~4 R8 _6 G9 E
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn"2 ]8 m/ N8 p. y$ B, e, Z

  427.   l4 E7 R; x; D! g8 }, j
  428. ! |$ E+ w; U& e/ K6 j, @
  429. 7 g9 h; ]+ J. z% A
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile); \2 v- D1 K0 D+ t
  431. {
    ) z4 P7 @0 O3 a5 I6 M0 J# i3 {
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;
    + X# ?+ x# q8 l% F# F5 i7 E9 [
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)& g  I$ u' ?3 B2 T+ v
  434.   {
    7 j" \3 @. D) H
  435.     char szLanguage[50];% v9 C6 A0 |8 o0 U: f* U
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    : x  T6 y' v! ]' c6 _7 Z' l
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
    / O) X: _$ K1 r$ a+ O0 Y) `! Q
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    % `' l1 n5 q: @8 ]- i7 `
  439.     else                                   m_iLanguage=ENGLISH;+ ]; G& F2 j1 i: Q
  440.     char szRegister[100];6 s+ k. t, ]* ]" j5 D6 \
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");  n: u! i* p8 U7 }% {7 L! T
  442.     strRegsName=szRegister;
    4 A' X$ U, S: k
  443.     char szPatchURL[100];
    0 U, U# Z/ N# X+ i8 w
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");$ H+ a1 C5 w  ^
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);! @0 C( J1 m5 G/ G6 [
  446.   }
    / l7 O  v2 h5 Q3 \
  447.   else5 \0 |$ N/ o& J6 M* A
  448.   {: H% \+ ?& h4 `5 G/ c
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);6 K" W; _* A: ^
  450.     strRegsName=DEFAULT_REG_URL;5 n9 s. ^* g0 c3 I1 c
  451.   }
    4 }6 m0 J1 f! e0 J% O
  452.   if(GetFileAttributes("hosts.ini")!=-1)
    ) d* h1 _/ F4 F8 e) M
  453.   {
    ; z1 s% r* o- i$ S
  454.     char szIP[50];/ ?; b8 r7 j/ U. b( q' S
  455.     char szDIR[300];. Q' M  O9 l( g* u1 T0 C% [
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))& p7 i1 o6 h/ z5 i
  457.     {
    ! q& a: X( }: K9 p& ?  G- n
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");: h6 D) Z8 W3 a* @# ], O/ q
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");
    4 `. l' U; C' t, U$ u( u
  460.       strHostName=szIP;
    ) U" r% |: G! m8 P* R2 V
  461.       strHostPath.Format("/%s",szDIR);
    " x0 y4 j4 t5 f" ?8 L
  462.     }
    : A9 d: E) Y) i" V5 a) C% l' d4 L
  463.     else# t- ]7 h+ r( X, `
  464.     {
    4 o4 _& o+ P9 O
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    0 E  D. @' G9 m
  466.       {- x2 V5 M5 r7 x
  467.         char szLanguage[50];' @. h0 a& j: x; K" ~) O0 b
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    3 P0 @! _; i" k! F, T/ `
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
    5 [& J! V. u. |8 E& Q
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;7 `: ^7 C8 y6 ^
  471.         else                                   m_iLanguage=ENGLISH;% O/ \' X/ W$ e! I4 G
  472.         char szRegister[100];
    , B$ x- H3 U3 `+ ^" P
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");. z4 M& t. @1 B# B0 F  C/ _; n: T
  474.         strRegsName=szRegister;
    " n% p' b  t/ ~: a* w
  475.         char szPatchURL[100];
    $ V: m( ^6 {. @- Z9 ~& M# ~+ J7 B: m
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");. M9 F& x+ h# A" _& z9 w/ \
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);9 \9 E) X* ]# B" c& }# }
  478.       }& M0 f' d9 S: ^3 d+ g
  479.       else! n3 X( Z5 X% D0 }
  480.       {
    + Q. w6 S: d' K+ ^, g1 Q
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);5 [* @" n2 o+ {, J0 K* [9 G
  482.         strRegsName=DEFAULT_REG_URL;6 w$ |# v* Z- X3 H: s  }7 ^
  483.       }) W+ w- ]& Y' G' T& b
  484.     }
    - _4 F% K' C" E- m
  485.   }2 m7 ~4 l8 b; }; i1 \: ~" U7 Z2 w
  486.   return true;) ]2 A0 ~# }) B. {) R- F5 d
  487. }
    ! \% C' M& W. S1 Q$ f2 H

  488. $ s. X3 c' {' }+ A7 G! g
  489. #include ".\ZLib\unzip.h"( j+ k+ B! ^! i! w
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);# e+ a. K9 |0 C, @0 H9 S
  491. /////////////////////////////////////////////////////////////////////////////
    & b6 C5 e8 _1 R/ B, I1 b9 k
  492. // CRevAppApp initialization
    8 C* F5 |1 y# ?2 ?: k3 u) M

  493.   P$ g- L/ U  o+ c1 `' u3 E. ~
  494. BOOL CRevAppApp::InitInstance()7 r2 p; ~1 t; ]' X3 P# o+ M- K
  495. {
    : A; B8 P' [# x2 c
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];
    3 W* j* {' L# {2 q
  497.   o8 B9 `( Y  `, T/ }) @- Q+ g" L
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);! `5 a0 s0 ^, d. l- R
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))4 X" m! Z: {7 u+ ?* v9 W- t
  500.   {& q; {9 E- Q4 X" h/ O
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");' m0 Y; }; H# O8 U% _& b
  502.     GetPathFromFullPath(szPathTarget,szPathSource);: ^) U& n2 g6 A" A3 c& i
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))
    , T( _8 G0 M2 o; @( O6 a! F
  504.     {
    * E: Q, h* y0 O, E
  505.       strcpy(szPath,szPathTarget);
    ! w; r+ _5 E$ S
  506.       SetCurrentDirectory(szPath);
    ) h0 [+ y' K% p: z" V2 w
  507.     }6 h- ]4 E5 u1 v' n( f4 y- R
  508.   }
    - w% K/ m' S0 d4 M3 Z5 s
  509. #ifdef _DEBUG+ M- i% z& T- F- b
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))* ~' b. j: y( n7 d
  511. #else) S& R; S$ L; m
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))' G6 q) \3 H+ P
  513. #endif5 {( q% o, n/ u) s, q
  514.   {
    " f+ C2 U5 H, c) F5 u/ e6 t
  515.     char tempFileName[MAX_PATH];
      P2 [4 \8 C  ~* I  m
  516.     strcpy(tempFileName,szPathSource);
    $ e" K3 ^+ b3 q' h+ W
  517.     tempFileName[strlen(szPathSource)-12]=0;3 z! [; Z! s( }$ O  n$ \$ R" Z
  518.     strcat(tempFileName,"\\$CSUpdate.exe");+ g: Y+ `& p1 e  n1 A
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);1 T3 r3 P4 E" O
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);
    , t( z3 Z4 q2 C: K. P5 h
  521.     return TRUE;8 `* k' }: I; z" e: M+ O# j  i! }
  522.   }
    4 {" ]  l8 k4 C; j, i- L
  523.   // Nuke 0118: Delete run.exe
    ( M- h% `1 U6 K
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );
    9 j) N% w2 N. Z4 N6 U7 n. P1 n
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");8 s! I, X$ u% \8 t
  526.   if(!ReadCfgFile("Config.ini"))2 O/ X1 d' y, ]$ ]
  527.   {) D7 G  ~5 A! Z
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);
    0 {# }) ~; r+ Y+ y' n' c
  529.     return TRUE;
    8 n$ _4 y9 F4 n7 U
  530.   }, S" Z0 ~7 C* j
  531.   HANDLE mutex;( e& l! m+ y5 S0 ?
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))
    $ Z/ M; F- k8 n2 K! v( z4 @9 a" {
  533.   {
    * m3 @$ _  ]# P4 h3 l) u; V% _* V3 j
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)& B8 y( l: c  z5 G- ?. Q8 l
  535.     {1 D+ k: D" e5 s9 K* j3 c
  536.       CloseHandle(mutex);
    " w1 Y3 R$ I! _; A9 _* F
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);
    # s0 @/ Q8 p% r# L
  538.       return TRUE;
    7 P7 g# q, y$ E0 H
  539.     }
    ' t6 O* O0 [+ M1 S7 O' V* @
  540.   }  
    , i: C3 l+ d. I
  541.   CloseHandle(mutex);
    8 w; S2 |0 @6 r. K) Y0 K( F: Q2 M8 k
  542. 0 [8 }/ F; s2 Z- \9 G4 E
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);$ X& g/ I$ z# u/ q
  544. " K  r0 u: }7 K% ~7 r
  545.         AfxEnableControlContainer();
    # y  D1 Y# {- ~. q
  546. ; ^3 a' a: k6 b5 X$ d  j
  547.   bCanUpdate=FALSE;
    0 q! E1 b9 G+ O: i# j2 x6 F; G
  548.   dwStartUpSteps=1;- y- V/ ?* Y3 e7 ]
  549.   dwProgramState=AP_NOTHING;
    . u' h- ?. k# D
  550. - I5 c4 k* c" _. M9 y! k
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);; s- Q, e# c8 l8 ?5 {+ V3 k
  552. 7 `8 A" ~! m: A" J
  553.         // Standard initialization
    5 y, `: ?& s" z  @1 j) W) h
  554.         // If you are not using these features and wish to reduce the size
    9 M$ L; b/ i0 }
  555.         //  of your final executable, you should remove from the following
    % n/ N2 d8 _) S0 e; }
  556.         //  the specific initialization routines you do not need.
    0 x# ^* M1 ?9 b" z/ K
  557. 2 g1 R. u# n7 L9 u; r; t+ q
  558. #ifdef _AFXDLL
    ) F3 _) B1 S2 y' E
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL: y9 u1 P8 d0 \6 W4 k" |; O
  560. #else5 s/ \# Q1 }. l4 S0 P; y0 e8 W
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically2 F, U+ s- D) [# o- O8 p4 d# z
  562. #endif- x6 }/ l5 M7 Z' M( I4 t- ^
  563. 8 T* j$ [) Z; l) K8 [' ~
  564.   dlg=new CRevAppDlg;
    : r+ P- q3 k1 g1 [
  565.   dlg->Create(IDD_REVAPP_DIALOG);
    + ~: j; U4 v  M' O" |, g
  566.   dlg->ShowWindow(SW_SHOWNORMAL);0 ~% X$ E* x, m
  567.   m_pMainWnd=dlg;; i; D% Z7 m1 F; d0 B

  568. - B4 L) V0 g) k* Y3 t
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);
    7 L, x' V8 H2 {5 u2 m2 }: w" b$ ]

  570. 5 _: O% [1 k: K  l4 y7 l: |$ g4 H
  571. //  GdiplusStartupInput gdiplusStartupInput;9 s# ?) b! A7 f* K- u
  572. //  ULONG_PTR gdiplusToken;* H7 ^; Q  X, w& T$ i% h
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);: F; H4 d, n/ A# r# T& X5 ^2 {
  574. 7 G% @, D' _+ C' U
  575. //        CRevAppDlg dlg;) \( b) C' E& o
  576. //        int nResponse = dlg.DoModal();
    ! q* \9 W2 ^1 X$ v
  577. //        if (nResponse == IDOK)7 _/ C6 R  l! h0 }% Y
  578. //        {% E# l; Y. I& l( S% ]* _
  579. //                // TODO: Place code here to handle when the dialog is9 A7 F8 A+ f) ?. \" n8 M
  580. //                //  dismissed with OK% L! ^- T( _+ [. p; l4 h! C" r
  581. //        }) r- K+ a2 c* z4 ?7 r0 h8 J
  582. //        else if (nResponse == IDCANCEL)
    ( N& A, [( k. B
  583. //        {
    2 p3 f' @9 R& r% h) y
  584. //                // TODO: Place code here to handle when the dialog is) L7 Y+ ^" ]' ~* N, n: M0 _5 U# A8 L
  585. //                //  dismissed with Cancel# V. ^/ u! \' _( U- }1 b( o
  586. //        }
    * ~9 _# U1 U2 ~% ]0 t4 s8 q, v6 h
  587. 7 l1 o  N& `+ ]( \4 E, B
  588.         // Since the dialog has been closed, return FALSE so that we exit the" ^! Q- t7 H0 c( O
  589.         //  application, rather than start the application's message pump.
    3 {2 s5 u3 L7 _" M/ ?0 [; e
  590.         return TRUE;% o2 n1 J% b. x6 C5 \3 p
  591. }, d$ w8 v% S! W6 n

  592. 0 `" Z; a$ I! {+ b, L
  593. char *CRevAppApp::strtok3(char *pSource,char *token)/ S" k3 ]: T! A
  594. {4 `! }# r$ H- Q, v2 `
  595.   int i;
    " o' \+ o6 C- R+ c! l# C
  596.   char *szRet;
    + J( A9 w* ~" U" `6 U5 r
  597. - ]! M4 x% W5 c, S7 y" a( m
  598.   if(pSource) { itoken=0; sztoken=pSource; }
    % h% F, N: \8 d6 e$ Q0 X
  599.   if(sztoken)
    : S! H6 c7 x8 q  ~# |% M2 }' @7 p
  600.   {, \( h0 z. I/ ^) s! B1 V/ d
  601.     szRet=&sztoken[itoken];
    # w5 Y* d0 M% D2 K
  602.     while(sztoken[itoken])9 B9 b: [4 l9 b! ~/ V8 r
  603.     {. u2 ~+ _& W0 ~  f$ [3 l
  604.       for(i=0;i<(int)strlen(token);i++)
    5 g- v$ p. e- s" B. m
  605.       {
    # J9 m% A; N# [& s  d" y. b9 [
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])
    ' g% F& ^! I: N% I
  607.         {
    - @  R5 ^' @  g9 \& [
  608.           sztoken[itoken++]=0;% U- N  j8 a& n1 [
  609.           sztoken[itoken++]=0;5 S" {! `- n) Z' r9 o1 t- r
  610.           return szRet;5 J( b8 e, s. Z5 u  j0 p  z
  611.         }
    $ }+ M* o8 \- O7 r
  612.       }( s/ ?) E7 k) d5 Z: H
  613.       itoken++;
    / e1 Z4 @- S' K: U) Y: r, V6 D3 ^
  614.     }) n0 Q' n, _, `( Y
  615.   }1 f8 h& ?4 l  i7 b) d: m) e7 }
  616.   return NULL;; ?7 n9 g4 Q' Q1 l+ F( b. O% l
  617. }
    1 x+ J( Y" j# D4 e
  618. ) U) Z+ V7 C! B' f$ L
  619. void ProcessProc(long Total,long Current)* L: T! ?+ V9 x: y
  620. {* \* `5 |) \8 \& Z" o" G$ V! e
  621.         MSG msg;
    # W( N3 z, j4 U- ]& t8 m* e$ q
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);, b+ h( x' e! N6 c. C: I4 {8 m; k
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));
    6 _# f; G: y1 `/ c
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))$ F3 h3 r8 B1 R8 B
  625.         {: v3 s+ I2 C- z, Z, T% n; P
  626.                 if(!GetMessage(&msg,NULL,0,0))
    5 @; I3 m2 ?, S/ g0 ^4 b  w2 Z
  627.                 {# L/ l3 c$ s& S
  628.                         return;
    ) g' S$ J  P& D6 `& T2 ~0 t# R
  629.                 }7 l6 _9 S  C7 b: [
  630.                 TranslateMessage(&msg);
    : |! m! K$ w) H2 Y5 T
  631.                 DispatchMessage(&msg);
    2 s# Q  K' M& Z) ~: [' @# N
  632.         }        0 j3 t1 j( c" D$ e4 K. ^6 |: k: p
  633. }/ a: l* \) M5 @9 R$ e

  634. * f) ?2 b3 Q. b- \
  635. BOOL bFirstChar=TRUE;% H9 R+ z% ~% F# h

  636. . r# q% i  D' ]8 e- Y# `
  637. BOOL CRevAppApp::OnIdle(LONG lCount)6 n+ D' z6 U. Z, f7 e
  638. {
    # W& @2 t& V$ e6 x( p1 ^
  639.         // TODO: Add your specialized code here and/or call the base class
    . k4 N4 V( n4 V2 L
  640.   switch(dwProgramState)
    & K; t5 c+ _% K6 H
  641.   {- u# m/ M; c1 l- \7 k
  642.   case AP_NOTHING:0 h+ C0 ^  U% r/ q& G/ b6 ~7 N
  643.     switch(dwStartUpSteps); r9 C6 r4 r. _
  644.     {& f# n0 r: b/ W
  645.     case 1:
    , _: ~: G: V: }* s3 U- X4 Y' c/ [
  646.       {# ~$ [- R9 x( I4 J6 Z+ ~
  647.         int i;
    ; H( r9 k5 r9 g# E
  648.         CDC *pCDC=dlg->GetDC();
    ( \  W* R6 t6 x
  649.         HDC hdcwnd=pCDC->m_hDC;. a- n$ t, N/ \  d& Y7 \! Y
  650. //        Graphics graphics(hdcwnd);, G+ a$ C% B# @: q
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");
    3 Q( b% z3 Q/ g( ^4 _
  652. //        INT iWidth=bitmap.GetWidth();
    ( n3 `( T0 E, s: `
  653. //        INT iHeight=bitmap.GetHeight();& f% X# f1 g# G) U  d5 z- i
  654. //        Color color,colorTemp;
    ! C7 ]' j; ?. `2 ]% Y
  655. //        for(INT iRow=0;iRow<iHeight;iRow++)
    7 {9 S  Z) [. Y8 d, W
  656. //        {, X- B- }) T' G! z3 v# l$ K
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)% g9 k" J/ n: [; X- D9 K5 q# w9 T
  658. //          {$ S1 n3 V8 P( [# j; S" @
  659. //            bitmap.GetPixel(iColumn,iRow,&color);7 d, g& A0 e! k" J0 ]8 O
  660. //            colorTemp.SetValue(color.MakeARGB(
    0 b( A2 y6 U7 C  y& ~* _
  661. //              (BYTE)(255*iColumn/iWidth),0 u! w3 ?! z6 f, R
  662. //              color.GetRed(),
      T1 t5 u$ Z5 T) n2 ^6 [' S  Z
  663. //              color.GetGreen(),
    ; C# s& X6 N3 y" ~2 b1 _
  664. //              color.GetBlue()));
    " o0 L: d; p* h6 f- [9 X# e
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);- F' L, L3 z* g. w/ H2 `- M1 f
  666. //          }
    : J- a; w" p) `) N6 u9 ~* |, A/ {: ]
  667. //        }
    / I- Z8 k) B. G3 Y
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);
    4 x/ x1 s# g% Y7 \: U5 e
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    : ?- I. G: R# }& R' X
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");
    # O9 h5 \* H% s: b/ B- F, j9 b, q% B
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    + b; E3 _' }; w2 E5 s) r1 M! F; ~  u
  672.         for(i=0;i<240;i+=8)
    ; }8 t! B5 ^4 @2 J
  673.         {. H- v% T7 x  z6 ]" \% [# C
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    " u. R" [: R9 [/ M5 ~; z9 E) p$ O; ?  q
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    ( f2 C; J$ ~. p# @. k. k: U* N7 a4 j
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    1 T: F" t3 L2 c3 X
  677.           Sleep(33);
    , F9 J0 d) d- B, B" e4 ?
  678.         }0 n. z# X; d: i( X) ?
  679.         Sleep(1000);4 L, S2 M5 m3 k
  680.         for(i=240;i>0;i-=8)
    ) t( s2 [& _2 S' O1 v6 a+ r  M
  681.         {
    # F2 @* x1 e' t; T9 m4 V
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);8 L$ X! \1 i! u. U4 ?
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    $ I3 p3 q& o; S
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    ( h- q; h( _" X/ E( B1 S
  685.           Sleep(33);$ r! r0 E9 T$ F+ V7 D7 d
  686.         }7 G9 m8 q7 ~# s: b6 i6 l, e! F. e5 h+ t
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);' B; \1 W! |# A2 ^8 r( c2 v
  688.         dlg->ReleaseDC(pCDC);. \9 g" m) A  L
  689.         DeleteDC(hdctar);3 @# U  T& n3 g" c8 E1 s/ x
  690.         DeleteDC(hdcsrc);' Z8 c; X' [/ W4 H+ E( r
  691.         DeleteDC(hdcorg);! J" y% H) Q' G  U+ _) M4 J
  692.       }
    , m; k3 j, C+ ]
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);
    ' v( @, Q: O& w0 g6 A
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");
    ( y" x5 U4 q6 \7 }9 R# Y+ X
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");  e7 t) L% I" t& P2 C- k
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");) Z. w! h# N- }- u; c' |3 Y! P- P
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    & h/ S4 g7 L+ H' d
  698.       if(!Dn.Connected())
    9 {" u, l7 u4 ?/ H6 o
  699.       {4 A2 p" U# N; R1 P; k1 \
  700.         dwTotalFiles=1;6 [1 {8 c# Q+ v, V
  701.         dwDownLoaded=0;
    * _9 |) c( M1 G) K9 ~2 d6 V
  702.         bSilentStep=TRUE;9 S& n6 D: N: e
  703.         bCompressed=FALSE;2 I) t, ^$ [$ e% @+ _1 a: A) r7 A
  704.         strExtLocal.Empty();2 V# a# _, A- @1 K4 Z1 p3 Z
  705.         strFullName="readme.txt";! Y/ [3 @* `" S4 J
  706.         dwProgramState=AP_CONNECT;
    8 C2 j7 I* g' J8 {
  707.       }
    . [0 [. S* E5 F
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();
    7 Q" p* ?! U& A% j. n
  709.       dwStartUpSteps=2;' }/ I1 F2 Q! h* j7 R; I$ z) |6 x
  710.       break;
    3 {& s2 u6 r5 a5 Q7 [) Z4 J. `
  711.     case 2:. U* F. b/ v" ~; j% g
  712.       {9 M! g, @& C$ \! G  N
  713.         int iEOF;
    ( n* Z. h; l+ |0 v3 p/ e
  714.         FILE *fp;
    , @# L' b. T: c- W
  715.         char szString[512];
    0 c7 H9 z3 s* ^! G, ^  m
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");1 p2 [2 Y! t0 Z  z% X# Q; M
  717.         if(fp)
    % J* h, b* N( D7 ^
  718.         {* g& q/ A# i3 G1 {
  719.           do+ U1 }! q5 i: A) {# ^# f# w. n
  720.           {
    % \- g3 M/ s; l; R% @! U5 t9 T- W
  721.             iEOF=fscanf(fp,"%s",szString);0 X% j) }6 v; @' \
  722.             if(strlen(szString))
    , A: G+ d' J9 U9 R
  723.             {5 n" M7 g* A" N4 ]7 z% s3 K1 W
  724.               if(bFirstChar)
    : y1 s% b% _' X0 x7 W
  725.               {
    9 [+ }) L3 t2 z9 ~7 J
  726.                 bFirstChar=FALSE;
    0 Z% s& m& C: [0 _! K3 G
  727.                 bConnectIsBig5=FALSE;
      t7 g9 _2 n% Y! O6 ~1 ~' U
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;# H( i# b! s7 ^! N! |" x. z
  729.               }( i7 o# l. ]$ ~% h8 ?
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));
    ; _5 a# t5 E$ _8 n0 B0 }
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));, d4 r2 v4 D; _% |
  732.               dlg->m_ListText.AddString(szString);8 w$ V1 e4 Z8 b' y8 ]% e+ J7 C
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);. ^( _, |& l( ]4 R3 L" w
  734.               *szString=0;
    ; L: ?& W/ `1 H4 ]
  735.             }
    2 B' o1 U6 Z" D6 L+ r7 O( D
  736.           } while(iEOF!=EOF);
    0 t  n( t5 s3 s
  737.           fclose(fp);3 ]8 W- r4 h% G
  738.           unlink(".\\DownLoad\\readme.txt");( P% Q; i' j( {- S" H
  739.           dwStartUpSteps=3;
    & D; z% Y8 W  \' ?8 h% }# Y+ I* x- d
  740.         }' n9 t: c% b# z, d; s
  741.       }
    + M9 J8 O/ j& e
  742.       break;  Q* [; W) d& N7 ~
  743.     case 3:
    $ V' T- K2 A& F8 X
  744.       if(!Dn.Connected())! d% }1 r" d5 w. `
  745.       {+ |% T, W  r/ C' `. B, r1 B
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);
    2 g/ L( h) V) D
  747.         dwTotalFiles=1;7 o8 c- j- ~& X, q! ?: j  Q: Y
  748.         dwDownLoaded=0;$ I! m0 e# _$ ^2 z' R" d6 I
  749.         bSilentStep=TRUE;: q3 b9 n  K4 C$ z8 ^# w' z5 L
  750.         bCompressed=FALSE;
    * ]2 W% B8 O- K) Q
  751.         strExtLocal.Empty();
    $ u3 I- C+ T- c: Y
  752.         strFullName="checkversion.txt";8 d& J' i6 X, N- n( f- [' i
  753.         dwProgramState=AP_CONNECT;
    8 G- s& Q3 a' B
  754.       }9 v: o( l; T+ {, X( T2 W* W/ ^  g+ W
  755.       dwStartUpSteps=4;9 `6 k2 X- A+ D4 S0 I: C3 W/ s
  756.       break;7 K: x( E8 b+ o2 ~1 K5 I
  757.     case 4:( L. i( w# m4 P: u. f. R1 D
  758.       {3 G2 {; ~" ?/ o: F: U5 _  Q
  759.         FILE *fp;
    * N, r+ z7 L8 p! a! F7 S1 V4 i
  760.         char szString1[128];
    3 p) d0 H% G/ ~& x- d5 g  l# T, n
  761.         char szString2[128];2 g1 J: @/ ^: n% Y% L" F
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");
    ( e  c) J6 b9 G4 V
  763.         if(fp)* b; {0 ?! p+ p& @4 T
  764.         {, Z6 B$ o1 s& z7 X
  765.           fscanf(fp,"%s",szString1);& N( \2 F8 z, y
  766.           fclose(fp);# T5 U2 {% A+ O7 s$ f2 }" y
  767.           fCheckVersion=atof(szString1);& r. Z$ x. ?( s: T1 H, c+ A
  768.           fp=fopen(".\\checkversion.dat","r");
    % f0 j% H$ P9 Y" R8 O
  769.           if(fp)
    5 V- Y1 H- v$ X# o. m; H6 n$ M
  770.           {' N& V7 O4 r3 A. W- w; Z( u
  771.             fscanf(fp,"%s",szString2);" G, F$ @# e# z6 W/ ^
  772.             fclose(fp);( B& d, i; u6 ?0 [6 {: v9 j
  773.             if(atof(szString1)!=atof(szString2)). h+ C& v: Z( d4 W
  774.             {
    , K; {  f$ J( i1 U: I% ?
  775.               if(!Dn.Connected())
    - Q) N8 D( J! @9 v! q( D
  776.               {9 D& D+ _; x0 e( S
  777.                 bFirstUpdate=TRUE;
    $ Y3 n/ f+ ~# o, N6 r* |
  778.                 dwTotalFiles=1;5 H3 d; B8 N" u$ |/ V, X
  779.                 dwDownLoaded=0;
    - _/ V# e$ M5 [2 v" K, e* N
  780.                 bSilentStep=FALSE;* @- R: a  `% T( ^
  781.                 bCompressed=TRUE;
    4 ~; W- a) b& C" f
  782.                 strExtLocal=".\\DownLoad\";
    7 A# [4 l# I" N% [3 A9 i2 g9 q
  783.                 strFullName="update.txt";
      R1 Z: k/ A9 V& E
  784.                 dwProgramState=AP_CONNECT;
    * e3 s" x. @& }: {  ^9 t  G$ k7 ]
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");
    - ~% u/ s# E' ?8 |" i
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    ( \5 \8 C: U- i5 v: U! E8 \7 N$ Y
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");
    , H% I- }, U- i7 r# H8 V

  788. $ k" B  i& C6 I0 M
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);1 m! T, m  d7 ?& g
  790.                 unlink(".\\DownLoad\\checkversion.txt");
    6 g5 V& g8 F/ Q( e, L7 O- g, J
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)7 y5 F) q. w/ M5 S3 P7 N9 Y, y
  792.                 {
    : P- H1 y' I) U- u! {
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");$ U1 ]9 F% ~( _2 j
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");% w0 J3 Z1 W; X7 W% ?+ {
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");
    3 t2 M! m# b0 ~
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);- V5 _7 W7 [7 o8 ~' `& W

  797. 6 Y7 m9 C7 Y$ V0 l' G
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    , e2 Z6 ~2 z3 @0 l# q+ P% \
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");- M8 J& o: ^5 ]3 z: Y
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");
    $ S: r- M8 S0 P/ a
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);* ~3 J6 s4 c; N) M: S; L
  802.                 }: z$ L1 ?' Z% p, X6 ?, @2 ^
  803.                 dwStartUpSteps=5;
    # u% D6 ]: B5 r2 o" M; M* \
  804.               }' m# N, P3 R; ]' g6 V6 n5 P
  805.             }( m8 z; b! S1 w; E( M! x
  806.             else! g# G6 j7 b/ Z/ ~! R9 b
  807.             {
    + O! n6 s/ M7 E% u
  808.               unlink(".\\DownLoad\\checkversion.txt");5 }! l8 \+ d+ ~0 K4 }2 s) g" {
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    & g" f# N0 ?9 j) u" B3 I
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");' i3 h) c( n6 P( S
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");
    / J, ?3 Y6 g2 @/ k
  812. 1 {4 j* Y# O1 m; K8 @
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    / P9 `2 a# v) m! H9 {: P# p, J6 {  n
  814.               dwStartUpSteps=99;
    6 i+ Y% z7 K5 l" @; n$ F4 f2 K
  815.               bFinishUpdated=TRUE;
    1 G) D* P- z: l/ }5 K  ^) s
  816.               bCanUpdate=TRUE;: C1 R- T; @" Y$ w+ B
  817.             }
    / J' X! O2 v" S5 Q: R1 Y" \" S2 v
  818.           }- ]. U+ L9 N) G# k3 ~2 U
  819.           else. Z" d$ F6 |: U. y
  820.           {6 I5 G& M. b& E6 \. z) E
  821.             if(!Dn.Connected())
    ' [0 ^# M; O8 z6 K; k- j6 I2 ?
  822.             {
    ' _* x: S( f+ C2 R, b' @6 t
  823.               bFirstUpdate=TRUE;1 U( D' q# F6 P! t; x& y
  824.               dwTotalFiles=1;
    $ g6 J, G0 W3 D
  825.               dwDownLoaded=0;
    ) P1 }1 t0 _- H2 Q* q
  826.               bSilentStep=FALSE;5 M! S! _* L( E+ U5 Q9 n
  827.               bCompressed=TRUE;
      N: A  `9 k% W* }6 `! e
  828.               strExtLocal=".\\DownLoad\";
    + S' h; q% o1 ~
  829.               strFullName="update.txt";
    ' u. a' v& N8 p
  830.               dwProgramState=AP_CONNECT;2 y6 R' |# D& |+ R4 }
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");
    5 @" k' ^9 i* v' y# y
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    1 `7 X3 \# ]+ Z, C# B
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");% p% ]! u( [) k* x/ w- x# J
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);! k+ I+ u4 _3 n1 |6 R6 h* k
  835.               unlink(".\\DownLoad\\checkversion.txt");
    & |7 m7 C" F9 t5 O. Q! O) N7 p
  836.               if(GetFileAttributes("Wsa.zip" )!=-1)
    : b0 d( H' U& a6 l% a7 E3 ~
  837.               {/ i* z( v  U9 O) U1 Y+ ?
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");8 m9 g* _$ `) D. E
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");, c! {1 K6 h2 u: p0 q
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");; Y9 _% L1 M( D* A" a7 ~1 }1 b
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    ; z5 V+ y; m; B2 V* X
  842.                 5 h# |  v: K! U, J, \+ O
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");9 m6 l& e* Z: |/ C" W2 b3 c+ P( D- k
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");5 ^+ w& v: H) O1 _' V
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");4 H8 O# C; U% Y5 [, v! V
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);' f! i" A/ i: i
  847.               }
    ; {8 U; b  T( [4 ?
  848.               dwStartUpSteps=5;  v# b9 m' V" u  X4 r" K+ O+ Z# t
  849.             }4 B2 e- D) Q1 h+ ?- i
  850.           }; _" W) I# W; S6 |0 i* ?
  851.         }
    8 ]* Q" `' I1 d) F5 y  l2 e
  852.         else
    , C8 W6 q% K9 O, Q9 c/ I+ W7 j) I9 t
  853.         {9 o* P% g- {0 p
  854.           dwStartUpSteps=3;
    8 j" V* o2 F" H7 E- n  e
  855.         }
    7 A4 D1 o2 _! X' i
  856.       }
    ) _7 d6 E; v4 Q* {: l
  857.       break;
    * C+ x0 B' ?; r9 Q$ Y" U: `
  858.     case 5:
    0 R5 C4 m0 I$ g, ^, z0 e
  859.       {2 l! X/ L4 V3 r% @% k
  860.         if(GetFileAttributes("Wsa.zip" )!=-1)1 o6 T7 h* z2 I9 b6 R+ G1 X
  861.         {
    ! W- K6 \9 C  G9 y
  862.           int opt_overwrite=1;
    3 ?$ |- s: N5 v( d. c
  863.           int opt_do_extract_withoutpath=0;
    ; m( v# ~' _. ^; J0 D
  864.           unzFile uf=NULL;5 d: }4 y0 E7 h: F6 y8 E  N+ G6 Q
  865. 7 A1 Q5 p3 R( h: g
  866.           uf=unzOpen("Wsa.zip");& a7 [% M  o6 ^1 Y
  867.           if(uf)8 y# H; N9 o: p, ^) ]- z6 l6 a
  868.           {
      D5 U4 F5 t! s  z
  869.             do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,NULL,ProcessProc);' @( v* ^& v6 S# `) S4 s
  870.             unzClose(uf);
    * s$ }/ k8 y5 G* J" r: v
  871.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃ЧΘ.....");+ D+ h5 r+ E" P$ k% O6 x8 S
  872.             else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压完成.....");' q. t( R8 g" Z8 l6 E
  873.             else                                                      dlg->m_ListText.AddString("Unzip OK.....");- E, Q+ Y& \( V0 L/ K; h! `
  874.                                           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    . X" ]4 {  e2 A$ v& T
  875.           }8 J6 q3 C6 E2 t
  876.           DeleteFile("Wsa.zip" );
    # x' b; U) u) k: X& Q
  877.         }1 p/ h2 _5 `' u# G

  878. * v  v% ]# a: H6 d  w
  879.         if(CheckLocalVersion())
    4 F6 d, t7 O- Z0 F/ C# \# x
  880.         {* T2 J% q' O/ ~5 Z
  881.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫磅︽絬穝戈.....");$ L. z8 ~( K* m" T, L% W( {4 D
  882.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请执行线上更新资料.....");7 l. O8 J4 x' Z3 x% j! F
  883.           else                                                      dlg->m_ListText.AddString("Please update.....");
    * Q0 f& r) F: S
  884.           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    4 v& U9 A2 R( t
  885.           SendMessage(GetDlgItem(m_pMainWnd->GetSafeHwnd(),IDC_BUTTON1),WM_USER+2,3,0);7 y7 `$ D! e0 B$ D( H, k) j# i' u
  886.           dwStartUpSteps=99;) M6 t5 `) M* f5 Y4 k0 [: K
  887.         }
    & l2 o" @$ p  S! w/ P1 L4 w# K+ o
  888.         else% d; Q% l: K: ]  X3 u7 p
  889.         {' D7 }" a) j) g8 c4 F
  890.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");2 b8 q' ?& G1 ^8 m6 R
  891.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");- O" b: _* z# v
  892.           else                                                      dlg->m_ListText.AddString("no new file update.....");% S5 ^. V* D4 y0 p' N1 z

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

$ ]; D, B9 P7 J  C3 c2 }7 C6 a1 q6 t
1 k$ _& }& h, }, U+ A9 w; a6 i

評分

參與人數 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, 2026-3-4 13:50

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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