找回密碼
 立即注册

CSUpdate.exe源代码

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

, N( l) e4 s! }( R6 s
  1. / RevApp.cpp : Defines the class behaviors for the application.. Z+ r) @# Q; q, O& j/ x$ j
  2. //6 ]) W2 k1 h/ `: I: r/ w4 m
  3. ; B) x6 X  w8 V' w7 W) j
  4. #include "stdafx.h"" z2 m. i( X4 \" C7 Z: [
  5. 1 [! S3 g3 k  T/ V/ E) i
  6. //#define UNICODE
    1 b# I( X2 [: m0 P2 h
  7. //#include <gdiplus.h>6 d0 _* K) [4 Q
  8. //using namespace Gdiplus;6 Y2 J, ]$ r! I+ D- {# N1 a1 r
  9. # |& Q/ M. c6 q4 C$ ~
  10. #include "RevApp.h". \& o2 X  u3 l
  11. #include "RevAppDlg.h"
    6 j* o' k2 ^! m2 S! K& f" d

  12. 8 F8 I+ M$ H' h) ]1 ?0 i
  13. #pragma warning(disable:4786)1 t+ u& D! G8 @
  14. #include <map>6 c9 S" b" H! ^; B) m) O, G; y! {
  15. #include <list>
    1 {5 x4 z* S- k' s: {6 a
  16. #include <direct.h>
    & O: ?0 m  N% S% O; e: Z
  17. $ j2 r+ d. e; q) }& m5 M8 v4 M! k
  18. #ifdef _DEBUG
    7 }7 E5 I) ~) c9 i6 i# W; g
  19. #define new DEBUG_NEW
    : O0 j% |6 ]" O& d3 G
  20. #undef THIS_FILE
    , t  A3 m8 k6 h7 v0 f
  21. static char THIS_FILE[] = __FILE__;
    ; T# `$ P& i- b7 q3 K
  22. #endif
    2 m* c" p. i7 }. d  q) e
  23. #include "SkinResDef.h"6 y# C0 W) f/ L: G$ f/ m
  24. #include "ChangeBG.h"
    9 H$ N4 ]# A$ P" A  p; J
  25. #include "AFXINET.H"% S! S9 ^+ [! u) ~

  26. * x! U: v" }9 b0 ^  l/ R
  27. #define TRADITIONAL_CHINESE 0
    % c8 s" W2 Z" ?7 C% z5 b3 e
  28. #define SIMPLIFY_CHINESE 1
    & H+ z' C. M$ Q) v, {+ Z* Z8 N
  29. #define ENGLISH 2/ A" r6 V- D- v, q9 X+ V( m
  30. int m_iLanguage = ENGLISH;
    ; G. ~$ g1 `& U1 f! g5 K- U' v
  31. /////////////////////////////////////////////////////////////////////////////
    4 m) n4 A7 q$ C3 B3 v8 q
  32. // CRevAppApp
    & S. z5 h" M8 n  \' ~; q+ t
  33. 9 V2 X. N8 r& b/ g" ~, c7 g
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)
    ! I7 i! \' o: m4 i8 p7 c& ?9 T2 r; J
  35.         //{{AFX_MSG_MAP(CRevAppApp)& M# b' z2 W# U& r9 b& C
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.
    " `( Q" X" k% l( V$ I( y6 Q2 t
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!/ @+ I! K3 g! K. A/ K& q
  38.         //}}AFX_MSG
      I" a& ]. e0 J* j& D
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)
    7 G( ^8 F4 b; P, ^$ R* ?
  40. END_MESSAGE_MAP()
    0 t; t1 m. V3 u9 s9 o+ X' @0 e* x

  41. 7 K0 l% x! o0 e6 U
  42. /////////////////////////////////////////////////////////////////////////////! @0 ~# l9 h; C% V. ]$ W& ]
  43. // CRevAppApp construction$ Z2 B( u2 d0 G8 ~" `5 G

  44. : |! X5 K; F) O4 Q' T1 z
  45. CRevAppApp::CRevAppApp()
    1 W$ u: {' Q; L% a: ?# G
  46. {4 R0 C* i  Q4 k4 b7 H, z# Y
  47.         // TODO: add construction code here,7 `3 ~% Q: w6 b
  48.         // Place all significant initialization in InitInstance
    % m+ `& j; S) z8 P; j& Q: q8 u, ~
  49.   bDisplayIsBig5=FALSE;' O& G( |7 l7 p' @4 I! x) X
  50.   bRestartUpdater=FALSE;
    ( I. q4 R' |/ R  N* U+ b- P
  51.   bFinishUpdated=FALSE;
    ) z3 z% y) w! W
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;7 b: O- I; D  c7 @$ E, y) B
  53.   InitChangeDataBig52GBKS();* x8 v: x0 j3 w6 e% F
  54.   InitChangeDataGBKS2Big5();
    6 a/ A7 Z  r9 p8 ]
  55.         //# V' |4 D  X1 W2 E
  56.         bClickRunExe = FALSE;! e6 w7 |' v. \, f) q, l/ H( {
  57.         //3 r( }! w# F) U8 u( |: k  K7 e$ R1 K0 k
  58. }
    % m: m! Z* K6 t0 I! G

  59. 7 R9 j3 T. \' D3 E- ?$ E! Y9 T/ |
  60. CRevAppApp::~CRevAppApp()1 r0 h. ~) }6 }& Q  J+ T7 G
  61. {
    3 w" J$ u2 `2 r) X2 N
  62.         // TODO: add construction code here,
    5 G! R. @0 ]0 p4 O! X
  63.         // Place all significant initialization in InitInstance
    * J; w# ]5 l. @4 A
  64.   EndChangeData();
    # m: H( k  v: t  A1 E
  65. }, n# ?9 V9 r& Y& C8 `0 K4 {6 {

  66. 2 |! Y  \1 }' [: b, k  V
  67. /////////////////////////////////////////////////////////////////////////////
    ; S7 X3 H/ q# E" z: u
  68. // The one and only CRevAppApp object0 A, h+ b& X3 F
  69. & S; B. w% a9 m5 u6 P  T
  70. CRevAppApp theApp;
    9 ^4 D$ [/ i% I$ Y" t
  71. . \# g, m4 e: ?: f6 C8 y& z! ^
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)
      `; @; C0 z: K4 c
  73. {7 V1 Y7 O5 y& u: d2 f
  74.   int iEOF=0;5 |5 U$ i" I6 R3 N9 ]
  75.   char szTempName[MAX_PATH];) j. `- P' U- L3 t2 g
  76.   *szFileName=0;
    ; Z9 ~( J9 ~( E. n) [
  77.   iEOF=fscanf(fp,"%s",szTempName);
    3 e# a( W, A1 ]. m- d! t
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')% W: K- t* {/ s2 R, D$ [
  79.   {
    " a0 g  g- p) s6 t
  80.     strcpy(szFileName,&szTempName[1]);& a- P4 \- z1 I5 t
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)
    2 u! p- T* |' n1 J- t
  82.     {
    ( E. o1 t" r# X  K
  83.       iEOF=fscanf(fp,"%s",szTempName);. p) ?9 _- B& @
  84.       strcat(szFileName," ");; [8 J0 J. d, z# ?6 I6 ~- n
  85.       strcat(szFileName,szTempName);
      {+ p. w: E; V  @# `' f
  86.     }
    % }  H. ]# {% S, Z! ]" w6 T7 ~: P
  87.     if(strlen(szFileName)>=1)) p2 @# V0 P. ?7 s: n! y5 S
  88.     {$ n+ S5 d: r; J& f5 w) m
  89.       szFileName[strlen(szFileName)-1]=0;
    3 h% S" l$ D( W: f
  90.     }, O: ~9 ]$ W5 s
  91.   }# _! P/ N3 N8 o, x/ ]) I% J  |
  92.   return szFileName;/ o) H& E/ P7 P: {
  93. }# C6 P3 B2 u4 M* c6 O
  94. 8 |+ |% [2 A0 y" g1 `% u
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)
    ' ]3 X( X$ f" n3 k3 a$ ]
  96. {- n% X: {* \; x. C- i
  97.   FILE *fp;
    - H9 r: b5 R, C+ Z  V
  98.   char *key=NULL;/ I6 ?' y8 t/ ?% g7 m: S5 H
  99.   char version[MAX_PATH];- p$ K% r4 R# Y$ o! n$ T
  100.   LPUPDATEFILE file,olds;
    # |+ z1 d: D0 c" g$ H, E7 Z: [# s1 ^+ ^
  101.   std::map<CString,LPUPDATEFILE>::iterator p;. R. `6 C. K% c# G/ I; r+ n
  102. 9 F: `) \- c' H
  103.   UpdateList.clear();5 H4 U+ V7 E9 e0 p) w* ]
  104.   UpdateFile.clear();
    " G* L# q+ F+ t, [
  105.   if(GetFileAttributes(filename)==-1) return false;& v! Q8 \: [* a: y
  106.   if(!(fp=fopen(filename,"r"))) return false;
    1 s- e- `" r- i# D/ g' [
  107.   fscanf(fp,"%s",version);9 e% Y% P/ m3 T8 a+ W
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }
    - L  H1 i- Z8 @0 F
  109.   while(fscanf(fp,"%s",version)!=EOF)! s. [- D: d5 C
  110.   {
    $ I8 p& O& g- T, ^( _
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));" ^5 s) s* H; W' {4 F; [9 {
  112.     fscanf(fp,"%s",file->path);5 e6 s3 V) m3 ?, j) H* H
  113.     ReadFileNames(fp,file->file);+ i0 \; W- m, t5 d0 _) A
  114.     strcpy(file->full,".");) c) {* t* n( x3 S
  115.     strcat(file->full,file->path);, _$ I) d6 P) y7 r$ u" v8 j
  116.     strcat(file->full,file->file);
    4 I. w) k, r0 L6 q8 o4 Y
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())
    2 x, ~7 d- F- ~' g% j
  118.     {
    9 n) _. @1 l8 p' ^; J4 o
  119.       file->vers=(float)atof(version);
    9 P& m6 Z9 \$ Z) P: e
  120.       UpdateList.push_back(file->full);
    9 E. @/ U' y* C2 U& t2 j9 v% v
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));" ?8 t/ p2 V& S1 `
  122.     }
    ' L; B; r& r$ a* y, \7 d. g
  123.     else* q% p8 s% i  l$ p+ m
  124.     {
    0 c/ G$ b2 U# }
  125.       olds=(*p).second;
    " C6 p- g8 P$ |& G' ~5 R* m4 I
  126.       if(olds->vers<(float)atof(version))+ U0 |$ W  }# y. S- q
  127.       {
    7 \& w4 k: @  S; W  P  \$ \
  128.         olds->vers=(float)atof(version);; A  U  S1 r% }5 m" D5 _
  129.       }: l0 C2 b& {  x5 G( X+ k, l% H
  130.       free(file);4 L$ i  [- }- {1 ~! w
  131.     }
    # [! P# u4 n5 _6 R  f
  132.   }
    $ K) {5 L1 P. G9 t* s) z
  133.   fclose(fp);
    / z2 Q' B2 N9 X  E  o) X( p; u
  134.   return true;
    3 f( Y; n. ~/ G: h, p# I" ?( ^* B
  135. }
    ! r& t" A; I( }$ n7 r2 x5 O

  136. : ^- J/ B+ [% E* O
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)
    ) y- w# {8 d' D: H/ R9 [3 s
  138. {8 M/ O5 F; Y) O+ @# m
  139.   TCHAR  szFull[MAX_PATH];
    : y  a4 ?, i% ^9 B1 b) V2 C
  140.   TCHAR *token,*inter;1 c1 {( ?4 `1 H7 O; w' E- ?& I3 N- Y
  141.   *szPath=0;
      F/ p8 D; X; }+ n
  142.   strcpy(szFull,szFullPath);. C4 U5 |* O& x+ }5 Z/ R" |
  143.   token=strtok(szFull,"\\/");# f" M; S5 A% k4 a% d( L
  144.   inter=token;
    * g3 Q- K2 x6 H  e
  145.   while(token=strtok(NULL,"\\/"))
    3 `# B! N) Y" A" `
  146.   {
    ' s) O* v0 P! m: C) J) q/ T
  147.     strcat(szPath,inter);
    ; a! S; D6 ?3 C7 {3 \
  148.     strcat(szPath,"\");( J2 n4 T: ^  N
  149.     inter=token;3 S" r! U8 q3 s& ?# @. T2 q
  150.   }
    + t. `! s& D* E
  151.   return strlen(szPath);
    " o: y: |3 F3 ]) a4 Z
  152. }' e3 d6 l6 I+ S
  153. 9 [  x( j( @+ X) h" K% P/ H: a
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase)
      f: u' y3 G- j1 v8 J
  155. {
    6 Y3 q; D2 S; T; U' K- U, R
  156.   DWORD attrib=GetFileAttributes(Target);5 _) V& }3 [1 l" ?
  157.   if(attrib!=-1)7 h0 r3 R% [& O; S6 V8 P' j8 \
  158.   {
    % T( j+ q4 i7 V4 H) b
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))! X4 O2 q; x, a$ R+ D
  160.     {
    4 l9 g; p8 Q+ J, B/ ~7 K9 N
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);( g6 K1 o4 k8 S" I0 Q/ U) ]) p$ }4 V' k
  162.       SetFileAttributes(Target,attrib);
    ) |. }: g  Z; h7 q# _5 k; o
  163.     }5 A& S" w8 K6 @6 C
  164.   }+ V) J/ z& ~  g) ]8 t; ]2 t
  165.   CopyFile(Source,Target,Erase);1 P1 m3 W4 Q' e7 R
  166. }0 @! @" ~" Y* Z

  167. $ v3 `' k1 P1 L$ a8 U9 @
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)9 k. w7 ]( d/ C4 X( t0 O2 ^
  169. {
    ) u0 p8 j6 a, h. a0 E( `& x
  170.      FILE *fp;
    9 Y. f" x0 I. ?3 j7 B
  171.      char  szBuffer[8192];
    & A- L8 @) X6 `: b
  172.   va_list  argptr;
    $ y' C! h1 G. f: ^2 u: d' S& H4 J

  173. # {0 h2 S3 `& U8 U
  174.         va_start(argptr,message);
    $ F% Z$ d% Z" X0 O& V$ I1 I; X# @
  175.         vsprintf(szBuffer,message,argptr);
    ' C& \, F9 @4 g, a8 ]$ h, }
  176.         va_end(argptr);
    & _6 a3 _- t8 F+ Y* X6 J, n$ O8 W
  177.   fp=fopen(FileName,"a");
    0 L3 p7 w- N# V& D
  178.   if(fp)
    9 F: y, l' }* I+ w% f1 n. U
  179.   {
    % L4 K. F# G: L/ f/ w! z1 x# ^
  180.     fprintf(fp,szBuffer);
    7 q/ X7 u+ b0 A" `- I. Y
  181.     fclose(fp);9 \3 p# O, E6 L/ P4 H1 X
  182.           _flushall();
    * S5 E4 f" \2 O
  183.   }
    5 L5 R+ I' G2 n8 x$ y  v
  184. }
    2 K. E3 `7 B4 u3 `  B
  185. 4 n  }( l8 f/ c
  186. BOOL CRevAppApp::Fclearf(char *FileName)
    , q1 ^) c/ O: G0 k: j/ d
  187. {0 J0 k0 Q- Z( h7 F
  188.      FILE *fp;% x8 B! g# y" _2 b
  189.     DWORD  attrib;  o3 Q7 G3 V# X$ \" U7 w+ g
  190.   attrib=GetFileAttributes(FileName);
    6 M; z3 ]9 U' K% q: ]8 t5 ^
  191.   if(attrib!=-1)
    9 N  y* x6 i7 x* p
  192.   {/ P3 r6 D" g$ `9 p$ H4 x2 x
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);
    7 ?" [1 g8 _9 h7 E, |+ V& k0 @
  194.     if(!SetFileAttributes(FileName,attrib))2 c, b! G: E4 y9 b$ D! p+ `
  195.     {" m# s; c: Z  e: e. b+ w
  196.       return FALSE;5 L7 j. p2 D: i! Y
  197.     }* H6 y5 f6 s5 B
  198.   }5 e0 N3 j, O1 A3 b1 ~2 n# d3 u, U$ Q0 z0 T
  199.   fp=fopen(FileName,"wb");
    9 x: s+ C- `, }4 [' i8 t; |! x
  200.   if(fp)6 u8 P9 C( n- k# G: B
  201.   {) y8 ^9 f  R% x/ I# J
  202.     fclose(fp);
    ; U9 v( E* a+ A" d5 v
  203.   }
    5 v) \5 O7 \; B
  204.   return TRUE;% {* J6 o+ f& [3 U7 Y/ b
  205. }, P0 Z2 z3 H. e7 U0 m4 V
  206. ( g8 \9 _6 r# H# y4 V7 W& O
  207. BOOL CRevAppApp::UpdateLocalVersion(void)* V7 H( e( Z; N0 t4 p1 n
  208. {
    2 \' i9 J: K, S/ r
  209.   char filename[MAX_PATH];
    % _7 G7 h# }0 n& O
  210.   LPUPDATEFILE file,olds;& M8 J' J, X6 e% ?& H+ ]2 o6 p: Z
  211.   std::map<int,CString>::iterator i;
      l' f# C8 W& L0 E, I$ R! O
  212.   std::map<CString,LPUPDATEFILE>::iterator p;; N- Z1 Q2 n. S' O
  213.   std::list<CString>::iterator l;
    ) a2 c6 q! V$ f0 R
  214. ; w$ ^! w9 d5 i
  215.   if(bFirstUpdate)6 w" i2 n, l% n4 T% y- I
  216.   {
    # ~% o: Q0 p- i" w7 Q
  217.     dwCurrFile=0;
    3 a* s4 L& a$ P" m) i
  218.     bFirstUpdate=FALSE;# y  m* r/ J8 t0 M( ~
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    ) J- j5 ~- A1 I/ F3 y
  220.     {
    ' `9 k1 s. @! u9 R
  221.       dwTotalFiles=UpdateLocal.size();
      E1 `0 g% O3 B8 l- i2 x: a
  222.       dwDownLoaded=0;
    7 F, D! c+ o9 {2 q( \% H. h3 q! [
  223.       bSilentStep=FALSE;
    0 a9 }2 Y( q; x& [. {5 U
  224.       bCompressed=TRUE;! g: }* B* z  k' d# z/ t: a
  225.       strExtLocal.Empty();
    ; k1 u' ]- b% V. C
  226.       strFullName=(*i).second;
    6 M% o; w& R/ I, c5 [
  227.       dwProgramState=AP_CONNECT;8 A( `: s  q# R
  228.       return TRUE;
    9 [3 I9 {# c/ w0 |$ c
  229.     }
    / x4 Z9 B3 ?6 Z& k6 x' N! ]
  230.   }
    * @3 r0 r& [, q- ^/ |. p
  231.   else if(bRestartUpdater==FALSE)4 S& `; D+ Q9 o' p* G8 m
  232.   {
    7 Y6 n' k( ^! z
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end())4 i6 k/ q/ c  B& j4 l' m
  234.     {
    - Q6 c8 D: z' {" Y$ V6 H
  235.       file=(*p).second;
    4 C. R' r6 d+ W  D
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())
    * y0 b) O* J4 y$ z( I1 a
  237.       {
    7 ~3 d1 _* \* t9 \
  238.         olds=(*p).second;- D* h$ n6 r. s" `1 O; F
  239.         olds->vers=file->vers;2 q) D" V: I% ]
  240.       }2 j  T0 H0 B2 n7 G
  241.       else- m. u. u% i' p
  242.       {
    , [# ^( }* {4 R
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    ! g. n0 j% l& z: _6 I1 X, E! j! G
  244.         memcpy(olds,file,sizeof(UPDATEFILE));0 G5 R" e9 X3 ~) B1 s9 v1 d
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));& q& E6 i/ r* Z& h; G& r
  246.       }; p# L! ]' g2 d1 a6 w
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");
    / D, {: c5 x! M7 }+ B
  248.       sprintf(filename,"(%s)",file->file);$ s  a: X' R; B
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);3 ]* r) w8 A+ w- I' D" [. r' {
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }
    6 U; s9 Z6 ]0 c9 Z6 ^
  251.     }
    ; M7 z6 a) |1 ]0 P
  252.     dwCurrFile++;8 e6 [- K6 S  b1 k$ M  h4 {
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())  x( H: t, }8 ^/ z( ]8 Z
  254.     {
    ' z) ?% b5 T! h# I4 b. }( W- @: h
  255.       bSilentStep=FALSE;5 B# `* a+ {  Y# @  D  u9 B' x
  256.       bCompressed=TRUE;
    8 f4 s; s% l& P5 y+ S3 P) ^
  257.       strExtLocal.Empty();% B8 W  v0 T- N5 ]% e- W0 }$ F
  258.       strFullName=(*i).second;
    1 k6 E7 u! Q. s  U, |
  259.       dwProgramState=AP_CONNECT;3 F3 b( l. V$ c- g' f; W
  260.       return TRUE;+ z& }! W: ^: y. b5 ?- G9 ]
  261.     }
    2 X1 H+ k/ ~/ e# ?
  262.     if(!bRestartUpdater)
    ) \" `: ?8 w& t1 M2 J6 V  v
  263.     {( a5 P( \4 z4 J7 B4 w
  264.       int iCurrSize,iFileSize;3 f) t, f( T# V7 H! w" U, d* N) i
  265.       iCurrSize=0;
    * e0 \, M7 O/ i! V; L# v; J2 A
  266.       iFileSize=UpdateList2.size();
    - \, P7 S* V: p9 g: m5 {* K
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");+ D  ^3 G/ o3 a4 a" o3 X: P7 V
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");( ]; f8 k* [/ G
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");
    " |8 q& g4 C# c. d* J9 e1 t. b
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);  Z: C- _1 g7 g; U+ T/ |+ |0 }
  271.       Fclearf(".\\update.dat");8 q1 X8 L' S) h5 M
  272.       Fprintf(".\\update.dat","Bloodyf\n");
    5 y/ O: t1 a" p9 _6 \2 P
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)
    . u; i# ~2 q( U. `8 G2 j
  274.       {' A3 c: T% I0 u8 x. C. ?
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())
    . e0 C5 W7 f& \8 H' ]+ ~4 ~
  276.         {
    + v% V6 E' {3 M6 ^8 n. y
  277.           file=(*p).second;
    5 J9 Y6 v' V" Q
  278.           sprintf(filename,"(%s)",file->file);
    - a6 d5 G* `# H/ P# ]$ h
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    1 e6 O7 |3 \7 ]9 w5 D; C
  280.           iCurrSize++;* l3 n; g, `& t0 J
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));0 b% c6 q! I; V2 N7 X& b
  282.         }
    ; v- N* n" d4 {9 h5 E5 [- L
  283.       }; S8 f0 Y8 r: e" }$ K
  284.       unlink(".\\update.txt");" _; W% q2 }" S% b
  285.       unlink(".\\update.tmp");
    ' t. i/ t) M& d! p6 A' |: c
  286.       Fclearf(".\\checkversion.dat");
    $ Q# @) _8 G: q  ]
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);. B) H6 ~& C" k6 O8 ?
  288.       if(UpdateLocal.size())
    # P. z9 v& s9 c  ]
  289.       {$ C' S, r* z0 R8 \& B7 Y! x2 \
  290.         UpdateLocal.clear();
    ( e- \% b! e3 W% X, i
  291.       }2 F# G* w' \- |! W6 x9 m
  292.       if(UpdateFile3.size())
    5 w$ h) c) S% d  h
  293.       {2 g1 k6 Q5 ?" m' c# Y1 y, J
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)
    5 _( g1 T5 F3 U
  295.         {
    , ?3 n7 P9 Z; I; B0 x
  296.           file=(*p).second;
    / i- `( D' o! }4 K6 }' D9 m
  297.           free(file);
    7 Q7 [7 O* B9 u  Z$ |, K: G' ?4 Y
  298.         }
    ; k- U( E2 W( z. Y8 J0 M
  299.         UpdateFile3.clear();0 K" g( M+ n3 J0 p7 F7 Z
  300.         UpdateList3.clear();
    7 T2 s8 _. |0 n7 }
  301.       }, H4 F. S5 l( _, ]' Z
  302.       if(UpdateFile2.size())
    ' W" ~$ ~6 @2 x, h" N3 o, ?
  303.       {1 Q- `" ]% G" N6 N7 A4 B. y$ L4 k
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    # J- G; ]+ o$ b) o! i) E
  305.         {
    6 B' J! T2 G. [
  306.           file=(*p).second;0 C( G1 }) I7 a
  307.           free(file);
    9 n% _% o3 p6 Z' m  \
  308.         }
    ) O! u$ _: r$ {+ P7 I9 j
  309.         UpdateFile2.clear();
    * V# g8 X5 J1 _, O
  310.         UpdateList2.clear();0 |* b& Y$ M7 ?4 R5 b
  311.       }6 T( S5 v( g  D# n$ `
  312.       if(UpdateFile1.size())% U- f$ H! ]0 b7 c7 Z7 [. Q/ w4 o
  313.       {5 O& N8 W6 h  L/ T) P1 i
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++): \. a/ j" Z1 _9 Y6 X* L& p% k
  315.         {, }9 Y6 d3 b1 M; B9 K, Z" Q' w
  316.           file=(*p).second;
    * k5 j; o& r  K- i
  317.           free(file);3 L7 R3 |( ~- r
  318.         }/ ?1 `) q$ Q8 z- \
  319.         UpdateFile1.clear();% D& m; |* h* D" v
  320.         UpdateList1.clear();
    8 ~. G; R4 [  y- i4 Q
  321.       }
    8 F6 x) K! j$ D9 o5 A4 B) C
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    # I- n: E7 ]4 P3 t2 p
  323.     }
    5 F% Q* M5 c4 L* Y
  324.   }
    ' C2 s$ P" d$ p% K
  325.   return FALSE;& p3 S" q) r; U1 I" g. i( W
  326. }
    ( z" |+ g! n4 e! z" _

  327. 5 l0 L+ c7 Z7 M- ?
  328. void CRevAppApp::ClearAll(void)
    + Q! o7 q! V7 r" g" P$ }  m
  329. {$ Y3 X2 {( S: B) S: [/ l
  330.   LPUPDATEFILE file;' J: U, d# @5 N
  331.   std::map<CString,LPUPDATEFILE>::iterator p;
    ! Q! Z( n% W- e$ X

  332. 3 P* m& O( E% u) d2 B; z# i0 z
  333.   if(UpdateLocal.size())
    5 i7 O3 r. r: S2 G  _4 I
  334.   {& m) U7 X/ P# N, P  u" V' i
  335.     UpdateLocal.clear();
    " Z4 O5 c8 ^: U* E8 ?% K
  336.   }0 B+ i  S+ K3 W! J2 w& x, [
  337.   if(UpdateFile3.size())$ y: S! V9 C7 i+ f# s0 n. y; e+ m4 x
  338.   {
    2 S% \; g' ?) D& V" H& u2 f
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)# L: v3 z. l! `5 r
  340.     {% X8 s- r( p0 K4 k
  341.       file=(*p).second;
    ! C) g; Z  e0 w2 {
  342.       free(file);5 p) n% B& u4 h0 Z
  343.     }
    " O- _& ]' G8 p, b5 ]
  344.     UpdateFile3.clear();
    . J2 A9 s6 q6 G# W* k
  345.     UpdateList3.clear();
      W: K$ c- \! P' P# X
  346.   }$ E6 }! ?( G1 R( I
  347.   if(UpdateFile2.size())
    $ C! b- n, T( h% Y
  348.   {
    & F' u5 i4 @/ D# E8 g% e0 B6 ?
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)$ q2 l9 `, G) V' q. O8 R9 M4 p
  350.     {% X5 O. H, |" p. n* s7 d4 C0 A% P
  351.       file=(*p).second;
    . e% S5 R  I4 ^
  352.       free(file);
    5 d4 o/ x/ X; G( N6 s2 a5 h
  353.     }
    : Y7 l4 y6 y( \! _! j4 V
  354.     UpdateFile2.clear();
    7 F' {0 @, i1 u8 u
  355.     UpdateList2.clear();
    ) N+ p9 A0 r2 h. E0 u4 p8 `
  356.   }
    ' I2 m) W) w2 o* r0 ^; W7 ~
  357.   if(UpdateFile1.size())
    ( O7 k. F" E# F4 }/ I$ i
  358.   {
    - \5 _. z1 k& D2 D1 Q/ @9 P  @
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    0 z! `5 }; M; r6 U* e% @
  360.     {- w* G9 M% W( F9 B8 H) E$ y8 v) z
  361.       file=(*p).second;
    3 n: n9 J$ i% H3 ^% m0 c, K
  362.       free(file);; v( Q6 S+ h" `, X! x6 P! T
  363.     }
    - P$ d! A3 a: {0 G
  364.     UpdateFile1.clear();, `7 w3 D* e- R, B$ g
  365.     UpdateList1.clear();
    9 R2 a/ X! ]/ d3 N  X$ T. B
  366.   }
      h( h. V1 O2 a# H$ t+ K; `
  367. }    Y* }3 t# K% d# i3 V# ~" a; h
  368.   
    ; J) ?, R& A3 M. T# ^% h
  369. BOOL CRevAppApp::CheckLocalVersion(void)
    ! W& C( A: E; B
  370. {
    : G! W7 h- B* X( w) S# i1 F
  371.   int c;- x9 j% a" T6 V
  372.   LPUPDATEFILE file1,file2;! |# Q$ Z0 I- M7 C
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;
    " G. N* ?) N, A* i* o' z
  374.   std::list<CString>::iterator l;8 |. _% Y* h1 ?
  375. ( g1 f5 r# i9 _% t7 e4 s! @) I& r
  376.   UpdateLocal.clear();- [0 }, o  n; i! h" _" Y( U
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);
    0 ]' a! }" F- [. K! ?
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);- d6 i$ V+ A0 \! ~( ?$ S7 g2 S
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);& _# V/ u0 B5 x+ ]/ O( s6 J! _# v& U! ~
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);2 Z. l$ d/ @! n  }5 n3 `6 S
  381.   if(UpdateFile3.size())
    ( @0 B  d) r% R" ]8 \
  382.   {
    7 ?) \1 X- U+ ^* ]( ]7 J$ P
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++)
    . W- s  p/ x8 o  L, L7 L
  384.     {# v9 U- H. j  k0 a" I5 J0 U6 `+ a
  385.       file2=(LPUPDATEFILE)(*i).second;: ~& I2 q& o0 h% E( @
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    ( `/ }3 T. I; p3 C
  387.       {9 \8 l" r( `& E, d9 c. c0 u
  388.         file1=(LPUPDATEFILE)(*p).second;" R2 z, j$ C& z; j. {2 u% k/ e
  389.         file1->vers=file2->vers;2 ~) Y! Q: v9 X- B
  390.       }/ K  Y& W5 I5 S' O, B
  391.       else
    4 u( t4 a" p$ y+ g3 R5 L
  392.       {
    3 g/ @9 W8 X/ N( z7 c( K
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));; X+ z- w! i% L! e, j
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));
    $ @+ L% ]' R/ r8 Y+ k  Z* H
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));
    1 w, S7 O8 I9 H
  396.       }
    - p5 i, C5 S4 ^. P
  397.     }
    . R& b+ _' P8 I& @) S3 D" h7 O1 N
  398.   }
    : g; F$ j# h* d1 Y5 ^
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++)8 H7 s# V. t7 p; Y" I3 s4 C( k
  400.   {3 y1 b3 J  S" e: ]9 f+ H
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())
    ! J+ `3 v; C: N; }0 ~8 u$ u
  402.     {$ A4 R7 `* `5 r5 x2 Z+ i$ f+ e) v
  403.       file2=(LPUPDATEFILE)(*i).second;
    ) V1 n! p+ M- \) e: m- m; }9 s
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    ; @7 _  _* b! C9 M3 F+ B, @  \8 f
  405.       {9 ]3 g# m, s. f/ \/ x5 W: F! r
  406.         file1=(LPUPDATEFILE)(*p).second;0 p& J: \* z  v% }
  407.         if(file1->vers!=file2->vers)/ G# W9 V$ M/ x8 u6 b
  408.         {8 y: _' x' W) ^) l( g
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));
    / N1 S# d2 V( @+ K
  410.           c++;6 u4 P" N2 ~1 _$ T5 E
  411.         }+ J' u: R# t5 H- L7 P
  412.       }
    9 Q1 P1 S% }0 c! X4 s
  413.       else4 x- X% ?! l& U* N- A/ N! A0 N
  414.       {7 p4 Z# N! S( o; F
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));
    : r# x1 i  y! E) w4 y
  416.         c++;0 y6 y1 H  Q9 n9 J9 a
  417.       }5 A3 R4 [% T7 j4 i; X8 p
  418.     }7 k$ x8 O7 N) n7 q( S- c
  419.   }4 U% y" f- X1 `4 r  |; ~
  420.   unlink(".\\DownLoad\\update.txt");/ n" v5 r6 b, D# \- I# M* h' K
  421.   if(UpdateLocal.size()) return TRUE;3 s" f' d2 Q$ t7 b1 j8 m
  422.   else                   return FALSE;
    , i. R8 w8 a( _$ p
  423. }+ P1 }% x& m" U0 N0 a, S
  424. : F& \" l% g4 d6 I# z4 o( d
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"- F4 u: t6 X  ?- T: J
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn"/ W$ N) r5 g7 _1 Z

  427. 1 u$ ?) k! P& i; e7 o) t
  428. * Q2 \- I( B% M( z5 D1 X% x4 o- w

  429. 5 ]; F8 W) L4 X" j% {
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile)
    4 o8 U$ \5 c* [, o- a% |7 g9 m
  431. {
    3 P# }* F: ^6 a0 R4 P- W2 u4 x% Y
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;
    : H6 x+ A4 z5 H
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1); \- K. [- L& O
  434.   {
    8 i7 w9 T: K/ Z& I
  435.     char szLanguage[50];
    ' }, P5 R' P' G6 ]1 V1 S
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");  N4 P% L6 [' f: z" L
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
    / G+ S: M, w" s' W4 H# ~9 e4 Z( W
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;; f5 r2 t: V+ U! t2 ]
  439.     else                                   m_iLanguage=ENGLISH;. S6 H7 I  o* k
  440.     char szRegister[100];: d2 B: T3 a7 _& b# z$ {, N
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");$ r) x0 Z0 g; W; f  {4 Q# `
  442.     strRegsName=szRegister;( ?8 P, j$ `% ?2 K6 b
  443.     char szPatchURL[100];
    . k; O  w5 u! e( b. F6 W
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
    , l7 c& O( z7 s+ c* }
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);- P( w2 A( B* G- R" R' h+ |
  446.   }0 O% Z& y" ~/ u7 K. Z
  447.   else
    2 ~3 ^2 R) i) J
  448.   {, G- u% g" `. h0 ^9 q( M: s9 q8 u
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    , N/ V; ~# @/ H, d, A4 h
  450.     strRegsName=DEFAULT_REG_URL;
    6 Y  f' C3 s( }) r* k
  451.   }
    - A; z- u: U' s4 Q+ i
  452.   if(GetFileAttributes("hosts.ini")!=-1)2 \' S1 ^+ R5 V" W% V$ Z
  453.   {
    * A/ b8 z% i, T! N
  454.     char szIP[50];
    2 Y0 {- s5 [* }+ I8 n
  455.     char szDIR[300];2 A. o+ j( n8 l4 e. Y
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))
    ( y% m* o4 E6 J6 c
  457.     {
      B7 l! q: l2 E
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");6 Z9 f2 s1 w; f5 i8 u
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");; I6 e( n: X8 D/ d* N
  460.       strHostName=szIP;
    & c5 I* M7 \" D
  461.       strHostPath.Format("/%s",szDIR);3 j* O7 E. l+ y) h
  462.     }
    1 Y' f# d9 m# B( T; j
  463.     else% ?% |: j3 Z+ T3 P
  464.     {
    4 _1 z' J* H; a4 J( `
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)+ o% ~2 V) O# |, U5 g
  466.       {
    ! w0 ^" j" L, s- o+ J
  467.         char szLanguage[50];
    - @. Y8 u: i/ F
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    9 |) ^* ^  w, U! p) n1 p/ J! q
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;1 F; c! }2 P4 U' X" G% @/ I
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;' {7 [1 e6 M0 {, Q; |& z
  471.         else                                   m_iLanguage=ENGLISH;- m- c  Q% J% a5 \& E. T" G
  472.         char szRegister[100];3 H8 f# S9 E: ^; I, T) X1 a
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    7 Z0 z6 x4 w: ~! y- F$ q8 z
  474.         strRegsName=szRegister;
    : q2 _# b$ c+ T. }: m2 X
  475.         char szPatchURL[100];5 s8 T% }. D1 F& e# {' \: v
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");7 x( A% w. f2 T/ d$ N4 e
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);' k5 }, ~$ b- ~. u2 _
  478.       }
    / e, M& b9 g9 b4 d
  479.       else. C8 S& l5 m! b) R5 O; b9 b# M9 B4 |* G
  480.       {
    ) P5 T5 O! @* T
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);3 b1 X$ `/ B$ [' j1 T8 G
  482.         strRegsName=DEFAULT_REG_URL;
    ) L. v' d, r* v
  483.       }3 i3 P( J: Y7 B& |: I3 w5 R4 C: T
  484.     }
    : {7 X" v8 ?7 U0 P) ]  C
  485.   }
    ( Q5 w" f3 s' o
  486.   return true;
    " `# }8 i# {* W, }3 a- N7 L# e
  487. }
    ' A0 K. r4 d( P) A0 s" g* s

  488. # G9 r. }8 m" P, ~4 |
  489. #include ".\ZLib\unzip.h"$ r# _3 j7 _/ a. D& ]( w
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);
    9 f/ t' Q2 ?" ?$ {) L# }3 B
  491. /////////////////////////////////////////////////////////////////////////////
    / _( B2 [8 n8 U7 g
  492. // CRevAppApp initialization: L3 @5 ]+ `  c

  493. . O  C- ^6 ^1 a: R4 G
  494. BOOL CRevAppApp::InitInstance()
    & R5 T" Y" Z! M" d" X
  495. {
    . P) ^8 {, v5 g
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];
    2 y& |  [( g7 g  ~2 U; c
  497. , C& t. S; q8 r/ t+ c
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);6 j% R  r) c9 N8 |
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))7 Y: A/ [" s. M9 [/ R& z( M
  500.   {- v0 U! q! r$ H3 M
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");
    : f+ _: q2 c4 ?+ s( q; w3 G* U
  502.     GetPathFromFullPath(szPathTarget,szPathSource);) E7 i5 T+ i  `' |
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))
    ) C9 [) s" o: A, K2 [
  504.     {
    ! g+ O8 h# V+ a( z) ^) i0 w0 Z4 h0 L
  505.       strcpy(szPath,szPathTarget);
    7 F! d$ ]/ N! j6 a  I+ u, }3 f7 p
  506.       SetCurrentDirectory(szPath);& ]9 b3 u$ X  S  u: ~
  507.     }( ~/ k5 M, b( R1 G+ H, h, {( L& ~; N3 [
  508.   }
      ~/ j; X, j9 t  X8 m5 Z8 D2 ^  o
  509. #ifdef _DEBUG- f) E6 E# Z+ {7 M1 X
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    8 c) n- a, j% b& ^& r% t
  511. #else
    ) p9 F8 f2 ?: n0 a. Z5 }
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))/ o( Z8 S- u' K2 O
  513. #endif
    ' s- X" O  @  G  J$ B5 U
  514.   {8 T. `' x- t5 U8 w$ e2 Q
  515.     char tempFileName[MAX_PATH];! Y" ^# W$ V1 ~& k
  516.     strcpy(tempFileName,szPathSource);, v' [8 ^7 a( H- q: \  z: ~) u- ~5 N, w
  517.     tempFileName[strlen(szPathSource)-12]=0;
    5 p8 u& j4 X( G7 g: F) j4 C
  518.     strcat(tempFileName,"\\$CSUpdate.exe");
    * P) D8 K  v5 G0 L7 ]2 m* I
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);' J1 k4 |1 j) o2 K* ?3 ~4 f( Z) H
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);, m9 [2 ]/ `2 v) L& C% ]) ?3 P% d
  521.     return TRUE;% k, b0 l8 E9 G3 `
  522.   }
    ; w1 W" D& Q8 {9 x& h) {$ n
  523.   // Nuke 0118: Delete run.exe5 C* y# m, G% R
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );$ P" c3 n& P9 R9 s
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");
    1 u- V9 e/ f. R) C* l
  526.   if(!ReadCfgFile("Config.ini"))+ l; g( O( A+ A) G- ~
  527.   {
    : a& ^* c) M2 V5 l8 T1 p
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);
    % l8 O4 O$ p# U* Y* M( O6 l
  529.     return TRUE;
    ! Y1 e; [$ J- f$ P  }* e
  530.   }
    % y  L' O  B- a" r' I1 r1 c( u9 y
  531.   HANDLE mutex;3 F1 n- n9 `* l+ J! z- l" t
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))
    ; }$ R2 O/ b$ w/ _
  533.   {
    : x! J, h& ]4 V7 Q% H8 ]% @% r
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)
    0 F0 e+ u9 Q& z1 O* w3 R
  535.     {" w) h! ^% S6 k
  536.       CloseHandle(mutex);
    6 R: A1 U5 }1 r. k
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);/ b" i9 E$ b7 J/ I, B
  538.       return TRUE;' C' Z9 ~: A2 {/ I; M: W
  539.     }
    8 P) H( F, K, L' Q4 C2 m- R( Q# a
  540.   }  
    * m6 A+ n3 I( @
  541.   CloseHandle(mutex);
    # x  W7 X! d8 \( }2 t# `7 k6 B( E+ `

  542. + ?* x3 X* d8 A+ n
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);; ^9 c# B" G2 X3 i  Y

  544. 0 \  j9 f5 o* B/ ?
  545.         AfxEnableControlContainer();
    ( [' |* X- w3 [% u& a  I
  546. 1 u2 @# O) B( \' |+ Z" |1 V/ ^
  547.   bCanUpdate=FALSE;
    4 H& O# z6 K3 H+ `. c# D
  548.   dwStartUpSteps=1;
    ' U8 H; D2 X/ ?0 v' {% j/ e0 ?3 g
  549.   dwProgramState=AP_NOTHING;
    ! ?* t9 r0 m! A5 p, [: w' y; D

  550. ( c' R3 e) L9 }6 {) A. ~
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);
    - H$ B1 v" n' p, c. w9 D2 p4 O) ]

  552. , x6 V  d( s# P
  553.         // Standard initialization
    + {! f, b! c3 o
  554.         // If you are not using these features and wish to reduce the size9 v  w: o1 P2 ]+ A
  555.         //  of your final executable, you should remove from the following
    ' i* k7 K9 J5 b3 U  e) @. I* M
  556.         //  the specific initialization routines you do not need.3 o' l2 l& R6 T6 G9 o
  557. & J' @- y% e" k" L
  558. #ifdef _AFXDLL
    " V7 d) N6 E5 C8 _0 l: |
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL' X& l3 C9 h4 P% U3 W; K
  560. #else6 e% \, w3 e# y5 H
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically
    ; ^9 Y# }' \) ~6 f" Y' c) n
  562. #endif# U) K6 h) M4 A0 e2 B- P
  563. - m7 j7 p/ V; z; O3 Z6 M9 P, Y
  564.   dlg=new CRevAppDlg;1 }2 `) s9 N" b" F, k6 G+ r
  565.   dlg->Create(IDD_REVAPP_DIALOG);
    : h9 x; J: P4 v# I
  566.   dlg->ShowWindow(SW_SHOWNORMAL);) k+ ?1 M% M. F
  567.   m_pMainWnd=dlg;/ ^) y1 N3 ~2 S& R& v2 E
  568. ' s% W) Z" S+ h+ f" V
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);
    & u) P3 I- K! U- ]# b
  570. 6 ~% N$ l5 v5 }9 n0 D! y/ S; k
  571. //  GdiplusStartupInput gdiplusStartupInput;( y1 ]9 h' \, W' e# M  F" ?
  572. //  ULONG_PTR gdiplusToken;
    1 R, q5 [: H. K7 W7 ^6 N/ _- s/ T
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);
    " G9 O, z" q6 R  o% ]+ M
  574. 1 `, v4 n, O' |: y
  575. //        CRevAppDlg dlg;
      h5 k& K5 N% a+ y1 ?
  576. //        int nResponse = dlg.DoModal();
    3 M1 i4 H; S7 Y" K
  577. //        if (nResponse == IDOK)
    $ N: u3 k& |( u: T: G1 \
  578. //        {1 u+ Y% N. K! b7 M
  579. //                // TODO: Place code here to handle when the dialog is9 E0 E$ F: v/ p% e, W% n* m1 [% Y4 E
  580. //                //  dismissed with OK
    . D! L4 v5 \! c, [
  581. //        }
    . r! c7 R& }& c: O% U
  582. //        else if (nResponse == IDCANCEL)
    " n$ T) K+ Q  `' a
  583. //        {
    , z' l$ |9 b% P8 S9 [
  584. //                // TODO: Place code here to handle when the dialog is1 k/ \8 t$ `7 c5 x7 j
  585. //                //  dismissed with Cancel9 Y, x' Z7 z+ M: O$ `& q$ M
  586. //        }+ r: A5 |0 W' h- v! _) i1 G
  587. 5 y# e: b) G/ v5 m* G
  588.         // Since the dialog has been closed, return FALSE so that we exit the
    2 Z( G2 B. V& x) G* _5 j3 K5 K4 n
  589.         //  application, rather than start the application's message pump.
      ]- g* p$ e% T6 \% y
  590.         return TRUE;2 N, }% d2 a8 ^) o! L9 l! m) {
  591. }
    6 A) H  f8 h. f; @/ Y% v
  592. / @0 r' p5 n0 s' e# h+ Z* h" x2 o
  593. char *CRevAppApp::strtok3(char *pSource,char *token)
    & }0 W5 {1 O  ?, ~- h5 ^
  594. {5 d2 v) O' s! b: X
  595.   int i;1 r, g/ b5 U7 ^1 S5 L
  596.   char *szRet;) ?5 C% _0 Y$ r+ N: _
  597. + j5 a. W1 }" c8 N5 M
  598.   if(pSource) { itoken=0; sztoken=pSource; }) s, |6 \( u  ]$ S& ^  b* {
  599.   if(sztoken)" `, W$ U% ~8 V, S/ e
  600.   {
    0 w, O, R% N! n
  601.     szRet=&sztoken[itoken];& ^( z' ?- a+ k/ ]0 F
  602.     while(sztoken[itoken])
    , n# Z3 @5 q: Y9 b! e; Y6 p
  603.     {
    . v/ n" x  v7 W5 S9 \( e  p
  604.       for(i=0;i<(int)strlen(token);i++)
    % C% k  x' C: H
  605.       {
    . i! W$ r6 B1 X& Q
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])9 q" L; v- z$ t+ r% \2 Z
  607.         {
    4 J& h  ?3 N! j
  608.           sztoken[itoken++]=0;
    9 S( X! K, F; ^/ f- y- {- b
  609.           sztoken[itoken++]=0;- h6 r+ v' y0 F" _" K) d3 g+ t2 T
  610.           return szRet;! U! v- S7 O# n; {2 }* {
  611.         }
    4 `/ k' @. R2 u8 c& ~  K  M  N
  612.       }8 M. h. N: L$ r- a
  613.       itoken++;& F9 ^! o  n  L
  614.     }7 P0 {# Q! e: `7 S0 u& o
  615.   }
    ( o# L* j9 N( N& z
  616.   return NULL;" _/ Q5 E/ F  U) e2 [8 u
  617. }
    0 m( Y% J% z0 g
  618. ; D4 m$ `3 V! n7 C! A& r
  619. void ProcessProc(long Total,long Current)
    $ V/ t/ M# _1 s! F( q
  620. {+ p% _: Q* {7 }; U% b& @( d  a  b
  621.         MSG msg;& G0 }# I# e0 ~$ @- q$ C
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);
    6 F. Y$ ^# m  C& D- E% o2 {
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));/ g; m6 a* S( E( f" V- ~
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
    - k; ?8 L: C2 |
  625.         {! U' Z  R' ]/ Y' y, U& q( v+ U* M+ ?
  626.                 if(!GetMessage(&msg,NULL,0,0))
    + P5 R- L3 Y& A3 O
  627.                 {0 F: o. n& j$ r  e) t
  628.                         return;
    ) [- x! K( e1 `$ n
  629.                 }' q, [) K, T# u  M  G, a$ v. j
  630.                 TranslateMessage(&msg);
    ) U$ P+ a& ~* U1 a: I3 n
  631.                 DispatchMessage(&msg);
    9 F. ^: a3 D/ K1 {& u4 u5 B
  632.         }       
    4 s! w' [# |% K; T% G& A
  633. }6 l% {+ a: H4 a; O2 T9 D

  634. & y9 S% |+ T7 H" |2 d
  635. BOOL bFirstChar=TRUE;! Q  c5 c4 T# w" |' E( @3 c* A- A

  636. 9 r% C4 t0 g' ]1 c4 }9 h( f* M0 i
  637. BOOL CRevAppApp::OnIdle(LONG lCount)
    8 t: u  e; w& ^  \* C  x* _
  638. {
    * A/ l( F& v  c' |# b+ Q& M' l; M
  639.         // TODO: Add your specialized code here and/or call the base class4 N; Y% U: r" ]8 h+ f
  640.   switch(dwProgramState)
    7 }  X. w+ k/ p  u
  641.   {
    9 G+ I! `( V. A8 q
  642.   case AP_NOTHING:; u. ~" }4 v: V7 K# z* h
  643.     switch(dwStartUpSteps)
    ! f" a3 g# n0 ~" s% F5 I
  644.     {0 ]6 j; q. y2 Z; J
  645.     case 1:4 }, _) R# O9 f: V+ q
  646.       {, V+ R1 n( S2 t" _* F$ V! f
  647.         int i;: o+ [& s% i; R" F
  648.         CDC *pCDC=dlg->GetDC();
    5 f3 }( x3 M7 F% y( z
  649.         HDC hdcwnd=pCDC->m_hDC;
    # ]5 j0 R! `+ C3 e8 T' z
  650. //        Graphics graphics(hdcwnd);- S" w! }9 w$ {
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");
    # L* G  h' @# e4 ], M* n
  652. //        INT iWidth=bitmap.GetWidth();
    * U' f: D8 [- J! t! M0 f9 P
  653. //        INT iHeight=bitmap.GetHeight();
    % t- v( `1 q" {  V, k) G3 l
  654. //        Color color,colorTemp;
    2 ^% n. |1 w1 ~. s! Y4 B2 {2 Q
  655. //        for(INT iRow=0;iRow<iHeight;iRow++); D! e6 V; n: K& c
  656. //        {# |: f+ ~  I. R6 |0 z0 `
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)$ a4 J* j7 A$ v( j  R! y% f
  658. //          {
    & W# e$ m4 T- L3 }5 g
  659. //            bitmap.GetPixel(iColumn,iRow,&color);
    - v$ ^. u$ z: m/ x$ {
  660. //            colorTemp.SetValue(color.MakeARGB(7 l- C' x+ C4 F- @* a! D3 }! i
  661. //              (BYTE)(255*iColumn/iWidth),/ v1 T$ o- @; F( Q+ P& n
  662. //              color.GetRed(),8 V# A! Z+ u% A( H
  663. //              color.GetGreen(),
    8 k( Q& ]6 n2 q+ @, _0 L
  664. //              color.GetBlue()));8 n5 g' n( A1 T- P3 h
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);& W* n2 W1 R4 K& X0 J: R/ f
  666. //          }
    9 p( ~1 @5 H! F' k
  667. //        }5 m" b0 \6 r( o' P& i+ f
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);. n+ x, v- ~/ r6 U8 H
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");% q4 ]9 p5 f7 Q3 H3 p7 M
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");7 e! A% s6 r8 J' @& M
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");6 A- J0 m" K% _. R! e5 t
  672.         for(i=0;i<240;i+=8)
    & J4 k3 Q1 V& w2 r  P
  673.         {
    - ^) G6 ?1 `; ]3 V* z3 `
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);  f: N5 D+ v, P4 ]
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);' H: ~; T9 H  S4 p+ j% K& q; X5 _
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);  P8 E9 \+ o* Q" K& {' J7 B
  677.           Sleep(33);
    ( @, \3 V) e4 b6 A8 c+ R3 \
  678.         }
    1 `7 G+ E5 W. j$ H3 G- u
  679.         Sleep(1000);6 D, c( J+ \2 m) q, s2 n! z. H  E* I# j
  680.         for(i=240;i>0;i-=8)
    + p' P2 m( q! f. G! ^
  681.         {
    $ K8 |- q( }* \( N' O0 s
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    + R/ j* ~5 B! n7 e
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    6 S* X( K1 U0 Y0 e; ^2 p
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    8 R* T* z# h0 [# K
  685.           Sleep(33);
    3 S: v' J7 p8 x# M2 g/ P
  686.         }
    # G" l$ z5 b% N0 E  N
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);7 O3 U* y) q, ~- X% ~
  688.         dlg->ReleaseDC(pCDC);: A) d* `+ {& F1 l! e# g
  689.         DeleteDC(hdctar);
    & w( ?/ J8 V) e0 G( ^) U6 v
  690.         DeleteDC(hdcsrc);, m9 R, @# b! I) Y5 I' K3 F
  691.         DeleteDC(hdcorg);& U% b  u! E; t% B, |+ F
  692.       }# I& J5 ~5 S. g6 C# D  ], |; D
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);
    ' W5 h' X8 Z' |) {6 k2 M
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");+ u- w4 q4 U! v8 y/ \
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");
    1 }, q4 Y( n( ^1 _9 s
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");; T* p, ^% n/ q: U" ^3 a! _
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);8 j- u2 I" H- a
  698.       if(!Dn.Connected())
    % s( ^: Y0 u- S+ n+ s+ K
  699.       {: j. O( [: x" X4 Z
  700.         dwTotalFiles=1;+ ^7 ~4 h6 ?6 S& v# ~* z
  701.         dwDownLoaded=0;7 |9 c3 |2 S$ J/ L
  702.         bSilentStep=TRUE;
    4 N+ @' u  }' `" Z/ H; H
  703.         bCompressed=FALSE;
      N2 `6 Q' Z; g% A- C0 J
  704.         strExtLocal.Empty();2 Y3 I5 G; t7 L/ a
  705.         strFullName="readme.txt";8 o5 v3 D2 {+ I$ \& Y
  706.         dwProgramState=AP_CONNECT;# N& I; ?' d4 C* h: ~
  707.       }
    & l5 J1 h/ E/ D
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();
    , O1 Q1 N$ I4 m1 i$ y
  709.       dwStartUpSteps=2;' |9 T( y3 y  Y& B" L
  710.       break;
    4 Z' J! B* O- ]. u
  711.     case 2:5 J) T4 X# H/ \8 |# `
  712.       {
    * G! o5 U; e6 P# v' s
  713.         int iEOF;3 @5 M2 s) S) B$ O# C( \1 ~
  714.         FILE *fp;
    0 {7 I- ^  E: M5 r+ n0 T
  715.         char szString[512];' Z/ X$ S# S7 F+ Y4 z
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");
    $ q9 D6 H. l. y9 u" q' i3 H6 N8 t
  717.         if(fp)4 [2 H1 F: W/ e- E4 K
  718.         {
    * n( r1 t" o6 @
  719.           do0 `0 G0 h' y; P
  720.           {! L* _3 M7 l! w* v% B" w
  721.             iEOF=fscanf(fp,"%s",szString);
    / v, K! X7 \8 U; |9 r- F6 ]
  722.             if(strlen(szString))
    4 [/ T( F- R# L1 E8 q0 [3 y
  723.             {
    1 B  N+ b" a( c" Y; y* Y
  724.               if(bFirstChar)
    / ~3 A8 h$ A- m4 K* q
  725.               {
    / Z( X1 ^' e% e% |6 r
  726.                 bFirstChar=FALSE;. K& w! F8 O6 z2 ^) R( q
  727.                 bConnectIsBig5=FALSE;
    - W4 N- A/ u$ X& O; u
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;
    9 R6 G6 K' Y/ G
  729.               }+ x: Y3 t- Y& [( D4 X
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));
    3 @' f1 Z  U0 H8 L
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));
    6 S$ |, C" |& p
  732.               dlg->m_ListText.AddString(szString);
    8 y8 ]" Q) a4 o- ^: |
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    7 f8 F9 B0 {9 q& F) w% }
  734.               *szString=0;, C# l0 p) u3 `
  735.             }
    9 D' U' e1 P) T# Z3 ^$ Z
  736.           } while(iEOF!=EOF);, X4 `  k1 ?$ S: q2 n( a2 I+ ^
  737.           fclose(fp);  ~% l% t6 q3 c& n
  738.           unlink(".\\DownLoad\\readme.txt");
      q' ]9 R9 e! v+ @' k: Q8 J
  739.           dwStartUpSteps=3;% V, q$ g2 U' G" ^  n5 o
  740.         }5 z; v+ x1 O& z# _' t
  741.       }. p2 _, v) d1 _$ k
  742.       break;
    : q, [: Z2 a- r; l/ P$ D
  743.     case 3:
    + V" Y- F# ?2 _; \0 q& t- `1 k( _
  744.       if(!Dn.Connected())
    7 ]9 Q2 l1 x4 h" i/ ]
  745.       {* s$ @( |" d" [) J) b6 I+ w" p
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);+ h( z  f. L1 D& D( n
  747.         dwTotalFiles=1;
    * x, v& p0 @( B- y0 }; g8 b' s, ^
  748.         dwDownLoaded=0;
    ! r8 z  ?+ \; J) i6 s  m- z9 s
  749.         bSilentStep=TRUE;
    + ^* z: K2 y! S
  750.         bCompressed=FALSE;
    6 x- d* e& v4 `* \- M1 N+ L
  751.         strExtLocal.Empty();* @; p2 L$ U5 [) a' S  C/ y, B
  752.         strFullName="checkversion.txt";
    " E3 C8 z) Q+ R2 f* d
  753.         dwProgramState=AP_CONNECT;
    2 C9 K, L0 r; k1 ^8 R
  754.       }
    4 h: f! M, l9 A+ j( _, S
  755.       dwStartUpSteps=4;, o9 A9 [% r2 I3 J3 A
  756.       break;
    * }9 A- r" M8 S0 \; |7 K
  757.     case 4:
      z, d! J* O' q* ]* Y
  758.       {
    % p; i1 Z/ \7 L$ u9 }4 l
  759.         FILE *fp;
    & B3 d: c3 V1 u0 ^
  760.         char szString1[128];  k5 k( ^5 U! L
  761.         char szString2[128];
    ( L0 O9 n  S0 \( i! N$ X
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");" c" d- ~5 v+ Y- v0 X
  763.         if(fp)
    4 R7 J8 f' r) ?
  764.         {: u# x' }% H1 ~" D: [- K7 F# _3 M
  765.           fscanf(fp,"%s",szString1);
    ' _4 E# `( u3 F2 h
  766.           fclose(fp);/ F8 n8 q, d' d
  767.           fCheckVersion=atof(szString1);3 V8 z$ E; ]0 P; }1 ?2 W
  768.           fp=fopen(".\\checkversion.dat","r");
    0 s. q: y0 {+ y8 n4 _" k
  769.           if(fp)
    3 z; @! c; m) @0 x
  770.           {
    9 x6 a- {7 w2 i& x
  771.             fscanf(fp,"%s",szString2);* O8 f! c9 m. j' m; _! N
  772.             fclose(fp);
    0 U0 U( S3 J! P; H4 T
  773.             if(atof(szString1)!=atof(szString2))
      D# D5 v  Y) i% ]; F( W
  774.             {& d+ H( c2 t2 Q+ `7 S6 d
  775.               if(!Dn.Connected())4 P9 T8 i: @: b7 g. z
  776.               {
    1 X3 q4 x% E1 F( t: K  u2 E
  777.                 bFirstUpdate=TRUE;2 N8 @/ n4 T# |/ ?- {5 I
  778.                 dwTotalFiles=1;* h& L1 i* G3 H$ a! r/ U! \
  779.                 dwDownLoaded=0;
    , r3 w8 d& m2 c5 ]% M9 n2 z. w% P
  780.                 bSilentStep=FALSE;
    2 D) M6 R* h) O8 k1 {' G& `6 K
  781.                 bCompressed=TRUE;+ w: L( G3 H" J6 G
  782.                 strExtLocal=".\\DownLoad\";
    7 x' D8 C' P* K, a- J2 t
  783.                 strFullName="update.txt";
    + a4 m/ t5 F9 j$ t
  784.                 dwProgramState=AP_CONNECT;
    / D) c7 w/ u/ \5 ?- q& [
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");
    % g8 a; N1 A: h$ ^
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    ! o+ _! U: z7 \9 r
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");
    9 z) s! Z% z7 C! M8 I

  788.   r% V' D1 _$ V/ ]. y: a
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    1 E7 e9 Y9 M1 j
  790.                 unlink(".\\DownLoad\\checkversion.txt");0 @; {; [* [5 C: d* M
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)& Q4 k+ G6 L  l) y% [
  792.                 {0 K7 j3 }; e( ?# o7 S8 c
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");1 I" J& e& p" ?  S/ h
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");
    9 D: T* M8 j4 _
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");+ O" R6 ~4 f- a6 ^( S/ F
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    : L+ S3 d* [/ Z' D' m

  797. 6 ]4 [" a: D9 s
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");( f4 q9 X* Z' c6 ]
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");* F# r/ f: L# x! B# ^' @
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");
    2 ?& T0 v- f/ j5 @$ K9 x
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    ' E  s- o; H" R
  802.                 }- Y- Q4 l. f! v2 M
  803.                 dwStartUpSteps=5;5 T; b( E9 m% O- _/ `
  804.               }. w2 S: h: R7 r" X
  805.             }! }6 G# e6 [1 C% V6 l9 D
  806.             else
    9 n1 V+ _3 W# F2 ?! }9 A' a2 F; r% x
  807.             {7 t. p4 z8 L$ U0 [% ?% I
  808.               unlink(".\\DownLoad\\checkversion.txt");8 u/ q. N1 t( F" r' u. @; ]2 C. ~* Y% U
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    7 L( B: K% |. ^  R2 n2 D6 s
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");- T1 s6 j& B4 b, w
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");
    + L+ Y* Q+ ^: u

  812. 4 |* M4 Y( g0 ?4 f
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    $ F* p3 W% X* t8 {  K9 I7 M
  814.               dwStartUpSteps=99;
    6 b: y2 \: r! u9 ], a
  815.               bFinishUpdated=TRUE;/ U5 A( F" q" K$ t( `( H
  816.               bCanUpdate=TRUE;
    , z) E4 J; y# P
  817.             }
    : u4 d2 x7 o% @7 A: E/ t* n
  818.           }
    ! g5 v3 ]# ]+ S, {- S0 |
  819.           else' v# i( F& H& |* H: L% q  o( J  v
  820.           {$ K* T# g" {/ U4 O
  821.             if(!Dn.Connected())
    + A- b" ~9 |6 r4 l
  822.             {; y7 g' b. H8 ^, G) }
  823.               bFirstUpdate=TRUE;
    ! j' g( H3 u( S% x5 [* J
  824.               dwTotalFiles=1;) R( k2 _3 J7 j- O! Q7 Q
  825.               dwDownLoaded=0;
    # n- h5 ]+ e6 S! K7 c* I' S
  826.               bSilentStep=FALSE;! i" K, _6 i) U' I* y
  827.               bCompressed=TRUE;. `1 ?) S. e8 @* b
  828.               strExtLocal=".\\DownLoad\";( H7 e4 x5 z: J5 E- E7 t
  829.               strFullName="update.txt";
    4 D) n+ F" }( o, D/ M
  830.               dwProgramState=AP_CONNECT;
    + {- E7 \9 z2 ]& j4 h+ i9 c! s
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");' f& n; Q' |% O# }5 y+ S
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    $ t% O2 U+ E9 R1 q1 u2 H* e
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");2 r  c2 A0 N; \9 Q4 `' S% q
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    $ W# L9 i8 |- K3 B; n  G# L% M; a
  835.               unlink(".\\DownLoad\\checkversion.txt");% R: d- U( S0 M
  836.               if(GetFileAttributes("Wsa.zip" )!=-1); T( `  u5 o# Q" [1 \
  837.               {
    8 j# b9 ?3 p1 w- N
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");
    3 i% y5 s# ^2 Y3 c. w3 A
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");3 S$ a  u3 x/ _! a, b  I' [
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");. c( X3 j) R: s0 \3 v
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    : c$ G! Q, F/ o+ O9 |
  842.                
    ; ?5 F/ e; t: V& Q2 ]
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    ( o2 A7 r9 _) W3 l. y) v
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    1 Z# C3 t* c9 L9 U5 a8 ?
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");5 T! F6 M/ w! E1 [, d8 Z
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    3 N2 c: Z! P) b7 v; ~6 V
  847.               }0 T- F/ t# _# z% i
  848.               dwStartUpSteps=5;
    / K4 C" j4 z7 \3 P( w
  849.             }- Z' u; `$ e' Y/ G2 T6 T
  850.           }4 Z3 k4 E6 G" K! h/ k/ V* H$ f
  851.         }
    " L1 \1 {) g- Z9 B' _. H1 F
  852.         else
    % _( Y. X/ J7 t8 r: ^
  853.         {
    ; f/ V, A/ i. Y8 e% `7 f  {1 l
  854.           dwStartUpSteps=3;+ x. T" ]" x$ k9 H$ ~. X, S& W
  855.         }
    0 Q! |( P. ]* t* U! g  N8 C
  856.       }& |" k! T/ {7 c3 c" y
  857.       break;
    . D/ A& T  B. [( n) I
  858.     case 5:
    ( x* G. O8 a* O# d7 r' L/ W1 |/ \  P+ [
  859.       {/ t; f$ W2 P9 }; b- d' }/ h
  860.         if(GetFileAttributes("Wsa.zip" )!=-1)" B4 ~- f" ^, W/ H, h' r* o9 {, q
  861.         {% W( b  \' k  _: G
  862.           int opt_overwrite=1;
    * r7 w& p+ b0 v( l0 j
  863.           int opt_do_extract_withoutpath=0;
    # Z* u$ O: T5 ?* Z) W
  864.           unzFile uf=NULL;
    ' c0 M' v  s6 d3 V
  865. / ~" N+ B% D1 b. z: `5 B
  866.           uf=unzOpen("Wsa.zip");
    : A  R9 y  V2 k- \" J5 t& b+ P
  867.           if(uf)
    ) j$ a# |1 S* ~6 ?& g
  868.           {* F! i" E2 s0 x
  869.             do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,NULL,ProcessProc);9 z  D0 b- M; n' Y, F
  870.             unzClose(uf);
    / L' z) i! z: p
  871.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃ЧΘ.....");$ E2 X  @4 Z% h" ?) k2 ~' P
  872.             else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压完成.....");; p+ |& |/ R4 R
  873.             else                                                      dlg->m_ListText.AddString("Unzip OK.....");
    : {9 y) k4 M( w; x% N
  874.                                           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    . J: t: y" v9 Y' Q0 I
  875.           }
    ( L4 H0 X7 i; A/ v; U
  876.           DeleteFile("Wsa.zip" );9 X) `1 n/ W2 Z$ \6 E5 o
  877.         }
    ) T% C9 \& [  T5 o9 R
  878. ) K5 r, x* ?8 {! W# r5 p1 M) \, j3 k
  879.         if(CheckLocalVersion())0 n) H& r1 r! @% \1 n! W
  880.         {9 l* T2 C; ~) d8 \( C. ^
  881.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫磅︽絬穝戈.....");2 u% m" L" q, L. g5 I4 `+ B" t  M
  882.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请执行线上更新资料.....");
    ( q5 k8 ?% `) z
  883.           else                                                      dlg->m_ListText.AddString("Please update.....");
    $ z1 j( k+ n! D8 X3 G
  884.           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    2 _* M5 m4 N: M2 e4 X9 M. T! E0 J* a
  885.           SendMessage(GetDlgItem(m_pMainWnd->GetSafeHwnd(),IDC_BUTTON1),WM_USER+2,3,0);/ r% g. x2 a, G  O% u! o
  886.           dwStartUpSteps=99;9 {. J" N3 e! }1 Z
  887.         }- \! h( g2 H# v" X
  888.         else
    5 W* b/ g1 j/ Q# s4 A: J
  889.         {
    . f0 s/ @8 C& l! P) v
  890.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");6 m! I" W3 Z: J! v5 P( v$ P- l
  891.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    1 f4 _1 M9 D+ r; V8 u9 ^9 c, s
  892.           else                                                      dlg->m_ListText.AddString("no new file update.....");, v7 D' `: Z$ ^1 L4 m: w

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

6 _! S" w  ~. L. F$ i* V* T
, r) U: e) |* ?) q* J# }  |4 {' K

評分

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

查看全部評分

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

本版積分規則

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

GMT+8, 2026-3-3 04:10

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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