找回密碼
 立即注册

CSUpdate.exe源代码

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

+ i4 ~2 b3 g) u) D
  1. / RevApp.cpp : Defines the class behaviors for the application.
    ) n# O9 m" l- P! @1 {& I$ _# n
  2. //+ c6 D( r) e6 [/ b. V' J  T
  3. ; I6 d9 ^2 g" }$ k* ?& z8 s
  4. #include "stdafx.h": Q3 n2 M% ~4 `6 `" h" S/ _
  5. : |* J/ R1 j, ^3 K
  6. //#define UNICODE. U1 H# F4 K% [( e: A% b
  7. //#include <gdiplus.h>
    7 a9 M1 }% i$ {2 e3 ?# s4 [! K
  8. //using namespace Gdiplus;' i! _8 a2 H% }- j& [" Y9 C
  9.   Q6 J, b% ^# v7 Z* Y" Y+ H3 x
  10. #include "RevApp.h"' u. k; [! l/ W5 Z5 V7 u+ [
  11. #include "RevAppDlg.h"6 v+ d1 P! X! H4 ^2 w
  12. . G; E3 x' h- N# V/ E0 ~6 t4 o
  13. #pragma warning(disable:4786)
    9 ^8 _2 {* C8 e
  14. #include <map>' v. D. z" n0 [% d% z+ m5 J( f
  15. #include <list>) i9 C- I* t* X( l* F+ I4 j  ]5 V
  16. #include <direct.h>% ^( ]% \; g) t# d, F; G) [
  17. # a5 t7 @; o, a  j
  18. #ifdef _DEBUG
    4 C% v8 y. b1 c- I' E( E+ z
  19. #define new DEBUG_NEW0 ?+ X: Y- v1 T9 w: i: O
  20. #undef THIS_FILE
    & \- `3 ]) k* X$ a  y% P
  21. static char THIS_FILE[] = __FILE__;
    ! n8 R$ P$ i8 B. v; h
  22. #endif* _# @( g$ J: q$ f
  23. #include "SkinResDef.h"& D" i; c! H: h
  24. #include "ChangeBG.h"
    4 }* g- o, ^0 ?& }2 Z, L
  25. #include "AFXINET.H"; g0 V! k! J/ d6 S5 E+ j: A) h2 q+ f

  26. " J/ p; `; U1 K# N. c, a1 s8 x6 P
  27. #define TRADITIONAL_CHINESE 0
    / `( j5 `4 n- E5 r7 \) ^) F3 d) W
  28. #define SIMPLIFY_CHINESE 1
    $ Z7 y6 b/ t# n; z3 e
  29. #define ENGLISH 2; D+ b* P: Y$ h' `) K* Y. w. j
  30. int m_iLanguage = ENGLISH;
    - S9 d( Z% Z, j/ t$ c
  31. /////////////////////////////////////////////////////////////////////////////
    0 }& {) ]7 D( e; [" X2 t+ j1 F. M
  32. // CRevAppApp
    ; v6 f1 d3 P/ r; M) m

  33. ! X3 A; ^  s% X$ x4 A/ H
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)
    2 R- L  N! t5 G% f0 Q) \
  35.         //{{AFX_MSG_MAP(CRevAppApp)
    . _6 W: p) M9 C0 j$ l
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.
    ( A& M; a4 Y) S# V
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!* l* q" V" q: ?  f) J* t
  38.         //}}AFX_MSG
      U( {# h4 l$ [% d6 w: i
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)6 x( }. j& J" A) o4 D8 m
  40. END_MESSAGE_MAP()' ^6 r* N) R7 q, I' t) Z
  41. . Y$ e; Z" t( c) `
  42. /////////////////////////////////////////////////////////////////////////////
    ! D+ n, K3 w: _  |
  43. // CRevAppApp construction- ]* g6 g" ^* C; H
  44. ( @8 t+ F: Z% A2 w: s* [1 J9 N
  45. CRevAppApp::CRevAppApp()
    ; w$ I' `7 G6 E* j" U9 h3 z- M
  46. {$ `- S9 }: q$ z7 k, P; o$ _
  47.         // TODO: add construction code here,
    + g5 [" ^3 [( M* ^$ W
  48.         // Place all significant initialization in InitInstance' ^. b, m& b6 G" w9 B3 r0 F
  49.   bDisplayIsBig5=FALSE;
    ( d& x7 C  Z  y7 [  [8 d
  50.   bRestartUpdater=FALSE;
    ; d9 v% P& J. }; g0 J* A
  51.   bFinishUpdated=FALSE;
    9 }$ z% b5 r0 L- s, r
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;" c& ?1 N$ U3 @2 m% c1 D) S8 Q6 I
  53.   InitChangeDataBig52GBKS();
      u" w0 h0 I$ S2 j+ J- C2 E
  54.   InitChangeDataGBKS2Big5();) z) E% ]7 h1 A4 X5 e9 P
  55.         //9 J: E* t  {, i8 ^
  56.         bClickRunExe = FALSE;/ U% A! f5 E9 e" s  {  I! N& p  [7 Z
  57.         //1 t5 D: Y- d: h0 F: p
  58. }
    / l& L1 s% ^8 d) D, p- ]! V) E" s

  59.   t+ Y; z% `- Q+ ?3 D
  60. CRevAppApp::~CRevAppApp()* s+ S& u, A6 m$ Y$ v9 i7 q
  61. {" H( U: y2 V% S' T- A
  62.         // TODO: add construction code here,/ n3 X% n6 H8 {% F+ n/ H* E! H" Y
  63.         // Place all significant initialization in InitInstance" ^4 }: O* w$ e8 E7 G# L; i& y
  64.   EndChangeData();  R5 r/ c7 _4 p
  65. }! P/ k& v' U5 H0 Q% r% Q- o

  66. " F5 P" v& a. [! d) ^( k. J
  67. /////////////////////////////////////////////////////////////////////////////
    - O7 q! Z* u2 T( R
  68. // The one and only CRevAppApp object
    . q' U, A6 \! p, J4 u3 l
  69. % j) D2 e1 j6 b6 P; S. @2 M. ?5 D
  70. CRevAppApp theApp;6 [0 f' l$ k) T8 i1 c' }6 [

  71. 1 c; z* S2 r9 D& ^( C6 C  ?
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)6 O3 p6 t, j/ h
  73. {
    3 G; A1 @4 |2 f7 P: Y' E+ ^$ O- t
  74.   int iEOF=0;
    - j! f- D1 f$ g$ @. G$ m$ k
  75.   char szTempName[MAX_PATH];
    - G$ S  ~) X) t
  76.   *szFileName=0;
    9 t! o4 V7 q$ d0 m$ L
  77.   iEOF=fscanf(fp,"%s",szTempName);
    ) \  c3 G( G) h  {
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')
    4 O8 \8 n' B, P5 Y. s: m7 _5 T8 W
  79.   {
    0 j$ U+ I* @# |: y* p+ A
  80.     strcpy(szFileName,&szTempName[1]);
    1 U- v3 e" C% G2 `3 |: S
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)
    8 c* }" t- C/ L6 Q+ Y3 m
  82.     {
    5 s5 ~# O) D2 m3 L' s# D: a2 ~0 X, t
  83.       iEOF=fscanf(fp,"%s",szTempName);
    : B+ M* U6 C  {+ b
  84.       strcat(szFileName," ");/ N& u, ^4 L# p1 r+ I* A
  85.       strcat(szFileName,szTempName);" O# f! G8 I6 V4 [5 Q
  86.     }
    3 z2 z$ B* v9 t- M% g: Z& N
  87.     if(strlen(szFileName)>=1)" I0 p+ F2 o/ C8 Y! R; w
  88.     {
    , c0 m; Z0 k% {$ e, ~! g, R
  89.       szFileName[strlen(szFileName)-1]=0;
    # T' E, i, o9 Y8 @9 g
  90.     }6 C7 M: Z' {+ ]) C
  91.   }
    3 f" P' P. c, q
  92.   return szFileName;
    + h! |; u' ?% y6 d7 Z+ c5 |8 c
  93. }
    5 ?! h6 s* s$ ~: R+ J

  94. ' X7 r6 b& l( b, g
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)3 ?5 ]/ v0 a' {* ?  A1 @
  96. {
    6 a/ ^( i! c, O2 Z% j! R
  97.   FILE *fp;" ^# H" Z$ E+ ~8 B% j- w
  98.   char *key=NULL;
    % ~+ W& n3 r2 n7 n6 a  v0 r
  99.   char version[MAX_PATH];
    ! Z' b+ p8 u$ N" Z0 {
  100.   LPUPDATEFILE file,olds;, a( A* P; @! w% D. e1 E
  101.   std::map<CString,LPUPDATEFILE>::iterator p;
    - T- |2 {! [: c9 h* P5 [
  102. . {% F/ d# D* C
  103.   UpdateList.clear();
    2 j1 {& h! U+ R7 J& J1 Q
  104.   UpdateFile.clear();  d$ |; Q  v- ?* x+ p: T; ~& W
  105.   if(GetFileAttributes(filename)==-1) return false;
    8 J0 P4 a6 Q' g* o
  106.   if(!(fp=fopen(filename,"r"))) return false;6 \  f# z( N  o1 R/ r
  107.   fscanf(fp,"%s",version);
    8 H: a2 h3 ~& ?. I
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }2 k6 j! n7 k$ A7 g# W/ B' \: d- x
  109.   while(fscanf(fp,"%s",version)!=EOF)
    6 E. a" c- g3 @& V
  110.   {, W. S& U, c, [3 l4 i1 O
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));" y' k) C4 i2 w8 Q
  112.     fscanf(fp,"%s",file->path);
    . J2 A% d) ~2 v7 K* N; E* T
  113.     ReadFileNames(fp,file->file);) b1 `% X8 e, F
  114.     strcpy(file->full,".");5 v) V/ l) @- C
  115.     strcat(file->full,file->path);
      X1 `2 q4 \+ ]: K
  116.     strcat(file->full,file->file);
    ' [4 P8 Q, E* _3 C, d2 T$ f
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())
    6 B3 Z9 W4 L9 l: {7 x3 U% n& Z4 o
  118.     {3 Y1 t/ R( I3 \% G4 l1 ?
  119.       file->vers=(float)atof(version);
    , p0 n, v  R' R+ g
  120.       UpdateList.push_back(file->full);, p- U" X! H2 H. b
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));( B$ h4 T' i- G' j, z
  122.     }
    $ v2 t- e' \0 i$ ?, U9 L
  123.     else
    - K) c, _, Z: m9 s; j& [
  124.     {
    5 r2 B6 }9 Q4 n
  125.       olds=(*p).second;- O) r" V* G: }0 V0 `. y8 h6 Z
  126.       if(olds->vers<(float)atof(version))# ?- m, v2 \+ ~) a' V) p5 f
  127.       {4 M: T' ?7 ]5 P% T9 d5 B. O
  128.         olds->vers=(float)atof(version);
    , W( w  a6 v. o% i/ a# ]" W. n* G
  129.       }; Z: \9 W9 n5 v" \
  130.       free(file);8 i: |6 f( Q$ z$ _( u0 U; G
  131.     }/ Z, T4 s2 j& X( w/ E5 W0 n
  132.   }
    6 [9 k" G4 X; [# q
  133.   fclose(fp);
    6 ~+ `; L! v3 V" T8 S- ?' h- I
  134.   return true;+ s& d, p7 Z( f" b  {5 A' F7 [
  135. }
    " t4 l1 N2 G- O; e& S0 ], R

  136. ( C- ?0 _% d, \3 J
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)
    ; X: W( `+ i" S+ J( j
  138. {6 k. j, e3 z5 i; w1 N6 W2 D  }! N
  139.   TCHAR  szFull[MAX_PATH];
    , y; n( E1 b* S* _6 F
  140.   TCHAR *token,*inter;) Q9 b3 J/ M+ }" d7 _7 q  {5 O4 v1 F* i; C
  141.   *szPath=0;
    * \! Y0 n: g% h( }( T% |3 Y( ]5 Z
  142.   strcpy(szFull,szFullPath);6 F7 M& C# @5 O1 P7 R; u3 Y  ~0 ^
  143.   token=strtok(szFull,"\\/");+ d2 Y) t' A3 E8 t5 ^3 ^* S' [* X, Z
  144.   inter=token;: G: s* ^! y: t- ~+ Q! H& I) u
  145.   while(token=strtok(NULL,"\\/"))9 e/ a1 w. ~  t. \1 V. I
  146.   {* m0 a6 y6 j" B1 m1 C) ]
  147.     strcat(szPath,inter);5 W2 K4 f. f2 R9 n3 L: h) ~6 \8 h
  148.     strcat(szPath,"\");
    ) G0 U6 U" Q- g4 I
  149.     inter=token;% \  ^( f3 Z; _5 G* H! p
  150.   }
    4 \$ @& a' }: T) f) P8 Y6 a: d
  151.   return strlen(szPath);9 ?0 w# }$ f5 U2 h% k& Q, x. y2 f
  152. }/ p& O. R- m/ {# ]2 r% W0 `

  153. 8 ]& J0 Y7 m! c3 @! m
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase)& u# U+ ^0 H& m* c1 I: A
  155. {
    3 N6 G: T2 L0 h; h( c7 M7 j
  156.   DWORD attrib=GetFileAttributes(Target);+ F' K6 T) t, T. Z
  157.   if(attrib!=-1): F+ W) j8 Z! d+ Q2 R
  158.   {  W& c$ f6 G- \( Q# _, Q! ~) i
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))
    , O, @" }( t* }$ t4 Q
  160.     {
    $ ~7 p0 ]% O% U
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);1 N0 X% n, x- o
  162.       SetFileAttributes(Target,attrib);7 L7 w5 |/ L* ?+ w, l  I
  163.     }; G. T0 h; V# J( @- \. I. F
  164.   }0 {5 ~1 v. ~/ i5 N5 h. x( x# R
  165.   CopyFile(Source,Target,Erase);. V6 f* F' g- E( J
  166. }+ h% K, u6 E; ^% Y1 P- U: n. m2 U* n
  167. - x) ]; a% U& J+ G8 g7 k. m1 f0 j
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)
      `  y6 D- C- R5 K, _2 J* }
  169. {: @  h- ]  R+ I' v3 c7 z4 m5 c
  170.      FILE *fp;
    1 Q( g* p/ G$ x2 X
  171.      char  szBuffer[8192];, A) l* Q0 S9 R* W  d5 G
  172.   va_list  argptr;  f8 o. S! i, Y% W" P* J
  173. , x! H. }/ }# T! b! I3 _" [
  174.         va_start(argptr,message);0 k2 T  n! D& `; J" G
  175.         vsprintf(szBuffer,message,argptr);1 u& f9 U" Q1 ^9 E- X
  176.         va_end(argptr);+ T# G2 P, \+ V1 J/ M: S) Q0 p
  177.   fp=fopen(FileName,"a");
    ! n4 q: A' Z4 @1 [* \1 g
  178.   if(fp)4 P. e1 c. I( x* ]* L4 I$ P9 O
  179.   {2 n+ O5 L3 P) x- D  W/ U
  180.     fprintf(fp,szBuffer);' z1 {$ H. e' }% Z" S9 w/ y" J
  181.     fclose(fp);9 W9 H8 o1 c. t$ [$ w
  182.           _flushall();$ T: A( a% Q- f7 C6 k
  183.   }" A! Q7 a5 p! @8 q/ F- K" c
  184. }6 ?5 N# Z+ x7 \/ u; m

  185. + X; ~5 C# ~* ]# s
  186. BOOL CRevAppApp::Fclearf(char *FileName)3 z5 A1 g( B5 A: d9 w# {
  187. {
    ; j5 @/ ^0 K, l8 o  @% W% z' D
  188.      FILE *fp;
    8 R0 e2 d+ z; H9 e- C- H
  189.     DWORD  attrib;9 o. W# f( F0 H6 I: ]9 Q
  190.   attrib=GetFileAttributes(FileName);1 H( e% H0 k% i- Z
  191.   if(attrib!=-1)
    $ ~# M; r# C, M, S1 K* o! W* g  Z
  192.   {
    . K1 y0 m( b% r' I7 C1 O
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);
    + ~3 d' ^9 t# x! q8 S
  194.     if(!SetFileAttributes(FileName,attrib))
    2 N* S# e# v, k* ?
  195.     {
    0 c, r1 s  K& \# c- J
  196.       return FALSE;
    % M4 h5 D8 s: S- R* k
  197.     }
    " d% ]9 B) S1 d) ]/ y: b/ ?# P
  198.   }0 Q& g5 d' \6 e6 T4 E7 Z
  199.   fp=fopen(FileName,"wb");+ v  t) s" y1 v# i! y' x4 t! W
  200.   if(fp)% d* g- P- ]# T
  201.   {
    1 c' B3 @1 P; \* D
  202.     fclose(fp);
    2 ~( E/ j3 @: O/ n+ `9 g
  203.   }
    3 V$ B& \2 s& m8 r9 j
  204.   return TRUE;
    5 U: u9 q7 R7 @( @; U8 c5 j9 n. S0 H
  205. }3 U5 }4 c: {0 |+ E! m# r

  206. / @% V$ V9 a' i
  207. BOOL CRevAppApp::UpdateLocalVersion(void)
    1 E' K& T2 ^$ f5 K) n0 O
  208. {$ k- m' S+ _" q3 f/ O9 D" W6 m( f
  209.   char filename[MAX_PATH];
    - B" s. }" |9 f. D: z
  210.   LPUPDATEFILE file,olds;
    : G7 Z3 F; t% q: i( x) N
  211.   std::map<int,CString>::iterator i;0 Q/ ^/ }$ h; H+ F& t. ?0 n
  212.   std::map<CString,LPUPDATEFILE>::iterator p;/ i" H& ~* W1 {8 r8 x
  213.   std::list<CString>::iterator l;9 w, B0 c" Q- u( H' T1 Z) z

  214. , z; W) x# \4 ]9 g! p% e. s3 l
  215.   if(bFirstUpdate)
    ; j( R) k& ^9 k
  216.   {
    # x4 t! j9 _# W
  217.     dwCurrFile=0;: W" A  C! C# s5 {
  218.     bFirstUpdate=FALSE;9 M. _# B- s8 C# N/ X$ m- O
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())( o; x/ m, c( l$ r$ p! v5 d6 [9 S+ x
  220.     {
      n% L: |$ f% k3 P
  221.       dwTotalFiles=UpdateLocal.size();) b1 d( @) \, M1 H; `
  222.       dwDownLoaded=0;# Y( Y  U& F* F- Z- |
  223.       bSilentStep=FALSE;$ \$ O  o+ i( [
  224.       bCompressed=TRUE;
    - H- {" G" C. _0 N, ?; R6 G
  225.       strExtLocal.Empty();0 Z0 N4 v) }7 L/ B+ w
  226.       strFullName=(*i).second;- Z7 P: d5 q5 G4 Q
  227.       dwProgramState=AP_CONNECT;, u9 o  V9 g0 y# ]# M! e7 Q3 ~# r9 _
  228.       return TRUE;
    & N) i) k) l  ?* X( }/ i0 O) l
  229.     }
    / V; m8 ~, R. Y, F  }+ s' J
  230.   }, a! s7 X( `! s% Z2 v; _
  231.   else if(bRestartUpdater==FALSE)
    ( |- e1 e3 R# h+ E  n
  232.   {3 m4 z% W& @& V( y
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end())
    - ~  g: c# Q5 t- J$ O! Z, E
  234.     {: `) N3 A, v+ I) H& h  n0 n
  235.       file=(*p).second;( P: C  }5 x: ^% t  \- H+ [& \/ I- z
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())2 |* I( p$ P! i
  237.       {
      c8 T4 S$ _7 R9 g
  238.         olds=(*p).second;9 w/ f4 ~' u. X. Q
  239.         olds->vers=file->vers;
    5 Z! h, g+ C  y* g* O" L7 Z9 N. y
  240.       }4 T: {/ O+ w; i+ Z& l
  241.       else3 W" o% ^- Z! ?+ O+ h, ^
  242.       {
    # P0 U% S+ t6 U* ?( ~4 ~
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    9 y# j7 v0 {6 c3 l
  244.         memcpy(olds,file,sizeof(UPDATEFILE));
    + E0 U3 m1 R# K) I% C
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));
    6 c4 g  ~! m2 k% L, U+ Z6 B- M
  246.       }  s( Z9 s7 _  r+ \
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");
    3 ~5 m0 r% J5 @% H
  248.       sprintf(filename,"(%s)",file->file);
    ) [* ]# z7 A) J1 e; A) T
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);. ^8 V- Z  h9 M2 S
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }
      o% ^# J9 w% C7 n) e
  251.     }
    ) Y3 q8 [5 |6 R0 D
  252.     dwCurrFile++;0 ?! N6 t6 O% A& @
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    ) F4 n* F2 R6 s3 K
  254.     {
    , @3 ]. P, D/ p* ~
  255.       bSilentStep=FALSE;/ y: W- s0 ]7 U8 v  m8 o* x6 a; {
  256.       bCompressed=TRUE;
    3 b/ H+ ]; _$ c5 q& w$ R
  257.       strExtLocal.Empty();
    0 {. n  p# T0 u# O- G* W( ]2 l
  258.       strFullName=(*i).second;
    " s, [, `: Y+ B' M
  259.       dwProgramState=AP_CONNECT;; \5 \$ P6 b, ?0 h
  260.       return TRUE;
    . x5 t  R+ h* b. N
  261.     }
    . @5 E  B- k2 _7 j) P. Z, \
  262.     if(!bRestartUpdater)5 S; d  ?3 W' n% |# h& \1 J* f
  263.     {9 ?2 I) p- O& k9 R5 T  `# X  R! q# N/ u
  264.       int iCurrSize,iFileSize;
    / v. b) f5 G& N; b
  265.       iCurrSize=0;8 m, ~! X7 @! L- K
  266.       iFileSize=UpdateList2.size();1 D" t0 ^4 p1 n, u" y
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");$ W- e; S* O/ Q4 J6 z+ P. Y6 U
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");% X" m' |3 H* o0 O# u
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");6 n+ R+ b( R0 T: t: A5 [
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);. m4 S# S; s/ G. H5 G4 z* @: }
  271.       Fclearf(".\\update.dat");
    - h3 ~( R+ e2 _' d) f3 J# `
  272.       Fprintf(".\\update.dat","Bloodyf\n");
    3 w- |# d' {) Q# b
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)* Y# ~$ d) O3 t( z
  274.       {; @8 r: [  y' K4 L: h0 s
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())
    ; N# U) I1 z: A( k4 n$ \6 e! E
  276.         {$ e) d( f0 x/ M' c. q
  277.           file=(*p).second;2 i5 t) u* o6 T) y. ]
  278.           sprintf(filename,"(%s)",file->file);
    6 _( p. x+ d7 ?, m
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    / M* \0 k' i4 J  x
  280.           iCurrSize++;& h; q& k1 M# i1 r$ Y' n  Q
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));- Z3 z: P4 w4 P( Y8 r
  282.         }
    5 G2 Q: Z" \  ^  c
  283.       }
    7 `, B6 P+ \0 V8 M
  284.       unlink(".\\update.txt");/ e. _, f9 w5 x+ i8 Q7 d. E
  285.       unlink(".\\update.tmp");* U& }$ L  J8 ~7 X) A
  286.       Fclearf(".\\checkversion.dat");; A/ M+ R2 J3 |0 T
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);
    / o0 U+ ?: }/ a8 \
  288.       if(UpdateLocal.size())
    4 A& W6 z7 C  W* H
  289.       {; V* I) E& U7 {% a  U5 t. F( z
  290.         UpdateLocal.clear();' u1 j6 u/ B7 E' ]7 {# G3 K
  291.       }
    & T' L6 w) D' L
  292.       if(UpdateFile3.size())
      {, J$ r6 r, E
  293.       {
    2 P5 J8 g; Z$ }  U' t' L7 h& i
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)2 e- b4 V3 a- U4 n) ?
  295.         {
    # R% `; X  I3 t/ Z+ x" T3 h
  296.           file=(*p).second;; L4 t: h& L7 J6 i1 u, D
  297.           free(file);% E! a! ~7 s; Z' e
  298.         }/ n$ C( s& X+ W' F, u
  299.         UpdateFile3.clear();+ W$ J0 A$ L# V/ f. e
  300.         UpdateList3.clear();
    / C( h0 n2 g; c1 \* @
  301.       }
    9 m! `8 g( g3 S/ |7 s7 G
  302.       if(UpdateFile2.size())/ n! u/ m6 P) c8 @
  303.       {" k6 X- r7 \5 O, S* ~" l
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    6 f$ o, X% w5 R! b. |& w' W
  305.         {
    & z/ \) i9 Z* R9 `2 U% k( j
  306.           file=(*p).second;8 D' K6 e/ @* E: v: l3 J
  307.           free(file);+ l6 ~) Z! N, [# I- h8 j2 M* j! ]
  308.         }
    - }: W" N0 s3 j+ U+ v
  309.         UpdateFile2.clear();
    5 `' ~: u/ V: ~! G( L1 u5 q
  310.         UpdateList2.clear();' y) o; [* G( U* _
  311.       }
    & n  h+ e: J0 ~0 R
  312.       if(UpdateFile1.size())
    1 ^3 f* G% p2 }3 _/ e7 g3 X4 }
  313.       {
    + T* n: Q( j4 r( Y
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    3 I& R" u! r: y/ ^
  315.         {
    ! p  v9 C* M, v( G3 l. K# C$ R
  316.           file=(*p).second;2 d: Q; o0 Q& U! }2 `
  317.           free(file);
    5 M6 L% S1 u  B5 r6 D* w$ u* V
  318.         }
    ) Z( [" X4 x9 `7 [
  319.         UpdateFile1.clear();$ U- }9 u" V( u# g* F, Z
  320.         UpdateList1.clear();
    6 |6 _+ |' a+ ^, |) b( L4 J9 `
  321.       }
    - b% O4 c4 B8 r: Z7 L
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    % g$ e6 r- ]* P+ w
  323.     }
    - E4 |3 S) J% H/ U3 r9 Y& ~; L1 L" }
  324.   }: r; H9 M. J. l& g
  325.   return FALSE;. ^0 A/ y. T. N6 U! N+ l
  326. }& _, C5 S  W- K" q* v* g8 [! K" |. J
  327. + K% T3 k2 N1 K/ @  V: ~8 v
  328. void CRevAppApp::ClearAll(void)) m( B$ ^/ A) k+ F4 C6 T* t
  329. {
    ' X! [$ i- K& f1 w1 Q& B+ _
  330.   LPUPDATEFILE file;7 v# h. T- v, P4 o
  331.   std::map<CString,LPUPDATEFILE>::iterator p;, I1 f8 R+ L6 q9 A

  332. ( {* {9 E+ A6 Q4 ^8 }. J6 G. C
  333.   if(UpdateLocal.size())1 x0 q7 \0 T5 p& j
  334.   {) ~; `( ?  a% i! G( ?! Z
  335.     UpdateLocal.clear();
    * `, C0 f+ T: g
  336.   }( Y% A' G% k2 D& }
  337.   if(UpdateFile3.size())
    # {8 k; g+ k, |, q7 ?3 [; w
  338.   {. I  Z6 M! J8 U* X* c2 a  L' b
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)
    ; n4 M7 F* K0 m: w
  340.     {
    6 [2 y* m. l) `. o
  341.       file=(*p).second;& S- Y% N" [, h" _5 J0 A& w& X
  342.       free(file);
    ! Q. X2 g% ^: T; F+ r' P1 ^6 z
  343.     }" t$ N9 p# _; s% R9 f$ f7 ^  c
  344.     UpdateFile3.clear();
    * r9 O+ y+ u( p8 X) I
  345.     UpdateList3.clear();5 ]+ o# L4 T9 N
  346.   }5 M0 K/ H& e; T- e
  347.   if(UpdateFile2.size()). W0 ^; ~4 ]: X5 e
  348.   {
    2 r" R- O: r; C! z" n# G: d
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    # Y! {! R6 x$ G' r. Y8 s
  350.     {! S9 }+ [# T) n, g  u; n) E, I
  351.       file=(*p).second;, j. @3 h' e* ?3 G
  352.       free(file);2 s6 @# H& V, N
  353.     }
    2 m  a7 ^: C; z! Z" i$ x; f4 {4 r
  354.     UpdateFile2.clear();
    1 v4 |4 W4 v/ |" L+ A
  355.     UpdateList2.clear();) k. X( f* c8 x. h
  356.   }
    + v( @/ t+ ^, c# P( [% O
  357.   if(UpdateFile1.size())
    ; u- x! z+ F7 p
  358.   {2 q' j5 F1 G& v9 _( A* ^
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    : X2 I0 v( v' \0 ?$ y8 h
  360.     {' Z1 i' I; }9 \: H' a, T( x& P, ]0 g
  361.       file=(*p).second;1 G2 Q' l: d# w, [' f0 A1 @" ]: t( z6 V
  362.       free(file);0 Z% h' W' D9 M, i
  363.     }
    % a& u, A$ q6 w6 w
  364.     UpdateFile1.clear();0 y4 ~0 U4 C. [; g
  365.     UpdateList1.clear();# B- @4 I# S, n& v- C
  366.   }
    ( r, f- h, a& T+ D
  367. }  $ t- l8 p- ?" Y! k4 u
  368.   
    9 S: w" O) ^2 v; r1 \7 b4 M
  369. BOOL CRevAppApp::CheckLocalVersion(void)
    : k' B! n' M7 Q3 O' W
  370. {
    , d" O* N. O. `  i! D2 _  g: @  W2 H5 T
  371.   int c;$ T* n( H0 i, e4 t) h8 _( [
  372.   LPUPDATEFILE file1,file2;5 ?3 X& W4 M) W) O8 s
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;3 \8 J3 N" j+ b
  374.   std::list<CString>::iterator l;: L2 s7 R7 g( F) @
  375. 1 G0 F+ C- O- s& N
  376.   UpdateLocal.clear();
    4 I) e5 k4 z4 A' ?! ?
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);7 k4 x% Q  a$ ~  U" W
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);
    / k7 ?3 r$ ?. f
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);
    # l: E$ z- }9 @5 g- T2 M
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);
    : _& A# U/ N( D( q2 }
  381.   if(UpdateFile3.size())
    2 W+ z7 D; W; n+ I% U
  382.   {
    + g! r) o: ^# S9 }! S. z. I. O9 t
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++)/ I! X; D1 C7 [$ A
  384.     {
      ^0 Y, K, b) g' ]
  385.       file2=(LPUPDATEFILE)(*i).second;
      w# S7 z8 z3 r0 Y- b
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    9 a5 Y# R$ t$ F4 w, ]
  387.       {$ l) P7 j* z: [' v
  388.         file1=(LPUPDATEFILE)(*p).second;
    " m- d" I+ p" {3 ~9 t1 U% O3 y
  389.         file1->vers=file2->vers;
    & [5 U$ V1 ]7 e6 H& E0 {3 w4 `
  390.       }
    7 e3 [6 Q6 Z; V
  391.       else4 b6 {+ S% w$ T! F3 _* j
  392.       {/ T/ Z. R6 X- l3 P
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    - t! @5 h) y6 g* j& a; R
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));
    ! |1 c( ]; A( X; M
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));
    6 S; g2 j1 j2 c' ^
  396.       }
    . a4 x* r1 [4 w# N0 N# Y1 C% r
  397.     }/ _( s4 x! P! j( I
  398.   }
    2 `4 ], B0 r( C! D
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++)" V1 r6 Y2 Q( X+ c. i! i
  400.   {- T( M8 a/ \9 l! k
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())7 `/ V7 M% F1 o1 |' |# l
  402.     {
    ; {7 W% v' `: N+ T& w- a4 F+ A
  403.       file2=(LPUPDATEFILE)(*i).second;" c3 l" {# h2 ?- F& P2 u
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    ( m  C4 t' H# e. E8 c6 p0 Z% e
  405.       {) g  U( ?" Z. Q
  406.         file1=(LPUPDATEFILE)(*p).second;
    / W# \% B3 D2 i, b
  407.         if(file1->vers!=file2->vers)
    ! h, A  M/ l! y  T
  408.         {1 A5 R4 x# {: g: i, ?5 X# z# a* e
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));0 a# S+ Z* t4 G  W9 r' Q
  410.           c++;: S9 X6 G; I( R) v6 Q8 ~$ i1 N
  411.         }
    3 d5 m9 a5 G3 N2 }% N
  412.       }: b, J: K- L% s1 q8 Y: J: ^9 Q
  413.       else
    / S- D& f. Q( p2 ]# X1 }0 I6 F) l& G
  414.       {
    3 }6 K1 t" q7 Q( V# ?
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));- D  ?9 `: u0 Z+ i; m
  416.         c++;
    / I! s& a$ v' B3 J9 S7 f
  417.       }
    : Y) B7 R" i% K8 k& R/ \, @
  418.     }( T# S7 o3 T# U0 q3 b
  419.   }7 x" @7 u  ]; D# `: L3 j2 Q. ~
  420.   unlink(".\\DownLoad\\update.txt");
    ! i: f0 D" i7 M* H# b+ D
  421.   if(UpdateLocal.size()) return TRUE;
    , N+ h( `, a( n7 k, s6 a4 K, k! A* ]
  422.   else                   return FALSE;
    * h1 l/ R' P9 g- x& h
  423. }
    5 T. ^- `# U" g, Y* g

  424. , n+ {9 R  ]* L/ a. d0 `  M
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"
    ) P6 X' V7 h3 Z4 T5 y( ]& t
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn"
    3 {, Y3 ~, F0 n( X/ |' @

  427. # L; G1 P1 J& r3 `2 M: P

  428. - h& G6 b$ N/ ~- f

  429. ' g* _* ?3 Y$ g, S) g
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile)1 Y# v) x. \2 Y1 t1 ~% S
  431. {7 ]- o$ i' R! m+ y2 n5 k
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;  ?% T6 R; X6 W. }+ i
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    ! ?7 Y/ ^) X" b
  434.   {
    & n/ e$ e+ b# E; X1 t9 T9 h3 d& A
  435.     char szLanguage[50];
    ; W/ H+ i- N2 @/ B( x
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");7 t) w" o( w3 V
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
    , u$ ]* C! Y! B2 {+ u
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    9 p4 u8 U; e( p+ t2 j8 M% ~) L
  439.     else                                   m_iLanguage=ENGLISH;3 x8 }/ s8 [9 G3 R3 ^# Z; S
  440.     char szRegister[100];
    , |! }6 {# p! V, u5 r' C1 G* z
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");; _: Q5 k8 |  b6 P
  442.     strRegsName=szRegister;
    ) a: _' i% V& U* Q1 z/ L% v
  443.     char szPatchURL[100];
    & _9 w7 X5 `9 T$ [
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");" f; k. h5 i- q1 P
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);
    ' E/ y; D1 Z- W, w
  446.   }
    7 f' G, {6 w0 [) V/ P
  447.   else
    ; _" {, R$ R* L6 Z& L8 T
  448.   {- z- |$ E3 ?& t0 }+ ]" d
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    - s+ x$ S: P8 r" j5 M: X
  450.     strRegsName=DEFAULT_REG_URL;
    ! Y' K; O' g0 u. N: A7 O6 U
  451.   }- D/ }7 \3 h& O- I9 t& j- D: x6 z, @1 D
  452.   if(GetFileAttributes("hosts.ini")!=-1)% i3 n; u2 W' y8 v1 \
  453.   {( I! Q1 x/ \  Z  p& H& t
  454.     char szIP[50];
    1 m. I& \* K7 y) K! s
  455.     char szDIR[300];. X3 y% y: [% g7 [  G& j
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))
    $ E; W$ v3 P/ A8 V9 i! i% t  l
  457.     {  c! {& J. I+ V# T% Z% E$ X
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");
    # N! s, @9 Z: s
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");* {9 U9 c7 Z; D; y6 z
  460.       strHostName=szIP;1 _( n* {$ F# H+ u4 I/ Z' I
  461.       strHostPath.Format("/%s",szDIR);4 X" {1 W6 s! s6 j
  462.     }6 {- v* W6 H! y
  463.     else
    . L$ y8 X8 B. {0 J
  464.     {
    $ l% I1 B8 \) c8 F7 w3 V
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    2 H% g' M. K) l+ |( O( n
  466.       {
    2 w1 F8 ~& z9 C7 c- {, _
  467.         char szLanguage[50];
    1 ?& W# k: y/ s  f* m
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");( I0 g$ t$ v  N) K2 P- ~
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;' K8 k# K3 v, r
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;% d- J, C: U7 n! u
  471.         else                                   m_iLanguage=ENGLISH;2 ?& ]# h: C, r, u9 C4 n3 ]6 g. z
  472.         char szRegister[100];  q  t; [( a7 h5 [. a( k6 N
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    + C0 H. s& O: l. A
  474.         strRegsName=szRegister;
    & X1 o5 [- H9 u2 i) }
  475.         char szPatchURL[100];
    : L- X& y/ l& E
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");* R" [1 w4 n: d4 W: L
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);
    ; x9 T( u& l4 ?6 h& f
  478.       }
    # }  N' {4 l9 a
  479.       else& j" k, E. r. ^3 U" m
  480.       {/ S% Z/ F7 A) [3 Y2 f. e
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    # i0 J- n/ t8 i$ ]: U
  482.         strRegsName=DEFAULT_REG_URL;& R9 b- S4 v3 q8 Z3 K: s
  483.       }* q2 o: K8 W5 |
  484.     }& W8 n( W/ f: N# i5 ]
  485.   }* u; Y% D4 Z4 P: [" u! q! n
  486.   return true;
    ( O' z! \+ R! D6 E9 |
  487. }/ Q% X/ V7 ~: n% Z+ N- D

  488. 2 Q9 \4 g7 o8 s! i0 g+ N: F: p6 t
  489. #include ".\ZLib\unzip.h"
    8 G" q5 c" _  K7 ^4 o2 }) ?
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);4 R3 o; Z. x7 e: D$ E
  491. /////////////////////////////////////////////////////////////////////////////
    , _( [/ ~! F8 W" _5 l1 F- X
  492. // CRevAppApp initialization
    * j. _- s" A/ f9 ]1 H
  493. 3 l9 n2 f% a: ^1 `1 X$ s3 r" r8 a
  494. BOOL CRevAppApp::InitInstance()
    0 j% H4 |% b, B+ G7 F2 u; C
  495. {* `( X, H$ B( M0 x
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];' {) F4 {( A* t* g# b

  497. - F7 H$ n& U. H3 @! t4 f2 c
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);
    : M3 ?6 g8 P: B! e* G
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))
    # o- V9 j# u* }- i
  500.   {
    ; j. u. d4 r5 f1 y/ L( R6 f$ q% K4 A
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");
    * j. s" T1 a2 |7 n# a8 G6 \$ a
  502.     GetPathFromFullPath(szPathTarget,szPathSource);1 r' R. o, O% g* c+ i
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))/ A. }7 a/ e1 R1 [7 l: ~6 b
  504.     {/ F3 D* x: }5 N3 \3 l
  505.       strcpy(szPath,szPathTarget);8 f9 I- r% o' t7 u2 {6 o
  506.       SetCurrentDirectory(szPath);- k- x1 V5 ?4 A1 _
  507.     }
    . |3 n" M, Z" b8 v' s2 \& c! k; y
  508.   }
    7 P4 r" ]3 u0 o+ @
  509. #ifdef _DEBUG3 N: s, `0 ^  j% Z( |
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    $ [6 p  N. D- j! o
  511. #else
    3 k/ W  P5 n- h8 U
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    1 D& x; g- C" _) W9 U; g  Z4 [
  513. #endif. \  ?" L8 I' l5 X. u7 j0 P
  514.   {
    0 z6 U9 J+ u% J% S5 `4 y
  515.     char tempFileName[MAX_PATH];$ @. u4 R3 D, |
  516.     strcpy(tempFileName,szPathSource);
    , k9 V" ^# u+ R8 a) n5 ]) }
  517.     tempFileName[strlen(szPathSource)-12]=0;
    ' [5 \6 l9 U% ]: t7 S$ ]5 `
  518.     strcat(tempFileName,"\\$CSUpdate.exe");
    * D- v3 |9 k3 g( L
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);
    0 Q" j. b, K& N0 t
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);; Q5 g9 m: h/ Y$ r
  521.     return TRUE;( B# _* x! f3 r  s, O8 P; A- {+ F
  522.   }
    1 d4 r3 v% M% T& |, A
  523.   // Nuke 0118: Delete run.exe! `- ^8 D6 a9 K) B& H) H+ j
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );# v# y( q" e0 ?
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");* J3 L7 K& }/ }5 p; O' ?7 w
  526.   if(!ReadCfgFile("Config.ini"))1 C5 R4 l4 w( m* S
  527.   {0 U0 ~3 T" z3 t$ q
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);/ t3 ]* q4 I8 x; }
  529.     return TRUE;
    ' U4 B/ \: D6 Z: k5 m1 ?% N! D7 f
  530.   }
    9 t+ M5 z) y& u
  531.   HANDLE mutex;7 Y7 @" h8 ^" W4 |9 q
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))
    ! p( B8 I! x; q! D
  533.   {7 }' t% o0 F" J% V( k9 U5 _: j
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)
    - ~' `0 g  s0 R" g( o6 F0 c
  535.     {) I( c9 v+ w, L. n1 d
  536.       CloseHandle(mutex);+ y# J8 |$ E. j4 B9 P2 I
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);  V6 k, k2 x+ g" z* W" e& h
  538.       return TRUE;- z; S- a0 K$ y0 f
  539.     }3 }: ^: g7 d1 x) K) Y! |( {
  540.   }  6 d, X( K& w# e0 I
  541.   CloseHandle(mutex);
    ; t/ ~" u: E8 k: B# C. V0 w: y

  542. - Y- }2 `, h  N! G, N6 q6 `6 l
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);
    * F) Z0 X  e1 I& X$ U
  544. % V6 [2 U  O2 j: ?* B
  545.         AfxEnableControlContainer();
    & Y% a# G% i8 q* f
  546. 5 f6 S! j5 ]; N! f: p
  547.   bCanUpdate=FALSE;
    ( t7 z6 R& J" z$ W. n) v
  548.   dwStartUpSteps=1;; U$ J( \9 S( I! t  l  `& A! u) {# x
  549.   dwProgramState=AP_NOTHING;
    $ J+ d3 _0 Z' K: g7 i+ b
  550.   w( K$ ]3 M* b4 s6 \& T- B7 }
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);) Y/ K$ U% A* v) z& j* H

  552. " l# Z/ [( p8 G
  553.         // Standard initialization
    ( o( x8 ]( s2 l: }2 N* c4 ?
  554.         // If you are not using these features and wish to reduce the size- N" H7 X2 m' o7 L+ w
  555.         //  of your final executable, you should remove from the following# H2 T% b+ C) T1 j  P9 G
  556.         //  the specific initialization routines you do not need.5 C7 t( x0 _  L) {3 j  y$ R
  557. % v, A; \6 D& C& x  K; u* j
  558. #ifdef _AFXDLL
    8 q8 {' A3 g4 D5 l. ~3 l+ L
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL- i& o; \8 ~7 r2 R: i, B8 L3 g
  560. #else+ j& u( P. P! s% g  }
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically( B3 H6 X0 N( Q8 K9 i
  562. #endif
    9 i5 N3 d1 @# Y2 d! o+ z* T

  563. 2 q* ~6 e. w$ t# z' ~9 O3 `) s
  564.   dlg=new CRevAppDlg;2 m" |% h1 Q9 M0 E# y
  565.   dlg->Create(IDD_REVAPP_DIALOG);! H! X" {+ Q& C6 _( O8 i2 L0 @  Y. z8 C
  566.   dlg->ShowWindow(SW_SHOWNORMAL);
    . _: Y$ G" ^6 q: _$ g0 e
  567.   m_pMainWnd=dlg;* [3 g# Y+ K. J1 I/ k3 c$ ]

  568. + ]/ z, `  e& E
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);* K6 O3 d- M( r0 Q
  570. 6 X7 _6 }2 d9 z0 U" j% U
  571. //  GdiplusStartupInput gdiplusStartupInput;* f: s/ d2 _1 s" i
  572. //  ULONG_PTR gdiplusToken;% j3 c& F6 U& c% U5 k" b; j
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);
    % x8 K: q& }3 y# N6 t- f. c

  574. ' d) r+ J/ {- r, Z2 G2 h7 v9 i
  575. //        CRevAppDlg dlg;
    # G9 v+ ~5 D0 N* O) |; b' v6 t  g, N
  576. //        int nResponse = dlg.DoModal();' O4 q! `# L2 @9 _& ]# `
  577. //        if (nResponse == IDOK)9 V; m( @; k8 _0 `% ^
  578. //        {8 L- g; C7 m: a- |
  579. //                // TODO: Place code here to handle when the dialog is1 P, i" a; {. F5 p& f: V
  580. //                //  dismissed with OK
    + \% i4 ]% j. D' [
  581. //        }
    8 u4 f# `. c( M  X
  582. //        else if (nResponse == IDCANCEL)  S  V, P) n- W* z9 o# z" M
  583. //        {1 f( M% n; E1 {. L" P
  584. //                // TODO: Place code here to handle when the dialog is
    0 y6 @+ L1 C) J4 ~/ s' C8 |
  585. //                //  dismissed with Cancel2 ~; o# a  i$ h9 m
  586. //        }6 M7 d7 s6 \& |3 `) B, A- S0 Z3 c) C

  587. 0 X, x% Z& {& V) W/ s! S
  588.         // Since the dialog has been closed, return FALSE so that we exit the
    7 g# a* T' t2 o# P
  589.         //  application, rather than start the application's message pump.
    9 U  J( k' N/ G8 ?# N
  590.         return TRUE;$ g5 q' `% v+ C  B; D
  591. }/ h2 P8 L2 w+ `; J9 \" e
  592. & E' O, h' a9 k- l- j) k
  593. char *CRevAppApp::strtok3(char *pSource,char *token)
    : [' x8 K, c5 a4 B
  594. {
    . W. f/ y0 ?% D
  595.   int i;
    ( p6 W& w9 i* P; F+ {1 t5 P
  596.   char *szRet;
    . R( ^. `) m5 T9 r
  597. % D4 u( T( u; |
  598.   if(pSource) { itoken=0; sztoken=pSource; }
    % @0 R/ V. ^5 \$ r5 L
  599.   if(sztoken)
      C1 b: A4 ^& d' U$ P
  600.   {
      G" y$ a; _" e5 ^7 ?" \, f
  601.     szRet=&sztoken[itoken];
    4 E2 [$ e* ^% V9 o" V
  602.     while(sztoken[itoken])* u+ K; U' G3 f2 N9 `) b
  603.     {4 m/ `" N: A- c! y# H+ F8 H) }7 m6 P
  604.       for(i=0;i<(int)strlen(token);i++): `' R$ ]: Q8 c5 M
  605.       {
    ! p$ c2 G  k. j- q; g! _
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])
    . v+ q8 b1 q% r8 R. U% k  H' q
  607.         {# I* D6 m$ |, B5 l9 N
  608.           sztoken[itoken++]=0;
    % l8 [0 o7 m; n
  609.           sztoken[itoken++]=0;0 e; h/ I' @+ ~2 g  W
  610.           return szRet;0 F* C' i( m7 k4 X' D9 ]& K* p0 p
  611.         }
    & o2 o, [& j5 x$ J
  612.       }& `  @# H: ]: ]/ O5 K
  613.       itoken++;- D9 o' l1 ^. ^1 X9 v/ [3 Z& K% w
  614.     }+ f5 d$ r( z( N0 O0 _! d4 r  k8 |
  615.   }
    0 U0 J) Z, l2 ?# ^
  616.   return NULL;
    9 C9 F0 s9 V- {% M# \, R
  617. }; c( P# X3 G# E4 U& v6 ~/ v1 R

  618. 5 S) l$ p1 @# J' Q* l& F
  619. void ProcessProc(long Total,long Current)
    5 j# O; D; I% Q. W! V
  620. {
      g) n* x& b7 a1 }$ M& L
  621.         MSG msg;
    3 {/ ~3 l/ f2 K* L1 [
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);4 X( @$ i' `0 ]$ ]/ Q- z. J3 Z
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));
    ! `% J5 ]6 @% o+ }( N4 X
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))& q3 C- M( a4 O8 k6 H# R5 o
  625.         {7 g2 j1 x& A9 t7 c
  626.                 if(!GetMessage(&msg,NULL,0,0)): W* e6 X. i' R" X* a: h/ k
  627.                 {
    & K* Z0 }; m) Y5 Z
  628.                         return;% [+ x2 A, G. ^
  629.                 }
    0 F4 {* F0 i& r, @6 s
  630.                 TranslateMessage(&msg);$ I2 ~& Z3 y; S: L
  631.                 DispatchMessage(&msg);
    * o5 q1 E1 C- p
  632.         }        5 E6 m; o& _* Y3 [$ u
  633. }
    - m6 g2 B- g' o

  634. . G4 D2 k+ F( d: T4 E
  635. BOOL bFirstChar=TRUE;6 |9 E+ J5 G' z. R' N! G
  636. 9 ?; m1 L, z. F9 A! N
  637. BOOL CRevAppApp::OnIdle(LONG lCount)
    0 P3 A$ Z/ O2 T2 M' S
  638. {9 d! c- Q  x! v- v2 h# K  e
  639.         // TODO: Add your specialized code here and/or call the base class. w( M% m" b7 R
  640.   switch(dwProgramState)
    3 O; k, e! t% a" Q- U6 f6 h9 {
  641.   {
    ! s3 ?% ]5 {1 H) u5 g6 @( I
  642.   case AP_NOTHING:* O5 ]' S1 n6 s0 @. F* ]+ ~
  643.     switch(dwStartUpSteps)
    ! V" A6 b2 e- y* A2 D+ l. z
  644.     {
    ! j8 {; \4 t" k& j
  645.     case 1:
    : K0 {4 q5 j! D7 {
  646.       {& r5 ^3 I* |( Z* S5 h5 G5 ^
  647.         int i;
    % R. T% F; e5 f& n  r
  648.         CDC *pCDC=dlg->GetDC();! ^: a4 P5 C: [. t4 `' c
  649.         HDC hdcwnd=pCDC->m_hDC;4 \% F0 |2 U" j, ^5 }/ Z, ~
  650. //        Graphics graphics(hdcwnd);8 o. N# J+ Y1 j- r3 d# j! F
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");6 u3 ]4 v% K+ D6 i" }5 `7 O; X% k
  652. //        INT iWidth=bitmap.GetWidth();9 {3 A, R4 _2 j, x/ F& Q; P
  653. //        INT iHeight=bitmap.GetHeight();4 Y6 H  j5 e7 M6 h
  654. //        Color color,colorTemp;8 l- I- e5 C+ J5 `/ L
  655. //        for(INT iRow=0;iRow<iHeight;iRow++); x5 l) u7 b* t  I$ v
  656. //        {" @# b0 D, m. y' P
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++), }4 n' r. O3 U/ C
  658. //          {
    ) v9 ?# W/ o0 z& ^# Y5 s* F
  659. //            bitmap.GetPixel(iColumn,iRow,&color);
    ; X+ G# y$ |% T* r4 e2 e! l
  660. //            colorTemp.SetValue(color.MakeARGB(
    5 H  @! a" F4 V% h) E! e: t0 r  C
  661. //              (BYTE)(255*iColumn/iWidth),
    8 v/ H9 \2 z- A2 I% ~2 n& x1 |
  662. //              color.GetRed(),
    ; |5 |2 |  L8 C! o& t
  663. //              color.GetGreen(),
    8 O' L1 E# H) y0 d1 i  z/ P" j0 d
  664. //              color.GetBlue()));0 o! |7 v/ z2 F; x: K
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);- a  F5 f! p4 F, H
  666. //          }; \' G; {* N; T' b- U
  667. //        }
    % X; {" O2 [& l8 w' j# U  M
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);2 \  S2 D0 F1 t% @8 Q8 P
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");1 {2 t& H: ~1 t2 I/ p, H
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");
    ( k6 P- ?+ @7 c9 u) F: e
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    ' [( B( c+ r7 I/ Q' W. c3 B
  672.         for(i=0;i<240;i+=8); a# R3 q. U1 Y9 Y; F
  673.         {8 N8 p/ E1 F8 a# P/ E, y& L
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    / _" F! b7 [& |7 F6 u
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);( m- y9 e3 T& x) }/ A  D
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);7 Z) H- `; m( c6 g8 V
  677.           Sleep(33);
    5 x: _& T# m) e8 G
  678.         }
    3 C7 Y: U- R: H" j7 I) T$ [5 ~& ^" X
  679.         Sleep(1000);  j/ ^1 ]4 U: E! D
  680.         for(i=240;i>0;i-=8). H" m- ], ?$ k: e
  681.         {/ u/ A7 S* ^& H+ q$ A0 G+ W! W
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);3 ^6 x/ {, m3 U6 S, q3 k' R3 F
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    " P0 o: m' \2 I3 c2 D$ y
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);' s' U7 ]3 \! F' {6 q  R6 k
  685.           Sleep(33);
    - h( p* e8 U! Z! Y% q/ D0 W6 K
  686.         }
    * V5 M+ \' _; ]1 m# M
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);2 G$ w8 E" @+ E4 t' {! z
  688.         dlg->ReleaseDC(pCDC);6 o2 u' X/ H: S& n
  689.         DeleteDC(hdctar);
    3 s9 T* a! Z$ G, a( A
  690.         DeleteDC(hdcsrc);
    , l4 h1 N! k' |- O+ |; z
  691.         DeleteDC(hdcorg);
    ! r, \$ j) o3 V7 L
  692.       }: o/ W5 h+ {! ~3 X: z/ j* a
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);
    , h1 d' P7 e# F% C
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");
    2 d) u  A  Q) w* G9 z
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");
    / ]/ U8 x( ?/ B/ X* _# O
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");
    , I, G  T6 k5 r: W" n* `+ f
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    5 \; V$ T, ?& i& A  H- |* y7 L: ]
  698.       if(!Dn.Connected())' d/ }& s8 F$ ^: h; n5 q
  699.       {6 `7 a. w: c- G. j( _# d
  700.         dwTotalFiles=1;  P9 ]/ H# \+ Z# G7 ~6 v
  701.         dwDownLoaded=0;1 p* }: m, C' B& x6 e' S
  702.         bSilentStep=TRUE;9 |% H8 c) m8 I0 \/ [% o) W
  703.         bCompressed=FALSE;$ X4 e' H0 L; y8 u4 t; g
  704.         strExtLocal.Empty();
    ; h. a4 W4 `; N
  705.         strFullName="readme.txt";1 s2 C5 ]# S1 b/ j, p  I9 w+ f
  706.         dwProgramState=AP_CONNECT;& b# r4 c0 B1 q; V7 u2 X
  707.       }
    1 q: P4 i1 v3 v* d" O& {! i' j
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();4 Q, C9 k. g$ c8 \8 o8 _0 P( Z
  709.       dwStartUpSteps=2;
    8 U: N2 c, u8 q9 ^
  710.       break;& r9 G9 T0 w: f6 T% \
  711.     case 2:! \6 ^9 p& R% j- @, I
  712.       {4 M' p" n# z) s! u# E/ Q6 x
  713.         int iEOF;
    9 l$ x2 `4 L  N8 d5 ~% e: g
  714.         FILE *fp;
    : Z+ Q7 ]+ ^3 [4 K" M# x/ w2 c
  715.         char szString[512];
    ( i9 H/ b8 N1 Q
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");* Q  n6 E$ ^1 F5 b0 @) `; P& Q
  717.         if(fp)
    & n* F) H, u$ q4 f- Q! |  p5 b
  718.         {+ ^- o/ r1 f, X! @
  719.           do
    ! L) j8 b6 s. r
  720.           {
    - p9 w  N" V1 w+ M- r4 g/ B
  721.             iEOF=fscanf(fp,"%s",szString);% u0 Y9 @+ L) p9 a3 T2 [0 f
  722.             if(strlen(szString))% O3 i2 B' I0 a+ X
  723.             {  y- U  P+ @( T/ C" D. i
  724.               if(bFirstChar)1 e7 ^/ d( s1 B/ O& v1 f5 N$ `, e) B
  725.               {
    1 k! b4 O' v. f  L- Z
  726.                 bFirstChar=FALSE;
    3 w+ _$ l" X, d' M  p
  727.                 bConnectIsBig5=FALSE;* L: ?  W( f6 d
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;
    " V9 X; J: d* f: U
  729.               }7 A2 e  ?+ ?) ]5 d
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));
    / V9 K/ F  Z1 l' }+ b
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));2 Z" h) G  H6 c& H
  732.               dlg->m_ListText.AddString(szString);6 m2 O& B0 p6 g2 I2 O  E2 s! B' Q
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    1 ?# U, L% e+ `0 ^9 ]
  734.               *szString=0;! n! Y3 d" }) D1 H
  735.             }- _' [3 v7 i- z3 w- E& V
  736.           } while(iEOF!=EOF);
    ) Z5 e$ o0 t- Q* D
  737.           fclose(fp);
    ) i7 ^& H$ ^* K( U) _: p
  738.           unlink(".\\DownLoad\\readme.txt");
    : T- X: F; z  Q8 [0 {* H- }
  739.           dwStartUpSteps=3;
    ' K, Q# k9 m* d6 H6 u4 i
  740.         }
    $ g" y# a& P# h% \+ J' j
  741.       }# \( ]( H5 j0 D
  742.       break;
      e/ K: T! b7 X' F
  743.     case 3:, _2 t# w1 F; y. x9 V* R
  744.       if(!Dn.Connected())# q% b0 T9 P/ i) }4 k1 X$ Q$ F/ D
  745.       {
    6 B2 u' h" [$ o3 e  R' u2 w
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);
    0 _0 p0 P& \+ E4 ~5 ]
  747.         dwTotalFiles=1;, C1 c1 \4 t, X( t: W
  748.         dwDownLoaded=0;
    / [/ i6 D4 U4 N: j% H
  749.         bSilentStep=TRUE;' t4 l, Z2 C# \) ^- F
  750.         bCompressed=FALSE;
    - S* ^/ s! d) z: R) p
  751.         strExtLocal.Empty();7 _! b! S4 ]- R$ q8 G, W0 V
  752.         strFullName="checkversion.txt";% z( ^- `; E9 ^! T6 F6 e8 s- T- t
  753.         dwProgramState=AP_CONNECT;
    ' G, w) F. s+ ?  e: O: i. Z: D4 [
  754.       }) @4 ]. O" L; _1 ?( R
  755.       dwStartUpSteps=4;& S% d0 ^1 G' O3 b
  756.       break;
    $ }8 Z0 H) o9 K6 [8 U6 d+ _3 U
  757.     case 4:; [. w' P+ x1 n7 W: g4 |
  758.       {
    * q- z6 o3 t" `5 p* o5 G3 z
  759.         FILE *fp;" l8 A$ C/ E: G; `. e
  760.         char szString1[128];
    8 b5 F" k2 q7 q+ J" z
  761.         char szString2[128];
    ' E% G# q8 Z. b" Y% a: N! p
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");; C. x& W" u+ q& R6 U5 K7 f
  763.         if(fp)
    6 g% ^* F5 f1 _" r; u# ~3 F% ]/ F
  764.         {6 K: U' V2 C# \, {! b
  765.           fscanf(fp,"%s",szString1);
    4 L7 T6 X! X6 }* z
  766.           fclose(fp);
    ) X- G0 D9 ?, y3 P. ~( }. V6 F
  767.           fCheckVersion=atof(szString1);$ r# s4 s7 P3 }/ _" |- X2 a
  768.           fp=fopen(".\\checkversion.dat","r");
    # b9 v0 J$ ]' D/ V
  769.           if(fp)1 c% w: c0 G0 j; K& l+ O/ q
  770.           {% j* K% \3 v- C& O6 D. a
  771.             fscanf(fp,"%s",szString2);
    , k0 {; d0 Z& G0 D7 T/ F3 G) v9 K2 i6 y
  772.             fclose(fp);( f; A) Z( V9 R# M+ f& \
  773.             if(atof(szString1)!=atof(szString2))
      p  W4 P# ~% B6 A0 p
  774.             {
    9 S. q4 C# H+ n9 u( @" n5 |* ~
  775.               if(!Dn.Connected())
    ( s9 |4 t4 }6 X5 i
  776.               {
    / B! P4 E2 e$ X: i" \) D9 q
  777.                 bFirstUpdate=TRUE;
    ) K) n9 X1 v- m1 {) f
  778.                 dwTotalFiles=1;  c+ t* S9 x# v/ `
  779.                 dwDownLoaded=0;
    : r2 f$ N+ O/ g
  780.                 bSilentStep=FALSE;
    + a8 C+ u$ j+ A& }' |( Z- k
  781.                 bCompressed=TRUE;5 ^$ \/ w: O- D% C0 `
  782.                 strExtLocal=".\\DownLoad\";, z& N, Z" A6 M% A5 G
  783.                 strFullName="update.txt";8 e5 o( m7 U& y) q
  784.                 dwProgramState=AP_CONNECT;& ?* G9 l$ V/ H& P5 ?9 J0 h& v
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");. _/ `# i, ?2 v; t' S
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    4 z$ m2 i) Y# f: H9 @$ a. a  O) h
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");. v* s+ X8 \1 H7 z5 N2 l
  788. ( n1 [* _; l# n* N
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    ; E' g2 J0 |& n
  790.                 unlink(".\\DownLoad\\checkversion.txt");. ]8 @( i& \- \; H4 K9 p
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)
    + m* v+ R7 [4 ?% q
  792.                 {
    # D, L$ o+ b; n8 {# w* S( b
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");8 \5 k; K: q$ S
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");/ t1 t0 e0 n3 l- Q% d
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");
    6 q! Y$ z+ H$ b: h2 F" Y8 C
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);. d. q! X' A- X' C8 z0 b, N
  797. 0 R' d  H0 u; e) G* Y4 @% S% f
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");" ~1 P) x& r0 l; N) Z" f7 P
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");8 h$ W+ }  f1 O  \$ d
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");$ i' A5 `+ R8 l/ _4 ~5 Z, C
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);9 Q* P: a4 W" o
  802.                 }" l/ ^9 {& F. Y2 ^+ w
  803.                 dwStartUpSteps=5;6 O1 C. x+ n' k0 j3 f
  804.               }; ]1 p* _, n9 N8 V7 o
  805.             }* [( \7 h" }4 @) X! w- X( l
  806.             else
    , N" }' N7 i9 c' V0 [5 W+ t: A
  807.             {
    5 E+ V/ r! |- `: k, D8 A: X$ d
  808.               unlink(".\\DownLoad\\checkversion.txt");7 }2 _7 C& ~" o; O* K: k' h. W9 z: V
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    5 D; A4 g2 s7 n8 @- M6 \7 a; q
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    2 B! u0 V. ]5 G# Q/ m
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");+ m% }0 V8 s0 s: N3 Q' O
  812. , c3 E, r) H0 `; T- D& C' C( N
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    1 K* m& O: J" z% e
  814.               dwStartUpSteps=99;' t7 d* B! E$ m8 Z
  815.               bFinishUpdated=TRUE;' X$ v4 Q( T: j# l
  816.               bCanUpdate=TRUE;
    2 ~4 R2 a' u9 a4 \6 S" [, y3 R
  817.             }" s' j" E7 \9 V' d
  818.           }
    8 ]7 ]* D+ B" H# d" v( D8 `
  819.           else) D4 i1 o. A/ v9 J3 t5 b
  820.           {3 j6 }4 Z. F  x  j
  821.             if(!Dn.Connected())1 a4 P0 O+ F* p0 f  e  l  N
  822.             {$ ?7 J! j) V. c9 k
  823.               bFirstUpdate=TRUE;: \8 N# S& [- E
  824.               dwTotalFiles=1;4 h  g: m; i7 h2 j# ^$ L7 V( z$ K: P' ?
  825.               dwDownLoaded=0;( z- Z: D% q) y' J5 {
  826.               bSilentStep=FALSE;( [: R- v5 |' s) U
  827.               bCompressed=TRUE;
    8 z% y$ F5 d+ J! E  v% w* W! h
  828.               strExtLocal=".\\DownLoad\";% n, U  O) d/ `. R( D2 l
  829.               strFullName="update.txt";* B  w9 A, W8 o. i
  830.               dwProgramState=AP_CONNECT;
    + Z1 Q. D6 @3 n/ w( A" s* V  P7 c: N
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");1 I; H! Z) @0 X1 e1 {/ ^
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    % H( a" D0 U: T' }$ L0 N
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");# r1 c" }, V! k% g0 v, B
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    4 q+ n- @& p% x7 u5 ]1 m; j( r
  835.               unlink(".\\DownLoad\\checkversion.txt");
    3 M: ?% [7 f3 @9 ^4 p% a1 @" e. c+ ?
  836.               if(GetFileAttributes("Wsa.zip" )!=-1)' i& r( K7 H; B+ i. }; v" l* h
  837.               {
    0 V( G, ]5 z% n: [; A5 U+ C
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");. L! V# u/ o( m3 Q3 s
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");
    ! F5 N) }. H& p  N; ?8 u
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");8 w- m4 T6 y: G7 B1 S- _
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);- J/ z  z$ v/ Q# n$ o
  842.                 3 T5 x& c0 {' m
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    5 m- H7 k# i3 F8 b% ?+ k
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    * F2 R, b! i8 }- Y& u! M+ K, w3 K- L0 h/ A
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");
    % j4 o' r* Q4 M* Y) h1 v/ G! c
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    8 x, X, z4 C# y) |/ B
  847.               }
    5 B9 o2 u3 [4 n: M$ h* l; |- S  z
  848.               dwStartUpSteps=5;; L$ U, O/ }- F: \- i
  849.             }1 I0 K8 }" E9 n) G- i
  850.           }
    0 ]2 ~; q# `$ T, a2 c, f5 k2 x4 O
  851.         }
      w/ j3 \+ H2 H1 @
  852.         else
    * d( ~( @: c3 D) n  s: d
  853.         {: u& l. [1 [( x2 ?$ x
  854.           dwStartUpSteps=3;9 ^, R7 m5 N, b4 c) l
  855.         }+ W$ J  z6 v. D- f$ ]% C! S
  856.       }$ E2 o5 s+ ^8 [9 g3 q; w
  857.       break;
    8 b/ b4 L. a+ a4 B
  858.     case 5:$ q. C' d; q/ e/ H, J( P
  859.       {3 u2 C; P) [$ }- e
  860.         if(GetFileAttributes("Wsa.zip" )!=-1): L$ ?1 P5 \3 W; x, ]8 [
  861.         {8 N+ r1 E6 t- h8 v# z' Y
  862.           int opt_overwrite=1;; w7 @1 `1 h4 i1 ~4 w3 D
  863.           int opt_do_extract_withoutpath=0;
    4 `0 [/ L1 F+ F2 t# a6 o" h
  864.           unzFile uf=NULL;1 D% v" Q/ m4 Y4 V
  865. ( u2 n- b1 I, V& x# x3 v* d
  866.           uf=unzOpen("Wsa.zip");
    ( a# C( e" y* I+ |! I( f0 a; w
  867.           if(uf)
    6 y# X1 r; }9 ~2 K
  868.           {
    8 I. ~  T7 ]; ~. p: a2 ?
  869.             do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,NULL,ProcessProc);
    0 Q- c! c1 u. f) H0 N; r
  870.             unzClose(uf);
    . O  V7 Z# L# a# Y7 i, V
  871.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃ЧΘ.....");
    * c7 h4 E# p: G  H2 R
  872.             else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压完成.....");7 V; l6 ]" }* P- p8 |" t8 I- V  m
  873.             else                                                      dlg->m_ListText.AddString("Unzip OK.....");! i7 R# H5 H! I+ c' g
  874.                                           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    / |0 p& h2 J. E) c: J
  875.           }; U% e: Z/ h5 `
  876.           DeleteFile("Wsa.zip" );+ Y# G. b7 S, y2 c
  877.         }) }7 Q# A8 J7 N
  878. , {4 j+ i0 F" L
  879.         if(CheckLocalVersion()): S4 f& J9 i7 }2 R. C- Y
  880.         {
    0 X8 G: {2 {; G! i
  881.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫磅︽絬穝戈.....");
    . `2 Y7 v* ?! h* L
  882.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请执行线上更新资料.....");8 c/ j& m7 L( _
  883.           else                                                      dlg->m_ListText.AddString("Please update.....");
    + Z- s' a! R; J0 h- D' f
  884.           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);6 N7 j1 r/ E( {' z2 s
  885.           SendMessage(GetDlgItem(m_pMainWnd->GetSafeHwnd(),IDC_BUTTON1),WM_USER+2,3,0);
    - l  D# f8 r5 g* N: W
  886.           dwStartUpSteps=99;
    : m; V7 F! T1 F; g* x3 g
  887.         }
    # }6 I2 t; }" U6 d; e, c
  888.         else
    . z; f' g$ ^. l! I. R7 s" ?
  889.         {
    - y' ^8 \# F6 D, L1 t
  890.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");- x1 P: H# K/ e5 `, F
  891.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    2 ~. n) j  L9 k1 b. r+ v! W
  892.           else                                                      dlg->m_ListText.AddString("no new file update.....");
    5 T( u! e! w+ t4 q4 P% R

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

2 q7 s; [) R2 V

評分

參與人數 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-1-16 22:51

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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