CSUpdate.exe源代码

[複製鏈接]
洛小枫 發表於 2018-1-26 20:48:40 | 顯示全部樓層 |閲讀模式
: ]3 A3 ~" X$ [4 I* _
  1. / RevApp.cpp : Defines the class behaviors for the application.& g# x4 I  }8 b, H+ R* H& J
  2. //
    0 M/ Y: I* w# K

  3. 9 M  K8 ]- J. t: w: c- v
  4. #include "stdafx.h"9 }$ v+ }' {/ Q
  5. 3 n' K" f0 J* X0 m) c
  6. //#define UNICODE
      \; @4 h/ Y; r, o; P. |6 c
  7. //#include <gdiplus.h>' a) J( ~- A4 L
  8. //using namespace Gdiplus;) }2 j7 r" O: |2 s2 q
  9. : o0 W' I6 m3 }& H5 _# _) H! S; x
  10. #include "RevApp.h"% A9 N9 r) c' C# ~5 y6 m9 p# o
  11. #include "RevAppDlg.h"
    + B" K8 F8 y+ f1 Z

  12. : {* ~& P, M( {# n
  13. #pragma warning(disable:4786)% B/ V) _+ Y" ]) x
  14. #include <map>
    7 K2 M; j- H: l7 U
  15. #include <list>
    . \$ B+ M' R, A  D. `" r0 {% d
  16. #include <direct.h>0 E' r0 t4 o8 _6 O2 E$ ^  R# a0 I
  17. * z; A- q9 h/ U9 d# z
  18. #ifdef _DEBUG/ p2 A( z& V4 o& {
  19. #define new DEBUG_NEW. a, {3 k3 z& C/ Z, B1 ^
  20. #undef THIS_FILE
    9 E  ]9 p; D3 ?6 O9 R; N- d6 G
  21. static char THIS_FILE[] = __FILE__;
    1 `8 |6 h2 z' L" F( ?3 B& m
  22. #endif' ^/ }1 G% c/ I8 k
  23. #include "SkinResDef.h"
    " ]+ |% i! t7 Q4 D. e1 Z) s
  24. #include "ChangeBG.h"( f0 l  j5 f5 D. o) Y
  25. #include "AFXINET.H"
    - S  j* N2 @  Z9 M
  26. 7 u6 Y' ^9 K! a
  27. #define TRADITIONAL_CHINESE 0
    ' g( E, _. m" T. v
  28. #define SIMPLIFY_CHINESE 1* k% H  ^( b  U5 K! E* d
  29. #define ENGLISH 27 z9 R6 z+ d: T
  30. int m_iLanguage = ENGLISH;
    9 J& U7 K& d; K7 Z
  31. /////////////////////////////////////////////////////////////////////////////
    . L- L2 e7 B4 `( Q" p/ Y
  32. // CRevAppApp* B6 H: ~! R, M3 o+ {3 m

  33. 8 _9 J7 Z5 k# ^4 @; g& q: t
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)
    9 C9 g$ z- Z3 f9 W2 l
  35.         //{{AFX_MSG_MAP(CRevAppApp)% V7 c5 |5 H' I6 S
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here." l) ]5 z% a7 O5 g5 O
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!
    & K: O( ~) {3 w- G6 e
  38.         //}}AFX_MSG* J+ I- w5 W2 L& @6 y
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)$ y/ ]+ O+ ]7 o+ w! f# h6 Q. C
  40. END_MESSAGE_MAP()
      V2 G/ I, k% \- I9 [; B* t2 g

  41.   g* r* M7 l  v7 d; h
  42. /////////////////////////////////////////////////////////////////////////////
    1 q4 r* Q/ ]% u: Z/ V
  43. // CRevAppApp construction0 G& D  O, r9 f5 _

  44. # u$ S- ^$ w: _$ ?. a/ w  m0 g
  45. CRevAppApp::CRevAppApp()
    / p' O0 k6 V( c1 v4 [
  46. {
    , U! v. E/ z% x/ X% x. [4 u
  47.         // TODO: add construction code here,
    . E; ~+ q5 b+ Z6 C1 T
  48.         // Place all significant initialization in InitInstance; T* J0 B% y7 x/ Z6 r
  49.   bDisplayIsBig5=FALSE;- e8 }* C' `' H) d; j: g. v
  50.   bRestartUpdater=FALSE;+ w4 ]/ a% X/ G' a4 j' p: `+ h
  51.   bFinishUpdated=FALSE;
    ' E5 Y( n3 _) X& V
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;) |1 v  u( b& f4 D$ b6 P
  53.   InitChangeDataBig52GBKS();# y! X# Q$ S3 `
  54.   InitChangeDataGBKS2Big5();
    % ^; \( N& u$ y$ ], _/ q$ _
  55.         //
    , e# J) H0 h% H5 @5 @9 e) O/ r" A
  56.         bClickRunExe = FALSE;
    5 n! J3 A) M# T0 C; V: @
  57.         //
    , J- N3 I0 I$ l, C8 C2 F, _1 x
  58. }* z9 G0 j5 }  l7 V+ }/ L1 Y! n9 i

  59. ) H( _7 d% p8 Z* q) t! `
  60. CRevAppApp::~CRevAppApp()
    / A( k7 _* F3 u3 V" J
  61. {
    8 Z. s+ p( Z' K+ g! e: U* Y
  62.         // TODO: add construction code here,
    ( k; Y3 Q; |- E2 ]0 M0 l6 M2 S
  63.         // Place all significant initialization in InitInstance
    ! w9 T3 F3 `& W1 A2 q
  64.   EndChangeData();
    1 G3 I7 O* Z+ m  ]
  65. }& V9 [1 @/ |5 Q1 P
  66. / \6 N" c# ~6 V; I
  67. /////////////////////////////////////////////////////////////////////////////
    8 q4 v% C+ c8 A& Z
  68. // The one and only CRevAppApp object
    : f1 V+ c" F2 _  c5 N

  69. ' d& k( X  X( T9 n) o3 u
  70. CRevAppApp theApp;; _5 h" f( H" B2 u+ G
  71. 5 e) U& N/ c0 ?* y5 H5 i( s
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)
    ) ]8 b3 p3 M. f
  73. {% z8 v/ w) [; T
  74.   int iEOF=0;
    6 q8 N$ C/ ~! T- J
  75.   char szTempName[MAX_PATH];
    : I( i8 {3 Y7 i$ u
  76.   *szFileName=0;2 f/ l2 s, M' D; ~' y$ e
  77.   iEOF=fscanf(fp,"%s",szTempName);
    4 ]0 \8 P* y( G5 Z3 U3 k3 l! |
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')
    : b8 E* O. L& E" r
  79.   {
    + x( [9 p5 t! o
  80.     strcpy(szFileName,&szTempName[1]);7 R, y) E6 |7 w# e7 Y# Q) N
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)
    ) {) V! q& C: f  [7 K: {/ X
  82.     {
      m& t; K% T% F$ W
  83.       iEOF=fscanf(fp,"%s",szTempName);
    % F/ N1 o6 t- t9 g2 U8 a
  84.       strcat(szFileName," ");
    ; y+ \) l2 K9 [3 l: i
  85.       strcat(szFileName,szTempName);/ E# m: s% k. w  F0 ^# b
  86.     }
    , T$ P! c/ x$ C! b3 }3 w* G
  87.     if(strlen(szFileName)>=1)6 W* B- O9 B$ x
  88.     {' n6 N$ N  C+ U3 R8 Z7 W6 M% C
  89.       szFileName[strlen(szFileName)-1]=0;
    ' p/ E8 h2 b0 E5 x& Z+ u
  90.     }  D& L' y0 u8 D$ \% O1 m1 J
  91.   }
    , O4 ?: C6 _: B
  92.   return szFileName;
    % r; C5 G. w3 v) C$ o, F) O
  93. }
    / N4 r2 m( z6 b5 u) c

  94. 2 K: Q# _+ T8 x/ w8 [* z7 Q2 c
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile); Q) q( Y8 g; Z' x: v* K/ E0 l; f
  96. {
    , _+ e8 T! o. `+ e
  97.   FILE *fp;$ E2 {5 H  U0 d  e2 Z
  98.   char *key=NULL;
    9 m! A' s3 A8 \2 {3 w2 W
  99.   char version[MAX_PATH];
    " C* Y; M: x) H1 S  \; L1 G
  100.   LPUPDATEFILE file,olds;
    6 G& q# B) {1 C" ~8 e
  101.   std::map<CString,LPUPDATEFILE>::iterator p;
    ! ~/ j2 a" ]7 k4 v5 D
  102. ! r( p, {: t0 h7 m
  103.   UpdateList.clear();
    ( T" w% ]! p6 _6 u2 J
  104.   UpdateFile.clear();
    + W. S* F2 J2 H3 e- R! l. s
  105.   if(GetFileAttributes(filename)==-1) return false;! S& |( C0 v+ p! C8 O* Z/ b
  106.   if(!(fp=fopen(filename,"r"))) return false;
    2 [6 O" @3 W6 C+ \1 g0 T/ h6 S2 O
  107.   fscanf(fp,"%s",version);/ z: o8 c2 q9 w  Y7 M4 m
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }1 Z+ E- U# W- w9 S9 }9 s
  109.   while(fscanf(fp,"%s",version)!=EOF): _& d) w- |5 ~* C* X- g
  110.   {
    2 o8 d0 U( G+ W; t! P& ?/ e
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    - J- \9 f. d* C
  112.     fscanf(fp,"%s",file->path);
    + m* j( n# F$ D) Q6 Y2 [
  113.     ReadFileNames(fp,file->file);5 e. u( ?9 z3 J' Z  ], D
  114.     strcpy(file->full,".");7 O5 V$ m4 l" }. v/ g
  115.     strcat(file->full,file->path);
    & }3 f! b, f: p5 ]* I) j5 L2 o0 p
  116.     strcat(file->full,file->file);
    - p: h. [8 I' T1 r7 R1 |. g
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())
    , [) d0 R" p! t% I3 [, D. k
  118.     {
    4 j! W2 R5 `( M; `
  119.       file->vers=(float)atof(version);/ s" h0 i( c3 e
  120.       UpdateList.push_back(file->full);
    ! ]: t4 ^) C8 i( F* A- X* |
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));) n. ~8 @& T+ K( o; S" C' V6 E; X7 K
  122.     }
    ( w+ @2 T) h: O7 U3 ~8 a* i
  123.     else. E$ p3 `5 R) i# I
  124.     {* F+ F, ^- F1 Z' E) B% E
  125.       olds=(*p).second;
    # q: }- T& c; }
  126.       if(olds->vers<(float)atof(version))
    ) }7 e. I6 F5 d* a2 _1 s& B' Z: m
  127.       {2 a: [6 r' j% B0 X: E5 U% l1 Y
  128.         olds->vers=(float)atof(version);5 m4 S" f2 t/ q$ N* w
  129.       }9 s8 L6 I! S. Z/ K9 V
  130.       free(file);6 z+ }- a: l+ g1 F( n
  131.     }% i; i3 d" }( m* h/ ^$ L
  132.   }
    * E. E/ W$ T3 W, P. M; K
  133.   fclose(fp);, `0 {& Z* o9 V7 z1 w4 K5 ^9 t% K
  134.   return true;' k0 @0 [- Q" |+ G$ [
  135. }
    - u7 O+ v; [: {* I$ ^- ]$ X6 @0 H

  136. ) J) H  f! r7 E7 P$ f  i/ Y: X
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath); m& Q( J: u# K: u* S' t5 m" \3 @
  138. {- B6 ]6 W; L3 ~( N9 Y& p) ^$ [
  139.   TCHAR  szFull[MAX_PATH];/ Z4 b/ C; m7 U  ~9 y) T5 E
  140.   TCHAR *token,*inter;: w; X5 H' n) d
  141.   *szPath=0;/ E( l% T% v! s" u
  142.   strcpy(szFull,szFullPath);  ?0 N2 h' G# d: p
  143.   token=strtok(szFull,"\\/");
    + z; f' v1 h( g- a8 F% V) [
  144.   inter=token;
    : `0 d/ S4 m2 K6 O9 f
  145.   while(token=strtok(NULL,"\\/"))
    4 i2 J) E3 u6 F, A- x" K* I
  146.   {
    % N( U, q  G2 z. k: \
  147.     strcat(szPath,inter);4 h8 H1 t0 f5 L8 U9 ^
  148.     strcat(szPath,"\");' {2 N% V2 |. C% A- W' `
  149.     inter=token;  Z5 I9 W2 M7 r5 _- i) N& K9 `& ]/ h+ w
  150.   }! L* B0 @% W5 b
  151.   return strlen(szPath);4 S5 ]' c/ c6 D3 M+ A
  152. }
    6 e0 Y4 m/ K" _; w' N5 ]
  153. 9 }, V/ }2 u7 x6 G2 B2 R
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase)6 Z+ d* {- e- `4 N
  155. {
    " s  L' ~: U! w& l1 a8 y* \/ @
  156.   DWORD attrib=GetFileAttributes(Target);
    4 T% K  j, `! b0 u* Q- F
  157.   if(attrib!=-1)$ D' ~" `0 x, k8 [; K  E/ [
  158.   {
    - p; p1 Q- `4 w: j9 o  f. r
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))
    / h$ q4 W# T+ J* B6 f6 d
  160.     {
    1 `8 {! M% x: @, Z  @" x
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);
    + Y: A6 y) ~0 L- y+ x8 ?1 G
  162.       SetFileAttributes(Target,attrib);
    9 y% u4 s, I7 g+ Z5 m; I
  163.     }& a( Z4 N3 D: @# b! D
  164.   }
    $ ]* d$ g( V4 M+ T% K
  165.   CopyFile(Source,Target,Erase);6 j1 z* Q+ I# P: w3 i
  166. }# S* B# E! }7 A* A

  167. 6 I6 c: P+ z8 ^- b
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)- d# b; c7 {# @5 X+ r
  169. {! M( I! h  e7 c2 s. G: U6 g& M
  170.      FILE *fp;: f' A5 H5 U7 O1 z
  171.      char  szBuffer[8192];
      K+ e# G1 k* r6 {& \& z* O- B
  172.   va_list  argptr;
    0 O8 M1 R/ t3 }0 B

  173. 8 m. `, U% A# n: |
  174.         va_start(argptr,message);- D/ ^3 K( R/ n+ g4 g
  175.         vsprintf(szBuffer,message,argptr);& J7 U" F( [! H: }% i. r
  176.         va_end(argptr);/ H* s5 o: [, ~( S2 l2 B- y- z
  177.   fp=fopen(FileName,"a");
    / G4 v- M5 x$ E- \; Q( d
  178.   if(fp)4 k( W1 ^7 m# y. j. |% J
  179.   {
    0 W" o' w8 p& B0 X# `- q
  180.     fprintf(fp,szBuffer);: R& a, k7 J- c5 b) r" i
  181.     fclose(fp);: A4 z9 P4 Y2 F8 ?
  182.           _flushall();& g  l  R" Z/ C- L# K3 _
  183.   }
    # i$ @3 Z  p* o0 @* e  j: Y
  184. }
    , |' M! p9 \3 E8 o5 s
  185. ) p) G) ^4 w2 _; y# ?8 h7 u
  186. BOOL CRevAppApp::Fclearf(char *FileName)8 s  V; Y0 [# m( |
  187. {4 z+ J$ P8 @9 h: @  {. C7 W3 F) O
  188.      FILE *fp;
      v- {. U# q; H8 X
  189.     DWORD  attrib;
    1 B& }, Z  ]& {0 }0 N
  190.   attrib=GetFileAttributes(FileName);
    7 z( X8 d- e" [
  191.   if(attrib!=-1)8 K- O( p6 l& k  T
  192.   {
    / U) }" _' f: F: A
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);
    ( O/ z2 ?6 ?& r! j
  194.     if(!SetFileAttributes(FileName,attrib))! D9 q2 _* S" ^  J* F7 t
  195.     {
    - ], \: R& q8 E
  196.       return FALSE;
    1 H5 H9 Q+ A8 N; ^
  197.     }
    $ K5 i) X' _! K+ `3 {+ @( P& p! _
  198.   }+ z; g+ c  `, R
  199.   fp=fopen(FileName,"wb");
    - [  f* o+ z% `" x4 D* e1 V9 V
  200.   if(fp)
    4 C7 p$ f0 W1 B4 H# l5 Q
  201.   {+ _3 |% B2 B: M9 G9 o
  202.     fclose(fp);% `7 ]: V. }3 n6 [
  203.   }
    2 D& r/ L; Z. o( @8 |
  204.   return TRUE;
    / [: w  @3 G4 l" n/ D  z
  205. }
    7 e0 ^$ v+ @( w( {4 @1 k# \
  206. $ o: t- S6 P  R$ b' C8 y3 e8 I
  207. BOOL CRevAppApp::UpdateLocalVersion(void)5 H' l' {" w0 x" Y6 p
  208. {$ w$ F6 a# p" e: }, H+ f8 r  \1 v
  209.   char filename[MAX_PATH];
    # V" E# h) n7 a' h4 d
  210.   LPUPDATEFILE file,olds;
    8 }5 n+ V8 T/ C( a- t3 Z& {
  211.   std::map<int,CString>::iterator i;3 A) r8 Z+ I. O2 f
  212.   std::map<CString,LPUPDATEFILE>::iterator p;' V" u- P; e9 w7 i0 t" W
  213.   std::list<CString>::iterator l;! s6 W, q: P4 z# M8 c
  214. 2 c( Q" H2 N4 R) v; q; T: c
  215.   if(bFirstUpdate)$ d" R; {2 `- y! k8 H, m
  216.   {8 \" _, u4 |4 W& W
  217.     dwCurrFile=0;$ f' I8 A! x/ ?/ n* i1 [6 K
  218.     bFirstUpdate=FALSE;
    * k& }# d# d9 H; ]3 U+ @
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())9 _7 L. R3 M( b& o
  220.     {
    ( o* C3 x- ]/ x- [& M3 N
  221.       dwTotalFiles=UpdateLocal.size();
    3 u" {  [4 Z! e: y9 x
  222.       dwDownLoaded=0;
    5 f: w1 @( Y' c- V
  223.       bSilentStep=FALSE;  ~( _2 k, C+ n5 h$ U. j( @4 K- W# d
  224.       bCompressed=TRUE;7 H+ t: _+ k" y1 X
  225.       strExtLocal.Empty();: y0 N; v% p( M) D1 }. a0 h
  226.       strFullName=(*i).second;( B: w7 n6 a" a" R$ ?
  227.       dwProgramState=AP_CONNECT;
    % {- P1 {2 H* A
  228.       return TRUE;
    ' w( I' m7 y/ d5 S
  229.     }: ]. B1 m' `/ {- @
  230.   }* K7 Y5 {4 ^- W+ u/ ~
  231.   else if(bRestartUpdater==FALSE)$ Z! E; d* Y0 R+ [. V
  232.   {
    - q5 {7 K) H: [0 q
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end())9 i3 E% H6 U4 o+ t
  234.     {
    . e4 P* Q2 q9 C2 J- y, T) d- @3 }1 `* V
  235.       file=(*p).second;
    " H+ e  J  Y( X8 g6 }
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())' j* Q) L- t5 K5 T$ @: z! K+ e
  237.       {
    6 p- _& w9 l$ c4 a  j3 c7 C
  238.         olds=(*p).second;
    , O  E" {- l$ g' B; j
  239.         olds->vers=file->vers;; I9 r) X$ d1 e+ v% n( ^
  240.       }0 j+ }! ]5 h) @! ]! k  H
  241.       else7 v( w# R+ ~5 s/ v0 B! h7 b6 f3 ]6 A% _
  242.       {
    ! [! v% g) u) W; Y
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    * q1 T/ E, ^8 M2 c. R  P, D
  244.         memcpy(olds,file,sizeof(UPDATEFILE));
    3 a' q) `4 n0 z8 `
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));/ H1 ]; z, f" _1 r! b
  246.       }
    7 G' {& n! M, I" E
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");
      L8 d2 e$ [& p1 D0 i& ~" o) D
  248.       sprintf(filename,"(%s)",file->file);
    0 o, }5 J% d3 _* M( }/ K( o
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    4 v9 r' y/ Q& G" i
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }
    . D2 Z3 H  V" l$ Z, i9 O
  251.     }9 @5 `' D* I( h( D3 Q/ ~2 B
  252.     dwCurrFile++;
    7 l9 s& \3 _0 x
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    : F( D' Q5 K) p% ^$ v4 A. d
  254.     {
    # m  @; Q. v, `2 ^0 a- z
  255.       bSilentStep=FALSE;
    3 D; ~; g9 H+ _& v, v4 y
  256.       bCompressed=TRUE;7 Z: y' q2 ]9 ?8 T9 L
  257.       strExtLocal.Empty();
    , O) G: v, `( \' `+ R  X2 m
  258.       strFullName=(*i).second;
      @3 R! h7 g: k. z/ o( V/ o' b5 }7 u. Y
  259.       dwProgramState=AP_CONNECT;
    $ ?$ @3 k$ z/ W  G( k9 K# B
  260.       return TRUE;% s+ J7 C2 v/ i) O# m/ ?5 Q. u& s
  261.     }
    / C. \' ~% `0 Z4 P$ y' m8 t
  262.     if(!bRestartUpdater)5 ]' j+ l; w' B* B& l
  263.     {( o$ s  ?- h( i; M9 P3 Q1 G
  264.       int iCurrSize,iFileSize;
    8 S9 V6 y6 R* R# z. d" @' j
  265.       iCurrSize=0;* m+ m7 u$ b/ q3 y6 y; k% L
  266.       iFileSize=UpdateList2.size();4 H' H. y! Q: ?0 O9 b& A( ]( g3 P
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");
    * Z8 ~: q: u$ M" L
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");
    ( Z( B/ b: d6 g: ?/ [& T
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");5 H, w% K" C, J
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);+ N3 ]% _( t6 c6 _
  271.       Fclearf(".\\update.dat");
    0 E( A% h* j! U- k6 X6 N
  272.       Fprintf(".\\update.dat","Bloodyf\n");+ M# d  W; J# |: P4 X4 R
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)
    7 H- h, L% W6 h7 d' f$ ^+ Q$ @
  274.       {
    3 z# y  p6 ~8 @6 A$ q; B+ P: D" t( R
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())  @1 z; C) |; d% ?, J! E
  276.         {
    + d+ Z5 n* P. d: s. n+ p# V
  277.           file=(*p).second;
    4 j8 F4 C+ w) [" U9 I. p5 w0 Z
  278.           sprintf(filename,"(%s)",file->file);4 c! b4 h. V7 N+ `8 ]
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    : m  ^3 V, _' X
  280.           iCurrSize++;) |% \0 L% C  c, m# @
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));
    ; Y" ]3 X# A1 i5 L$ p) i' c$ O) R
  282.         }; H/ z* P1 S; f! P4 A( C# @  ]& S
  283.       }& p" ~) j/ g1 }. u' w7 E
  284.       unlink(".\\update.txt");
    ( H5 H2 M5 H( m
  285.       unlink(".\\update.tmp");
    8 Z" w" n' x$ x# p
  286.       Fclearf(".\\checkversion.dat");
    ) D0 s  o+ k- c/ v8 _# v- Q
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);" Z- v4 p2 B: }# R0 r; B1 E; y
  288.       if(UpdateLocal.size())' D8 p7 `7 D: m3 ?' z" x
  289.       {
    # s( l: j' k+ V- X; u* U7 l& H; V
  290.         UpdateLocal.clear();
    / l' U9 l2 x8 v! W! O7 t3 t
  291.       }) ~7 G3 B" l+ }; M" l
  292.       if(UpdateFile3.size())
    # v, V* v9 I2 [: \  i) v' v- @
  293.       {
    5 p* O6 J$ {. s
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)7 L( y1 X" i9 w0 s4 e9 v/ J5 ]1 `
  295.         {( F# G1 o4 v$ y: l
  296.           file=(*p).second;+ u4 G# }& I: V' d' z
  297.           free(file);4 R3 c% O) c9 F
  298.         }
    5 ~$ _0 x5 N" H
  299.         UpdateFile3.clear();7 L" @, o  t* `
  300.         UpdateList3.clear();
    & Z9 z+ ~, f6 E+ |
  301.       }- C# x7 o* ^+ M9 a' A- m' |  ~2 H
  302.       if(UpdateFile2.size())
    : H( j8 `+ H  C# w1 c: q
  303.       {
    $ R7 n8 d; x% W
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    , d) i4 W) v+ j5 ]/ F3 V
  305.         {: }- O1 i; o" [& u9 n$ {  {
  306.           file=(*p).second;
      B" C3 j& N7 b
  307.           free(file);
    * }/ K- O" E) l  G. F' S
  308.         }8 Q* s' w  }" t# D
  309.         UpdateFile2.clear();
    : j) _' g) h2 Y
  310.         UpdateList2.clear();6 L$ c8 }1 M5 ]. G; ]3 K3 {
  311.       }% [% o* E9 @% }( G3 F
  312.       if(UpdateFile1.size())
    . t$ d2 |: y% c" J% F
  313.       {- w, M5 J! ?8 U& ^9 L2 L! e; }
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    . {$ n9 w0 `) Z5 K
  315.         {8 ?# p9 v4 X- |
  316.           file=(*p).second;
    - R) H0 j1 g$ l: l
  317.           free(file);
    ! N9 C% c. l4 k0 H4 t
  318.         }
    # Y# U# q# h, p
  319.         UpdateFile1.clear();0 w# m/ K5 j: f4 _) J
  320.         UpdateList1.clear();
    2 R6 z, D2 i+ B/ Z' e8 f
  321.       }. l/ s; p4 N7 h( ]/ K( i9 w
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));# q/ V( j/ s9 k& a9 P
  323.     }* v- Z+ g4 @# U0 i5 Y
  324.   }4 U* T, S# \+ o" r0 e% z6 ]
  325.   return FALSE;
    # r  z0 G+ V4 ~. L; z: E1 v
  326. }
    ( Z) X/ T# D9 R& T
  327. / w& l8 L" y9 Z# T- z
  328. void CRevAppApp::ClearAll(void)" X- E+ |) {+ A# H& _$ W% k
  329. {
    8 Q& X* p% p) Z9 R4 Y: r0 p
  330.   LPUPDATEFILE file;
    " C" y% ?0 b8 a3 a+ [
  331.   std::map<CString,LPUPDATEFILE>::iterator p;" [/ P6 q+ F* l

  332. : t, Y1 ^/ C2 [$ J5 C
  333.   if(UpdateLocal.size())
    2 b- V* c7 f. Q5 L: c
  334.   {0 Y# I' X! }$ m9 n
  335.     UpdateLocal.clear();3 D3 h  R, e6 Z- g. X5 D2 p
  336.   }
    ) J0 x7 X4 M, t8 p/ W5 ?  Q
  337.   if(UpdateFile3.size())
    / t  ]" l, h1 ^6 D6 Z$ w
  338.   {- S& d' j- N3 x; t
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)" b8 r7 x5 T- g/ H/ V
  340.     {
    5 \  B: @* {+ j
  341.       file=(*p).second;( e* c8 W) p( B' i, {0 n
  342.       free(file);
    . ?0 |5 k0 Z4 V6 A1 p( L
  343.     }' V; B$ a+ W8 c
  344.     UpdateFile3.clear();$ c% L' F. t7 v2 B1 s2 X; T
  345.     UpdateList3.clear();* D* P& f1 z6 H" t
  346.   }' X3 R8 z3 F% z# E& |( V" I0 e4 g
  347.   if(UpdateFile2.size())
      V6 m1 P5 @/ q3 S! G
  348.   {
    3 G* O. v, A( C
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    * D, @* o1 ~0 H. k+ c) U$ k, U4 R
  350.     {0 o- D; M# W6 P& G7 i3 Y, I& L$ p$ ?
  351.       file=(*p).second;
    ; l& D$ m0 h( j5 l" o/ ]$ G/ B
  352.       free(file);' P, K" H* _# b" H8 V
  353.     }/ ^' N6 H7 s1 g) ^- X; b4 N- H5 C" t
  354.     UpdateFile2.clear();5 u% f, x; J' k. `- G& e4 j
  355.     UpdateList2.clear();6 p5 I+ K) F9 w9 M) U, M
  356.   }
    9 Z2 O) I2 r9 w: t$ W1 J
  357.   if(UpdateFile1.size())+ x. z5 h) ~, a5 g6 k# a* F: G
  358.   {
    * G- D% R0 M; C
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    , A/ p& p6 }# K; G' f6 K
  360.     {
    7 x& i3 p: [' P9 F
  361.       file=(*p).second;2 C1 X+ p- ~7 j8 R4 k3 D
  362.       free(file);
    1 r4 @$ B% R/ b, {$ s) _
  363.     }4 i; G! {0 F9 W2 ^% W! C& n
  364.     UpdateFile1.clear();* l& p( J: r4 J# i; {( `
  365.     UpdateList1.clear();* p5 h& f# M( Z- o
  366.   }
    ) [6 M  ]! w6 ?0 j2 t- L% n) g
  367. }  
    : n8 h0 w5 ]( P: P) w* c2 z2 [5 Z
  368.   
    * o; K2 a% W1 T( ]8 n
  369. BOOL CRevAppApp::CheckLocalVersion(void)
    6 t9 K' y: R# j  J3 @. T6 e& z
  370. {
    # E5 L% ~& E8 |$ J
  371.   int c;
    " ]& h% l5 d' s) N  s5 X" Q, m
  372.   LPUPDATEFILE file1,file2;5 y; o& @; ~( K4 d/ l
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;
    # O! Y# N5 G1 Y% H1 _5 S
  374.   std::list<CString>::iterator l;
    4 ^- l) I; Y" h! q: l0 r" s- Q

  375. 1 n. h: z3 M$ P* e
  376.   UpdateLocal.clear();- H8 c# t+ d& t" G* V0 I3 @0 y- r
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);+ d1 ?' L" {$ `8 S* i4 {6 I
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);% g9 i% j6 y/ ?  ^
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);
    * i1 {% F+ [% j& O) E, \" X) }
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);
    " u' P6 u  t1 |4 L* N! S
  381.   if(UpdateFile3.size())
    , x$ C  p+ @% s
  382.   {5 Z. N* \* [0 M7 n4 M% q
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++)
    * d7 s8 p9 S0 J* |" a# ^, L# u
  384.     {) _3 E) c8 Y* ]+ [. \
  385.       file2=(LPUPDATEFILE)(*i).second;8 @. V: |$ V2 g! [1 x5 e& N  n
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    ; j4 A" I+ ~* @
  387.       {% ?7 z/ D) U1 ]$ X- p( H! N
  388.         file1=(LPUPDATEFILE)(*p).second;
    ) g% J# b) D% q; u. ]' J, [' s
  389.         file1->vers=file2->vers;& L: A" Q! k: W: J# d; ?
  390.       }/ q; ?5 i4 y) U6 G
  391.       else
    9 H! P. l- i) M' R0 B
  392.       {
    , v7 w  E. |; M% V
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));0 n% F! n& d" i. t2 X  q& }; S
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));
    / P2 x4 m+ f! ~; Z
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));& N$ ?# |8 ^8 h2 X5 [( z# e6 O, j
  396.       }8 G5 ^6 V* N: s  o6 E
  397.     }
    * D+ b; x4 p/ e/ Y" I5 z
  398.   }
      O) e" A5 x  h
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++)
    , g6 X, b6 R( ?. v! r0 p
  400.   {9 ]  p, T8 ]  H$ v; x! s
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())
    : E! Q: |: W9 U1 `5 x9 L3 l
  402.     {5 s7 a7 G2 @3 d9 y
  403.       file2=(LPUPDATEFILE)(*i).second;
    - W- K! x4 r6 [9 J9 D% n6 L
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    7 O; R  y7 x" q2 @' s2 w/ P
  405.       {
    # }+ ^/ Q& ]5 x3 j& h1 y$ M
  406.         file1=(LPUPDATEFILE)(*p).second;
    6 s" H, N. H, M2 L: y. b( z
  407.         if(file1->vers!=file2->vers)
    # ]& v1 b: L$ l
  408.         {) E! q( W/ M5 \! H7 K
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));3 z9 I  a' N2 Z6 `
  410.           c++;
    " ^; p- h" `* W% H. l4 @
  411.         }+ z) D$ V& ~8 \- g8 Y% [
  412.       }" Q+ w4 [# e- u! D' d* p% S) T
  413.       else: Y0 ^9 V6 V3 J
  414.       {7 H0 C9 g% k, F' \5 b
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));- d3 f% Z" v: B" y  h
  416.         c++;- J: G! ?5 N7 l4 h
  417.       }+ m* ?* \8 s1 P* n. F
  418.     }9 R- v) J9 f& E0 b6 b
  419.   }3 D, X: w0 @) U. c+ N" u9 o
  420.   unlink(".\\DownLoad\\update.txt");
    $ p: [' L6 f: ?3 H& `$ U  z
  421.   if(UpdateLocal.size()) return TRUE;
      h) Z- m$ a, n
  422.   else                   return FALSE;
    . L5 _( F3 y: V: D
  423. }
    / F7 Z6 {7 E' j: G6 ]& _; u9 q' j3 O

  424. , F* X" j" D) \# C6 C7 q5 Z
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"
    6 E3 q+ l, w! l% Q& D7 W
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn". q4 s* r. y4 J
  427. 5 C; h+ o+ ~! G
  428. 6 x  M3 ]/ V/ d: z

  429. ; }3 Q& t' `$ ?; G0 m1 t0 {! i% M& [
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile)
    % m' W, l! c2 X" g& }8 O3 X, @' {; E
  431. {
    8 F" w1 J4 z) e+ G  |
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;
    " [! _: X& ?# H( `9 L- h) u" e
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)2 a1 v9 |% o8 y$ Y0 O/ L
  434.   {! G9 \8 i. C) J$ Q; _! M( g
  435.     char szLanguage[50];
    9 O/ X& O8 d' U) \, m9 d
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    % Q  s/ f6 J1 j! _+ W$ E
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
    . s" H- ^6 o4 Y% L
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;9 a$ `% G# i6 k6 P! k) z
  439.     else                                   m_iLanguage=ENGLISH;
    % I: H8 z1 l7 M8 F- `6 }
  440.     char szRegister[100];) m& j, r" C2 E- C, p- z5 i
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");" y6 e/ d7 P- _  N3 Z6 [8 J, z
  442.     strRegsName=szRegister;5 A  ~' e: o9 U6 Q5 q
  443.     char szPatchURL[100];
    6 z$ F1 |3 s3 m7 @% g% q, M* E5 _
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");* g* r" L) j- o
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);: C6 d1 M9 J7 m/ e& N
  446.   }
    - F. F( K* P& i, i$ S& v+ O
  447.   else
    % n2 z5 }' p1 H3 s' R0 K& q
  448.   {! ]/ L, _6 Q3 H/ \; K
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    : s  F4 F, z* }3 j- j  [
  450.     strRegsName=DEFAULT_REG_URL;5 }3 F* d' {% H- t7 j# ~* {
  451.   }
    $ L  L0 S& U& s
  452.   if(GetFileAttributes("hosts.ini")!=-1)% g' R8 \" J6 H2 t9 P
  453.   {
    0 ], R1 B- V1 c6 q( C! U. r: V
  454.     char szIP[50];
      w% I) N* v  l7 g) S. \
  455.     char szDIR[300];  F7 L9 [6 P: [/ {# m
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))! B0 F  u# G( ]3 d0 j1 P% `9 J' n
  457.     {9 P0 t- @- n5 \3 R  c3 H9 M
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");
    5 H2 B) T8 y0 D
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");
    - d6 o0 }4 I3 J- B+ a' M
  460.       strHostName=szIP;
    5 u* H! [- G; E2 h8 D
  461.       strHostPath.Format("/%s",szDIR);# _& M. L0 B& A) X- T
  462.     }
    ( g7 \; F% A2 J6 C  H# i
  463.     else/ O5 Z2 R. `5 W* Y* |6 b
  464.     {
    ' H% h; T9 {  K. f  M" P# W% v- U/ o
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    0 Y; V: Z* k4 {
  466.       {" t/ H! W& E9 ]: ]
  467.         char szLanguage[50];
    # l. u* o- Q3 {$ D& V9 i- r4 Y/ P
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    + l% ^% \% @% _3 n4 f1 e  a# B
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;0 p* v/ F7 Y' `# J# |* H, U
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;! e& k( Y* E9 s6 e8 Q
  471.         else                                   m_iLanguage=ENGLISH;$ P. k1 R. ~2 }; _. j
  472.         char szRegister[100];5 F2 i7 _; d, Y/ h1 @
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    8 H% Q5 H1 U- S+ w/ ^
  474.         strRegsName=szRegister;
      \  u  o. l8 Y* ^" i  z
  475.         char szPatchURL[100];% Z, E# y) s$ }/ R; K# k
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
    * o& E# ~7 I- E* b% x
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);
    7 T9 f$ V; X  F2 @' R
  478.       }
    # w. B; E1 h7 j
  479.       else
    , W1 h4 J0 q6 Z8 S3 h3 M
  480.       {+ G5 H: T1 z( E# j+ p2 _( ?
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);& h  M- }; r2 O- N* s" R
  482.         strRegsName=DEFAULT_REG_URL;! N9 D8 s6 [+ H. U2 r' H
  483.       }: H) v  t! h) p* _0 Z8 Y/ t( c
  484.     }3 k' f2 t: \8 I2 {8 d
  485.   }' k, F5 ^! r! u, b3 a9 J2 t
  486.   return true;
    % _: ~5 o* I; g+ R
  487. }- [8 ^# W) J6 I6 _5 U6 Q* C, X

  488. 8 A1 C( _0 \: W8 T' T  K
  489. #include ".\ZLib\unzip.h"2 l8 N0 J- ]; S& g$ e. `
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);
    9 j; Q, f6 u, n& Z: ~5 R$ N3 ~2 _
  491. /////////////////////////////////////////////////////////////////////////////1 q& M% H) M  E$ r# P5 M
  492. // CRevAppApp initialization, @: ~5 k# B6 i; t

  493. # j5 G# Q( C0 W" J9 z
  494. BOOL CRevAppApp::InitInstance()
      i' ~9 R+ r" x, w
  495. {
    ! z9 R+ }8 u* V5 x6 \
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];! }) b( H# M. z' Y- [
  497. 5 w1 v- p+ e  I; w
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);
    0 d1 K' n* B. h7 {' s- k0 ^  D% f
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))
    3 K2 Y" E5 n$ e  X  q: u
  500.   {
    * b9 G: `8 k# Z  D$ Y: V  P
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");: a( H0 B+ N4 Z# |$ h- c, d
  502.     GetPathFromFullPath(szPathTarget,szPathSource);4 R9 H8 N: v$ q/ {- G  }* x
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))5 T; G& w1 `/ d, w& }% h, Z$ J! T
  504.     {/ ^5 {3 E5 Q( m
  505.       strcpy(szPath,szPathTarget);
    4 f* s4 J9 I# k  W( o
  506.       SetCurrentDirectory(szPath);" e3 E" Q( W6 l' a% y7 G
  507.     }( d" G1 f6 S9 Y: n
  508.   }0 `6 `) _+ |; h$ i" L
  509. #ifdef _DEBUG
    7 O, |- z  A  d! m
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))4 ^& U( E5 R9 r2 Q* S
  511. #else
    " |; K# s' s: T! P* e. C9 {7 L( x
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    . S9 _0 J* h7 |' q4 R
  513. #endif3 ^. L1 u2 A! o, u# w. W0 M
  514.   {! u. ]" Y+ ^: \/ \% z- H" s
  515.     char tempFileName[MAX_PATH];+ m) N, l1 V/ a- |; H. p* L" i, O) b6 }
  516.     strcpy(tempFileName,szPathSource);2 @# V0 I. o7 v+ w9 j* }$ l5 d
  517.     tempFileName[strlen(szPathSource)-12]=0;& ]( Y& t6 p9 z6 S
  518.     strcat(tempFileName,"\\$CSUpdate.exe");
    & e+ e9 T3 h4 G2 b
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);
    * E5 I6 I6 [+ ]2 s- i
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);8 P5 H! z/ Z4 M$ r8 W
  521.     return TRUE;! M1 W3 i0 Z5 y( H) o
  522.   }
    6 @9 @" J$ j# m7 P
  523.   // Nuke 0118: Delete run.exe* S3 u+ I1 N! N: }# P- [
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );
    ' n2 K0 ]6 R. w. @
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");; f* M  _) W* p+ s
  526.   if(!ReadCfgFile("Config.ini"))
    7 N3 I6 x9 c" a7 H! V
  527.   {4 T( c2 J# O9 U  c2 A3 q# F, ~6 e
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);$ N! X; {# W7 r1 x4 q! i
  529.     return TRUE;
    ) m5 E$ B' l6 Q/ C9 i# `
  530.   }  Z' I' ^4 K1 N6 R- e4 m
  531.   HANDLE mutex;
    . B% c8 `- ~( M* F5 Z9 K& Z. t
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))
    " G& Q( S/ F) r: k( d
  533.   {) `9 W9 j9 o2 z! U+ f  K$ ~- @
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)
    6 z( n& p: G6 K2 }3 X
  535.     {
    # n" A/ r8 ~5 W) r% A
  536.       CloseHandle(mutex);
    # D+ O$ e  z1 \
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);
    8 t5 f2 H) G- l/ ?
  538.       return TRUE;# s5 t$ X9 m0 W) ~) q
  539.     }0 N* _2 D  @% W! U1 l( p+ @
  540.   }  / g4 e& H+ @% G" |: U* E, N& j
  541.   CloseHandle(mutex);1 R! p0 r; K3 {8 s

  542. 0 h5 s. B8 U# K, u$ |' T
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);
    - X. A2 P$ w6 E: h& d
  544. / `" c2 C) f. r6 `
  545.         AfxEnableControlContainer();
    7 p! L" l6 r- f/ `& N8 ~

  546. : g  `3 j/ d6 {! G# p! ^1 O8 C
  547.   bCanUpdate=FALSE;
    * _* Z+ z8 ~% \  D
  548.   dwStartUpSteps=1;$ ^) z4 t8 k4 X' S$ h( x# S
  549.   dwProgramState=AP_NOTHING;
    + j) L/ J% c/ e* C/ @

  550. : r/ P* ~; b! r8 ^4 e
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);. ~: Y. q0 ?! Z! c: O

  552. 5 g$ v0 q/ N2 W  S% _, d
  553.         // Standard initialization
    0 t" d5 c( `5 m9 S! M
  554.         // If you are not using these features and wish to reduce the size+ D9 x  L% I9 M% s
  555.         //  of your final executable, you should remove from the following
    % Z  ]% m% |9 Q2 d/ O2 X6 j
  556.         //  the specific initialization routines you do not need.* O) X& g% V2 L" ^; v) Z# h0 o
  557. ; S  r) l1 F" f: \7 q7 V8 I
  558. #ifdef _AFXDLL% p$ A+ D8 A5 ^' h) C- A
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL4 c& p7 T  |/ i+ g* A
  560. #else
    ; J3 {7 T& \: G$ P7 |8 v
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically$ a2 W: D/ j$ d. X6 f3 H8 D* n
  562. #endif8 y, `# }' \6 {4 i* i) B
  563. 3 U9 y! ~/ M. A, p1 b7 ]
  564.   dlg=new CRevAppDlg;
    ) G6 r. }' e# w) ^
  565.   dlg->Create(IDD_REVAPP_DIALOG);% J4 C8 k. Y( o8 j6 Y6 T8 p
  566.   dlg->ShowWindow(SW_SHOWNORMAL);4 N6 {% n1 L! j2 g) Q  Z
  567.   m_pMainWnd=dlg;) Q) Z" R0 S9 U0 [# x' t

  568. : m3 Z; E! [8 b; j
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);
    + M! U7 d8 L7 ~  u
  570. & x+ k' {' e8 H( a- f" Q
  571. //  GdiplusStartupInput gdiplusStartupInput;4 d! M$ d# A; U+ b+ V
  572. //  ULONG_PTR gdiplusToken;% \  t6 N% s3 {
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);3 o+ ]2 r) m% i) J, ?4 d0 q& z

  574. 0 E4 W$ ]$ Q+ S0 J$ `$ ^( e& W
  575. //        CRevAppDlg dlg;! _/ U* l+ \  g$ E4 U- o
  576. //        int nResponse = dlg.DoModal();+ X- I& P& r$ e# H' |( U
  577. //        if (nResponse == IDOK)2 z3 G3 z3 ^' T4 O
  578. //        {1 W. m# D4 f. P7 c" Y% Y  f- `0 k
  579. //                // TODO: Place code here to handle when the dialog is
    & N$ x9 Z/ m, t9 Z; K
  580. //                //  dismissed with OK
    : A- Q, P+ \( H0 }7 H/ y/ J$ C) Z
  581. //        }
    - a% b5 D( @( `$ x1 A5 j" i+ i+ u: k
  582. //        else if (nResponse == IDCANCEL)
    : M8 M# g) R. F# o0 J: E
  583. //        {
    * j' N- M. M' H5 M0 Y4 Q
  584. //                // TODO: Place code here to handle when the dialog is
    " n+ C$ ~. W. c# k3 |
  585. //                //  dismissed with Cancel
    : ?3 ]0 g" a, j( s/ Z- X" f
  586. //        }7 f4 J2 k( q. g, k& Y& x% |

  587.   ~9 m9 A- b! }. m; x: f5 N
  588.         // Since the dialog has been closed, return FALSE so that we exit the
    , u2 I/ T' Q# x" X9 S* y
  589.         //  application, rather than start the application's message pump.
    1 I. Y- g" Z; [  \3 r! Z8 S
  590.         return TRUE;2 w  O9 ?  v3 H
  591. }
    8 w. V1 x- L5 |, n

  592. $ o/ V6 |0 A7 X
  593. char *CRevAppApp::strtok3(char *pSource,char *token)
    ' P. M1 _% x7 j  T
  594. {
    % P' q. d! E$ g2 Y# U/ @" ~2 D
  595.   int i;
    " @; _6 V" n( W" n' n3 N# O  T
  596.   char *szRet;
    ' O* k( \1 y3 |0 x, t- ^8 m
  597. ! I% _6 h! B$ m: O& g
  598.   if(pSource) { itoken=0; sztoken=pSource; }
    - v, G3 Q. X5 F% T# z6 ]: S
  599.   if(sztoken)- [" t5 \1 c% b
  600.   {: Z, {) h9 `; ]+ z4 }
  601.     szRet=&sztoken[itoken];
    0 V6 x  t  a" @9 M; P/ g' B
  602.     while(sztoken[itoken])& U/ M) {/ c3 X6 e3 H! X1 G5 O
  603.     {
    % r8 n5 {9 J! u1 I# e
  604.       for(i=0;i<(int)strlen(token);i++), a6 Y6 A$ L4 W  S; D3 m; Z
  605.       {6 m% u. T: b' m
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])+ O  N5 y% n' c1 g- Y
  607.         {
    7 q/ G5 T2 J6 A7 P( ^: O" t
  608.           sztoken[itoken++]=0;
    ( e) d8 ]' }6 h, u0 J9 l
  609.           sztoken[itoken++]=0;
    # i% m9 n$ p9 d  m
  610.           return szRet;% a' k0 Y7 @, Q+ F0 ^
  611.         }
    " Z6 E- l2 v* r1 ]1 T/ `$ M( `
  612.       }
    * m: T+ Y& A. H1 }# s4 c
  613.       itoken++;
    5 S# Y7 G* l  y/ I7 c% ~
  614.     }
    " s' O  S: B3 N$ A9 C/ b/ ^$ ]. U% D
  615.   }
    1 u0 u! `8 X/ L9 r( n
  616.   return NULL;
    & F3 ]: ~) V3 A" _9 l) F
  617. }
    4 h; \, M6 E7 z/ L" ^+ V0 h! P+ x

  618. 4 d, P3 X4 t  W" X1 l
  619. void ProcessProc(long Total,long Current)$ r2 m% K1 u* m  k. q1 E
  620. {
    8 E- q5 }" U" x
  621.         MSG msg;
    ( f% g+ `# q6 `
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);# ~! q; y. q1 i* c# s
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));
    . y1 K. M% ~+ B) e( N; E9 H# S
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
    - X2 ]+ f3 R5 S$ f$ @' a) Z( d
  625.         {
    / @0 R; ?' x3 W: V& y1 |
  626.                 if(!GetMessage(&msg,NULL,0,0))% c: N, Y$ W) a2 z  A+ n1 b4 r
  627.                 {7 G1 K5 z" W" Q
  628.                         return;  [! h- _, G% {0 t" ~2 l
  629.                 }
    . L* j4 x+ X% E" B: p
  630.                 TranslateMessage(&msg);7 D( F4 M# y' R) i: ?2 _( X! }
  631.                 DispatchMessage(&msg);  h/ l. S" \3 B! a& ^9 N3 `, X
  632.         }       
    5 e5 a$ L" k5 k- m: h" L8 A
  633. }
    9 G3 M# x5 m  d! H: h5 u% L4 ], ?

  634. & U2 z' h6 h, o5 ~5 W
  635. BOOL bFirstChar=TRUE;
    % |  v4 T0 Y5 a! Q0 j

  636. & P9 h' \4 V% Q, d) H/ i0 v
  637. BOOL CRevAppApp::OnIdle(LONG lCount)! n; `: o, s/ Z* s6 ^8 b
  638. {
    - P5 n7 u0 }7 O2 u5 `" e
  639.         // TODO: Add your specialized code here and/or call the base class
    0 \" I6 q- w0 U, o8 D
  640.   switch(dwProgramState)
    1 @8 S! V9 j, M! ]1 H7 ^5 Z
  641.   {
    2 ~, f5 W# Q0 W  _% J2 c5 _9 `3 D% Q
  642.   case AP_NOTHING:
    $ f! F1 t* q3 K
  643.     switch(dwStartUpSteps)
    9 w; \5 ]& |7 x+ {) z
  644.     {
    & ^7 f5 N# N, \. c8 w6 N$ t& h
  645.     case 1:
    7 O# G5 p' M- r  Q
  646.       {$ L+ N$ I" w+ e, D! C
  647.         int i;3 f* D, W- @/ i3 d4 e; F6 u
  648.         CDC *pCDC=dlg->GetDC();7 n" {, t# l9 W. h6 C# f
  649.         HDC hdcwnd=pCDC->m_hDC;% h% R4 f! x4 ]- D
  650. //        Graphics graphics(hdcwnd);
    , \5 B+ D/ H# R* U* `# G6 @
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");% D- {/ V' d" |; q. J* D
  652. //        INT iWidth=bitmap.GetWidth();
    # J2 i2 i0 z2 c8 F. o0 `
  653. //        INT iHeight=bitmap.GetHeight();8 `* [7 r5 {6 m6 F- @+ u5 c9 N: ]
  654. //        Color color,colorTemp;) [8 _! x; ^7 M9 @  m
  655. //        for(INT iRow=0;iRow<iHeight;iRow++)3 C& v1 b; M( g
  656. //        {( F- ^- C, V# s0 t+ s
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)5 t9 S; L% t& V
  658. //          {
    9 F( h) v: h& q. k- m
  659. //            bitmap.GetPixel(iColumn,iRow,&color);: d: y' B6 h# x0 z
  660. //            colorTemp.SetValue(color.MakeARGB(  e4 v  K  W3 Y5 C: A% r9 d2 P
  661. //              (BYTE)(255*iColumn/iWidth),
    , B* M' c0 ^+ ?) U! P
  662. //              color.GetRed(),7 \( v8 x. F; }* k$ N
  663. //              color.GetGreen(),6 E6 _; {/ N; E8 q2 j4 {: q
  664. //              color.GetBlue()));& _# m. e$ }. L+ b' y0 [* F; I
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);
    4 a$ f# }* K+ v- L0 S; v" A0 K
  666. //          }2 W* u, |) Z; V- D$ q- b; Z, E
  667. //        }
    $ I& G& m" J5 Q/ g
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);) N! t4 t0 N5 m" }
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    - O( X& a" Q9 e
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");
    3 z2 ^5 [2 W3 K1 p0 \
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    4 b. s4 y5 e7 W3 D  |" ~
  672.         for(i=0;i<240;i+=8)
    $ Y" c; V; k! N5 d
  673.         {: H7 r$ s) G* B
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    ) ^* l$ b+ s0 ]5 f7 q1 D
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);1 \9 z9 F) @- u, {) m$ [# }
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    * ~# |3 w4 t) C7 n+ ?+ B; r
  677.           Sleep(33);, k) ^0 _* ^- s+ N) E
  678.         }) u! T/ O; m5 u, ^- _; o8 @
  679.         Sleep(1000);* \, j; G3 {, l. |' f$ V
  680.         for(i=240;i>0;i-=8)
    $ ^/ t( C$ C. A& l  S) V. _
  681.         {
    1 o$ G4 t' n) m( |+ C
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);5 u2 m9 z7 A  T
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    6 y0 v, M- w- w
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);' I/ O5 C5 F3 X4 T& C6 T
  685.           Sleep(33);
      ?3 M+ p7 \2 N
  686.         }
    * t' S, K/ d/ g' Y0 m& U4 f
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);' j4 q+ n  t5 `2 ]0 v: o
  688.         dlg->ReleaseDC(pCDC);
    ) M+ A9 X& O# d' {% o
  689.         DeleteDC(hdctar);
    ! l; v' Y* M* j. z% k1 n
  690.         DeleteDC(hdcsrc);
    # q2 A+ j- H( E- `" l# D
  691.         DeleteDC(hdcorg);9 o' z. T/ O$ y( c. n: O& t
  692.       }
    . Q5 a$ U, s0 Z$ X# Z0 M: |5 L
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);
    ( q4 @6 e( p. R& |+ b9 N9 o5 o
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");7 z3 ^, a/ y5 r1 Z4 f5 Q
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");
    ' _  L, D9 L0 L' |/ k- W- ~
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");
    & Y5 c; Q3 @- {4 ]
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    . U; G' r5 ]7 Y  l% R7 u" O
  698.       if(!Dn.Connected())0 N. d  b+ s8 Z6 F# ~9 w5 ]0 y* K( z
  699.       {
    7 U% k* f; z9 {' r3 H1 G
  700.         dwTotalFiles=1;# N9 N! w5 _  o2 C: J' L9 z
  701.         dwDownLoaded=0;& u: }  |$ y4 g4 K+ ?
  702.         bSilentStep=TRUE;: p; [- V5 L! l% u" x  a
  703.         bCompressed=FALSE;
    ' ]' I% K- w6 l2 l  n8 ?+ X
  704.         strExtLocal.Empty();! N5 e/ C8 W- n8 O7 t
  705.         strFullName="readme.txt";
    / Y2 F9 G6 S. X5 N" G/ Q+ K7 Z. I2 k1 k
  706.         dwProgramState=AP_CONNECT;
    7 w+ q/ U6 D! R' ]  T
  707.       }
    2 L$ |, X" q/ ^7 T1 _4 ]" k$ _
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();* f8 Y$ ]: M. R( m3 H8 `# r! b: a0 s
  709.       dwStartUpSteps=2;
    ; ?4 t, q) Y3 W8 r/ }% ?
  710.       break;7 j( `' p5 }6 l4 }$ }8 F, Q* n$ F
  711.     case 2:
    ! n2 I. C! o. f: D. \
  712.       {( I, D" w" F  h# _+ T7 _
  713.         int iEOF;# }1 I% A2 {; h8 y5 {
  714.         FILE *fp;, q1 g& f8 U! w, l) W6 ~, B/ g
  715.         char szString[512];
    # O5 h% |+ C; x* w
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");
    6 V. r) ]" _/ I& x+ _( c4 x  X; _
  717.         if(fp)
    / R$ G5 R: J6 \
  718.         {0 _  h0 H$ T# N7 {8 R/ t9 }
  719.           do
    9 u) O4 j7 n3 P8 a# n
  720.           {
    * |& ^0 P# p1 W2 @
  721.             iEOF=fscanf(fp,"%s",szString);
    ; N$ v0 ?& B2 x- e. r8 y* k" m
  722.             if(strlen(szString))
    ; \+ l9 y- E/ A4 t3 [, R( L: m. L
  723.             {
    1 M- B9 `# `, R
  724.               if(bFirstChar)
    7 Y1 d  ~$ I$ u" e
  725.               {6 \4 q* ?2 w) E! E& S4 `
  726.                 bFirstChar=FALSE;
    - S  R4 f8 l+ U3 b2 F: G. g( q+ J# D
  727.                 bConnectIsBig5=FALSE;& Y. Y! @: |4 {- T% p! T
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;) p8 [. F- f% b, {/ M2 H2 f) t' C
  729.               }. |$ b' D/ d9 y0 q/ X8 C
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));8 u5 d1 u9 C: |) [3 P5 Q, [
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));+ p( j! ?. q5 l4 y( d
  732.               dlg->m_ListText.AddString(szString);
    ! t" \" s4 o: f( }
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);: `, @8 I; O5 ^  F; b1 i8 o
  734.               *szString=0;
    , b7 S( C' @9 V( G
  735.             }
    ( K$ @0 B/ n- `$ g8 W, n8 U/ x
  736.           } while(iEOF!=EOF);' h, j( |4 ?# S/ K* @% F
  737.           fclose(fp);
    : T! y2 Q3 B1 y
  738.           unlink(".\\DownLoad\\readme.txt");. J" E$ N# n/ O
  739.           dwStartUpSteps=3;
    / S: X, z/ o" W0 P# c6 c# Z
  740.         }
    2 v9 L- s6 X! {0 o8 }  x
  741.       }
    ( z1 i6 e" P& W  t# h8 m0 C
  742.       break;2 z2 f+ h6 n1 u, k4 r1 J6 L
  743.     case 3:
    ( c( g( S6 C1 d: M8 }0 t0 A3 ]; }5 D
  744.       if(!Dn.Connected())  ~( F0 u# G2 X5 L+ I9 L2 _
  745.       {
    , f! F, V- }1 s* Q$ T) v+ R" K
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);
    7 @8 I: X: z" l+ _6 X2 i4 ~, ~/ R
  747.         dwTotalFiles=1;9 m" x6 c# F" G) e% H
  748.         dwDownLoaded=0;+ V) X4 V! |1 m
  749.         bSilentStep=TRUE;" Q- G( m$ ]7 L: m/ V
  750.         bCompressed=FALSE;! w9 e- i6 U; q. x2 D
  751.         strExtLocal.Empty();
    & _- M8 k6 {( {4 z- ?7 C* K2 T
  752.         strFullName="checkversion.txt";# M- B' ?0 u4 r& N- |# t( u0 g
  753.         dwProgramState=AP_CONNECT;# a; K4 U) P) a  h/ H. p7 d
  754.       }
    0 V6 \1 ?8 P$ Y3 B9 |. M4 U
  755.       dwStartUpSteps=4;
      a+ q3 I. a5 O2 }. O1 ^9 k
  756.       break;, N! ?/ `6 G/ d, |- ?
  757.     case 4:
    ! A5 F% T5 J* F. i+ |5 G) r
  758.       {' o1 y7 \2 G. N# N6 z2 `& d
  759.         FILE *fp;
      w9 H0 G/ Q$ n$ a0 ~5 e
  760.         char szString1[128];
    5 H& w2 Y0 ^3 m6 d& U
  761.         char szString2[128];: a  f: B8 Y) |$ b3 U& b7 M. a$ a5 V
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");  P+ }6 C. o$ `! G
  763.         if(fp)
    5 @$ N) b) Z* D# x1 n: U* M) r
  764.         {
    ! C! r; r; x6 `/ b1 ?9 \. t2 b- b
  765.           fscanf(fp,"%s",szString1);
    7 B* `0 E/ ~: @) [+ q$ y$ h7 K
  766.           fclose(fp);8 L. e+ x3 `  T. Y- F4 a, c9 C4 f
  767.           fCheckVersion=atof(szString1);0 @9 G2 e% Q( i
  768.           fp=fopen(".\\checkversion.dat","r");
    ; D" f. o0 |+ g2 y2 R0 S
  769.           if(fp)7 i8 \+ V9 w) W" H$ `# A8 Q
  770.           {6 I: X: s( ]. `) J' k. T$ w' k
  771.             fscanf(fp,"%s",szString2);3 A0 s- T0 a/ m! Y( o# T
  772.             fclose(fp);3 ~( |; r7 z. n: P- f- }8 @2 M
  773.             if(atof(szString1)!=atof(szString2))# d3 ^1 }. U/ c* w- ?* g  b2 p
  774.             {
    ) Q5 i2 C( f6 h0 M$ c) h/ ^) G
  775.               if(!Dn.Connected())  q- _9 ?4 ]/ [. n8 y
  776.               {
    8 l" i) A) c0 x0 L& c( @  O# {7 E) }0 d
  777.                 bFirstUpdate=TRUE;$ W  b% a1 l9 |+ w4 @& N; P4 X5 G
  778.                 dwTotalFiles=1;$ S/ k9 d: t( p9 I% @6 d  L
  779.                 dwDownLoaded=0;: D; ~- D+ H7 d4 X* j
  780.                 bSilentStep=FALSE;
    7 b- J$ y. V- I; a3 v7 T
  781.                 bCompressed=TRUE;
    - z  u+ u5 I8 o9 k: H% [- P: ?
  782.                 strExtLocal=".\\DownLoad\";" ?6 r9 U; E- q8 w
  783.                 strFullName="update.txt";
    0 y/ i* m* L/ z: X7 T  A
  784.                 dwProgramState=AP_CONNECT;
    ( f, V9 c* A8 G* n3 L# N
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");" j7 r* k3 m/ m8 C" ~
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");; K1 f2 _  F. ]
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");) P: n9 s2 d! z9 d% M# V
  788. 8 S$ n( X1 h: F' L( S
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);  L# y$ M  F7 F3 H0 B  f# i
  790.                 unlink(".\\DownLoad\\checkversion.txt");* m3 {8 e! Q/ O2 z' K: m
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)
    , ~7 _  P/ D) a& v, w6 x
  792.                 {7 r# o. k3 }1 W2 W: }% R8 }
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");
    5 G- v& C) t- d# W
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");
    + ]& Y7 l$ G: }9 j9 k; N1 u
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");: k5 `' ?, x" k+ m8 |
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);6 V0 o9 \6 D6 m! C
  797. 7 g  h) i! [; }5 j/ c) z/ S' @
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");! b+ J/ w  `  \4 i0 t. M# m
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    4 m3 n; e" D* ^( _6 z2 Z
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");
    # `8 B) ]' U3 \" |
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);+ S* n6 m6 T) B2 @1 }0 \! G7 e
  802.                 }
    * p9 N4 |2 h9 v) N
  803.                 dwStartUpSteps=5;
    0 |6 j, U/ [( @; l1 T* g
  804.               }' C: |3 l) C6 e  N6 j
  805.             }
    # q, E* |' J) `( C
  806.             else
    ; j/ S: H- n' E# ~7 l6 ]* ]
  807.             {
    . z3 q8 H# Q, h
  808.               unlink(".\\DownLoad\\checkversion.txt");
    : C8 z5 B' m' A" K- z& w
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    7 i" P4 F3 ?) M2 f6 e7 O
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    ! Y& ?  I' N: i, @- d
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");
    3 p0 z" C# M/ O' C4 N1 ~
  812. " r7 Y% ~' e: \
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);2 c6 z  C- Q; p
  814.               dwStartUpSteps=99;
    " @2 j. j" b% G5 H
  815.               bFinishUpdated=TRUE;
    7 d# N& e& p2 R
  816.               bCanUpdate=TRUE;
    : ]9 X3 d4 {- i0 L: i
  817.             }
    % O/ {( ?& d' ]; v! |5 Y" E5 p1 m
  818.           }9 f1 N. I" T% u' y4 }$ g: [; R
  819.           else7 ?% k3 p# |" w2 ]7 l0 O* K
  820.           {9 A+ w) w, n/ s0 `1 {/ T
  821.             if(!Dn.Connected())
    " a8 `+ W0 x% s1 a' @) Q
  822.             {9 I9 Y$ @4 d3 I& p( P; o3 j; H. A5 n+ C
  823.               bFirstUpdate=TRUE;
    ( u$ a; O$ {- \* l. f
  824.               dwTotalFiles=1;
    8 ~' a6 O- l  y4 h/ V
  825.               dwDownLoaded=0;  T2 W7 F; Q5 u( B. Y
  826.               bSilentStep=FALSE;4 D" ~6 Y& Z6 z' O& ?8 c' f8 |
  827.               bCompressed=TRUE;' l: A# v5 c: r: L: I" l$ I
  828.               strExtLocal=".\\DownLoad\";$ N! L" z/ o+ g2 ~5 e# s
  829.               strFullName="update.txt";3 P7 |4 a, Z7 B' l' `  N+ t9 N7 B
  830.               dwProgramState=AP_CONNECT;
    / `& r$ m3 a& C. P8 K. L$ G
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");+ D8 G8 R9 r" f6 N4 V" k7 Z/ l
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    ) y! D5 N: K# |# \, m2 A8 [
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");
    4 J1 x: h& f3 j9 z# A% d
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);# b# j$ a5 h# g6 f! B# t% {% M
  835.               unlink(".\\DownLoad\\checkversion.txt");" L/ D' {5 y: e( m
  836.               if(GetFileAttributes("Wsa.zip" )!=-1)9 U& a' n+ e. U; E
  837.               {
    0 w8 f. E+ B- T; F1 e( G4 D+ G9 W
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");8 y6 ^  G: {$ z3 R- U  r& w
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");
    ! s7 w4 \/ @2 {' }& f
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");
    $ e) e3 t; J. @" ^  k$ `
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);( M4 h5 G  R( t9 m# o
  842.                 * h& c8 A" @* b3 W
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    " X6 v5 {( l0 ^" P. t
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");2 u. D& W  A( ~  H; t
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");
    ! W9 G* c: j) j. S! C  `1 u# d
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    9 F% Z% y7 i, e: U5 I
  847.               }
    ; Z+ G, b1 P& W1 ]3 M
  848.               dwStartUpSteps=5;
    3 M, s5 Q. w2 d! X$ L& k8 Q
  849.             }% {1 G3 [$ D! {8 ~; |1 y
  850.           }
    , M7 D" y6 M. Z
  851.         }7 a6 l6 W3 m* U' v& o
  852.         else
    1 c/ }1 |# K& Q; d4 k  ~3 Y) d
  853.         {
    + }9 Z# ?' r2 N0 W+ t0 ^$ U
  854.           dwStartUpSteps=3;
    , F) l! p; q: J  M* P7 }- W! \. s
  855.         }
    , e6 c6 X0 K. h  p. v% X( s0 W
  856.       }
    2 q. G5 h3 L" O5 B9 t
  857.       break;& e6 A+ L: ]6 V# J+ O5 Y3 Y
  858.     case 5:6 I$ h% M" G2 U9 b$ f% I# }: i0 M
  859.       {
    : |* G$ ?/ J+ y( e$ \7 f$ B
  860.         if(GetFileAttributes("Wsa.zip" )!=-1)
    8 _: M& ]4 P$ w6 o2 M7 C
  861.         {
    3 N; \3 Q- y0 u5 T) T  @
  862.           int opt_overwrite=1;
    ) k; ?; j9 B+ t* z5 e; \2 \
  863.           int opt_do_extract_withoutpath=0;
    , G$ f7 x. S' O) ]
  864.           unzFile uf=NULL;  \# C0 I" x; z+ n1 o

  865. ; @( D9 j$ [6 o# k( f) [
  866.           uf=unzOpen("Wsa.zip");# L% J8 {) q( O) q" A9 ?
  867.           if(uf)3 I7 |9 L& O  y/ ~4 l
  868.           {' J; }6 W. K; c4 z3 R
  869.             do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,NULL,ProcessProc);
    3 i! q9 S) K1 _2 l' i1 T1 j
  870.             unzClose(uf);9 X1 G3 U5 l* Q/ k* \9 L! z' B7 V  g
  871.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃ЧΘ.....");1 d! F3 @3 p4 w0 w% U. Q- x+ o
  872.             else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压完成.....");
    8 v1 X1 i! L2 e6 P, }. h
  873.             else                                                      dlg->m_ListText.AddString("Unzip OK.....");
    * G% H0 j9 K/ H/ L3 G3 c8 L
  874.                                           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);2 w6 H! y1 {8 D  Q
  875.           }
    : b4 b3 {' S* e4 r
  876.           DeleteFile("Wsa.zip" );
    / d3 i* ?. H% C: [: @
  877.         }  ~9 V: d! p8 Y5 w; H& g

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

2 k- p; O4 Z' g1 R* P& ^. r

評分

參與人數 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 來自手機 | 顯示全部樓層
东西不错,只是现在研究的人少了。
回覆

使用道具 舉報

寂寞在_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
回覆

使用道具 舉報

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

本版積分規則

关注公众号

相关侵权、举报、投诉及建议等,请发 E-mail:admin@discuz.vip

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版發帖QQ客服返回頂部