找回密碼
 立即注册

CSUpdate.exe源代码

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

2 J, n. U5 m6 O- F6 V! W, N* @
  1. / RevApp.cpp : Defines the class behaviors for the application.
    ' r  h" o7 i$ s# ^# e- K' y4 `
  2. //, L' Y, N! V$ v& L0 j

  3. / ~: Y! W4 I8 d6 N& q6 V4 W" p" a& D
  4. #include "stdafx.h", B& ^7 ^! I6 M9 E; g1 k# J
  5. 5 J" N, s0 m' H& V! g. k, U! d
  6. //#define UNICODE
    % p3 e2 {) Z7 b5 F2 R
  7. //#include <gdiplus.h>& M# t! S& ^2 {& v% q5 m% p- g
  8. //using namespace Gdiplus;/ o" [  i6 s/ X4 \

  9. & `5 E9 Y7 a0 i% w* d
  10. #include "RevApp.h"* T7 [8 G( e; I  P& x
  11. #include "RevAppDlg.h"* U  G$ S, p9 F: T0 w, \) T
  12. , {8 \4 r; b4 r  G. O
  13. #pragma warning(disable:4786)
    8 {/ ~" b) d/ {' X$ [5 @! Y
  14. #include <map>& n) x" Y+ h, L
  15. #include <list>" n2 C1 m$ R8 p, g2 a
  16. #include <direct.h>
    ( e, z8 \% r1 h5 ?

  17. + T* t) r5 g9 o/ A1 |
  18. #ifdef _DEBUG& o2 F" ?( {! N/ ]3 Y$ }. @
  19. #define new DEBUG_NEW4 k7 u, _/ K; v$ b! I+ V
  20. #undef THIS_FILE
    / V  d) Y9 D4 I& k( [$ {
  21. static char THIS_FILE[] = __FILE__;1 F; @' @) a2 z9 G  @
  22. #endif4 K" M* e: V: T/ T& ^) L
  23. #include "SkinResDef.h"  ]# g: H) d$ x5 @3 ?9 a& F1 @
  24. #include "ChangeBG.h"
    * Y7 Z( M* }( d, x. r% T
  25. #include "AFXINET.H"
    1 F- A2 G8 l* O1 W% o

  26. 6 a4 T( Z2 u! R+ q
  27. #define TRADITIONAL_CHINESE 0
    : t( v! B( Y) E3 S' N
  28. #define SIMPLIFY_CHINESE 1
    9 k6 k% c+ {, g: n0 v0 S: v3 S$ T
  29. #define ENGLISH 24 `, O) @: k9 D1 q6 H, ^0 A) w
  30. int m_iLanguage = ENGLISH;
    % W/ F  r+ r9 p% E7 F7 |
  31. /////////////////////////////////////////////////////////////////////////////4 e/ O5 b  _, A  f$ `& J& k
  32. // CRevAppApp6 E7 R  b/ X4 Q9 y( {+ [' A. g; f( x0 u
  33. % U1 C0 l' I" ?; }' n
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)
    ( Z: w0 X( q% H
  35.         //{{AFX_MSG_MAP(CRevAppApp)$ Z3 W- }+ o) ~7 ]2 ~" i
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.
    ; B5 C; x, D" r2 ]- u" G
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!6 I  b  j! P" \+ V: Z
  38.         //}}AFX_MSG* \6 G/ J: {) C9 d6 |7 p3 {
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)
    - ^/ s2 Y( E% @% t$ c4 n
  40. END_MESSAGE_MAP()
    ) T# @( j5 E" {1 q
  41.   @$ i7 |1 {: V0 L, _& o
  42. /////////////////////////////////////////////////////////////////////////////. B, N3 \1 T$ q* S* u  N
  43. // CRevAppApp construction: p: z% q8 B* B6 P" P

  44.   ]2 [9 o7 Z& E& Q! w. s% g
  45. CRevAppApp::CRevAppApp()
    1 b4 e  @" S& u( K6 A
  46. {% S4 [: v5 x2 x2 p& W6 _; E; i
  47.         // TODO: add construction code here,' ]/ @' b" `: C1 S
  48.         // Place all significant initialization in InitInstance
    " ]9 x* a# D' U4 y! [
  49.   bDisplayIsBig5=FALSE;+ z( B6 f5 n# ?8 s$ A3 D8 J; W
  50.   bRestartUpdater=FALSE;. H5 R- \( h# E
  51.   bFinishUpdated=FALSE;
    2 o1 c1 Z5 _% w1 V6 H9 C5 I
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;
      a# _* ^$ @+ I9 M4 \5 n) s! B" I
  53.   InitChangeDataBig52GBKS();- F% ~( E. F7 h) W8 y/ ^# ?2 g* Z
  54.   InitChangeDataGBKS2Big5();& ], I+ E+ n2 u2 J
  55.         //
      r& k4 s: ~8 W; c3 I7 ?; P
  56.         bClickRunExe = FALSE;/ H4 ^3 {. S7 l$ E: d9 H. u
  57.         //3 U6 H4 b- `/ _$ s  R: o3 I9 R- w
  58. }8 _4 \% k$ ~4 o! t

  59. ' q  q0 Q, w5 P) N- F0 @
  60. CRevAppApp::~CRevAppApp()) J: n) K# ~& o7 ]7 |. H. {
  61. {
    " t8 x% ~2 O' S2 c/ ]$ p- x
  62.         // TODO: add construction code here,: Q/ w  f. \: u8 D4 S6 }- V5 T' V
  63.         // Place all significant initialization in InitInstance( b( c% I* ]) A8 v, \& `8 V! D
  64.   EndChangeData();$ U" F$ P6 V3 M7 |
  65. }! D9 E* j4 H- D: W' B

  66. + j1 `4 P+ G5 `4 `0 @8 g
  67. /////////////////////////////////////////////////////////////////////////////( b3 c( \% b4 x: F3 r
  68. // The one and only CRevAppApp object
    9 Y! U9 {! F) n2 i0 Y5 [( E: X  Y1 m
  69. 8 }" M! E7 |3 n: f% Q1 ^5 G
  70. CRevAppApp theApp;5 G2 P# C2 _6 D7 z. }
  71. 6 p9 m  r. B+ A8 }2 l: q1 C
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)
    9 I& V6 e, L! ?/ {
  73. {
    2 _# o5 `  ~1 F  r
  74.   int iEOF=0;
    ; W6 Q& H4 e6 D8 W, `+ r5 X' |
  75.   char szTempName[MAX_PATH];
    / |. w9 z4 ?: \
  76.   *szFileName=0;+ [! q) B3 L, W6 u, y
  77.   iEOF=fscanf(fp,"%s",szTempName);+ T% y* f! `& S( r0 L4 j5 m
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')
    & b6 s: j- u# U6 c* f2 y# m- I
  79.   {
    ! j- ^* V. j0 t# V
  80.     strcpy(szFileName,&szTempName[1]);+ V2 J# e9 c- [- n5 ]* T$ h
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)
    - H6 m% A; z9 ]" t
  82.     {" O  U5 c. B: ]  ]+ Y5 m! }1 Y8 H
  83.       iEOF=fscanf(fp,"%s",szTempName);  \5 u% r9 H5 |2 u$ @
  84.       strcat(szFileName," ");
    . |+ R/ S" V6 f2 p1 o; f$ u
  85.       strcat(szFileName,szTempName);+ K$ [% d. W+ U) w7 A
  86.     }
    9 v# O! e, o" T# ~7 w
  87.     if(strlen(szFileName)>=1)
    $ g" @0 j. f4 @) G4 L: R
  88.     {
    6 |- G1 E$ u9 G/ k3 F
  89.       szFileName[strlen(szFileName)-1]=0;
    1 q# d+ h( |* T" f7 z
  90.     }) B  q9 C. {! O$ ~9 h; p" \- @# I
  91.   }
    $ _/ |5 g- L8 g$ ]$ d& |
  92.   return szFileName;; v) Y+ O2 @7 p
  93. }
    * W; ^" |8 W* B9 \
  94. 1 X- h# K: @2 d3 L
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)" r: ]9 _: t3 d/ A! X
  96. {8 I/ {% g4 `1 b3 Z- z
  97.   FILE *fp;" Q8 b' s. [) `5 }& Q3 O
  98.   char *key=NULL;: D& _6 I2 _& T" R+ O5 D: V
  99.   char version[MAX_PATH];
    * b8 _  }2 J3 l9 O, ?* a; C
  100.   LPUPDATEFILE file,olds;
    + I) `) U& m; V- H7 T. F2 P
  101.   std::map<CString,LPUPDATEFILE>::iterator p;2 l5 X( ~6 t0 e* ]$ B8 t
  102.   Z. G$ ~' g  z6 I: o" O3 D. p
  103.   UpdateList.clear();: D2 h) ~5 I0 E2 K
  104.   UpdateFile.clear();, f( @: w! P+ E! w5 f0 h
  105.   if(GetFileAttributes(filename)==-1) return false;1 u' t6 c; U7 p0 d
  106.   if(!(fp=fopen(filename,"r"))) return false;& o# E9 Y0 V0 L6 R* @1 B
  107.   fscanf(fp,"%s",version);
    1 E; C, J' e0 F/ `! M
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }  }7 K2 u+ J. L
  109.   while(fscanf(fp,"%s",version)!=EOF)
    ) ?; X1 e- ~& l# ]3 N
  110.   {
    & Y% ~# B% E# ~/ v
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));  L$ U% q6 `! C7 j1 [- ~
  112.     fscanf(fp,"%s",file->path);
    5 n3 t" [% B9 F
  113.     ReadFileNames(fp,file->file);5 g" W1 l* w) _/ P3 @/ I" p  ^
  114.     strcpy(file->full,".");
    $ N; q8 J3 ?- B8 Y/ C
  115.     strcat(file->full,file->path);6 @# ?7 P. ]; G+ T( p
  116.     strcat(file->full,file->file);/ G) h; n5 b3 c
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())
    6 h/ U' x6 ]- z& ~1 z1 b
  118.     {
    $ S& Y' C+ Y# Q6 a7 w. U
  119.       file->vers=(float)atof(version);
    ( f8 I6 d+ W# @  h- s
  120.       UpdateList.push_back(file->full);
    ) V5 N& I+ x- T9 b1 m5 n
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));
    8 w  n1 f4 w4 h5 l# c
  122.     }& P6 n: A- l, {" D  X
  123.     else4 G* g8 \$ u1 p8 l
  124.     {
    ' m6 w# s$ R) `7 S5 _# ^3 Q4 w
  125.       olds=(*p).second;
    - E6 s4 s! _# `! A
  126.       if(olds->vers<(float)atof(version))% S! ~$ j/ f1 @3 u9 ~! m3 z; ?
  127.       {. A( r& ~7 U( P2 i/ p1 K
  128.         olds->vers=(float)atof(version);
    / t8 t5 b5 J" w! N3 d
  129.       }4 E# R0 [5 S) T3 t7 E
  130.       free(file);, ]  h/ @4 C' [2 D" _
  131.     }
    . {* X1 W1 D  k" k/ z+ _
  132.   }
    1 v) p8 a: i2 a# R
  133.   fclose(fp);3 A2 a2 ?: d# X) t
  134.   return true;' X5 i. ?! U" M& r7 S
  135. }
    * u$ i. Q* J4 P  n( s( G, x
  136. + d. j7 u  D9 n' e' P  S# a
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)
    5 n/ R+ i+ c$ A, ?* T
  138. {! w% X) N. {0 p4 t1 P* E3 j
  139.   TCHAR  szFull[MAX_PATH];& L/ `! D* o; |/ L+ e
  140.   TCHAR *token,*inter;0 p' R* c% h6 h
  141.   *szPath=0;7 p. q% E8 L  ~; ?$ @- S: F7 R
  142.   strcpy(szFull,szFullPath);
    3 S: e  N; B9 a3 m& |
  143.   token=strtok(szFull,"\\/");
    6 P! s& ^9 q: x* e! [" b. B
  144.   inter=token;
    ! X. @) f8 [: e. E, j
  145.   while(token=strtok(NULL,"\\/"))
    ' Y% E& P: A$ u7 [! I- ~
  146.   {1 ]: f1 E: ?9 B1 Y$ c
  147.     strcat(szPath,inter);
    + y8 P) P: d' i& Y( V; l
  148.     strcat(szPath,"\");* W, X2 G' h# s9 _& D8 K
  149.     inter=token;5 T! x( X7 s( }
  150.   }8 c; Q# n6 s  \7 s  i
  151.   return strlen(szPath);
    2 U  {/ T+ {2 L: P4 S
  152. }
    6 G$ b' C$ P: u, y, P5 u
  153. & C1 |& f) l& P% ]  ~8 X
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase)% A  ]8 g' W4 ?( J* |# h2 l0 A
  155. {. z+ E! b* h2 u/ g1 R
  156.   DWORD attrib=GetFileAttributes(Target);
    8 f$ Z9 \# U9 E. e5 V5 f8 q
  157.   if(attrib!=-1)
    8 A: P, f. O  `, }
  158.   {
    7 b, J. o% `1 E8 [5 o3 @! V$ ^
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))
    / I+ t% ~6 V7 u# _! ^6 }
  160.     {
    # i3 U9 `  ?4 o: h0 b- c2 q! f
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);: Q* V7 Z1 ~1 s( W3 H) j
  162.       SetFileAttributes(Target,attrib);  i4 m) y* C/ t& O- v
  163.     }
    0 y. G4 x% ^9 ~, U
  164.   }) |0 W( o; S5 o7 p, s2 e. k
  165.   CopyFile(Source,Target,Erase);
    3 t, M: a% Q2 Q0 r5 \4 F
  166. }' ]' R1 m6 x* B) Y3 i7 T& `
  167. ; Q2 Y  [8 J$ l# c$ J0 C
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)
    ( R/ T" I/ P! [+ [! W
  169. {. d6 A% b0 U; D( {* O+ a% ?
  170.      FILE *fp;' [( y7 d" d. H2 ]
  171.      char  szBuffer[8192];
    7 J" _* |) Q( J5 |% J- l" [2 U
  172.   va_list  argptr;: T; R) L7 ~5 e

  173. 3 ]  L* P- V, [) Z% u  G. d
  174.         va_start(argptr,message);+ D5 l# H+ e: H% p  e/ y5 X  N) x
  175.         vsprintf(szBuffer,message,argptr);
    1 P0 j2 d; K3 l" \8 ~- W- w' A
  176.         va_end(argptr);  ?% k- H% U, d  R2 W4 U
  177.   fp=fopen(FileName,"a");
    / P7 o. e5 t- t
  178.   if(fp)
    ! q. `3 Q0 I4 |% N- [
  179.   {
    ) i% g$ F' n! h! y
  180.     fprintf(fp,szBuffer);' Q* m2 \$ P. H- s* F
  181.     fclose(fp);
    5 J5 J& R( w. m5 v1 t& P' k
  182.           _flushall();
    $ i8 j+ Z5 V$ E$ s9 c% A6 |
  183.   }
    : R8 i, X7 u+ P4 r4 A
  184. }
    5 x- |" e7 \" ?: k" s. A8 C
  185. 6 M8 ~, R& Y$ s' k! r2 R" S# R
  186. BOOL CRevAppApp::Fclearf(char *FileName)
    0 D, \/ \( V/ G' }; S) v; b- Y
  187. {/ _/ E4 _% m. `! A9 R7 T
  188.      FILE *fp;$ i2 }# O: N* c1 V
  189.     DWORD  attrib;2 z( b* T1 z! c2 y
  190.   attrib=GetFileAttributes(FileName);; ]& c% k& _% t
  191.   if(attrib!=-1)$ e/ Q9 G5 G+ S5 X# |8 Z- B
  192.   {
    6 [+ B8 W+ g& \- d  Q( P6 }+ B$ i
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);. w' C4 G$ w7 ^$ z3 a/ Q
  194.     if(!SetFileAttributes(FileName,attrib))+ T/ F3 S; G) c1 n' E4 H
  195.     {8 W) v+ T; M* W7 ]" [" K( P
  196.       return FALSE;( m+ A; v9 Z3 W& j" w' w1 x, t
  197.     }" U5 ^3 E- W0 N
  198.   }
    / [4 y: V% I  R% V  A4 P
  199.   fp=fopen(FileName,"wb");
    % ?, _: j' k% j
  200.   if(fp)" h7 ^( Q( ~' M' S0 V! B% S
  201.   {
    ! e: A7 P5 q: Z' Y9 H& u. r$ b
  202.     fclose(fp);4 C  w  ~0 n5 J$ {
  203.   }; b  l/ e' S7 X7 s+ o
  204.   return TRUE;
    9 M, u2 a7 e, J8 l. ~
  205. }4 W. m7 |0 Z8 Y( x" s; e

  206. 4 U) ~! E( u8 _
  207. BOOL CRevAppApp::UpdateLocalVersion(void)
    * B" Y7 g% S* A9 ~1 ]. I4 j
  208. {
    " q7 ~/ r* M! f; P' t) `
  209.   char filename[MAX_PATH];
    7 _- p. g. x7 D; S% q
  210.   LPUPDATEFILE file,olds;9 v2 Y* S! R# M2 T" o
  211.   std::map<int,CString>::iterator i;
    " c  c& q% ^. w* d0 n# }) `
  212.   std::map<CString,LPUPDATEFILE>::iterator p;; i2 d4 U1 P* J; U1 T/ N$ j
  213.   std::list<CString>::iterator l;* A) M7 l; Q: F/ b4 C# ]
  214. 2 g! T; h; L0 D- I* q/ Y9 ~
  215.   if(bFirstUpdate): S" T: r7 @$ `  ?; J
  216.   {
    - @0 z: R, G: R% l0 k: [  K  i4 z+ u
  217.     dwCurrFile=0;
    - W- F( R1 I4 _- n' v3 U
  218.     bFirstUpdate=FALSE;0 H/ Z+ {9 [/ l: w( l  e
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())( @4 t3 Z( Y+ h5 ~! w0 V
  220.     {& X4 T7 V- E. t6 G. R3 [5 {6 D8 |
  221.       dwTotalFiles=UpdateLocal.size();
    4 D2 ?+ F" z9 H
  222.       dwDownLoaded=0;
      U2 P. C7 X1 y$ d8 r
  223.       bSilentStep=FALSE;
    6 E6 h, Q6 q2 V2 o/ M0 Y; T- q
  224.       bCompressed=TRUE;
    1 ?0 m+ B5 E9 j0 A7 @& r! U
  225.       strExtLocal.Empty();
    ( C, T4 D0 ]1 j
  226.       strFullName=(*i).second;% z, v( @) N' Y' y
  227.       dwProgramState=AP_CONNECT;
    $ L  d- r! G- d8 W% f
  228.       return TRUE;2 I" R8 X& `1 |; v
  229.     }! R- Y/ H" K9 f' r6 W! `3 l  }
  230.   }
      e; M% b% g; `$ ?# Y
  231.   else if(bRestartUpdater==FALSE)$ j7 I' v* t# q- w3 B
  232.   {
    1 j! K8 O' d. E6 g
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end())# R. L1 b3 W# a0 w% g
  234.     {
    " J9 [4 z; \* ?
  235.       file=(*p).second;4 J! ]) d+ C3 c) ]4 c9 q6 ~
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())
    / {1 m# a  y6 J0 x( O1 x
  237.       {
    , [  g5 Z* u/ m  J4 U, L
  238.         olds=(*p).second;
    $ k7 }9 V! @- v2 S
  239.         olds->vers=file->vers;
    % r& O3 v) v. f2 E7 g- s, O! |
  240.       }8 `5 ?0 Q  I2 U, s  X# I. w
  241.       else' y8 q8 |4 g% }4 i
  242.       {
    + `% R. Y1 M& g4 \$ D$ D% i
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));- L  ^; u3 ^- U  a: _: [( L
  244.         memcpy(olds,file,sizeof(UPDATEFILE));
    , N( S% P! _8 I# @* K6 o" P7 Q3 h: L% S
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));. [! X: ?+ o2 v0 N
  246.       }1 m0 d3 E2 B, A& Z$ W+ v, t
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");' i. ^* P- V* {+ _
  248.       sprintf(filename,"(%s)",file->file);9 v, E8 c! K9 v% S) }
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);# t( y9 A% [( Q4 D3 Q
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }
    + S/ M" z( U. k' U: c4 A# ~2 ]6 _
  251.     }7 h# E2 I$ c0 {/ {4 g
  252.     dwCurrFile++;
    - O$ i, u4 E1 }- A2 i& w7 e
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())+ W$ `4 _% c( t' }
  254.     {
    0 g. ~9 m. L- G& \9 s
  255.       bSilentStep=FALSE;6 j9 ]  E$ V& ?4 r4 t5 `. v
  256.       bCompressed=TRUE;0 N" X* r9 Q7 e3 ^- b  `5 [3 p
  257.       strExtLocal.Empty();+ W* F- o$ `9 M+ u! z( _. T. a
  258.       strFullName=(*i).second;0 b" r  [) T9 j' \2 G
  259.       dwProgramState=AP_CONNECT;! m8 d& X0 _5 ^7 G& u
  260.       return TRUE;
    % |; K6 m' q" B7 Z' p
  261.     }/ J$ G1 F! J3 V4 P6 k! _( M  ^) S
  262.     if(!bRestartUpdater)
    , D  Y# {" h' t7 a( p7 p* I  d. `
  263.     {
    0 ~" g# w( x, O/ w0 b
  264.       int iCurrSize,iFileSize;
    , y: e& @$ z3 P7 z/ p. f
  265.       iCurrSize=0;
    & W2 O! e$ e4 n! v
  266.       iFileSize=UpdateList2.size();
    , U# E& Z. O2 N$ K$ Q( M
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");( ~2 p0 r1 M" `4 o  @; W
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");
    ! Y+ h& U' s) ^9 g8 |
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");% A% [, v; o9 q6 S" a  K
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);# ], ]  g: i5 H- c0 l% E4 k  d
  271.       Fclearf(".\\update.dat");% E' A( v: K, F& }! }
  272.       Fprintf(".\\update.dat","Bloodyf\n");2 ?0 s- b9 S! z8 }' K" b6 K
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)
    0 z( y; v( e. ]3 q1 r/ k
  274.       {
    1 q! Z3 X8 P. m
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())
    1 L8 P9 |" a* ]5 @. B
  276.         {
    $ D( X. }) o3 g
  277.           file=(*p).second;
    ; M$ k' q& [  l+ V7 D# L, f/ z0 p
  278.           sprintf(filename,"(%s)",file->file);# Y# k0 E+ r) e3 Z
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    2 y: G1 X- T9 |# p  T5 l
  280.           iCurrSize++;4 d+ r' A2 [/ J% s/ ]. V
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));4 _- X, P6 T( E
  282.         }
    . n/ P0 h; D% S/ G# C# _$ u0 f) Y
  283.       }) b# P. ]3 l% Y8 V8 \/ @2 x
  284.       unlink(".\\update.txt");7 D/ H1 P; q! y3 X# t1 j
  285.       unlink(".\\update.tmp");
    4 h$ h9 D: Y$ y: V# F
  286.       Fclearf(".\\checkversion.dat");" f- s6 i4 j% D/ i
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);" R$ ]1 G9 X3 S0 V% J% K( n
  288.       if(UpdateLocal.size())6 o. b2 \8 C5 u2 k# t0 J' @
  289.       {
    * B' l3 U9 T9 ^' l
  290.         UpdateLocal.clear();
    1 `8 z& [4 J7 t  ^1 Q
  291.       }
    9 ]' A, H! g' s) f1 ?
  292.       if(UpdateFile3.size())! L$ _7 D: v2 {
  293.       {
    & t8 f- V% K; a
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)* k0 {/ w- K  m, }( D  T. \* H$ r$ U
  295.         {
    5 T2 d+ m; B9 p/ |4 e: }
  296.           file=(*p).second;" @  v* m  `6 H* C9 U
  297.           free(file);* s( _- B* n; n  m  `
  298.         }7 _& t$ y0 i: ?8 `
  299.         UpdateFile3.clear();
    ( G2 H# i/ V" g5 n( k5 w! I
  300.         UpdateList3.clear();
    ( K/ \. {! q) @9 j  r8 Y, D) o
  301.       }
    2 L' N' J" h  \8 {
  302.       if(UpdateFile2.size())' [: f% U" z8 b1 [) C0 \
  303.       {
    + T' m' h* L* o9 Y9 i$ e5 d+ I
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)( I  e$ W; n) L0 V% x$ |
  305.         {- F6 C- p  G! Y
  306.           file=(*p).second;
    9 G8 t1 c- }7 ^( s1 M3 L, M1 f; [
  307.           free(file);
    1 d: e9 A7 v, V7 k6 F
  308.         }
    ! _5 b5 j! l- f0 m5 w
  309.         UpdateFile2.clear();
    # `2 f5 ?7 X) x3 c9 W' }
  310.         UpdateList2.clear();  A& d: H# x6 |( ?9 n: O
  311.       }- ?! b! Q8 _% e8 j  G
  312.       if(UpdateFile1.size())
    2 z+ P* ?) }) V) y6 I
  313.       {
    6 c/ _. \) D; f3 o% Y4 r+ y$ {
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    9 x3 X  ~; a4 u1 ~- ~3 `: b
  315.         {7 U6 Z8 V- h7 f5 R, q
  316.           file=(*p).second;9 D4 z3 a" e( A2 V5 {
  317.           free(file);
    7 e- C! B* U' d; y' I& Y
  318.         }( ]& J! h9 ]/ a" L( h
  319.         UpdateFile1.clear();+ ]6 N5 A+ |' H( _2 M1 Y
  320.         UpdateList1.clear();0 D( G( K: p4 n+ j+ {% t$ D  j
  321.       }
    1 V3 `6 v7 w1 o* Q6 U( V2 O
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));) |! `) K9 _3 y! D) e
  323.     }
    1 Y" O9 f2 F9 X, m
  324.   }5 J# w' o" R' T  |) I: h
  325.   return FALSE;
    ) t5 A; z6 o6 X5 C9 K
  326. }+ E; S8 Z9 a2 r

  327. , i# T5 c  }: l8 F+ r
  328. void CRevAppApp::ClearAll(void)
    1 J8 Y+ \' ^8 y  C
  329. {
    + o, Y5 i: X' ~
  330.   LPUPDATEFILE file;
    $ Z; _. I# g. C( ^
  331.   std::map<CString,LPUPDATEFILE>::iterator p;0 \5 b, p6 p( F3 Q8 r9 c

  332. ! M8 `5 H  L5 m
  333.   if(UpdateLocal.size())
    + M2 K! \. n0 S' v' P4 P
  334.   {! |# j9 @5 @- {+ N9 P, r
  335.     UpdateLocal.clear();
    ; M% w) R* D; B' b6 b4 T+ A: L% k* O+ u
  336.   }3 ?/ V4 s( Y/ C! X4 J# e
  337.   if(UpdateFile3.size()), G! P( {& j! u) X9 n6 S
  338.   {
    4 q  H: e0 ?) ?% l
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)
    + `2 y' r1 |7 _$ M' G
  340.     {% @  a6 x1 w( i- P6 Y" c
  341.       file=(*p).second;
    % Y7 _8 |$ P4 B" _) |" e; X$ ]
  342.       free(file);
    $ d, q. `+ j2 {
  343.     }  q# O  h) {9 w2 `4 s
  344.     UpdateFile3.clear();7 {* T9 y+ M2 b: [1 a" I8 y) Y$ ?
  345.     UpdateList3.clear();) B% }5 _4 S. E  v/ U6 E) f
  346.   }
    . i% `/ p1 s  D0 H4 M
  347.   if(UpdateFile2.size())
    7 t, X- h* ^3 O
  348.   {
    0 r3 s% P. P8 T  Q  H
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    4 S% j" D1 F* |) C4 }
  350.     {: }2 \. y4 r8 l' {0 o6 A
  351.       file=(*p).second;/ C- E5 t& y6 \5 A
  352.       free(file);
    : m( X5 |7 N/ E9 S
  353.     }! \3 ]9 K: i* }4 l( M3 m
  354.     UpdateFile2.clear();( T6 w! j" D" i7 P7 V( R- `
  355.     UpdateList2.clear();
    ! U) D( ]4 X* a6 a  A3 a
  356.   }
    " H4 Z1 ~8 t0 c* v' R
  357.   if(UpdateFile1.size())
    # b/ d& f- o9 W: j; O# v3 C
  358.   {
    6 X8 M, h8 \4 ~7 @( A: e
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)3 o" R( ~2 P& F( |- a7 [7 l! u; E
  360.     {2 H  D' t. i7 u$ x9 _0 h
  361.       file=(*p).second;
    ! J8 i3 n: I0 l+ }. K
  362.       free(file);- [9 y* n9 ^! D6 e$ V
  363.     }
    9 Z9 Z( Z; |: \) w' q" h/ g
  364.     UpdateFile1.clear();
    5 ^$ Z& ^9 y' E3 ]/ Y5 e, a( H& ^
  365.     UpdateList1.clear();, m4 J8 \' ~; O& R# i' l/ P$ p3 B
  366.   }
    9 d* I& A  @% m
  367. }  
    1 a9 l! ?8 \: Q) e, S/ ?! B
  368.   
    5 ~2 V- }* E. V1 M
  369. BOOL CRevAppApp::CheckLocalVersion(void)
    0 Z/ W. \7 }5 \* p& N
  370. {
    4 w1 X# Q6 m- h2 W
  371.   int c;
    % h# O7 U* C1 S0 c( @$ O- T6 ~- m
  372.   LPUPDATEFILE file1,file2;
    : ]; J( ^3 K  u/ M
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;& {+ j0 n- u# ]. E& I
  374.   std::list<CString>::iterator l;. V% j$ c4 B- G4 q* N; l

  375. - K) u, O: F- y$ Q' v# f& u( E$ U
  376.   UpdateLocal.clear();7 b' G$ e1 E) j0 _- u
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);$ a  e* R/ D5 }& ^% Y: N
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);
    + _$ g, n% P7 d+ v7 h
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);# a2 g( }2 M7 @: E( x& o
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);
    # ~$ Y1 f. |1 Z
  381.   if(UpdateFile3.size())1 X4 [5 B" E* ]8 `! X, K
  382.   {6 j' q9 Z' l  \0 n8 F
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++)
    3 h& J2 D7 S" x0 u) E! n7 {/ W& m
  384.     {
    & X$ ^8 H) `( K) P' s
  385.       file2=(LPUPDATEFILE)(*i).second;( C5 C+ e9 |# g
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    ( J) f5 i9 B0 ^1 ?8 J" b4 h  J
  387.       {
    2 B# H; x5 n( m; [" b
  388.         file1=(LPUPDATEFILE)(*p).second;( V/ R% ]9 e, w/ `( p& }, I
  389.         file1->vers=file2->vers;
    ! `5 {- D% [( |. _  ^
  390.       }
    5 z5 L! M* ]' U. c
  391.       else
    + v1 p' ?) ^3 K0 [& g3 G- l3 {
  392.       {
    " X: S: H, O5 B7 i$ F5 I9 B( F
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));$ M$ s; e( l  Q9 Z$ B7 F5 X
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));9 @+ P- ?2 c! l# J8 o3 @
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));* ?4 Y4 p7 ^0 F) F8 H
  396.       }
    : M: X" g8 d* i0 l
  397.     }5 z& U5 D/ `3 H* J3 C
  398.   }
    $ F+ {  R* a+ w+ U' |% O
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++)
    8 ]) Q& F; c7 O  P
  400.   {3 `0 ~* E# _5 x: h2 }2 ~; F
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())( `4 w7 Z, e1 \9 f, R% H
  402.     {
    ' Q) t4 q8 W0 Q6 }
  403.       file2=(LPUPDATEFILE)(*i).second;
    2 ^' e  V7 l' s4 h( A+ v' ]* o
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end()), s0 c! K; j8 Q6 g0 r
  405.       {
    ; ?7 x; N) ]9 P) s
  406.         file1=(LPUPDATEFILE)(*p).second;
    & V: h7 w9 f! D# ?% A6 S0 g( X& v
  407.         if(file1->vers!=file2->vers)
    : l; [  U7 s# W* [$ p
  408.         {
    0 s9 O3 H) v, r0 ]9 `" b
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));
    9 P( J! f' e9 l; F
  410.           c++;2 P1 E/ i& T/ J: j+ c* K
  411.         }1 Y- r: z0 b! h# C# u- S/ ~* k
  412.       }
    ; A# w* ]0 X5 o# r
  413.       else
    & p* x, x' M! x4 n
  414.       {0 I" h$ H5 g* K% R
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));
    " N; a/ x0 ]& `  |' G. i
  416.         c++;. h; t/ t4 y4 d6 c7 c2 V
  417.       }
    / Z9 M, h! W& x
  418.     }
    6 ^* \$ f$ D; x
  419.   }5 Y& S) @! k. A6 H6 _! `- V" d, ?1 a
  420.   unlink(".\\DownLoad\\update.txt");1 b0 i- T  v5 J5 {
  421.   if(UpdateLocal.size()) return TRUE;
    * Y$ U* s' t; T& y7 F
  422.   else                   return FALSE;
    % I; M! z+ v: G& C! ?8 D
  423. }
    ( K" z0 V# N) Y' l

  424. & q4 ]# v1 n% |1 @6 R5 H! _3 P  @
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"
    4 v0 c# O$ Y0 {! r  m
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn"9 x5 f8 E3 V/ v( |$ U2 m# A

  427. 8 B$ r4 G* G0 f# N* E+ n0 T0 N

  428. ' K! {; N! _3 p* p
  429. 6 J! [0 \5 q4 y8 K& c
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile)
    6 T' ?0 b$ ~6 @; ]1 {
  431. {
    / Q, N- |) r* R- x
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;0 z7 s& N' C- {2 S0 n
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)' Z5 Y1 O9 _- l# ~! B" o6 C
  434.   {$ d3 T0 d2 ^$ o+ j
  435.     char szLanguage[50];' U1 w" d8 a0 _0 |% m% O
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");1 U$ p% a  W, v, N
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
    3 \0 D8 a1 x7 s3 _) ~5 H
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    ; Q( ?: ^' P- z
  439.     else                                   m_iLanguage=ENGLISH;
    * D' ], ~& `4 J9 c1 e! ^; }
  440.     char szRegister[100];
    0 E5 t# s/ y  A% m
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");5 i8 e% D8 g4 e- V
  442.     strRegsName=szRegister;: L) y7 c. x, {* q( e/ F
  443.     char szPatchURL[100];
    ' T! M3 I3 C( s) b0 O& h% v2 Q
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
    ! b! I: t! u$ J+ f: s* ?  ^7 t, g
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);% X, |/ T& G9 Q4 A0 `2 s
  446.   }
    ! H  p: X0 |2 ?9 a
  447.   else  C4 S, M$ f4 h' N! Q9 a( L+ J: M
  448.   {1 |2 H3 J% h; s0 [  a5 }6 R9 C
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);# v7 s& \1 r8 E$ O7 O
  450.     strRegsName=DEFAULT_REG_URL;
    " J& W( s7 T7 y0 I( r: o
  451.   }0 z" A# T8 _' l3 W% C
  452.   if(GetFileAttributes("hosts.ini")!=-1)
    , X) M$ _7 @& O
  453.   {# |+ j+ e5 u9 e% r3 ?# H6 ?
  454.     char szIP[50];/ x3 E, y/ w+ U) W" N6 K* F+ h; X3 f* `
  455.     char szDIR[300];2 x( E9 z; X' ~0 T1 C4 ^
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))% ]( V8 W- e2 x% G' I& r
  457.     {  }6 U9 Y3 _3 \6 c0 J2 u+ {' v
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");
    + m. Z' V3 Y4 N) r5 i
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");
    & }5 x& o% y, z
  460.       strHostName=szIP;
    . u8 X4 D; T, r' |' E4 j7 M
  461.       strHostPath.Format("/%s",szDIR);
    % f. s, J) G8 D7 s
  462.     }7 C9 ~+ `' [& n8 @% }
  463.     else
    / ?# x: Z$ c7 g$ u4 _9 X* t- @
  464.     {
    0 P# u' U% M% ]4 s# [
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1); H  H) k! X4 c
  466.       {
    ' V, n9 ~! p6 ]" B1 B/ I/ l
  467.         char szLanguage[50];
    * `3 c& q% U3 Q# G: ]
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    # r; U1 e' B+ r+ n
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
    7 E( v1 w" P& N  {8 B+ Q' |  H
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;1 [. s5 O7 ^( }' ?
  471.         else                                   m_iLanguage=ENGLISH;
    4 n& {+ M2 m0 [* c6 @% W
  472.         char szRegister[100];" g2 C3 N3 F" [9 f; U% _
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    5 k3 ?3 F, B+ `5 y- c3 s
  474.         strRegsName=szRegister;! @4 E, \- y5 \& }* }. B* W
  475.         char szPatchURL[100];
    ) ^, z6 y1 a( d1 A% l9 b" H
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
    3 @7 f+ O( v* S3 D: t/ w
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);
    2 o/ x$ K0 g; o( k) e
  478.       }2 Q) h# E4 S1 G6 O8 }
  479.       else$ I) A) a/ q; O0 |. f7 ?/ r
  480.       {
    1 v' q" k; F0 L& i- e7 M
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    0 M& q3 B7 V9 L. L/ c
  482.         strRegsName=DEFAULT_REG_URL;1 x& k7 u" ]  p& D5 E& w
  483.       }+ h- |$ s/ r1 V
  484.     }8 y/ o4 q" K: [, y
  485.   }
    0 U3 w" s$ E0 q1 s! r
  486.   return true;
    8 U: ~  g  B9 W8 D+ Q/ n) R# a7 b
  487. }
    : u' n# `- o9 c0 I- j" c

  488. $ {$ B- M% D8 K3 F1 X+ P5 q
  489. #include ".\ZLib\unzip.h"
    6 ~* E& A7 A* |+ Q$ _' ^7 U
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);
    9 g7 Y$ {5 q2 q
  491. /////////////////////////////////////////////////////////////////////////////
    " g- N. u: ^; ?% K  I1 e" F+ F- `) e
  492. // CRevAppApp initialization
    ! g9 Q- h6 p. d% l1 ~# q

  493. " C& T9 r+ N8 N. C; ~
  494. BOOL CRevAppApp::InitInstance()
    . S9 _. N* ], o4 k
  495. {5 G7 [" m5 q4 Q7 i! T( Q
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];8 r- @2 k2 N2 T! r7 D4 m8 n
  497. 3 s( h( Z/ v* B& o6 p
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);6 f( n( X+ }5 {" x" d" R
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))
    1 b' y* u, C2 {
  500.   {
    . k6 f9 g" d7 w, R" O! R
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");
    ( s5 W( t( U2 Q  x: Y
  502.     GetPathFromFullPath(szPathTarget,szPathSource);4 m+ {. }+ Y; u3 |5 Z0 d
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))! T- H5 k  \! C0 E7 G# @6 y. g
  504.     {; @8 z& o' e: I9 n
  505.       strcpy(szPath,szPathTarget);
    ; e1 R  h& |/ z; ?8 r  r
  506.       SetCurrentDirectory(szPath);3 J0 H( E5 H# q9 ~) X
  507.     }
    7 ]* G3 v" A! i1 z) ]
  508.   }
    0 z% |0 N3 D2 T( j' g9 o  T
  509. #ifdef _DEBUG7 R: A: T$ K1 h7 P1 @
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    1 Z; Q; r2 k& f) d
  511. #else
    + J3 G: t3 y% O) \" ]. u7 q
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))7 K1 ?- h4 |3 B; p: {& g
  513. #endif' Y- ]) ^2 j- S# B' p; f- f) i8 @$ [
  514.   {; K- \9 y9 f! P# @
  515.     char tempFileName[MAX_PATH];) ~. G4 Q4 r# T. s$ ]# l
  516.     strcpy(tempFileName,szPathSource);
    8 m8 g2 t# U: O5 l( d
  517.     tempFileName[strlen(szPathSource)-12]=0;
    7 ~" c" W+ a# O- i( Z
  518.     strcat(tempFileName,"\\$CSUpdate.exe");
    $ r3 L8 q5 Z4 j7 j2 Z8 x# ]3 \
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);
    ! J4 S! m# t8 ~' m  F0 D" h  Z
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);
    2 u2 d6 C) s& y# \: x; u2 I& g
  521.     return TRUE;
    , k9 }! f3 @  f% a9 N9 f
  522.   }
    / {4 ]0 F8 h, V* A! \
  523.   // Nuke 0118: Delete run.exe
    5 |. p- x% [! d9 N; C7 [' o) O
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );
    ; ~) T; D) x( a0 o8 r
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");6 c" U1 u: z: @! P7 l
  526.   if(!ReadCfgFile("Config.ini"))* {+ P4 R2 W  \) E" }
  527.   {( E" {, r3 c8 z0 E8 G, S, c+ j
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);9 b  j: K" v, b7 O" @# {9 W! }, q
  529.     return TRUE;
    6 c) l- m$ s- m6 _# h
  530.   }' I7 o) R1 q$ s6 s% `
  531.   HANDLE mutex;
    3 g: H) J! g- C( C2 j" V( z
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))
    ; p3 P5 C; F  f5 ?
  533.   {
    / b, e0 o# X- P, ]7 t
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)
    ; i/ g9 A2 E+ C
  535.     {
    + ^# n, x  }3 ~! n7 ]# A
  536.       CloseHandle(mutex);- h: T' F& s+ [8 P6 H, i8 w
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);# U) |; B* o6 x  Z
  538.       return TRUE;9 o; H2 f2 G! J1 ~% F7 N
  539.     }
    8 e7 F2 M4 w- b, c' k
  540.   }  9 T' a5 A, d6 |
  541.   CloseHandle(mutex);
    ! w- ]" T8 n: T. h# ~7 W; D
  542. ' {' ]) ?: o2 K$ ^5 D$ E
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);
    7 V8 n" Q8 H: Q/ v" J
  544. & j0 a+ a6 [6 h9 d9 m
  545.         AfxEnableControlContainer();
    * ?& Z4 W' g+ C9 p7 W" D( A) K  m0 N

  546. $ K1 A; M! {: k( k( F* S$ K
  547.   bCanUpdate=FALSE;
    ! Y  o8 g! P( Y8 |
  548.   dwStartUpSteps=1;
    6 Z' N  m# S$ G+ D) A( N
  549.   dwProgramState=AP_NOTHING;5 y- b7 Z/ B$ f& q( X# m

  550. 4 i8 B5 `% |( _/ {4 V# O
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);  J4 y- M+ _9 k

  552. 7 b* y* Y! W* h# U
  553.         // Standard initialization; F3 g; q( E; ^( h0 n
  554.         // If you are not using these features and wish to reduce the size0 W3 F! [( W& l
  555.         //  of your final executable, you should remove from the following( J. R$ b6 B; j
  556.         //  the specific initialization routines you do not need.8 x; Z% s5 i! v/ z" }3 b" }- g

  557. . ?0 V1 v0 a7 Y+ L# z, J( d
  558. #ifdef _AFXDLL, _  Z0 P; Z8 y2 P" o- k
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL) k% W& k) h2 D& g9 @) b" z
  560. #else
    8 |6 J  ^/ y% H! y. L
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically
    # r; {, F4 Z1 M5 J% a- J0 p
  562. #endif: d& J) O' L- x  _7 |8 A

  563. 1 [* @6 y* B2 q& b- j
  564.   dlg=new CRevAppDlg;
    , A) j% G; i# ]% b3 i# a
  565.   dlg->Create(IDD_REVAPP_DIALOG);
    9 \2 g/ F. M0 r- ~  z% s
  566.   dlg->ShowWindow(SW_SHOWNORMAL);
    ' J0 N+ R8 T2 `0 Y- Q" m
  567.   m_pMainWnd=dlg;  m3 n" P" J, p
  568. ! W; d& }% W" O; o) i$ g% b6 l1 N8 j
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);! X: }2 M) f' H6 a
  570. 6 g& z# C, y" B" A: p% g, k
  571. //  GdiplusStartupInput gdiplusStartupInput;& s7 v/ t2 ]5 V2 Z% c
  572. //  ULONG_PTR gdiplusToken;
    ! C" ~4 y, m! g8 h
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);
    6 l: i( m7 a, x' p" `

  574. $ o, G- W8 {& ~
  575. //        CRevAppDlg dlg;
    , A/ m3 t# l& X; ~  b$ i5 V! o5 L
  576. //        int nResponse = dlg.DoModal();
    ( j# c0 Q6 Y7 `$ D0 u
  577. //        if (nResponse == IDOK)
    7 O5 C2 r9 K/ ]/ {; Z. G0 U
  578. //        {
    ; A* T( S3 |+ x0 n8 L. F& ~1 J% R
  579. //                // TODO: Place code here to handle when the dialog is8 t+ d" \( G9 o9 P9 w" V, t8 t( f
  580. //                //  dismissed with OK9 o+ G4 }- @) l/ r) [$ [
  581. //        }
    % J  k  {& D4 ^. G- g
  582. //        else if (nResponse == IDCANCEL): H- W+ u+ D, Z$ s9 m! Q# |
  583. //        {
    # a/ A' {) E  `' B: K- C. s$ k
  584. //                // TODO: Place code here to handle when the dialog is6 s. r9 [2 ^: v( U
  585. //                //  dismissed with Cancel0 h0 j/ m3 [; s) h( H# W
  586. //        }
    9 J/ N1 v: e7 D' D

  587.   N& O) e( T: f- ?$ `4 n/ }* w' M; P
  588.         // Since the dialog has been closed, return FALSE so that we exit the6 J( @9 a) H: N, Q( q: U2 i
  589.         //  application, rather than start the application's message pump.7 _. [) h/ M/ w4 n
  590.         return TRUE;
    ) j1 s% c7 m' c5 ]9 C- |. X8 i9 \  I' P
  591. }
    " c1 v3 I2 A# Z) p$ B, s
  592. 5 u. F8 \9 O/ W0 o
  593. char *CRevAppApp::strtok3(char *pSource,char *token)
    : b* l/ ^1 K; Z& c3 [7 e
  594. {
    & l1 Z$ X1 [3 g3 `+ m8 H0 m
  595.   int i;( c8 l/ i# {3 o- U
  596.   char *szRet;
    + [* i9 @+ P  C
  597. # D( R8 ]! q" m  I! m% F1 l* M( }! J) @
  598.   if(pSource) { itoken=0; sztoken=pSource; }
    ) Z5 Q8 r. L8 ?8 F/ H( ^. P* d, e" p6 q
  599.   if(sztoken)
    " u4 ^" Y3 B1 P8 R! m- Y
  600.   {2 s1 ^5 c0 `8 m* h% i" Z
  601.     szRet=&sztoken[itoken];7 t* w6 D9 |3 c  M$ ^' T6 K" @
  602.     while(sztoken[itoken])
    + v, n# y  Y4 U, z. q7 h
  603.     {
    5 Q. H9 ?, O- K: h2 n+ R
  604.       for(i=0;i<(int)strlen(token);i++)7 w$ h, a9 g/ V+ e
  605.       {1 i5 }$ Y. d" F9 t% p& _" O5 Z
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])
    % v( J7 i) f, k5 d
  607.         {! A" _$ M( z+ K  F' V& E
  608.           sztoken[itoken++]=0;6 C5 C# L  t3 Y' O
  609.           sztoken[itoken++]=0;2 ]! g! l9 |1 r7 N7 G
  610.           return szRet;
    8 j% ]% ?4 v' }8 k/ z
  611.         }0 Y$ P) \: ^% x/ Y
  612.       }
    6 l) E' a- v8 @' b' v
  613.       itoken++;
    / ?7 }5 I- M. a6 l: d, ^
  614.     }4 M- j( U- X$ x* J& [
  615.   }
    ' C6 X& {. C1 |/ N2 r
  616.   return NULL;, x+ u2 {' z+ ]  z
  617. }/ v1 y& ?, r/ g

  618. * ?, J2 h. `* Y) p1 Z6 e
  619. void ProcessProc(long Total,long Current)/ U2 [  G5 k* C
  620. {* O* U& @! y# f% Y/ F, X
  621.         MSG msg;
    4 {3 ^9 ]5 X/ `3 k2 q8 @/ E
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);* Q7 |1 {5 O  V2 r
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));0 d2 q$ A9 C( h% k/ a! n( s$ S3 p
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
    ) g. ^7 k, S, l3 _  s4 c
  625.         {* e4 J1 ?% O5 a1 u
  626.                 if(!GetMessage(&msg,NULL,0,0))
    + p% b9 t6 b9 q# b" T2 x8 D9 o
  627.                 {
    6 n1 S! m+ ]  A3 i
  628.                         return;5 L. a; |; T! N8 F
  629.                 }
    " B6 m1 }! {( U) D
  630.                 TranslateMessage(&msg);" `/ \# [$ q% J" C% _  F: [8 A
  631.                 DispatchMessage(&msg);! p# g4 [4 l" a9 F
  632.         }       
    : A, D: @  O8 s2 b5 y" ^6 T# a
  633. }
    6 E4 E( d0 |* b
  634. + E& T  C( T$ A4 c+ n, ^3 p
  635. BOOL bFirstChar=TRUE;
    # k( l: V1 \$ i. k, c

  636. ; F$ t1 l! Z1 K7 U8 ~: X
  637. BOOL CRevAppApp::OnIdle(LONG lCount)/ O2 T7 J3 @% N* z! D1 D
  638. {* V/ L  s3 O9 I3 X% k  C
  639.         // TODO: Add your specialized code here and/or call the base class
    ) l: W/ a/ q0 A( R; I
  640.   switch(dwProgramState)
    # V6 G4 b. O' j0 C8 ^. a, e& V
  641.   {1 T" V9 Q9 V' O7 v6 _
  642.   case AP_NOTHING:) u3 m9 u* f' s/ P; v
  643.     switch(dwStartUpSteps)/ E5 h* G4 ?& k  p+ j; W9 V" T6 U
  644.     {7 ]+ K! ~$ N+ e* J) W
  645.     case 1:$ v' H# y6 I# Q6 Y* h- e/ C6 D
  646.       {
    / [- D/ M7 n) q9 l; P- g* \/ v
  647.         int i;
    ' a' u' K2 z! A/ h6 x
  648.         CDC *pCDC=dlg->GetDC();
      w9 I- D' j% B5 U/ y
  649.         HDC hdcwnd=pCDC->m_hDC;
    * R) n+ s  b; [( T, b& o% I, z% F3 U
  650. //        Graphics graphics(hdcwnd);
    ) x: K' d; r+ p' q# Z
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");
    $ [4 b0 A- A5 {/ ?. x0 p
  652. //        INT iWidth=bitmap.GetWidth();& W0 q* s. b5 [1 B3 w* G7 C
  653. //        INT iHeight=bitmap.GetHeight();
    2 |; P. t- G+ Z9 L; m$ G
  654. //        Color color,colorTemp;
    , ^7 `+ T) B1 M; }# c
  655. //        for(INT iRow=0;iRow<iHeight;iRow++)& {( {. E* Y: c
  656. //        {
    9 D; E5 w. W/ j6 d4 ^. O7 T
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)
    2 F' h& C6 J, d# K$ i  `
  658. //          {
    : g% Y- S0 v' ^5 A1 I* C" l5 M3 p
  659. //            bitmap.GetPixel(iColumn,iRow,&color);
    ) r5 f! {# E% _8 I9 A, d, W
  660. //            colorTemp.SetValue(color.MakeARGB(: f+ z4 ?2 Y  v# \* }5 v
  661. //              (BYTE)(255*iColumn/iWidth),
    ) F, B6 \) u: D0 h0 k  \8 R
  662. //              color.GetRed()," _9 ]5 ^) I6 w$ S; `( D
  663. //              color.GetGreen(),8 g; `  w, U7 V' r7 D
  664. //              color.GetBlue()));
    : k" P" U$ }8 h$ ^# L: v. X& X
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);
    $ f& j' x$ @% P# w0 [% w5 \0 a
  666. //          }
      s6 i$ s, e9 W! {
  667. //        }" n5 V* L6 J: A
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);
    8 d8 O2 F$ H! v- {
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");3 Q4 h/ [' x! P( [
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");$ R, m" P" q; o& n' C
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");, q" H' C* m( m4 a( }
  672.         for(i=0;i<240;i+=8)
    : r8 y+ B0 F3 w1 Z
  673.         {
    ( C1 i" U9 E) S. [6 \. I
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);$ Y$ g/ X/ j$ H! j
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    # z4 W, f- m8 f4 T5 I1 H" w
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    1 p- V' {! k6 I
  677.           Sleep(33);* H  p( J1 A) s2 u( I% z0 F
  678.         }/ `6 T% q- S* S2 A1 M. }% ]
  679.         Sleep(1000);
    # _- [3 n+ u; t2 t5 `! v3 W, v4 w
  680.         for(i=240;i>0;i-=8)
    2 k( {, N  X9 X' Y, a9 B3 O
  681.         {
    ; C# I, c2 P' j; _" z8 k% i
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);9 h" L$ ?* T+ N, \, ^! O9 c' P" c3 U
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    3 P9 o; O+ T% P
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);! m7 f4 y* b; Y, B! b0 \
  685.           Sleep(33);
    + }8 X& G. c, ]6 a6 L  z& R0 P
  686.         }
    , o& U8 I% F' Q1 u5 I
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);# V$ |4 d0 S* q0 X
  688.         dlg->ReleaseDC(pCDC);
    % [5 O  Z4 T/ w# G; t+ X
  689.         DeleteDC(hdctar);' |8 T$ K  [; v* k; ^4 V
  690.         DeleteDC(hdcsrc);
    1 O; \7 X) K+ e3 e3 {! T- _4 f. w
  691.         DeleteDC(hdcorg);6 q: ^; p$ [& P  b) }4 ~
  692.       }) l6 {) O( e/ O7 Q! x( [
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);: ^8 o+ z7 P8 X1 o. v
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");5 `/ @; d7 |7 r8 K/ ^- g% C3 d
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");
    ' q6 X; o( b$ Y+ V1 E# K0 v0 }: y' L
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");
    * x# }8 v- D( |6 b- h
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);7 s" X. {  [6 |7 |0 O
  698.       if(!Dn.Connected())" L/ B- }1 S# E3 i
  699.       {
    ( r4 M+ p. k7 W! B/ ^6 r( T% ^+ p. `
  700.         dwTotalFiles=1;" _, b  O4 D8 Y1 U1 K$ b  H* E
  701.         dwDownLoaded=0;5 F% Z+ m6 x: U9 }+ x1 z- Y. |
  702.         bSilentStep=TRUE;) [5 L+ c& H' C
  703.         bCompressed=FALSE;8 t' [# D( E. F% T# y1 U
  704.         strExtLocal.Empty();
    : f6 ~2 V) f& |5 S) Q- B% e
  705.         strFullName="readme.txt";
    + I! M- @5 [0 G- a. R; M; i
  706.         dwProgramState=AP_CONNECT;+ X0 a) z9 {6 f% R0 s. z" v
  707.       }+ l1 [# v- k8 E% B0 h* O
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();
    # }4 D+ Y4 u, p. v+ A
  709.       dwStartUpSteps=2;
    . S& ^, j$ R9 C/ z
  710.       break;8 |  g. B/ b0 |2 m( P* V! ]
  711.     case 2:
    $ Z  P' Y1 H2 e3 q0 r+ U* q. X
  712.       {* Z( K! i- r- X: R6 I6 ?
  713.         int iEOF;
    # q' e/ m* i/ V0 W2 c  H
  714.         FILE *fp;
      j# ]. M0 F2 k/ `3 ]$ q
  715.         char szString[512];& ^$ M" n+ c3 k1 O+ [. r- O# m
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");
    - z/ e8 r. p4 z- u0 S
  717.         if(fp). _# j8 R7 q! H" \& q' j* |
  718.         {
    ( r4 |: l& Z3 p
  719.           do& K! R/ K7 G; a9 X( Y4 {. H
  720.           {
    " b4 |& E  n0 u4 T; l! c
  721.             iEOF=fscanf(fp,"%s",szString);
    # b( [/ p7 V6 D) n9 S( J* e5 m
  722.             if(strlen(szString))4 o* U2 u* _! U) Q# V4 w( M
  723.             {" A3 Y5 q# L0 F7 L& c/ L# w
  724.               if(bFirstChar)) l- G$ W/ y) t/ F2 C; l. ]: V2 J
  725.               {
    0 k8 W% L0 d$ s% K6 v/ d
  726.                 bFirstChar=FALSE;8 j: W8 K' N! N  r8 O
  727.                 bConnectIsBig5=FALSE;
    ; N% R0 C( ~& A; B+ {
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;) k2 i5 Q) ]! I  d5 s
  729.               }
    ( j9 y: J: C7 {: H4 D3 h2 j
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));4 [& e# e4 T% Z( _  O: w0 g1 D
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));6 G& ]+ U$ C/ [5 {: @
  732.               dlg->m_ListText.AddString(szString);! f9 j$ z3 \5 n8 }  N
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);9 k* ^" E7 G7 d3 ?" u
  734.               *szString=0;+ e2 f4 ?( }4 B5 g: [3 e  D. ~
  735.             }
    # D: O3 k+ D. I+ f' a2 M5 v
  736.           } while(iEOF!=EOF);+ D8 L, _# M3 v, e2 P; V
  737.           fclose(fp);$ s% ~0 G+ K; o2 g- x
  738.           unlink(".\\DownLoad\\readme.txt");
    4 W5 m6 s2 \/ v1 w. ^, V# G2 C
  739.           dwStartUpSteps=3;7 q4 w- D% Z3 [# N5 }6 S
  740.         }
    $ X! a5 c" A# x, ^1 L6 n4 m1 {/ p
  741.       }# |  z/ v. h" R+ t% c9 K
  742.       break;
      ^2 d6 O: Y( o& e. r  m
  743.     case 3:
    + I6 e1 F+ K$ U8 E. N5 @
  744.       if(!Dn.Connected())
    " t/ r4 ~! @+ r8 h7 t
  745.       {
    ; E3 ~# h, W  p4 {- I
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);
    : f0 x* p) b0 ^  x0 F" B
  747.         dwTotalFiles=1;' F: Z0 D7 Q8 |% P+ @, O( g8 K4 r
  748.         dwDownLoaded=0;
    & l4 {- I& J! S. @! o3 q% G: ^+ F
  749.         bSilentStep=TRUE;
    6 _  Q2 P5 j4 ?$ g2 d1 s2 k
  750.         bCompressed=FALSE;9 {- F1 q  z  s6 [2 T
  751.         strExtLocal.Empty();
    , {, @) {7 c- ]9 ~" R3 R
  752.         strFullName="checkversion.txt";6 Z6 G* L  v# T* e
  753.         dwProgramState=AP_CONNECT;# p% |! o  O* H% A" Q
  754.       }
    & E+ y. k! y1 D0 g, B9 l
  755.       dwStartUpSteps=4;  S( B2 B; i" ^- c
  756.       break;
    0 g* E$ O1 ]' }7 x
  757.     case 4:& {/ y+ l4 X& I2 L! t8 s
  758.       {
    $ U+ g6 M, W. W/ ]! m
  759.         FILE *fp;
    6 ^/ a# F. a0 z; N
  760.         char szString1[128];
    ; [( e+ A% W4 b' t' {
  761.         char szString2[128];
    " f. u4 |- I, S/ j" u
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");7 {9 Y) v* R3 R/ F/ w
  763.         if(fp)
    ( C1 a. f, N( M- c
  764.         {
    # a" w; f( M4 \& t/ A
  765.           fscanf(fp,"%s",szString1);
    6 {, A5 Y: P+ W# h' e' ~+ X
  766.           fclose(fp);
    : `  i4 w6 l* f' u: v! g! F" p# y
  767.           fCheckVersion=atof(szString1);4 x# m+ Z  S6 g0 w. F2 b
  768.           fp=fopen(".\\checkversion.dat","r");5 V6 k. p! m: o6 v  a+ k& o
  769.           if(fp)
    2 B1 I0 T' J7 F- e+ n4 Q1 J( I0 U
  770.           {4 f! a9 d  w! k; v
  771.             fscanf(fp,"%s",szString2);
    % b) o+ }- t# K5 |3 t
  772.             fclose(fp);
    7 O( n+ B5 Y3 Q" b$ q7 }
  773.             if(atof(szString1)!=atof(szString2))
    4 \7 z, p! S6 [2 d, a) o8 @, ?; k
  774.             {
    / @" t& |% c, Q# a% X* [* T+ e
  775.               if(!Dn.Connected())
    ; o: p! r# P7 l5 w
  776.               {* D1 n4 U) t; V
  777.                 bFirstUpdate=TRUE;6 `7 R! M- |# G2 I+ f/ W  ^  d
  778.                 dwTotalFiles=1;
    1 [) L/ b$ [0 |
  779.                 dwDownLoaded=0;
      n5 t' X! @7 P0 h
  780.                 bSilentStep=FALSE;: J% _9 D- P- L
  781.                 bCompressed=TRUE;
    ) z' \! P* e5 \  ^1 I; M
  782.                 strExtLocal=".\\DownLoad\";# B' E6 [0 L  R0 S9 f/ [, s; v
  783.                 strFullName="update.txt";; Q; n+ N3 x: y4 }. c- O% i: }
  784.                 dwProgramState=AP_CONNECT;. x$ \! a$ J* R2 ]: R
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");# S. l3 w- W; [# t0 g0 |1 U$ a4 [
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");% P9 B. {2 h6 j' ~) S
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");
    ) i9 H% r2 |- H' K/ w; [
  788. $ e8 F, y2 ^8 t& v$ ]+ P5 _
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);* `: z5 n# |2 ?6 b7 \" I2 h
  790.                 unlink(".\\DownLoad\\checkversion.txt");
    ' j- t7 @0 v5 |5 Y
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)$ t- ]$ H8 l' e
  792.                 {$ ^4 x! R' @+ c/ J
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");
    & b2 h4 {3 a3 e
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");. C' Q. M5 H4 Z4 t
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");% G2 \2 b0 v2 _2 G
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);: z8 n4 s8 [4 ?/ |$ S9 a

  797. ) r7 G, M) c  Q0 M5 }! G; j) N
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    5 C6 l) ^+ t. |" w9 x% r' J
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    , D! ]0 ~3 q' Q" M
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");+ z$ |& w% C, C
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    4 Z* J( C8 S4 ?: x
  802.                 }
      @' F6 f& g$ _% d/ q
  803.                 dwStartUpSteps=5;. ^4 u( P; Y  \; ~
  804.               }
    ) `$ T; `8 P9 X; G* {2 U6 b
  805.             }
    . c) r; m. ?  q2 C- S. R& O5 l
  806.             else/ o8 G4 E7 {- v- X. z+ }% a/ I! @
  807.             {
    # U, \0 X5 e3 l& D3 ^
  808.               unlink(".\\DownLoad\\checkversion.txt");
    0 h- f2 @& a# m* Y
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    - k2 V8 L4 ?" T' ^( i7 e
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    6 ?! C+ I3 Q& r3 l' ?: ], R' ?- u
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");% F" q/ K& j/ W, u% S+ f) Q
  812. 9 }1 ]( p+ ~  N# N
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);$ \+ k& f! ?# t) Z$ B3 p
  814.               dwStartUpSteps=99;! \$ S" Y, ^6 ^. a( \6 B" ^  G
  815.               bFinishUpdated=TRUE;' l& S6 _9 i4 S2 v( u
  816.               bCanUpdate=TRUE;# F1 ~3 P# V- K" u8 [
  817.             }
    / y( o/ _" V9 n0 S* y: Z* U! F
  818.           }
    - j3 S5 W8 r6 Z2 Z0 r
  819.           else
    # m- `" U% f) g: i; v/ l
  820.           {, ^, r2 B+ p$ @) W6 n! e& t
  821.             if(!Dn.Connected())( u$ F1 I+ m# _( E! Z: \
  822.             {
    . J7 b! U$ A7 `4 E* X
  823.               bFirstUpdate=TRUE;0 c: ~7 f1 \) V0 X% o8 D
  824.               dwTotalFiles=1;
    ( G( Z# G7 G" v- Q) G1 [) W
  825.               dwDownLoaded=0;
    . p  r4 q, v" i7 {6 @7 B: U* E
  826.               bSilentStep=FALSE;
    8 J# L0 U" }1 ~  p
  827.               bCompressed=TRUE;6 D0 Y2 }% m; v9 c
  828.               strExtLocal=".\\DownLoad\";3 ~  j" l( ^0 j: P" w: g
  829.               strFullName="update.txt";
    + j2 v1 U5 t4 ?  o
  830.               dwProgramState=AP_CONNECT;9 M) G2 Y- l% X
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");
    ) u  Q- ~( B' O/ U3 P8 o
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    1 z/ C7 ?. i- i8 m% a: w
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");
    ; P4 f9 d) d- @5 U2 ~6 `5 @
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);  w2 r) G' m+ w. C% w- @9 i% }) ~: i
  835.               unlink(".\\DownLoad\\checkversion.txt");1 e, T+ x+ b6 e* a
  836.               if(GetFileAttributes("Wsa.zip" )!=-1)! X7 f. j, N1 ]8 J
  837.               {
    $ g+ ?  i5 t* y
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");
    3 @6 |6 e+ \: C! W3 R
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");. {" `8 f% J3 ?$ U% U
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");
    % M2 R0 a  }, W5 `* i
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    5 h3 l/ Q# `& t
  842.                 / }1 N5 O8 F: l* A
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    * g( G; I, q2 C  b. D
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    ' U! i/ g" N: e
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");; I0 ?0 e! ?: O/ v, ^# k2 i
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);( t7 X) s1 H- S" P: U2 d0 t
  847.               }& \8 h2 h+ s" D) J
  848.               dwStartUpSteps=5;4 m: l# _# y4 y1 n' G$ \4 S$ k
  849.             }- {' `5 J! Z/ W! D; N5 z5 q/ m
  850.           }
    , x# X: @9 y% d* o0 q" O1 C
  851.         }% {, N8 t8 S5 v1 G1 ?* A
  852.         else
    2 f: D! K" l8 G" Z# P( Z  T' b
  853.         {
    / m/ W/ \7 \3 T1 e% w9 W; X5 R: s8 e
  854.           dwStartUpSteps=3;! [( h- A* {8 g9 z. u, Z' u! }; |
  855.         }7 s$ @' l2 }+ i
  856.       }
    $ r/ l( P/ i; L3 |9 J3 g
  857.       break;8 Z% A" Z2 {1 B1 |+ d
  858.     case 5:2 C2 @8 o6 M0 i  {$ I7 W$ a
  859.       {; ?0 ?5 c! O9 d' |, w
  860.         if(GetFileAttributes("Wsa.zip" )!=-1)* W7 b( h8 F/ L' V1 ~+ Y
  861.         {
    . O5 y5 B/ z. H7 A5 L( |1 e5 @& b
  862.           int opt_overwrite=1;1 @& W! j4 O% M$ U7 @
  863.           int opt_do_extract_withoutpath=0;
    ' ~% X9 H; V( V  _# @
  864.           unzFile uf=NULL;
    ) L- b" b3 R' N+ a
  865. ' W' o8 m2 B" Z2 ~# ]2 |/ G% R
  866.           uf=unzOpen("Wsa.zip");
    # O6 ~$ v* k7 M! j, r0 O
  867.           if(uf)! P) ]( m" D, D& E
  868.           {/ s+ ?. k+ K7 x5 D4 I# `1 P% i4 P) ^
  869.             do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,NULL,ProcessProc);
    # x, c" c6 N. X) h" {6 i; y+ a/ Z* Z
  870.             unzClose(uf);3 d- C( J. _! l; F; v3 X7 `5 [
  871.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃ЧΘ.....");
    , Z0 a  V/ {% V7 v# A& F
  872.             else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压完成.....");
    # s6 ]4 f! M' J( z! |7 }
  873.             else                                                      dlg->m_ListText.AddString("Unzip OK.....");
    & F# Z; d: ]3 P2 D  F3 V
  874.                                           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    / h/ [+ O' U* s. z% @
  875.           }$ z  j* ]7 n6 o' G* [
  876.           DeleteFile("Wsa.zip" );' e8 c! y  ~. ~; p
  877.         }
    ! w7 X- c, U) m% M5 d
  878. : k+ Q! B6 |1 }+ [# [
  879.         if(CheckLocalVersion())
    1 Q, K$ s! ?) p" \
  880.         {, X7 x- }  b- [( q
  881.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫磅︽絬穝戈.....");- p. f1 b. \# T: z5 I% C
  882.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请执行线上更新资料.....");
    3 e- c  y: E; u# m! A& n
  883.           else                                                      dlg->m_ListText.AddString("Please update.....");/ B, a. e6 s3 d2 C5 T
  884.           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);1 G. p- W. C4 Y. e
  885.           SendMessage(GetDlgItem(m_pMainWnd->GetSafeHwnd(),IDC_BUTTON1),WM_USER+2,3,0);# u3 w/ Q/ [) L, Z5 Q5 t6 \
  886.           dwStartUpSteps=99;( u+ t/ u8 [" U. f# y1 s
  887.         }
    " D/ ?' g6 h* Z6 i: A3 K* E  p- j! \0 s; Z
  888.         else: x  o2 s2 l# T, G. y  i6 |
  889.         {! ]1 N0 r: C$ D% C! f: M
  890.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    4 F: v4 t2 y. d, ~
  891.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    " h& K6 V  T' `" k5 ?$ W+ E1 z: Z
  892.           else                                                      dlg->m_ListText.AddString("no new file update.....");
    ; h' `' m: {" T8 H+ U

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

, }/ P8 [+ N. h/ e+ y, K6 L$ Q& F
9 i7 Z6 d3 z% \# 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 來自手機 | 顯示全部樓層
东西不错,只是现在研究的人少了。wechat:lang_wechat_threadmessage
回復

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

本版積分規則

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

GMT+8, 2026-2-24 08:40

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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