CSUpdate.exe源代码

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

9 ?1 W0 |/ Q# s5 w4 O
  1. / RevApp.cpp : Defines the class behaviors for the application.1 [- T& y6 e, Q
  2. //* G# ~% M( L9 F  v
  3. $ p1 U8 R7 A% @. x0 N3 S
  4. #include "stdafx.h"6 S. }$ n9 n& X) ^' P) f- m9 G

  5. 1 J) |8 ^; T" T4 f, `" S& H3 g
  6. //#define UNICODE
    9 D1 P4 J" c$ r2 M; s3 K/ N
  7. //#include <gdiplus.h>
    9 k2 H3 h1 b5 q$ J0 O! E7 x" z% z
  8. //using namespace Gdiplus;
    3 B9 e! x% z4 V. O# W
  9. 2 y- ^% {  D6 W+ u6 ~
  10. #include "RevApp.h"
    # m" [6 \0 A+ E- E+ k( d4 f
  11. #include "RevAppDlg.h"% w2 T1 a* S8 z  ?7 q5 V

  12. 3 F* E( C' a, Q3 E* `
  13. #pragma warning(disable:4786)7 @! O0 W# Y0 E+ I" p5 c
  14. #include <map>
    7 l7 g: p7 R: Z$ t
  15. #include <list>
    ; @5 Y; s7 O+ F1 K( g, _+ Z2 m
  16. #include <direct.h>
    9 x9 r" [1 B. p0 Y
  17. 2 B& `* F, s- c- H: z9 N; \
  18. #ifdef _DEBUG; n. U' j+ v7 d* r
  19. #define new DEBUG_NEW# t: B% x4 U9 ~; S2 N+ X* t
  20. #undef THIS_FILE
    + K) L+ b: o9 k0 A
  21. static char THIS_FILE[] = __FILE__;
    9 N4 G7 K) w6 ^, F0 E
  22. #endif- T. t8 S( c) G# n
  23. #include "SkinResDef.h"( m5 `5 y; d/ }# `# d
  24. #include "ChangeBG.h"3 N( W0 A7 b* j* \4 y: X$ d
  25. #include "AFXINET.H"
    - c8 O( g$ C  ~5 {, X; h

  26. % W, N! x1 L7 l  \% E3 A% B
  27. #define TRADITIONAL_CHINESE 0
    ' E+ I8 A1 Y) f. Y4 B% J7 T* g$ `
  28. #define SIMPLIFY_CHINESE 1
    2 t5 O) @4 d4 C. ^; Z; ~, v/ M) r
  29. #define ENGLISH 2( d' A. h- Y3 l7 l: Q
  30. int m_iLanguage = ENGLISH;# e, T2 N4 J4 u6 D' v6 z
  31. /////////////////////////////////////////////////////////////////////////////
    , _; m5 h& m% e* q+ ]8 ?
  32. // CRevAppApp
    6 a) A# k9 Z) m) `! D9 }7 i3 L

  33. 7 X/ w3 ]5 W5 F$ H
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)) m9 ^. l9 V: P$ p, k, I$ b" e
  35.         //{{AFX_MSG_MAP(CRevAppApp)
    % N! U: d/ v1 w- b
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.$ p) }# ]- d8 u2 e
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!
    & s" ?+ W9 k% C
  38.         //}}AFX_MSG, ]& V8 l7 ]# X
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)
    # M  D/ ~% b, W2 ^
  40. END_MESSAGE_MAP()
    # k, B. }: R/ \  I+ |

  41. ' |5 ?3 g$ t: F& ~- I! ~% k
  42. /////////////////////////////////////////////////////////////////////////////7 C' _9 b4 ?7 B- _: \
  43. // CRevAppApp construction# C3 g9 {3 B% Q8 G9 X+ |

  44. # P& \7 k' r/ n: p, t( y
  45. CRevAppApp::CRevAppApp()
    7 [$ ?- S, ?" ^) l+ @
  46. {3 g: J( G) Y: ^0 e8 `7 S
  47.         // TODO: add construction code here,* n2 @+ K* R) f9 n
  48.         // Place all significant initialization in InitInstance
    ) x! B8 m, g! W* B& M
  49.   bDisplayIsBig5=FALSE;9 w4 w! n2 r# V
  50.   bRestartUpdater=FALSE;
    0 e: q3 `8 E0 i
  51.   bFinishUpdated=FALSE;) {8 Y2 j* O" c
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;
    2 `' s, h2 r; t
  53.   InitChangeDataBig52GBKS();
    / k, v( n4 Y) Z
  54.   InitChangeDataGBKS2Big5();
    " w3 B) s/ p6 n! {9 y$ i  r
  55.         //
    4 Q5 D2 t7 ~6 b5 N8 m" h
  56.         bClickRunExe = FALSE;
    2 Q- ~/ m/ x. @$ x: s1 J0 |
  57.         //6 P5 O" U& c) C7 I- W
  58. }
    7 a  Z& ]" ^, @: [" T

  59. # X& j, B) i) h/ u- y
  60. CRevAppApp::~CRevAppApp()( P* q% y' R* w% w
  61. {; _7 o( X6 ]1 h+ S# N
  62.         // TODO: add construction code here,
      B$ N- A# g( d. t" l: M6 V5 A
  63.         // Place all significant initialization in InitInstance
    $ r3 n. I/ q0 J4 y. {
  64.   EndChangeData();3 K& G  }4 ^& e$ a+ |, U
  65. }
    9 t1 V; g' v  F$ i1 t6 d

  66. / c: m' K- ~# y* T5 A! q
  67. /////////////////////////////////////////////////////////////////////////////8 V# \; n+ J7 a3 Q+ O( P! p, `
  68. // The one and only CRevAppApp object
    3 U; Z3 o$ B" D

  69. 4 d7 i; X4 D6 e# d4 {2 b; s
  70. CRevAppApp theApp;( }. ^0 F) U4 h4 ^5 L- Q) Q

  71. ( C2 m7 P, {4 ]7 x" z! ]
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)1 ^. \5 v* y1 \; n. d
  73. {
    / w$ q4 {  y1 S7 l/ I, W
  74.   int iEOF=0;
    - w8 e, U: A* n: U, u  q$ E4 I  x; N
  75.   char szTempName[MAX_PATH];
    . R) L$ l+ c6 M% W# c. c7 P; H+ A
  76.   *szFileName=0;
    7 l9 B1 J& g0 x5 E" U* X
  77.   iEOF=fscanf(fp,"%s",szTempName);
    6 K  j) d* p" O* y/ S
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')' R" ^5 Y8 Y( I. a
  79.   {
    : ?0 @7 z7 _0 x
  80.     strcpy(szFileName,&szTempName[1]);
    , o# M$ }3 B+ `& C& F
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)1 ]% k' Z1 A; z: I% ^$ n4 j4 J
  82.     {6 y2 t: h4 W% V
  83.       iEOF=fscanf(fp,"%s",szTempName);
    0 f3 C+ J% r3 m" d1 e. b7 a
  84.       strcat(szFileName," ");
    ; F/ J8 p' i4 s) P8 ~
  85.       strcat(szFileName,szTempName);
    5 |# o; j/ T4 X$ T
  86.     }. P/ q, B- l8 d1 v
  87.     if(strlen(szFileName)>=1)
    0 Q0 {9 R3 {! O% ?6 J9 a: b
  88.     {% |1 l' x: `* m0 h# h2 |; e
  89.       szFileName[strlen(szFileName)-1]=0;3 _0 ]" g* {: D+ |' h; z- W
  90.     }" l8 U& f2 B# P% v* O
  91.   }# E. C7 a, @& s6 T1 @3 H. H2 k5 p
  92.   return szFileName;
    - n$ T* ?  f9 `& u+ K7 X5 ?6 U* `
  93. }
    ) f5 J( R6 R0 |9 s: I  b; {
  94. ( a7 L4 d( N, W" y1 H
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)5 V5 `5 o6 |9 o  b
  96. {
    2 W$ d5 k# f2 @# H6 c
  97.   FILE *fp;8 @, e- A  [& X7 \7 h& |" F8 R& w% A* r
  98.   char *key=NULL;
    / B( W& |& E; K2 T) M/ P; f
  99.   char version[MAX_PATH];% o$ k$ M  A" w% J8 l7 Q+ W) S3 B; G
  100.   LPUPDATEFILE file,olds;
    , r& E' h* ~" s
  101.   std::map<CString,LPUPDATEFILE>::iterator p;9 O; s) i! J) k9 J

  102. . x4 ?4 h5 \" _- H4 L) B
  103.   UpdateList.clear();3 ?. Q: A* d9 r0 y/ T
  104.   UpdateFile.clear();
    * F/ D/ e* d; z& A1 W' [) v, y
  105.   if(GetFileAttributes(filename)==-1) return false;
    % Y2 ~2 d1 G/ w/ c0 r  @, O3 ]0 u
  106.   if(!(fp=fopen(filename,"r"))) return false;; l4 ], [, G) V. r% n" @
  107.   fscanf(fp,"%s",version);
    ) m+ B$ Y; [+ @: ^" d+ u
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }
      |  p7 e3 G4 `- F; s# A% v
  109.   while(fscanf(fp,"%s",version)!=EOF)* w7 X- W1 Z6 Z' h
  110.   {; k# U/ z  {: l5 z- l$ ~  a8 L
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    $ `5 v, s6 R* a6 {
  112.     fscanf(fp,"%s",file->path);( e8 c5 P1 G; D+ g
  113.     ReadFileNames(fp,file->file);5 x9 ]/ P3 G9 ?$ F6 k  n
  114.     strcpy(file->full,".");- r+ U- \3 X" B" ^/ o
  115.     strcat(file->full,file->path);4 H1 ?1 k, Y( M/ Q) T* ^  _# _; z
  116.     strcat(file->full,file->file);, {) l& I+ X+ t2 k3 F6 F: T: m+ H
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())
    & S8 p. D7 ]4 e5 x0 K
  118.     {
    6 C* ?+ m& ?4 G( i
  119.       file->vers=(float)atof(version);' v, g) v" R+ f; d% M% ]4 _$ l  t* a
  120.       UpdateList.push_back(file->full);2 t# I9 x& x8 ?( X% b6 ?% s2 b
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));5 ~$ `. q/ g; @8 N
  122.     }. ~& a4 M) t0 {) x# ]- i
  123.     else
    5 [  [7 @. C& C/ H6 {1 }
  124.     {: P+ K0 J1 z1 G+ }4 S2 `
  125.       olds=(*p).second;
      a) d6 q* }6 Y7 n# u$ I
  126.       if(olds->vers<(float)atof(version)), _/ B2 Y; |4 ^! c! \
  127.       {' G2 ]' [  R3 [' E" x
  128.         olds->vers=(float)atof(version);& K0 S' h, ~8 X8 M
  129.       }7 u$ ]' g; b$ @: f
  130.       free(file);
    $ S/ Y2 ^$ Z+ l- M3 X3 e
  131.     }) j2 ]* e" g% a5 u; O, x
  132.   }
    , R7 k& ?) L3 S* R9 U9 g, }
  133.   fclose(fp);
    7 R8 n* x, v7 Q! z
  134.   return true;
    : Y1 y! V# }2 k$ M
  135. }: L$ O9 M) y  @/ d

  136. + w9 q% d1 `# q8 T- I
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)
    " _0 S% `1 c5 W- `/ g) U
  138. {
      ]- S# G# n2 {! j  }7 x
  139.   TCHAR  szFull[MAX_PATH];5 d. S% d4 A( p5 Y9 Y* A1 @4 w' y
  140.   TCHAR *token,*inter;
      C  h9 ^; o9 @
  141.   *szPath=0;  x+ W( g7 G+ z6 i( U8 K/ Q
  142.   strcpy(szFull,szFullPath);+ O0 u% d. [$ g7 U- U
  143.   token=strtok(szFull,"\\/");
    6 X4 w# g- x9 \3 _
  144.   inter=token;
    $ g: H6 R' o  f. M, ^! F
  145.   while(token=strtok(NULL,"\\/"))2 c; B8 F" V# p& y
  146.   {
    , V! e- @: Y* @$ Z4 _
  147.     strcat(szPath,inter);
    4 Z& f$ {' m9 \' z3 W
  148.     strcat(szPath,"\");* X' Q8 g* \% w: V7 m1 [. K" Q) ^
  149.     inter=token;: L4 K2 G7 r: V9 t' _
  150.   }" z% m9 b& _* d
  151.   return strlen(szPath);
    ! m6 [9 G( m) n! R  m7 x
  152. }/ U/ D4 T' S9 b$ _" I
  153. % M4 Q& B# L4 O' c. T0 i" e( ], Q
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase)  l) D; c$ |3 w, k' h4 V* O6 E# ?
  155. {1 q: W& j8 P% V5 b# Y# h# I
  156.   DWORD attrib=GetFileAttributes(Target);
    & F) l% y" ~% z3 T* }# K5 ^$ d. D
  157.   if(attrib!=-1)6 I) e; k* O% D7 J
  158.   {
    4 V6 N$ k0 Z# L* V
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))
    & F, u! _$ F6 \0 y0 U3 E0 t
  160.     {/ c6 l3 Y7 w2 A
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);5 {% S$ m- c0 m
  162.       SetFileAttributes(Target,attrib);2 o  T$ @, y2 P6 y9 E
  163.     }2 `" t4 z$ _) r7 B, O/ Q
  164.   }
    % M( h" ^# f2 S% a
  165.   CopyFile(Source,Target,Erase);
    6 K: L5 ]0 s5 [7 ~( X9 R" Q. ]/ ~0 `8 L
  166. }
    4 d5 j8 M3 O6 U0 Z7 X
  167. . M) e& L* |1 y& d2 k( B; Q! J
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)# }  o1 a8 t) D
  169. {
    9 ?  s: N) e9 y( h- m2 ~1 k7 V
  170.      FILE *fp;8 @% `/ c0 \% Q0 Y
  171.      char  szBuffer[8192];$ I+ c  g$ O; v
  172.   va_list  argptr;) e9 A/ S' v) x& [3 A8 G
  173. + |* n. z- f0 @3 W. l2 q6 d
  174.         va_start(argptr,message);; a* \3 H8 a( L4 x, O
  175.         vsprintf(szBuffer,message,argptr);
    . o* n. b0 [& r
  176.         va_end(argptr);
    1 b& D( m% z# ^# H
  177.   fp=fopen(FileName,"a");4 d% ^( ]" w7 s- Q& u  X
  178.   if(fp)
    6 d! z% U# ^. k# Z. P
  179.   {
    8 f+ U1 n2 T( v4 c) u8 P
  180.     fprintf(fp,szBuffer);% W* P6 y' `$ u1 _5 H
  181.     fclose(fp);
    % _8 l0 ?  \! e7 v
  182.           _flushall();
    , ~' r* @; d, T: k9 b. i
  183.   }+ Q5 S: ~! ^: B! Q4 p
  184. }
    ; A6 g8 X7 K: i3 L
  185. 8 m: W5 m) z; j# j5 G% y# R# l. L
  186. BOOL CRevAppApp::Fclearf(char *FileName)4 R/ I. x4 Q2 u* n7 e: s
  187. {
    : N1 f! s8 Y  A$ T+ l7 |* z! p! J
  188.      FILE *fp;
    & a# H. `7 Z2 h) w; {7 C
  189.     DWORD  attrib;
    + _- ?" K  G! L9 Y% n- a$ Y0 _+ ~
  190.   attrib=GetFileAttributes(FileName);; r! o' U* j& v+ `- M% K
  191.   if(attrib!=-1)  T/ [& v4 g, J7 v' h* Z; k
  192.   {
    4 W; c3 F6 d) z4 |
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);
    5 e- ^/ N3 \7 u( J6 E, f, o
  194.     if(!SetFileAttributes(FileName,attrib))
    ( E: p, J2 F; q9 \- @% x: G! e# \
  195.     {
    ) ]/ ]1 m# }0 g, p$ Y
  196.       return FALSE;
    " M4 G* Z1 ^. y2 R6 [6 H# r8 P- k
  197.     }6 _- e4 Q; A6 X( X9 h7 G
  198.   }
    % x: P0 E$ N4 ^, f9 x: H
  199.   fp=fopen(FileName,"wb");' T5 c7 O$ ]8 g% d
  200.   if(fp)
      N. {% u; u; r
  201.   {* F$ P& p4 |7 b8 V* |8 T" ^8 y
  202.     fclose(fp);
    : v4 d9 N. \! @* Q9 F. m
  203.   }
    ' ]! J0 C( d7 P1 c+ z; F2 V4 t/ z
  204.   return TRUE;( g' x) _" v  q# Y4 I
  205. }2 a0 q! r- @( Z" i% T
  206. 8 T# I% O4 C( T7 {
  207. BOOL CRevAppApp::UpdateLocalVersion(void)
    5 j; k& V8 `: p5 q
  208. {3 T1 f2 ^6 v3 y
  209.   char filename[MAX_PATH];
    1 Q8 X: A, n; y+ s
  210.   LPUPDATEFILE file,olds;
    9 ~- M8 U- ~- m# v
  211.   std::map<int,CString>::iterator i;
    - f$ z; ~6 F6 u/ T7 a5 d- |
  212.   std::map<CString,LPUPDATEFILE>::iterator p;8 M) Y( r8 ?" [) g) }
  213.   std::list<CString>::iterator l;
    6 f) s* K3 s# J
  214. & |9 B+ g) W- y" i' Y
  215.   if(bFirstUpdate)
    3 q; G( n3 C5 A6 ?: n2 X
  216.   {  a  s% V; u7 e: T
  217.     dwCurrFile=0;
    ) Q7 |/ P. Z, V7 v! U3 ^% g
  218.     bFirstUpdate=FALSE;
    + Q4 O- i# f6 p' \
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())/ v: K4 E' f- v6 w0 a# V+ j
  220.     {' p  `4 z, i* F4 W8 c
  221.       dwTotalFiles=UpdateLocal.size();! |; A0 N; S) C: ?' r0 R: i
  222.       dwDownLoaded=0;5 H  m6 Z! \: Q! S1 z6 x. j5 G% o
  223.       bSilentStep=FALSE;/ a( L$ ]8 ?5 d7 e! ?
  224.       bCompressed=TRUE;% Q; d4 E: ?  b1 ~
  225.       strExtLocal.Empty();
    ! P0 o+ t2 X! y- m; t' v
  226.       strFullName=(*i).second;9 [  d. p0 B- L3 D% X. L. o( ~
  227.       dwProgramState=AP_CONNECT;
    # e0 A4 \5 R$ X  q0 y  \
  228.       return TRUE;/ Q) T$ n2 X1 Z0 J
  229.     }
    + d" r5 v# d* B5 y$ z; J' @3 F
  230.   }  A: W6 K; Y1 ~  C, f* M
  231.   else if(bRestartUpdater==FALSE)9 _; ?( `3 C- B, `8 B
  232.   {5 o; J. N% [. w% H' ~% B; _
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end())
    # [4 i$ p7 ]! |/ F/ E
  234.     {: _/ V% @! Z% e
  235.       file=(*p).second;; N: D3 }" j9 F. Z1 _' S0 s* @
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())
    1 U2 i8 k- O! {8 l$ O
  237.       {7 }5 X5 R4 I2 ~) M8 {- o, ^
  238.         olds=(*p).second;, G3 |2 B, D$ B( L
  239.         olds->vers=file->vers;
    ! x$ j9 d4 {: X* n' G$ i- b1 f
  240.       }+ A6 M' {7 {2 P5 \: Z
  241.       else! |# F( l: s6 \# m4 F! I
  242.       {
    * w/ l2 A: T2 H$ t
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));2 `" {( w; i% z% X% `1 X% F/ K0 U& A$ h
  244.         memcpy(olds,file,sizeof(UPDATEFILE));! ?5 E0 c, b, J3 [
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));
    6 B$ ]. r  t+ J: L6 \
  246.       }
    7 _, n5 |- {9 K$ H6 Y
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");3 {6 D% x  I6 c+ e  z. T
  248.       sprintf(filename,"(%s)",file->file);
    & r/ t8 V( Y& Z
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    5 E8 N. K( @! b3 U' E
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }7 ~3 e7 J3 g; g1 H* Y* G
  251.     }  w5 e& v6 A6 J/ \  t2 w) z
  252.     dwCurrFile++;
    + k5 W- k' ]  Z1 J
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    ) r) @: A. ~3 G% k8 h8 c! w
  254.     {5 z3 }0 h9 G3 m! S- r
  255.       bSilentStep=FALSE;
    4 \, @1 r, P' k" ], f0 p- N
  256.       bCompressed=TRUE;
    % {/ `. X! x0 R9 r2 F
  257.       strExtLocal.Empty();
    / h" X# [, @7 c& s7 z
  258.       strFullName=(*i).second;- s9 B% A) j1 w. F% |
  259.       dwProgramState=AP_CONNECT;8 x8 u- S8 a# ?0 E* m) W4 l
  260.       return TRUE;: S) k3 t# D0 P% V: |
  261.     }+ E& V* m8 Z6 h9 a( Y4 L, E$ E# P
  262.     if(!bRestartUpdater)
    2 k8 i# Z- q$ Z7 D8 c  `; }
  263.     {
    9 s8 @5 u5 j4 }7 n4 F, w) A
  264.       int iCurrSize,iFileSize;6 U4 Y0 f6 u& ]. J3 X8 k/ }1 w
  265.       iCurrSize=0;; X/ B  a$ n2 y- A
  266.       iFileSize=UpdateList2.size();% g! I9 U4 D0 b  A9 H- d
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");  t$ Q7 \: E& H/ u8 d  _4 t
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");/ Q& [3 q- M1 S3 u
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");7 J0 D& L/ i1 f; P
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    1 s" t4 X7 q  v3 t: N
  271.       Fclearf(".\\update.dat");: O4 ^4 P9 ^4 M; n' S
  272.       Fprintf(".\\update.dat","Bloodyf\n");
    % V6 g; y  ]* `5 n' {7 n
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)/ W: _# v1 h+ g  m- Z5 Q: w
  274.       {
      r5 Z- S8 q, o
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())( z0 |+ C+ j9 o7 U
  276.         {
    ) ]% @- x, g8 e/ }# w5 A: k0 _
  277.           file=(*p).second;) E6 j; u2 \0 x0 N
  278.           sprintf(filename,"(%s)",file->file);
    . }! K! f7 _5 b
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    7 o) U7 I$ n- @4 W1 }
  280.           iCurrSize++;
    * x# _$ E7 S1 m0 y% f. q+ L
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));
    % M* N1 k4 R* J% k+ o/ a/ {
  282.         }( g: x/ v, h% e- c
  283.       }- `! D2 G% i1 E7 s! ?- G/ Y; g' {0 r6 n
  284.       unlink(".\\update.txt");
    4 `9 C& [1 y& c3 \8 {
  285.       unlink(".\\update.tmp");
    2 ^1 Y+ M; a! m+ H3 y  p
  286.       Fclearf(".\\checkversion.dat");( @& v* F8 U) P# O
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);8 @# t, l' j( K
  288.       if(UpdateLocal.size())6 j$ b/ c/ n3 l0 `# D
  289.       {+ a% G+ }1 C; s2 ]$ w
  290.         UpdateLocal.clear();
    - f" L! f) G1 T
  291.       }
    ( ^7 h$ q& O; }2 U
  292.       if(UpdateFile3.size())
    0 ]: }- i" K# ?' U
  293.       {
    3 Y" s6 N, u& i/ q2 G" Q# d1 c
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++), o( F. d$ }. h
  295.         {7 o/ e/ J7 J  c1 b
  296.           file=(*p).second;
    # Y! o- C% x* N7 t3 p. I
  297.           free(file);
    5 L1 z2 K: |4 ^- ?# l, t
  298.         }
    , {0 H: ~: @5 Q8 [
  299.         UpdateFile3.clear();" \3 Z' S6 N7 b; F0 P" R: x
  300.         UpdateList3.clear();
    . g/ U+ W+ @! I* Z4 u
  301.       }8 {+ J" \, z  o6 p) H
  302.       if(UpdateFile2.size())
    5 @" S( g3 w( B2 G! y7 U
  303.       {
    & y( p. b% k. h% u. ^! N
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    + }5 |  v8 X2 b6 W: T& l/ I/ e6 K
  305.         {
    5 I6 J4 r/ s  D, Z, i+ d
  306.           file=(*p).second;# Z# r" P# y+ `+ I6 @% w- M
  307.           free(file);2 g# r" t8 L2 m9 |
  308.         }
    . X& m' ?( T7 A  \$ }- J  L
  309.         UpdateFile2.clear();1 N( [3 @0 ~  k5 W, r5 }( b
  310.         UpdateList2.clear();7 |! X" ^- |1 Y6 @, O  R$ j
  311.       }
    4 |5 R, }3 ^/ J# Z
  312.       if(UpdateFile1.size())
    3 p1 m' o0 @) T! `! j+ [3 L
  313.       {2 _# _9 W5 y! \/ }  h* [5 c
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)# u' y) p0 a. M* R; M8 \- W6 l' a
  315.         {8 d0 |" r$ d/ ^) \
  316.           file=(*p).second;+ d* W; \5 R5 ^6 X& _
  317.           free(file);
    ( \2 G. d0 @) V4 q; Q
  318.         }
    . O* G3 Z1 `. @7 t1 e9 P9 u+ d
  319.         UpdateFile1.clear();
    & z9 o6 P- k% P. P9 x: J
  320.         UpdateList1.clear();
    & E7 s- ^; j1 e* m
  321.       }
    ' Y) N' D3 e; q* M
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    9 Z% ]3 Y7 P1 O, [5 T9 w* A, I
  323.     }- V7 L: J- Z, Z" q8 W) r$ K
  324.   }
    / n) s8 b1 F! R' X% a3 ?9 L6 O
  325.   return FALSE;
      v: v& E4 y. w1 H; F. `
  326. }, \; d+ @% U: o: g9 K* L* {
  327. ) Z5 J1 F0 D% o/ J0 B' p" S
  328. void CRevAppApp::ClearAll(void)
    1 a% E/ q/ M# i  F5 x
  329. {! M$ K; v, k1 b" A3 N* N
  330.   LPUPDATEFILE file;
    1 K6 R% K1 G0 Y4 U
  331.   std::map<CString,LPUPDATEFILE>::iterator p;; r; v5 x! {. M* Q; Y' Q9 y

  332. ! B3 f& I( x5 h" \; S
  333.   if(UpdateLocal.size())1 c0 Z4 x. `8 o: L8 y
  334.   {8 D/ A9 c; x% p9 }* l' p! D) o
  335.     UpdateLocal.clear();
    " C2 i  {! x! ]
  336.   }8 e6 i) J& Y6 J/ m  d8 }  g! e
  337.   if(UpdateFile3.size())
    ; R/ D) J2 A1 s& k! x# V0 s3 d" m
  338.   {
    - Z% Y5 K  Y& a3 Z
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)5 t' K. m; i+ Q0 D+ u) Z
  340.     {" e3 c/ Y3 e1 a! m. A: [
  341.       file=(*p).second;
    3 \3 k0 k/ Y& N, A) b
  342.       free(file);! S1 E' t  H' N. P2 o; O
  343.     }; [% N% K' Y' _; v: O
  344.     UpdateFile3.clear();
    . M2 N$ T6 `6 e$ X2 `: X
  345.     UpdateList3.clear();
    ! W0 q% K& a2 {, i% w: Z' k
  346.   }
    / j1 S3 L: `! p
  347.   if(UpdateFile2.size())& A4 l8 Q5 K4 b2 [& k5 c6 C, Y
  348.   {
    : y# ~+ |% Y  Z- Y( Z  d- ]
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    . Q( \" o# p' m% K: A( v* X) s
  350.     {
      S4 A0 a* N! N* i1 h7 S+ |: ^
  351.       file=(*p).second;
    0 m) L% |3 I! p& y
  352.       free(file);
    0 S  n- P9 s$ @) Y# w4 h( p- h# d
  353.     }6 ^5 L2 M4 _* o: l
  354.     UpdateFile2.clear();
    # _% ?3 h; s. D$ j# R5 }
  355.     UpdateList2.clear();) a6 j9 |- R4 W& |# _
  356.   }* V& u4 m. y7 ~! G3 J/ J
  357.   if(UpdateFile1.size())0 z6 j% t* o& o2 c
  358.   {5 z: k; Y. _/ t  h
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    # F/ M) G' V$ R
  360.     {
    9 U" g" v8 D, ^9 D( j, A9 i" A  b, J
  361.       file=(*p).second;) u; u+ d9 t* ]* d2 O, K
  362.       free(file);
    ) j) K7 D) s5 F1 ]1 i% I. d
  363.     }
    . a# k3 o* A: ?6 l5 X# ?2 t/ q
  364.     UpdateFile1.clear();2 n+ j; U( Y2 Z$ ^( ?" p# F- g
  365.     UpdateList1.clear();: Z7 j' W% W1 E$ p0 T7 y. E
  366.   }
    9 R. W; ^6 O5 q' n% {; n" [: p/ D
  367. }  
    3 }4 y8 l; U0 p: W3 F6 D# d4 A, j
  368.   + g$ Y* K* m% ]8 l8 o
  369. BOOL CRevAppApp::CheckLocalVersion(void)
    $ s  k! Z/ m3 U8 w+ t" }
  370. {
    7 A, N( g% T+ w, U$ _9 |0 q" r
  371.   int c;' o4 f0 \! h0 v; ^6 Q" Y
  372.   LPUPDATEFILE file1,file2;
    # _5 I" `: S- U% e0 S
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;
    . b4 ~% M. a- v3 B
  374.   std::list<CString>::iterator l;
    + y" E/ |) k# ]  l# D* r
  375. 4 v) ?/ S9 D& \- n1 D2 w' a
  376.   UpdateLocal.clear();
    & Z/ ^+ o3 u/ W( s: P
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);
    ! T! G1 B! ]" L/ j* h" t
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);
    0 W& e1 {: _4 Q4 x& f7 W
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);
    ( j% `, H' v  Z+ d4 d
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);! t9 w7 E/ h4 w
  381.   if(UpdateFile3.size()), W8 \; a% W- T, b! Q5 p
  382.   {
    9 i$ D$ n* r' f. h: y6 T
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++)
    , n1 `, v1 w# N& b( b
  384.     {
    9 U$ Y$ u- m! Q. e6 _' |* `  F5 _
  385.       file2=(LPUPDATEFILE)(*i).second;( q3 b/ ^$ k4 @3 B
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    4 u) S* l- u' J/ ^6 ?+ J; q
  387.       {
    , x9 z4 N, E# @2 d& B: J
  388.         file1=(LPUPDATEFILE)(*p).second;
    5 p" L  J7 J- p- L, g. u
  389.         file1->vers=file2->vers;
    , I  z2 v! A7 M: f7 h; x% B
  390.       }' f' P/ a: t! y/ h
  391.       else
    $ C  N8 V1 k5 d
  392.       {' m4 X% o" z. V& c- {2 ]
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));1 [) Y. O, q: q4 |) v8 s
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));) W8 w4 @+ E4 q( E: @, i1 Q
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));7 p2 K# y( Z! i2 j6 ^. Q/ X
  396.       }4 J7 v9 ~- @4 j3 t
  397.     }& I, j/ B& u0 N) b
  398.   }
      K6 g* m6 q; t2 Z7 N! r
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++), K' @/ u3 F$ H
  400.   {
    3 [& Z( U8 |" b0 E  M% K2 y
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())
    " K8 x9 c9 y% j: [# y4 k
  402.     {  F  c) Q' [& [& u/ O  U
  403.       file2=(LPUPDATEFILE)(*i).second;
    6 A' J4 j) Z+ T4 s. ?
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end()). s$ [6 p/ g: f: [# y! C
  405.       {# i& x7 v5 U' ^; R
  406.         file1=(LPUPDATEFILE)(*p).second;4 h0 J+ Q! _% U; C' z1 r5 @
  407.         if(file1->vers!=file2->vers)
    6 S( ^  @# s8 t% W) n& S) n
  408.         {
    ' j1 u* L5 i9 z2 L
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));5 b1 g; `) X' F; ?
  410.           c++;( d. q* ~6 T" O: |/ k3 e
  411.         }
    ! F4 \* s" s4 J( s( }1 M; @2 N! \
  412.       }
      I  |0 |7 @. i# t
  413.       else
    % D' u, O, O8 z
  414.       {
    : h/ u9 X& N7 g* X6 ~5 u
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));( J4 r8 p8 u1 L
  416.         c++;* G+ v6 X$ w6 m6 m
  417.       }/ I- w" L! h8 I  C  \) }: x
  418.     }
    - @# g8 S2 x) d9 t# j1 P8 N
  419.   }) k7 V6 x+ F# v1 H. ]& D
  420.   unlink(".\\DownLoad\\update.txt");) }; R' H. ]1 Y  M! j, z1 _
  421.   if(UpdateLocal.size()) return TRUE;
    * B2 s4 E$ g; k* F1 U: K
  422.   else                   return FALSE;
    % ]+ v& X' g4 Q& U3 I
  423. }; A6 Y8 ~. f/ I" h- ?

  424. - S/ K3 z: c2 e7 G
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"" S5 u! g8 k# R/ X7 D
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn"
    . b: ?. i: H) e; _. w+ S, f- S, \
  427. + }3 y' T0 }; N8 b

  428. $ j$ `( @* Z, }* Z7 u% }2 [. s
  429. ; @2 ?' h) g) p( B9 T
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile)
    . r! V" e2 r( b( e4 v  _
  431. {6 I" E8 V  Y' \7 a! }1 s
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;
    ) i) H2 P) q& n- @; F
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    ( p1 A+ ~4 [' k- S' ~9 f
  434.   {
    8 Q+ b8 E: G7 e
  435.     char szLanguage[50];
    & m( N, k% d: A: z# c1 s
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    0 Z* K% H: ~0 ]/ q) b
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;0 ~  q+ ?2 [7 M2 E
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    7 o, ~2 @/ I5 h+ R& h5 J* }
  439.     else                                   m_iLanguage=ENGLISH;0 P0 d# r+ \6 T5 c: ^& w4 X
  440.     char szRegister[100];# K" ~( Y1 [8 b! K( \" z; m
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    ; U2 c, c5 c3 P. ~6 e0 C; K" r' w
  442.     strRegsName=szRegister;
    & Y' ?# X# U3 N. |' {
  443.     char szPatchURL[100];" p  b$ e+ Y: y: D& Q4 B
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");1 ?* R- s  W6 |6 o; w
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);
    ) d- `" E7 B. Y/ `/ x
  446.   }
      O1 @$ Q! I4 z2 R7 m1 ^" L+ D
  447.   else
    + U# |7 N5 ~8 C0 I
  448.   {5 O+ I4 j" \7 w
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);9 Y( u3 W% i* u
  450.     strRegsName=DEFAULT_REG_URL;
    ) q7 f, e. M6 i
  451.   }
    . L" \7 t& N* r# `- C& Y8 }3 x- J* r
  452.   if(GetFileAttributes("hosts.ini")!=-1)! L0 I  d) W- J+ _# s% m2 d  Z
  453.   {! ]! E3 r0 x, w3 K+ U; `
  454.     char szIP[50];" [5 ~6 B6 t9 D- v3 t
  455.     char szDIR[300];
    % e. i# H: F" [/ A! M- o' g% r
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))7 A! p2 w2 v3 k/ |. g3 c% B- _
  457.     {
    6 U! X# c7 [, N* D  U5 z
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");
    , q% R) P/ t4 |
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");
    ' {) c! d. l' m+ n/ ~* `
  460.       strHostName=szIP;
    + |  ~  q+ b) b# l% f5 H5 F
  461.       strHostPath.Format("/%s",szDIR);
      r  p9 q& H- {  L, h, ~
  462.     }
    ( `- j2 I( L: G2 S  ~# f, e
  463.     else& f* J" Z# c5 _# c9 _
  464.     {1 K, g& Q3 H; W- H: I2 e) h
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)  \0 n( o1 j+ x
  466.       {
    $ Z$ \. L5 y' n( r3 J4 a
  467.         char szLanguage[50];$ }( A4 U5 A2 M
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    ! C' L# Q! J- h. _: o4 y: R4 P; z
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
    ; G4 J) Y/ A$ T0 O: D: r7 S
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    - ^5 ^: t0 r( |8 y+ W5 {/ k
  471.         else                                   m_iLanguage=ENGLISH;" C9 a/ ~3 d9 O' i" ^  w1 r
  472.         char szRegister[100];
    & z/ r  F) O$ Y5 [
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    6 j6 l4 X( ?. V
  474.         strRegsName=szRegister;
    & Z+ Y2 C7 G) d& h
  475.         char szPatchURL[100];3 j2 J7 J, X$ G! I# \
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");% u2 }6 U2 B- A) g; ]7 h7 A" u
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);
    * f4 o- _, a) Z+ x; D6 b0 d! J
  478.       }
    " X5 l% z: h( `, X! E" `
  479.       else+ \' z/ _, |/ X  b# k
  480.       {9 A9 W& j- Q0 `4 s* M: y  A5 H& o, p& a
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);/ i) \: W2 G6 C& h$ R# `; N3 F# u4 g
  482.         strRegsName=DEFAULT_REG_URL;
    % A2 g8 [0 x" Q& C- v6 L
  483.       }7 ?% T4 l% M: f' p; s, s8 R6 y" i
  484.     }& M: S0 J) y. ]! r6 g4 Y
  485.   }( p/ r- u% E7 b- i1 Z
  486.   return true;
    0 Z: m/ d% R7 K6 b
  487. }
    * N: H* O# }, t) a: M+ w$ x' v
  488. 9 S3 |; v& x6 S
  489. #include ".\ZLib\unzip.h"
    . f# v7 H3 g# D$ I* h2 n. M7 v
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);; m1 F* L0 ^4 i
  491. /////////////////////////////////////////////////////////////////////////////
    & Y$ M/ b% t( \5 j
  492. // CRevAppApp initialization
    2 G1 M0 s, {3 p' j# Z
  493. ) L$ f# C/ H3 A2 h2 T/ H/ W
  494. BOOL CRevAppApp::InitInstance()2 F0 t  m' D* @5 K5 d
  495. {" ?0 T( X* d$ t+ a  s; z3 t
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];6 C! }( r& |+ B, D$ d% s, d6 A
  497. ; l# r# }6 Q5 p. Q
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);, N2 k. c) J4 l4 y0 ~: J
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))% r% H! h7 b+ q( v: v+ L
  500.   {
    2 I3 Q$ `; R+ Y, E6 e5 U
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");
    % N6 f* q3 c5 i- p4 D3 V
  502.     GetPathFromFullPath(szPathTarget,szPathSource);7 ]" z" P( u- R1 N: x
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))
    $ C6 D! a2 K0 k% [
  504.     {
    & W# J: C1 O2 v& T+ K
  505.       strcpy(szPath,szPathTarget);$ A" K' Z0 x( N, H# p$ |
  506.       SetCurrentDirectory(szPath);
    / |" M2 v3 Y/ ^, l. y
  507.     }* Q6 l2 D! b8 E$ c! [
  508.   }
    6 u2 w0 j+ @( _* ~& j4 Z
  509. #ifdef _DEBUG" V% t$ Q) `# E/ }. K( H, d1 T
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    ; q, z/ B8 S' _9 B! F
  511. #else
    : V+ ?6 `+ Y( i, n$ D- E4 N# e) n
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    / g5 r/ h4 w7 p7 N: l$ H3 c" g9 d: K! m
  513. #endif
    8 V9 u3 U9 Z8 X$ S, Y1 ^' R0 \& K
  514.   {( P8 [0 d9 g0 m* H, _, p
  515.     char tempFileName[MAX_PATH];
    4 v. G. v% }9 v, B* }9 I
  516.     strcpy(tempFileName,szPathSource);
    - f/ V+ s5 G* @3 S3 G* a
  517.     tempFileName[strlen(szPathSource)-12]=0;- |  l2 h4 y0 t1 {
  518.     strcat(tempFileName,"\\$CSUpdate.exe");
    3 }7 }6 U! b( K2 t$ ^: y
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);
    5 ]1 ?2 B* c7 m- c
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);5 m! p) h+ d$ D3 ?, i2 N
  521.     return TRUE;0 G7 `5 Z+ l' }8 r% ?$ |
  522.   }0 m7 D  X4 |% m. Q4 u. \1 Q6 U
  523.   // Nuke 0118: Delete run.exe" K- U3 Q2 {+ r1 S2 _" a1 @
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );
    " \0 l4 B3 c; s( ?6 ^
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");
    : ^/ m( n. k3 C
  526.   if(!ReadCfgFile("Config.ini"))" q" \4 u# A6 ]0 ]& E
  527.   {% [3 S% _+ L3 O6 O8 S
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);
    % d) Y# F* |3 K  b! m! r! Q
  529.     return TRUE;1 d7 Y8 a' A& _  L5 p; @
  530.   }
    6 k* b( y. K& @5 D( ~# E9 Z4 H
  531.   HANDLE mutex;- }7 q# l$ L" l! n, f3 d: N4 a
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))
    ! a- N, u8 p/ L5 H! f: G
  533.   {, d0 p' B: P! C* l
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)( q, r" E) a5 F( Z' j. X  m
  535.     {
    " y& U3 q: m6 [4 l& F( P, G! _
  536.       CloseHandle(mutex);
    $ z& X+ ^' _5 A% c
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);6 C( z; j9 a( a0 C2 W. @% L
  538.       return TRUE;
    , N5 q5 {6 u3 z- ^" e7 j
  539.     }: x$ @) e* ?) h' F
  540.   }  # Z9 [: V# r$ H' A2 j+ u9 m( F
  541.   CloseHandle(mutex);
    5 j2 P& E( n7 S( m

  542. $ I' f, I: r5 t" M: h1 U) c, _
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);, I+ }( f- }  D& L+ E% y3 D

  544. - {0 K* p1 M0 t" ^' W
  545.         AfxEnableControlContainer();
    / q" ~4 ^1 M8 y. N5 B
  546. 0 ~; c$ i3 ^  Z" s5 w
  547.   bCanUpdate=FALSE;- ~& P1 s; E/ L8 w9 _" H; R' p
  548.   dwStartUpSteps=1;
    . x$ m" f" F( m' x3 M8 \; y
  549.   dwProgramState=AP_NOTHING;
    6 Q! L! v6 F4 D! s' s; d2 {) S

  550. ' ~6 U4 F2 Q  M9 V1 t+ r6 [+ z! Y
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);
    3 j' k7 ^" ~5 I% q: s5 C
  552. + y3 G8 q% {  L* g- A+ Y
  553.         // Standard initialization' O7 a; p9 }+ p6 C0 v. D/ z4 U" v. |# J
  554.         // If you are not using these features and wish to reduce the size
    ! f( a6 M. x; _! O
  555.         //  of your final executable, you should remove from the following8 o+ y/ a! a/ O" x! `, F1 a5 O: q! M
  556.         //  the specific initialization routines you do not need.
    # k7 Z) h' g3 a+ k$ O4 f+ J

  557. 1 y* h; B, v1 I$ u* u% R" t2 t
  558. #ifdef _AFXDLL
    ) p( _' G! u2 f% d) p
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL" H& j. Y' p2 w
  560. #else
    & V2 K0 ~. N4 w5 n; h0 V+ H
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically
    ! n$ r7 a& G7 N- x
  562. #endif! i3 l% `; i) j2 u2 S
  563. & P# c/ k3 W, U- C. `2 s2 F5 K
  564.   dlg=new CRevAppDlg;
    / L7 q3 u7 F! u$ Q% U: K
  565.   dlg->Create(IDD_REVAPP_DIALOG);
    : F9 T% N1 n# b  G' s$ x4 @
  566.   dlg->ShowWindow(SW_SHOWNORMAL);$ A1 R% ?: P, Y" U* g
  567.   m_pMainWnd=dlg;  C: e/ u  K2 J) g

  568. / }: p& [/ _3 C# ]; M: }, O
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);7 K2 w% S3 x  R8 j- r& A+ w

  570. & @3 z$ w0 ^; O2 G! h
  571. //  GdiplusStartupInput gdiplusStartupInput;
    1 j3 V+ L7 W. X+ W& @7 m5 D9 u& c5 d
  572. //  ULONG_PTR gdiplusToken;- r) y5 c" E  B6 |- S! T. ~
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);
    8 M% a2 l3 n" `4 ]- |4 O: i

  574. 6 H; K0 O' Q9 m; I
  575. //        CRevAppDlg dlg;" ]$ ^. P) J5 u; U* D" h) Q$ c/ z6 l
  576. //        int nResponse = dlg.DoModal();
    " }, U  _1 }6 y" o) ~& K. h- S  V
  577. //        if (nResponse == IDOK)
    + U8 C/ Y+ Y& l  l( Y7 I
  578. //        {& R& j7 A4 a$ U& l" L- f9 ~% ?
  579. //                // TODO: Place code here to handle when the dialog is" c7 G2 @/ o8 @; |" u& m2 p: Q
  580. //                //  dismissed with OK4 [! G; S, D: Y1 r' Q& U6 G
  581. //        }
    % k  ]3 `- w4 Z" k
  582. //        else if (nResponse == IDCANCEL)
    3 T9 q5 |: I3 ?* o
  583. //        {, }; o& v) @3 a+ h" F$ y* o
  584. //                // TODO: Place code here to handle when the dialog is" I8 j# X. ?7 ]2 d
  585. //                //  dismissed with Cancel
    ; w) t7 ^) g" n7 @
  586. //        }- B- z7 U/ c3 l5 v0 L$ i; x6 ]/ H$ m
  587. ; p% B' U+ z1 c& m) E2 z* {
  588.         // Since the dialog has been closed, return FALSE so that we exit the1 P5 n, |8 d: w1 L7 u
  589.         //  application, rather than start the application's message pump.( g6 H3 G2 [( i2 b/ L
  590.         return TRUE;
    , ?1 i2 I1 M$ S; \+ I* I
  591. }
    ! d! m$ x( l8 ?4 ^" O
  592. " X4 p: h$ B* ?8 p
  593. char *CRevAppApp::strtok3(char *pSource,char *token)3 d. O/ m7 R6 J. [5 p
  594. {3 K2 F* e/ ?4 M9 _: C
  595.   int i;
    9 x! M- ?1 x/ w. P
  596.   char *szRet;
    ( j1 R7 I* d+ n  L: R, n

  597. 3 b5 t5 C/ i; A0 K1 {
  598.   if(pSource) { itoken=0; sztoken=pSource; }* I0 f' w( s" t2 G8 h# |' u! d
  599.   if(sztoken)
    5 }# S! }) P' \# O  X
  600.   {
      U' A7 ?- X/ u  D% ~/ d
  601.     szRet=&sztoken[itoken];
    7 T: }5 P3 Q8 R' k  m
  602.     while(sztoken[itoken])
    ! ~! f$ O5 P, N, ^& z1 H
  603.     {, O$ `/ d& F' b" C& S
  604.       for(i=0;i<(int)strlen(token);i++)5 Q$ C; d1 R4 p, r
  605.       {% }9 z* B) q0 z
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])
    4 m5 \2 N  t) w& E
  607.         {
    $ M1 }7 ?2 w0 @& a3 m, s
  608.           sztoken[itoken++]=0;
    . k- @: {' r/ ^" ?9 [+ n4 e
  609.           sztoken[itoken++]=0;
    : d* T: l, ]! W/ _. \
  610.           return szRet;
    5 [% \( I& G3 ?
  611.         }) E9 [, i( n' \
  612.       }3 c" P$ p, y7 e. \+ d4 _
  613.       itoken++;9 C2 O7 z2 a, l+ r7 Q- S
  614.     }) y- x$ v% g9 f) }0 a
  615.   }
    % E' E& d9 ?* b
  616.   return NULL;
    + h' M# _- ]. q0 ^, |
  617. }* m* g3 M! h! d' B( j

  618. . H! |' w$ f! J' Y, o8 q. l- g
  619. void ProcessProc(long Total,long Current)
    7 D1 S$ e, x1 z% j( S
  620. {/ q" n; N( v: t: G& B, k
  621.         MSG msg;
    3 u1 ^$ j6 j7 E2 h$ N1 s
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);0 y) h$ v+ u+ Z5 V) S
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));1 p% D" c' L/ I# N+ W7 i
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))& q4 Y2 @% [/ @1 Y9 f
  625.         {- N; j- p; h9 G7 e+ a5 i
  626.                 if(!GetMessage(&msg,NULL,0,0))  D3 D0 Y. r" R( k
  627.                 {
    & `& [! U' M/ c! `
  628.                         return;
    - w- r( |4 E& g) \
  629.                 }
      D# f  y8 r" ]; \- C
  630.                 TranslateMessage(&msg);2 z4 W" C( N  v* B9 }% f' ?' N
  631.                 DispatchMessage(&msg);
    1 L* @& @: [' t2 h) {& w
  632.         }        ! F9 b, ^' C" f* v5 q
  633. }
    1 i7 [  [& @/ q- {' u6 Q

  634. / I) P: N5 J! x5 v: {; n
  635. BOOL bFirstChar=TRUE;+ y; n0 v) Z  m0 ?( h5 ]

  636. & {, x  I9 a6 f( k5 R7 d- Z
  637. BOOL CRevAppApp::OnIdle(LONG lCount)! H7 K0 ^. G7 Y& k6 [$ P5 ~
  638. {' I9 z  Q# q( C4 f7 }' ~- s
  639.         // TODO: Add your specialized code here and/or call the base class
    9 y) S1 Z9 G  E0 M. D1 \2 d
  640.   switch(dwProgramState)
    ; y" C. f& V; w) k. @
  641.   {
    + A$ G: f  @; G8 i* g
  642.   case AP_NOTHING:6 g) }+ @( S8 i& }( c. l' C
  643.     switch(dwStartUpSteps)
    ' }- l( E$ r/ ]  p- l2 M
  644.     {
    ' \0 D# H  z" C& r5 u) F
  645.     case 1:
    + P! q# |9 b( G3 k0 I/ m4 D- n
  646.       {
    3 i7 ?5 E) f) O, u1 ?6 Q
  647.         int i;: r; [1 f: J3 `' S4 M  r
  648.         CDC *pCDC=dlg->GetDC();
    4 Z8 ~. ^& B% I9 @% ~! `
  649.         HDC hdcwnd=pCDC->m_hDC;
    - Y! E4 N; f! C
  650. //        Graphics graphics(hdcwnd);' a% ~% {) L3 ^# E
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");" u' f) G1 S0 `/ D1 b) o4 ]
  652. //        INT iWidth=bitmap.GetWidth();  G+ N$ o. C0 D0 v
  653. //        INT iHeight=bitmap.GetHeight();* {  F) ~- z8 P3 n. O
  654. //        Color color,colorTemp;  i5 t# E  L) o
  655. //        for(INT iRow=0;iRow<iHeight;iRow++)
    / J6 e' D4 o* v1 @% n4 f
  656. //        {: @; ?) c% i$ Y6 F  \9 a( n0 h2 R
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)" |9 t; ~3 N/ V) X% h  _
  658. //          {
    4 f* p2 d4 M( y& @6 N
  659. //            bitmap.GetPixel(iColumn,iRow,&color);; \: P/ h9 \9 _
  660. //            colorTemp.SetValue(color.MakeARGB(- e0 d/ W% m7 |. W; q8 n5 _
  661. //              (BYTE)(255*iColumn/iWidth),
    0 e9 k7 i& E5 g
  662. //              color.GetRed(),* S, m7 k" e8 c9 |3 \9 r8 S# w
  663. //              color.GetGreen(),
    ( h- I& l4 e* V0 R4 A+ m
  664. //              color.GetBlue()));
    1 _2 m' t- U0 F: a( `) g
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);6 H$ B- W4 c! i4 a& ?
  666. //          }
    4 w+ f+ v3 j$ }2 A) @* w
  667. //        }
    9 ?8 e1 d8 F. ~( _
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);; t  p7 r0 }; T4 F; X# x& }, ?
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    * y# h* R4 F$ H2 W, ?' L
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");
    $ o2 k6 {; ?6 k6 D: b9 w
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    8 T- D  g  z/ ~. I/ y/ O  V
  672.         for(i=0;i<240;i+=8)* |5 T: _) z& a% Z
  673.         {! D) W* d) ]+ L9 G3 j4 Y  T3 I
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);3 n$ f, J! m, Y2 ]" J& d
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);9 X" b9 y. B5 e
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);# p( J5 ~  |# I! |
  677.           Sleep(33);
    5 q: ]( a( L* V6 j
  678.         }$ w0 ?6 z% u4 f& c' z' [
  679.         Sleep(1000);
    : \! N2 E1 X1 ?) O6 t, }( I
  680.         for(i=240;i>0;i-=8)* J* b  X& z4 u0 ^
  681.         {
    9 v! i& g6 w; W- F3 K/ z$ r9 H
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    ' j6 _, H# ?" B
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);5 T5 o* }. X+ M9 @' L# c. `# E
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    ; n' p* X; \+ l; G$ J  C: N; M. O
  685.           Sleep(33);% v+ b8 z/ N; o' o# k0 X# E' j
  686.         }4 d, q5 @/ u) ~! f% X* d2 Z1 a
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);
    % _/ p/ z6 o( D; ~( C0 K3 g; o1 U
  688.         dlg->ReleaseDC(pCDC);
      e5 h6 q7 M$ r' ^
  689.         DeleteDC(hdctar);
    / w, }) a; ]! Q, I* \# D: `
  690.         DeleteDC(hdcsrc);
    # `" m( _, }! T0 \! J1 U* E, Q
  691.         DeleteDC(hdcorg);' ~/ Y$ `- m' G% P' T& |" S  {
  692.       }
    ( {( O7 M5 Q/ A  T
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);
    3 j- p( ]- ~0 ]- [0 U& _* n
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");
    7 N( L5 I0 [+ j7 Z' y$ p
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");- D$ [# ?; i8 V* v% O1 f
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");5 J7 ?! f7 l( q1 a8 A- [! B8 ?
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    1 a  U8 l4 H! h4 x4 }) E+ y
  698.       if(!Dn.Connected())' p3 L( W# R) E3 d) l8 j" D* j$ a: b
  699.       {3 K/ l. H4 E6 _1 m& Y0 }" M! d
  700.         dwTotalFiles=1;6 l! e' S: s0 w
  701.         dwDownLoaded=0;! `0 {; m5 |( v- K+ m
  702.         bSilentStep=TRUE;1 ]+ X# V( ^! a  z9 X# g4 e
  703.         bCompressed=FALSE;
    . o! j9 S+ R* J3 m$ _$ v
  704.         strExtLocal.Empty();
    9 Q5 L7 a. p. H3 Y) C' q
  705.         strFullName="readme.txt";: p2 ]' n: g( n- D+ J/ P
  706.         dwProgramState=AP_CONNECT;) B; v  ~3 \( d4 j/ e
  707.       }
    + w, K3 d* {1 @
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();, j9 M; I( H; g! C
  709.       dwStartUpSteps=2;
    1 I6 @  L% Y* M! N8 s
  710.       break;
    3 \( q! d2 L% Y3 h" i) P! V9 H
  711.     case 2:
    $ n" ?: R2 `4 x2 H. G
  712.       {
    ( [$ [1 Z9 s) k, e# T+ ?7 f
  713.         int iEOF;
    & Y* b  t/ R$ T' h  S8 ~
  714.         FILE *fp;2 A: y" F9 [  ?4 E7 r
  715.         char szString[512];
    4 \% K  ^1 s1 D( q2 F) G
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");1 |6 O9 z" \% F$ ?+ v7 {1 E, r: y
  717.         if(fp)8 I; _8 ~& d+ v) ^) P; f8 ?2 p, _8 ?
  718.         {
    , U/ \8 P3 T$ g
  719.           do
    - P6 E) Y' P; t" Y8 X- o
  720.           {: H; r, ^! e6 H
  721.             iEOF=fscanf(fp,"%s",szString);
    3 r1 ?) S% P6 w
  722.             if(strlen(szString))
    ) f. @) a' e- o4 `
  723.             {
    1 _: K% k6 p& G/ e/ p; t* A
  724.               if(bFirstChar)$ ?3 N- J# G% C
  725.               {' a6 V$ q7 l3 b2 ~8 b9 `
  726.                 bFirstChar=FALSE;
    ! b+ C9 Z7 h& `  P
  727.                 bConnectIsBig5=FALSE;% c$ Y' P" T, u; T* [
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;# |; `9 Y/ @, B' F$ c. ~4 z
  729.               }3 B9 J2 S7 L$ M: t5 g7 N" ~
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));: q& H) O, ^! w. Q' R
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));
    1 j" l4 Y8 J" K2 N# a0 J+ h- ]7 E7 r
  732.               dlg->m_ListText.AddString(szString);
    / B. Z2 w6 U: d/ B5 Q' Y. K
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    0 n$ F* k  y5 a# I- }* ~
  734.               *szString=0;
    * u- J7 d' M$ U- W
  735.             }5 j- w5 G, M3 n6 S
  736.           } while(iEOF!=EOF);
    3 x6 {: a+ p3 O6 E* |# K
  737.           fclose(fp);
    4 X# g$ x6 k4 m- O! t, A% f
  738.           unlink(".\\DownLoad\\readme.txt");( C+ u0 Y/ ~3 e* @
  739.           dwStartUpSteps=3;
    0 ]# Z  L4 c2 {5 k4 z( ?
  740.         }
    8 T- J2 K& D3 n7 z
  741.       }
    . A  R* M! r- V+ u; e! L! [" K
  742.       break;) j4 Y" L0 S1 v4 C9 L4 Y0 k
  743.     case 3:
    ) d# H/ M  {2 f- y
  744.       if(!Dn.Connected()). J6 c4 p- M' Z" o1 E$ g
  745.       {& i5 t. A" W) P* u+ v
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);. T- g( y9 g- N! k+ o  P! @! _# _
  747.         dwTotalFiles=1;1 o% e, b& M* j% D
  748.         dwDownLoaded=0;
    3 F' b3 _) W( [' ~: Z
  749.         bSilentStep=TRUE;) {, _! Q5 o* ^# J* S8 a) q1 m
  750.         bCompressed=FALSE;, S- Z: _0 A, f3 c, A  M/ S2 `
  751.         strExtLocal.Empty();9 z0 g( c# G) A9 x, N
  752.         strFullName="checkversion.txt";
    - m0 [& ^+ T4 A5 u" X! f* M
  753.         dwProgramState=AP_CONNECT;
    7 ^+ r$ H( w1 [: D
  754.       }" v* C; N$ h, ]' N: ]+ h: N
  755.       dwStartUpSteps=4;
    ' S' D+ _  y' b! }
  756.       break;
    # e2 b% X* Q0 j" I, n. J: Q
  757.     case 4:
    ) t3 ~" v' x! J) o! T+ s
  758.       {
    / S* t, g+ B+ A: Y  ]
  759.         FILE *fp;
    - \$ r' s* @. b, M! {! E
  760.         char szString1[128];+ V$ [- |) l5 m8 u% Q3 I( P) y. P
  761.         char szString2[128];
    , L. B* H! s& s8 q7 x/ L
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");" i+ N" q7 ]/ ^
  763.         if(fp)$ l5 K  e$ u5 |5 F4 F* L
  764.         {
    , C- I5 l' ~& {# ?" n
  765.           fscanf(fp,"%s",szString1);
    % {7 z3 Z- |$ A6 k; X# ^3 s& K
  766.           fclose(fp);
    7 D/ Z2 }, `8 y* i
  767.           fCheckVersion=atof(szString1);
    * J( B' F: C  f; Q& i' f
  768.           fp=fopen(".\\checkversion.dat","r");
    5 s) A4 V& }: A6 H+ i$ P
  769.           if(fp)
    ) w4 n7 x4 i; z9 J& x9 T
  770.           {
    6 C- q: A4 O! A' z& q3 N1 s2 t
  771.             fscanf(fp,"%s",szString2);
    5 u3 ~4 Y7 r4 g/ d* @
  772.             fclose(fp);. `9 V6 G  w5 ~
  773.             if(atof(szString1)!=atof(szString2))+ c' K+ T) T9 `1 \$ ^2 K6 ]
  774.             {3 C9 B% `: z: z7 ^/ I
  775.               if(!Dn.Connected())7 A: y% Z1 ?5 E- w7 I$ ^" O
  776.               {
    # H5 R( s9 F  e
  777.                 bFirstUpdate=TRUE;3 z% b9 S; y" M! j2 P; {) A
  778.                 dwTotalFiles=1;
    # I' d4 y* c8 b7 J8 O8 ]
  779.                 dwDownLoaded=0;
    9 Q/ D  `& f# u2 u9 @
  780.                 bSilentStep=FALSE;
    8 B0 J: v  {9 z) u6 u
  781.                 bCompressed=TRUE;3 }; Q* W6 ~5 h# {
  782.                 strExtLocal=".\\DownLoad\";
    0 Z8 b( a4 }0 }( p8 g
  783.                 strFullName="update.txt";, M( i9 d; N  S8 Q3 `# ]
  784.                 dwProgramState=AP_CONNECT;$ P* |8 r. p2 U( w/ k# f' u- O$ ?6 X
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");
    5 R* M* s# U5 V# p' s0 C# h$ c1 {
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    - i! b$ Y0 X* p# W
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");; F- t6 R' Z4 }- g$ j7 }
  788. 4 h5 Y; l& F$ v7 w2 `/ p4 s
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);* H% W) h( g* B% \+ a& B! c
  790.                 unlink(".\\DownLoad\\checkversion.txt");
    2 f; O  T3 s! ^: e7 h
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)' ?0 Z5 ?/ ^6 j# P) ^. s
  792.                 {
    0 l8 k/ d# F8 q
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");
    + Q4 P2 l0 D% e! G9 ~
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");
    " y' v* Y5 D8 Z6 z
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");
    * O% m/ w" S" R' Z. _5 J2 S& A( F
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    3 ^3 _! b# g. c7 [# @5 j
  797. 7 V/ @  W8 i, n. H! Y7 `' k/ d0 d2 ]
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    ; C) U, Y  B* q) t
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    + ~0 s$ C7 C# |: j. o
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");
    ) m8 Q5 x3 O* Y2 V4 }- z
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);5 X4 E# I6 Y) V* I  R
  802.                 }
    % r: P* e3 H7 S: F2 K) f
  803.                 dwStartUpSteps=5;
    ! h# C+ H8 ~: ~. H+ Z$ T  D5 X
  804.               }, J7 D$ l  P8 Y3 |
  805.             }1 e; ?7 u; F$ {  B  s4 A
  806.             else# h, M6 D/ r" B5 z% V. B; g1 ^( j, q9 B
  807.             {" T* X7 M0 D$ t6 I% V
  808.               unlink(".\\DownLoad\\checkversion.txt");5 ~/ h: ]. L$ `4 y2 u
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    : W( N4 V7 z4 |. l
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    . p& r/ z4 ?2 l9 m( K. ?3 |6 t+ E
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");& L& f3 i5 X; a
  812. ; u$ b9 ~" q! x1 x
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    7 t/ Z. z3 h% ?1 ?2 P
  814.               dwStartUpSteps=99;% C" e8 p$ p, `1 G3 `7 F# W
  815.               bFinishUpdated=TRUE;
    3 I$ x. h; o' H0 U; I
  816.               bCanUpdate=TRUE;9 w) X- C8 N4 b8 S; D
  817.             }
    / i+ q/ ~  r7 x
  818.           }
    2 v( f+ n- f. y& `. g
  819.           else9 d% x! L* N$ A- q7 m# H8 ~# n
  820.           {
    + g7 C' i8 R. |8 U
  821.             if(!Dn.Connected()). T0 |  E$ a9 `' H# _: F% {
  822.             {, d' q( X5 {. n/ R6 b( T0 y
  823.               bFirstUpdate=TRUE;9 S( W2 I/ \8 }# w; w
  824.               dwTotalFiles=1;3 c4 l  p4 S3 c4 G- g+ R: u/ d
  825.               dwDownLoaded=0;
      n) [% v8 f& C) u/ L7 h
  826.               bSilentStep=FALSE;
    * Y6 V' B. g# T5 I% n4 a5 F
  827.               bCompressed=TRUE;/ C0 S* p% z2 j" p
  828.               strExtLocal=".\\DownLoad\";
    - F& i, ?! Y4 G7 a& A. {- X
  829.               strFullName="update.txt";
    3 K* e6 a: ?  _8 b5 [; v5 Z2 V
  830.               dwProgramState=AP_CONNECT;# M* r0 E! L, K" w7 O( O
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");% O3 W& g1 x! @- t- g6 W3 C
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    * `6 v/ j1 M0 s0 y! E0 W
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");
    / t  z- A2 b0 h  A' p% B$ z
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    / t, _7 C- v$ p
  835.               unlink(".\\DownLoad\\checkversion.txt");4 m1 f# n& [6 N" `8 m( _5 X# r
  836.               if(GetFileAttributes("Wsa.zip" )!=-1)
    + x% u, |. |$ d7 @7 ?
  837.               {
    $ ]; q  y+ A# S8 `- G8 L2 z
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");3 b' N0 |, K& a
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");
    ' C6 @# d# U( J3 z6 u
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");
    ; C: D" M* B; S5 z* P
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);* }3 ?$ Q8 c, n% `3 m: o
  842.                
    % F( N+ E6 a7 x4 i& Q# R5 f
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    , \2 X( b9 s4 I$ X. O  H
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    2 d! h7 F! d6 g; ^8 V. v* e
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");( ^0 N  j5 N' t  q& I8 C, z
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);& W' W0 _9 x# K3 P
  847.               }4 S' H7 h  c1 V$ B5 g) n' y: W3 m* @: {
  848.               dwStartUpSteps=5;
    8 l# |2 A/ n: v
  849.             }! R4 L% x6 Q( A" ?# {- @
  850.           }5 r- y( H: J6 J* S
  851.         }8 d1 Y0 {3 z8 p+ @# u3 K1 S7 Q
  852.         else' E3 ^, j/ J! H7 X, O. X* Q+ @4 H
  853.         {7 [0 i% M. }. T
  854.           dwStartUpSteps=3;
    2 C& H$ v" L" L! z8 h, g+ x: o
  855.         }. M$ N3 |$ s" I3 \- r
  856.       }
    % ^1 P0 }9 ?& a6 u+ S* v; Y7 c# b
  857.       break;5 J) `" s6 k& q* o& H( g' d
  858.     case 5:
    ' D6 J( e8 ]: j  |1 x5 m7 d
  859.       {
    2 G% U# O4 H. x. p. R/ ~0 t$ J% _3 x; Z
  860.         if(GetFileAttributes("Wsa.zip" )!=-1)
    6 v9 y& X: m, x1 F, A  e
  861.         {
    # X) {2 j* j0 S, T& W! P# ~
  862.           int opt_overwrite=1;
    7 Y6 ]2 ]0 f. x. t) U
  863.           int opt_do_extract_withoutpath=0;
    $ @$ e( h( }( L7 {7 A- r
  864.           unzFile uf=NULL;
    # \! H* u5 N! r

  865. 1 ^7 t9 o. D' }: L
  866.           uf=unzOpen("Wsa.zip");" X' U: A+ a; b5 v! T0 c- f
  867.           if(uf)4 m( O7 |, u; o1 c4 r
  868.           {
    7 j9 K  F- @# T
  869.             do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,NULL,ProcessProc);' E- F( ?, k% t9 I& h
  870.             unzClose(uf);( E6 n5 D  |% v! T  r5 G% s
  871.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃ЧΘ.....");
    3 A" b% g4 y/ Y+ w% a
  872.             else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压完成.....");. V2 [8 a5 z# O
  873.             else                                                      dlg->m_ListText.AddString("Unzip OK.....");# O6 |& h$ w0 x: c: q! b! H. q+ W
  874.                                           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    - b0 X+ g2 b) k& D+ [. f
  875.           }& J- M# u. z. g+ \- L
  876.           DeleteFile("Wsa.zip" );; _) L: a7 ]  v) L  p7 A# j
  877.         }
    , N1 c. c% @, i$ V- k* l

  878. " m! d+ q+ g$ ^& g  r
  879.         if(CheckLocalVersion())3 o* G$ u, @/ T6 ]
  880.         {
    - H* x' a! n8 s2 q
  881.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫磅︽絬穝戈.....");+ n0 L: z% R/ {9 v
  882.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请执行线上更新资料.....");
    5 _6 D' A5 {! G. i! X# t
  883.           else                                                      dlg->m_ListText.AddString("Please update.....");
    , S1 p8 v9 w4 |# D2 a" [1 ]
  884.           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);1 Q$ U& `0 F5 H! T
  885.           SendMessage(GetDlgItem(m_pMainWnd->GetSafeHwnd(),IDC_BUTTON1),WM_USER+2,3,0);& X- }4 d) z9 v/ \9 c
  886.           dwStartUpSteps=99;( |: B$ y3 ]# i6 g; _
  887.         }
    / b3 d; m. v' k" C
  888.         else
    ! @' V: s  g/ H% F! F2 T
  889.         {
    ! v1 _  Q" W  M5 U: {# p& C# @' ~
  890.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    5 h, o8 E7 c2 z8 R( ~
  891.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    0 z6 g4 }) I6 {5 J
  892.           else                                                      dlg->m_ListText.AddString("no new file update.....");. N8 z2 C7 o7 [

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

  q0 b# C4 v$ o$ ?

評分

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

查看全部評分

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

本版積分規則

关注公众号

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

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

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