找回密碼
 立即注册

CSUpdate.exe源代码

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

+ I  D8 c* d" D  A( S& @* K; Y
  1. / RevApp.cpp : Defines the class behaviors for the application.. ^& B, ^% y" O$ V1 \/ _  M
  2. //: A! A# R! e! H" |
  3. + s6 ?7 |- J$ x+ Y. D9 J! l- j' k
  4. #include "stdafx.h"
    8 A  W1 a( G9 a& b) g9 b

  5. " }- \* `. U9 b
  6. //#define UNICODE
    $ _" v+ r! {7 F, \8 |  t
  7. //#include <gdiplus.h>/ f0 Y) G2 H5 y9 \  w! {
  8. //using namespace Gdiplus;
    , Y- d: d6 b, @- Z: g

  9. 8 p- ~0 J: D( a; |' V
  10. #include "RevApp.h"
    & o8 O* o/ y# y
  11. #include "RevAppDlg.h"
    ; W# O8 ^6 {7 ?+ R5 }3 q0 ]

  12. 7 J* i$ w# e5 K: m" m
  13. #pragma warning(disable:4786)* }# M. Y" o. M) C6 m% F
  14. #include <map>5 E: [) r* s# o
  15. #include <list>7 O! x; p& H* A2 k  N$ U
  16. #include <direct.h>
    6 s1 C" e. m9 q( S; X

  17.   O  m- l8 Z, _* r- V, m% p' l
  18. #ifdef _DEBUG- M* K  m; G: I2 n9 h% u. x" V
  19. #define new DEBUG_NEW% s5 ^$ x* z7 F$ w# N/ A" ~3 P& g
  20. #undef THIS_FILE
    ; s9 ~- T- T' `, k+ U' L
  21. static char THIS_FILE[] = __FILE__;+ `7 S$ U0 V& s
  22. #endif
    5 K5 X) A9 [. V! E6 J. J
  23. #include "SkinResDef.h"
    8 Z  ~) w* k# V& P# m
  24. #include "ChangeBG.h"% R1 F2 f# w% g' Y, d# Y% x
  25. #include "AFXINET.H"3 c. c7 B9 t8 u: a% k/ o

  26. 9 Y# S. }1 _' `8 S
  27. #define TRADITIONAL_CHINESE 0
    3 Q% d7 W" ^) X) P) Y8 N& b. R
  28. #define SIMPLIFY_CHINESE 1( x# k) y( L4 [
  29. #define ENGLISH 2
    ! {% {$ k: t7 W
  30. int m_iLanguage = ENGLISH;
    6 O6 Z. H' q9 ]( {( ]
  31. /////////////////////////////////////////////////////////////////////////////
    & D3 P8 b- k; X4 B- s
  32. // CRevAppApp3 L, |+ t1 K% s/ Z
  33. * P- I8 G, O+ y. i, v* r4 b2 r% e: _
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)/ a- c( y2 W/ @- }$ l
  35.         //{{AFX_MSG_MAP(CRevAppApp)
    4 X- c( O) X- B2 C: F1 M( W& ^
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.* S" ~: U5 i' d8 R0 J
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!
    $ c- }7 l  n% q$ G
  38.         //}}AFX_MSG
    # h4 M( ~+ m# g' P0 @. }
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)5 D1 V  Z; e% m6 X) c( Z4 ^
  40. END_MESSAGE_MAP()5 w5 W* _/ T- g/ o6 v6 K

  41. , g1 M! O; U, q, P
  42. /////////////////////////////////////////////////////////////////////////////
    . h9 }5 C! `- N
  43. // CRevAppApp construction7 q$ O0 q$ Z2 M0 B- n

  44. ; @$ _6 `5 e+ U
  45. CRevAppApp::CRevAppApp()
    6 w: L7 Q: K& K1 Q
  46. {
    0 S+ X$ g. [3 h, I5 M
  47.         // TODO: add construction code here,
    8 T$ N# O/ P* u
  48.         // Place all significant initialization in InitInstance9 I2 H9 f  f' X& _* ~
  49.   bDisplayIsBig5=FALSE;+ ^. m4 a' Z1 a) m0 e
  50.   bRestartUpdater=FALSE;
    . n; M& F# q( C& _9 D! d
  51.   bFinishUpdated=FALSE;
    ; r  F! P. u5 f. h/ A
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;
    & F4 ^; m% W! p" i: Z
  53.   InitChangeDataBig52GBKS();" @* H- m- D* X+ n# g: y0 s
  54.   InitChangeDataGBKS2Big5();
    8 V/ n' A9 b2 L6 Z& ]" ?7 U* K
  55.         //
    8 h& k9 Y$ s. a( e. o2 O8 H
  56.         bClickRunExe = FALSE;7 F2 ^$ i- ^( E, H& G: S( M7 L: [! E
  57.         //4 g5 Y' u4 Z+ Q) e4 F5 X7 R
  58. }  y) _' M% i. U+ v
  59. 4 d, o8 |: l3 @4 z9 R- f4 o5 r1 E
  60. CRevAppApp::~CRevAppApp()
    6 j6 ~$ E# D  f' j7 D
  61. {
    $ g* X) z3 D- Z' [3 J
  62.         // TODO: add construction code here,3 C; U+ c" S. s0 N! e* u) @
  63.         // Place all significant initialization in InitInstance
    $ {0 Q+ q0 i. {
  64.   EndChangeData();
    6 S) i: |5 Q# ^+ h8 C5 d' l- [
  65. }
    4 f! Y( q0 x! P1 H) f; L

  66. ; i+ P9 W' \. @" v& A! o8 S
  67. /////////////////////////////////////////////////////////////////////////////
    7 H4 D. U8 }. C9 M, |$ k7 \
  68. // The one and only CRevAppApp object
    1 [# O- i/ H! w6 P3 {5 _1 T. a8 @* N( w

  69. 8 f8 Q. A8 m* B: b$ ~( t3 Q5 x- s1 i
  70. CRevAppApp theApp;
    ' C  _1 V& S/ S$ n6 d2 c/ w* d
  71. & S2 q( n% ]# I& @9 E9 }" D% G7 F& Y
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)) R; C( G! Q5 D1 q2 m
  73. {
    4 [5 c) |8 Z5 `6 t  L. _2 P  l0 x
  74.   int iEOF=0;4 }9 ]: n* p7 A9 N2 \+ l, f% n  {
  75.   char szTempName[MAX_PATH];
    + [7 T0 Q. r2 k, H2 C
  76.   *szFileName=0;
    2 B: V. m5 k3 [4 G& n8 ?' L
  77.   iEOF=fscanf(fp,"%s",szTempName);+ S& C1 ^- ^- X- D" k1 s
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')
    3 H' |* L: `& x% |
  79.   {
    1 f) q; b2 t2 [
  80.     strcpy(szFileName,&szTempName[1]);
    ! @6 `. m$ ^3 H; c
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)
    % ]0 u1 D) g" s8 u" m+ o
  82.     {
    & ^' Z( v4 k; D* c' e: C/ d7 P9 p
  83.       iEOF=fscanf(fp,"%s",szTempName);
    * F$ q8 m1 X( t6 Z" e4 [
  84.       strcat(szFileName," ");" ?9 X4 S1 O+ {& F" q1 S
  85.       strcat(szFileName,szTempName);# x7 ^& _$ S4 p* t: Y
  86.     }
    9 Z- {7 ~" V+ ^
  87.     if(strlen(szFileName)>=1)3 {3 L: d. ~; o# e
  88.     {
    8 [6 D+ L- `2 |6 u. G5 \
  89.       szFileName[strlen(szFileName)-1]=0;4 [+ Z: Z4 O$ ]" x; D9 \
  90.     }
    & b, F' @; W5 d( P
  91.   }1 E6 s, ^4 @/ d$ e& ?) P5 d: ~/ Q
  92.   return szFileName;
    8 O" T* ?, j6 g0 i7 d5 T
  93. }9 A* h/ b/ i) ~5 _8 K0 ], [
  94. 1 [8 L) e$ p4 |# `3 f
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)
    5 }6 X: t4 Q1 W4 W
  96. {
    9 n3 ^. P4 @  Y: c" R
  97.   FILE *fp;
    / {6 w- C+ z2 C+ Z6 H0 u
  98.   char *key=NULL;3 R2 E: p& c& F( ]1 l" ]
  99.   char version[MAX_PATH];' m) T( l$ G5 |: e6 b8 B+ L
  100.   LPUPDATEFILE file,olds;
    ; F7 B4 U) O5 c6 a
  101.   std::map<CString,LPUPDATEFILE>::iterator p;+ V1 O9 I9 R  x( K+ o) M
  102. $ D8 o, [) Z; N% E# t/ S6 ~1 h
  103.   UpdateList.clear();. e5 H4 R0 b+ P" D# w1 B
  104.   UpdateFile.clear();+ e# a2 W8 j5 }  V3 [, e8 A
  105.   if(GetFileAttributes(filename)==-1) return false;. u9 g7 r+ {5 h: h) O, ], f( K. D7 J3 `
  106.   if(!(fp=fopen(filename,"r"))) return false;
    7 r. S6 N& |" O& w: `$ w  [
  107.   fscanf(fp,"%s",version);! Z% ~% V' J7 }& y* E/ y
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }
    + {- [$ d6 Z/ W" s9 W
  109.   while(fscanf(fp,"%s",version)!=EOF)
    * ?6 u$ Q6 J) e
  110.   {
    $ R5 m& N/ S0 Q% @- s* c) Q
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    ' Y  E& O- ^% Z0 e5 i
  112.     fscanf(fp,"%s",file->path);
    * ^. H/ {5 Q$ [5 O( Z8 q+ ?! i& L
  113.     ReadFileNames(fp,file->file);; V3 n) ?6 U! T  V& g2 k! A
  114.     strcpy(file->full,".");
    1 X7 Q2 W* Y+ [1 D: |/ I( J! q# W$ ^0 j/ m) P
  115.     strcat(file->full,file->path);
      ~$ z6 f6 G. r* e
  116.     strcat(file->full,file->file);, e3 b, X( ?0 T# n1 ?/ u
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())
    4 i& a8 ?2 m* J5 b: v& ~0 h
  118.     {
    + L5 g3 e* i7 h+ H
  119.       file->vers=(float)atof(version);
    9 K+ g9 L! `7 w* ]
  120.       UpdateList.push_back(file->full);
    $ \2 V4 |: |3 i
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));
    . X( i1 z( @& a; d$ c3 ^
  122.     }3 E! T6 C+ b+ M7 ~8 D3 v
  123.     else+ }& m# Y: r" i
  124.     {4 L! v( j' V  T& |/ C/ n. W+ h' S2 T
  125.       olds=(*p).second;7 I' s7 {; r- I) G* c: M9 w
  126.       if(olds->vers<(float)atof(version))0 \! _8 h! e) G5 g
  127.       {- F  ]/ v, a9 b3 x( I5 @
  128.         olds->vers=(float)atof(version);
    ; s- U& _4 c% n2 s1 x& P
  129.       }
    4 c' o) K1 q* f4 M5 g. j
  130.       free(file);  K. W- q1 H- j3 ^
  131.     }" }2 t* q; S" ~  w5 _- y
  132.   }/ o: p& S2 O- C) k& N; D( d6 T
  133.   fclose(fp);' I' i! R" ^4 \3 g
  134.   return true;7 K- H- O. e- `  J
  135. }/ Q/ U; G! V/ h% q& R$ r
  136. . u; _; g8 V- E4 `7 K
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)
      p7 V1 i6 p! D; h1 T* _. f* p+ t
  138. {
    5 z4 G2 C2 G: u' E3 W! e! T% m
  139.   TCHAR  szFull[MAX_PATH];
    ( t: W6 F, f' S) ]. @% h( O
  140.   TCHAR *token,*inter;
    # {- I0 B0 ~. m0 D8 j7 n+ |
  141.   *szPath=0;5 s3 F6 C. {8 w/ h
  142.   strcpy(szFull,szFullPath);( W, R5 `2 }- Y+ A: V6 E6 `1 W6 D) T
  143.   token=strtok(szFull,"\\/");6 M: q6 d- I& d) Q* d# O: E& i
  144.   inter=token;( j, I5 p+ ?- X4 Q; s$ ^
  145.   while(token=strtok(NULL,"\\/"))
    4 h; z  E3 {$ ^
  146.   {, _8 V! ~3 y8 x' \
  147.     strcat(szPath,inter);8 R" i8 i# t1 f; N
  148.     strcat(szPath,"\");# Y  d* ~, Y- D! P/ J# B# l
  149.     inter=token;
      P3 }5 P! m: J
  150.   }3 B* {! U) R( F* n
  151.   return strlen(szPath);
    % z- n0 S' k& n1 J9 s
  152. }
      U9 v0 X9 M  k0 J& _7 |7 `; B+ R
  153. + c6 R, i) }* E# ]9 Q
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase)
    9 X7 M3 o6 Z4 _! L! a! ]
  155. {
    * B; M" L1 K& G, Z& V
  156.   DWORD attrib=GetFileAttributes(Target);# N& l" T6 K- Q
  157.   if(attrib!=-1)
    9 h+ c. l# j' ]0 ]- Q4 H% J
  158.   {
    5 s  Z4 O: J+ O  U' f
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))* ~1 U. u, Q3 m  G& a
  160.     {
    : h. a6 q- t4 G% o  ]. n
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);
    * @4 l& X5 t3 p
  162.       SetFileAttributes(Target,attrib);
    4 |* l" T; P5 u+ V! r4 r# G- D/ p
  163.     }  h0 ^* C9 b2 W& Y+ W, u. f- Y
  164.   }
    : K7 S0 C% S% v& q4 h- N
  165.   CopyFile(Source,Target,Erase);7 w1 ]; u5 `, J
  166. }& I: `$ I' R. b
  167. & ]: d) m* |& a* R; U9 X
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)
    - h6 p) O  }" z+ V
  169. {
    ; `! Q; I# O4 {7 N9 }
  170.      FILE *fp;
      s  m2 ~) k, d4 N/ a0 U: _( ^9 F
  171.      char  szBuffer[8192];1 S; V0 W" ~/ C1 X# y- |) M9 H
  172.   va_list  argptr;
    ( G; K  e- N5 r9 Q: W
  173. / q5 ]' u5 Q2 i+ j) a6 K1 ~- K" p( u
  174.         va_start(argptr,message);4 ~% B" M! J' E( j/ s% I# P% N
  175.         vsprintf(szBuffer,message,argptr);' P6 `* ^- T9 v" t4 @) ?" w# y3 B* p
  176.         va_end(argptr);* P, m! x3 |) q( [3 S
  177.   fp=fopen(FileName,"a");# J7 {: j# O, U$ c
  178.   if(fp)
    8 `) B  z6 }4 B' F0 L, Z8 {
  179.   {& y  T4 M7 P5 F6 N
  180.     fprintf(fp,szBuffer);( [4 D' W6 k, Q8 ~* ~- r" N
  181.     fclose(fp);
    ) ]: i* p9 U: ^- ]
  182.           _flushall();9 m' o- D4 E+ B2 k0 R- c3 b; k' j
  183.   }
    7 P& T: K, f6 }8 L* s
  184. }5 R7 L6 }" P/ t6 V
  185. . l: v! {+ L) W3 r  K* W# P
  186. BOOL CRevAppApp::Fclearf(char *FileName)
    ! E4 I( U8 j* P5 F7 d" ^: G
  187. {
    4 d$ X, G5 d' k( B2 Y2 |5 X8 j
  188.      FILE *fp;
    # l# |, x% |! t5 O, r
  189.     DWORD  attrib;
    $ M- t; H/ G) E; n
  190.   attrib=GetFileAttributes(FileName);8 o% W3 c- z( D) ?! }) j
  191.   if(attrib!=-1)! Z8 h$ n& R/ ]- n9 P) h+ N6 m/ f$ E2 |
  192.   {$ t! }& H  M6 ?! a8 E. l7 {
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);  A: |9 R# {' E) l& L' a0 n* l+ p
  194.     if(!SetFileAttributes(FileName,attrib))) f' C' P- G4 [% K8 G$ w) {
  195.     {, C) N/ _8 R( G% y% l/ c, e
  196.       return FALSE;# N) T) [4 N' ^+ s+ v
  197.     }5 C, C2 B; ]) C; O8 C( a
  198.   }
    - o% H5 T( R- B+ j+ F
  199.   fp=fopen(FileName,"wb");$ p  `+ X* M0 Q
  200.   if(fp)
    ( K6 \! J0 _6 a
  201.   {; ]3 ~! o0 \8 E0 H! K( S
  202.     fclose(fp);) |+ @: X. o/ T' U: V4 X4 O
  203.   }
    ' h4 |1 r$ |( {. K4 j
  204.   return TRUE;4 p$ t# Z" x& ^1 K0 I8 U
  205. }5 w2 i6 H5 Z3 L  B/ B0 {' @
  206. 7 K1 X: [" l0 Z, l0 U1 F5 x9 L! x
  207. BOOL CRevAppApp::UpdateLocalVersion(void)7 X5 h7 r3 a1 R6 W
  208. {* f) q! L/ {) b' X8 e1 C
  209.   char filename[MAX_PATH];0 J0 d4 r/ y" l; R! H0 ^
  210.   LPUPDATEFILE file,olds;8 X. i! y; x$ K' l5 _  [# b( a
  211.   std::map<int,CString>::iterator i;1 m. Q/ t7 Z( p6 H+ {, N; v: v& G
  212.   std::map<CString,LPUPDATEFILE>::iterator p;* G6 @( v, O% b6 n( b0 R
  213.   std::list<CString>::iterator l;! q: J# o: }4 _

  214. * r0 l( H6 f  K9 ^$ i+ b
  215.   if(bFirstUpdate)9 j2 ]6 j1 G- C& S! T
  216.   {
    8 B$ y3 O' d; g' {5 S
  217.     dwCurrFile=0;
    7 n; z9 j' F! l% e3 i, p
  218.     bFirstUpdate=FALSE;
    1 u) X* v, r: k; q
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())& z  |) \/ R4 u  a4 k
  220.     {
    ( v* }+ \9 p% |% v$ Z1 R
  221.       dwTotalFiles=UpdateLocal.size();
    ' U7 j% w0 D# P9 `8 S
  222.       dwDownLoaded=0;$ T! a% `0 y4 c8 K+ M- V0 @  R
  223.       bSilentStep=FALSE;
    ; U& }7 w" p0 |* f9 Q3 O
  224.       bCompressed=TRUE;
    $ {  {2 Z- {/ B
  225.       strExtLocal.Empty();
    . x  Y0 X& I+ p, E3 g
  226.       strFullName=(*i).second;! c' W3 ~( t5 q: `/ {7 z. B' B
  227.       dwProgramState=AP_CONNECT;
    3 }' x+ L: N, G# c/ l( E+ q
  228.       return TRUE;
    " f/ H9 [6 F% k- L! v! ]
  229.     }
    7 o" L, I2 Z! b8 u: h. T
  230.   }
    3 f8 V1 L2 c' t
  231.   else if(bRestartUpdater==FALSE)( e0 \* ]' h. A  s9 |
  232.   {, e) t; N- C6 Y; u
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end())
    % b6 d! @; {9 p5 ?2 }
  234.     {
    : _/ ], V" O+ f# z' O3 W! G8 {
  235.       file=(*p).second;
    7 c7 Q6 E+ \2 k2 X' m
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())' u, \2 ~" U; N* N, \
  237.       {
    / |. @8 t4 m3 z- R
  238.         olds=(*p).second;: f" J. q! N6 x6 z# `3 M
  239.         olds->vers=file->vers;
    9 A6 F2 {. R" ?8 }4 |8 O
  240.       }
      O/ L6 p# {' C: F9 Z* A! U
  241.       else4 D0 P4 `& [0 ~, x8 e- `4 A; o# z
  242.       {
    4 D2 M8 O; |/ Y; ]
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    3 l3 [) t- P# w1 M' Q7 d2 P( V# ]5 t
  244.         memcpy(olds,file,sizeof(UPDATEFILE));
    5 G% _/ P) [* K7 c7 B
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));
    % z! H/ k5 D. z3 W8 [' d
  246.       }4 X. H( t8 u  b  S
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");5 \0 }: ]# s. {6 e: b7 z0 _
  248.       sprintf(filename,"(%s)",file->file);
    ; L' S( z% T3 |) K& m: h
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);" a5 E$ Q, ^. }$ n/ S4 B
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }: @3 n* Z2 A0 c5 J' w
  251.     }' B* m  \3 K4 }  P8 O& z8 U, ?
  252.     dwCurrFile++;" a5 g2 P! U( W, R: ?6 u
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())9 N# ^, O6 O. n( w' {5 k; E  n
  254.     {
    3 N1 E0 M; U) z
  255.       bSilentStep=FALSE;2 b& o( i5 x. {% s+ e
  256.       bCompressed=TRUE;( S3 T! y1 l  @* c9 e) G! h
  257.       strExtLocal.Empty();9 x6 i& |; h3 O
  258.       strFullName=(*i).second;
    1 w/ z/ w0 `2 Y0 {7 S' R
  259.       dwProgramState=AP_CONNECT;1 ~$ L+ s* J8 Y1 D0 O# I  i
  260.       return TRUE;) h9 M. V$ _/ E% @# i+ d6 z/ z: c
  261.     }+ }8 N/ b1 x& p1 f( ^
  262.     if(!bRestartUpdater)7 W( \4 `/ L+ Y$ N
  263.     {
    6 e- ?: U3 x' K9 r
  264.       int iCurrSize,iFileSize;
    8 h% _' ?' ~$ r% D* L( P
  265.       iCurrSize=0;$ ]3 T. s( d* o6 e2 v2 R1 T; O; n
  266.       iFileSize=UpdateList2.size();* d5 H  u" ~7 h6 ]! {' t% P
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");. v" |6 ?" b2 ]/ L; Q3 c
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");. N5 e" r) |+ k/ H9 _
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");1 t  T8 R2 Z+ \: h
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    ( f5 p$ X1 I" s/ d# o( [/ Y* o' @5 t
  271.       Fclearf(".\\update.dat");
    - x0 Y- p  Q4 r$ |
  272.       Fprintf(".\\update.dat","Bloodyf\n");
    : |3 y2 g1 \6 i
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)6 Q2 p( v* M. V8 `/ r' Y3 O
  274.       {! C4 I' j2 x9 l  H( _0 v
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())9 b5 M, J+ f* T5 ~7 `/ Y# C$ b2 [
  276.         {0 S- C! b3 D( v7 S
  277.           file=(*p).second;2 ^7 @5 n$ @0 f; c! c. I& |$ ^& ]
  278.           sprintf(filename,"(%s)",file->file);7 g2 }' N9 s4 @. O4 R! \5 a
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);$ G4 M8 N! L8 G" G7 I3 [4 M7 f
  280.           iCurrSize++;7 ^; T  L' r/ [/ R$ i2 ?: p* F
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));
    ) s" [1 n  f5 ^2 P+ a% A* O/ d
  282.         }
    0 f/ C. ]( U( |! n0 o" w, u& w
  283.       }% D% y* d: j1 s+ ^5 R- V8 H7 s4 o
  284.       unlink(".\\update.txt");
    " k0 x7 {( L" l' a
  285.       unlink(".\\update.tmp");
    0 ^0 l( y* G% Q0 u3 O/ `+ X
  286.       Fclearf(".\\checkversion.dat");% ]4 p( r1 p! R, ^; j) Q6 E8 S
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);
    ' ?& g& \( i" Z
  288.       if(UpdateLocal.size())
    * C' W7 N. p, Y1 r2 X( g* K; f
  289.       {
    2 ?  q7 Z( d2 {% J
  290.         UpdateLocal.clear();, y) \& Z, F* i# W1 q* x7 H
  291.       }
    0 r$ C; w) s% h0 j
  292.       if(UpdateFile3.size())  j% o% _( U4 e! u
  293.       {) h/ O, q' S/ W8 l9 o- A9 @
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)6 E8 Q% j% a  O: H: b' ~
  295.         {
    6 `" ^. M3 @) o: U2 j1 `# M
  296.           file=(*p).second;+ ~% R6 k5 f5 y/ W# A4 D* m
  297.           free(file);4 b* e  l# [3 d: z  T  a& e
  298.         }
    3 N9 J' P: W7 F1 B. p  E
  299.         UpdateFile3.clear();
      z% V  I% T2 `- F+ `
  300.         UpdateList3.clear();( c3 C1 Z/ _& ?2 H" Y
  301.       }4 C+ ?$ v1 P5 @, g  `3 J
  302.       if(UpdateFile2.size())& {# W7 U: Y6 l1 a8 m
  303.       {1 m+ U6 b0 u7 N' h# s6 p
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    : v- I( O6 c+ t, p* u: z
  305.         {
    ) f: E1 [2 G8 ~! B3 P0 L
  306.           file=(*p).second;
    ! V  C& ?% J1 @
  307.           free(file);% \3 ?3 i+ R" L- w0 x7 `$ I
  308.         }& g! l  J3 a0 G' S6 t
  309.         UpdateFile2.clear();
    ; R. u0 B4 X+ V" j1 G0 D. D$ y# P
  310.         UpdateList2.clear();
    0 Z/ E) x7 v+ }% V$ z1 w8 I$ q% [/ B
  311.       }
    % S) ~5 }* y! X, c* U
  312.       if(UpdateFile1.size())6 c* B, T! {+ k3 `7 }# `' S
  313.       {" _: V) v+ e. N& d+ M" d# i4 t5 d
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    ( @% R- N& y, s- y5 l$ [
  315.         {
    , ^, h7 L0 w3 B: I# y) Z& D
  316.           file=(*p).second;
    # X: s8 M; r- t0 Z, I9 N2 Q- {
  317.           free(file);' `* O6 D5 H: T; m' x  o$ s* L
  318.         }6 ~5 s; P9 \. O, T# }5 z0 L7 j" \3 @
  319.         UpdateFile1.clear();
    ; l- ?" }  G, Z
  320.         UpdateList1.clear();
    . J# c! I4 K1 d- x: a' s, {
  321.       }. m" X* r! g3 @4 g4 ]5 \" A8 S
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    - Y+ v: s9 N$ M" H$ o/ Q& v" S& ]
  323.     }
    : S5 x! A. k* c, p9 k
  324.   }+ j$ t  `1 j( b. r9 a) j$ X
  325.   return FALSE;
    / y8 H  p+ p- j7 O& g( A
  326. }
    ; p5 u9 P" ^& z) ]' t" S

  327. ' G. D% r) T2 u2 |2 U8 r6 `
  328. void CRevAppApp::ClearAll(void)
    ' N7 `) R. c2 n: i; F' |1 K
  329. {, j8 e2 B0 ^3 _
  330.   LPUPDATEFILE file;' w) _8 f  Z. ]) Y
  331.   std::map<CString,LPUPDATEFILE>::iterator p;
    8 T. r6 d6 z$ A: b9 A! L  I  f
  332. 2 D& B6 l, p0 [9 Z7 A1 T
  333.   if(UpdateLocal.size())+ `; G3 ]4 p3 h
  334.   {& h, Y1 L; U; X
  335.     UpdateLocal.clear();7 E. q2 M) {! I# L/ X3 O
  336.   }7 ?8 s- X2 U, z
  337.   if(UpdateFile3.size())$ G( U/ `1 o, v& x9 Y- ]
  338.   {
    + p* L! U1 J/ |- Y* H' ]
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)9 y( `( \% u( k# t
  340.     {
    ( c$ D8 J# t" W+ J- L: n, g
  341.       file=(*p).second;
    + Y, S, m$ P; }2 L# g
  342.       free(file);
    , o9 a8 G5 u  N* e  f8 g
  343.     }
    - N; B$ B& e$ k& h
  344.     UpdateFile3.clear();
    / E8 q2 |0 _. ~2 }6 \
  345.     UpdateList3.clear();$ K/ X. y/ b% U0 j
  346.   }
    . f+ t: ]* A9 j* o
  347.   if(UpdateFile2.size())0 Z: U: f( x' H1 w/ X/ g2 G# V9 Z" Y
  348.   {8 }# C/ B" v0 ]' B1 k, \
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
      \8 }5 r5 u; W& h
  350.     {
    ) n7 X8 B0 ?+ y4 @
  351.       file=(*p).second;
    3 N6 U; g" m5 a+ d6 b. c1 q; f/ E
  352.       free(file);
    # s: \" Z6 }/ t6 y& B+ g6 K
  353.     }/ \+ C' q0 _; @7 i4 h
  354.     UpdateFile2.clear();+ t! b  i# b( e! [
  355.     UpdateList2.clear();
    1 [3 ~3 c% B" J. b) a; W
  356.   }
    / o; Q6 X# X9 a! n
  357.   if(UpdateFile1.size())
    8 [+ s4 A0 d- [2 S2 e2 G
  358.   {8 R" s3 u0 G4 `" \+ U/ ]
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)* ^( k) k6 g  R0 B( @
  360.     {
    8 o" W, d. d+ p3 J8 n+ v2 I: k* j$ z
  361.       file=(*p).second;
    # s& e* S7 y9 |( v3 Q( g' S3 e+ X
  362.       free(file);( T! R7 j( j1 k4 F  [7 B& U% l
  363.     }5 r  r" ^, }1 H0 `$ `4 b) x9 ^8 n
  364.     UpdateFile1.clear();0 v$ I2 b. f* q2 [
  365.     UpdateList1.clear();
    ) F( [- m+ B: t1 V, a. ~
  366.   }
    . `5 s- B/ O! j
  367. }  # Q, j5 Y2 q) ~( W/ D" J8 o
  368.   
    0 F3 x4 C" I1 P1 U
  369. BOOL CRevAppApp::CheckLocalVersion(void)4 o( c) M; v1 o
  370. {7 n5 Q" e! C' }' u" r0 T2 h7 g
  371.   int c;$ p/ T& r: f- H4 q/ I+ Y& c
  372.   LPUPDATEFILE file1,file2;! J5 S4 J) P" P6 ]
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;) m: e9 b: R* d+ u2 ]( i% t6 e
  374.   std::list<CString>::iterator l;: b* ^- t& P, V3 o2 O- [- H4 _
  375. " {, Q2 y9 J! T$ G0 e
  376.   UpdateLocal.clear();+ a8 E  T: A3 w4 u5 P3 v7 N5 H
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);: ?( F: A8 o" x0 R/ T
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);7 q4 [6 V3 |1 m/ a5 Q
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);
    9 b* ?/ h1 i8 X4 _& v+ J
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);
    ( G) `3 W& }/ A, Y  D( V
  381.   if(UpdateFile3.size())
    - e% f- z1 ~) r5 L5 [1 X4 S
  382.   {2 K4 |3 Q2 k6 ]/ g% G* Y
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++)4 o  E5 `( @4 L+ V- y) h- j' e
  384.     {- u6 I; u* M: u) \: @7 D
  385.       file2=(LPUPDATEFILE)(*i).second;6 D0 U; b9 ?- w7 B( e3 [
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())* z* g7 A2 Q  s6 C. n' d
  387.       {% P/ N$ E9 g+ l$ P( o2 w
  388.         file1=(LPUPDATEFILE)(*p).second;4 ]8 p, e" l2 C+ N) S( v1 S
  389.         file1->vers=file2->vers;
    , r5 ^1 v. @* S' j& a/ u. }
  390.       }
    " B+ E, ]1 l) D: I! K6 d- p7 f6 o
  391.       else: N9 N$ S3 K4 M& j
  392.       {- y2 Y0 E1 R. x( @
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    7 x5 S" T0 ~9 Q5 b
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));7 x' _0 y6 E9 U+ f6 V
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));" T* d- Y' x! M) k3 f
  396.       }
    % A$ m* ]5 `6 V* j
  397.     }$ a) @! K* H% {" `1 C! |+ m
  398.   }2 d* \4 u7 `9 p
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++)$ C2 g+ Q$ p- n! G4 y
  400.   {
    . n) \+ P1 k( _% y
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())
    - W+ W; E0 a8 g7 j8 a
  402.     {
    3 h: N# l4 u+ C7 q% d. q
  403.       file2=(LPUPDATEFILE)(*i).second;, c2 N7 v0 ?( t5 q+ E( m* G) D
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    7 I. S+ W) o6 z# j3 p" X  H) a+ [5 z
  405.       {
    $ ]; v5 |9 s. Z+ h. q
  406.         file1=(LPUPDATEFILE)(*p).second;  l$ f; Z1 D) ?7 B
  407.         if(file1->vers!=file2->vers)
    * s6 l9 v) {) I6 |
  408.         {
    3 T& D8 `% t. m+ B$ N
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));6 o" J! ^4 {8 P0 P0 v
  410.           c++;# j* [  L7 d& k5 t; c/ r
  411.         }
    # q) V7 p% L: d2 v
  412.       }& k8 |7 O1 n( P
  413.       else% }, Q# o6 k' e
  414.       {
    8 @( o. Y: \) \; v! b  z) Q5 E
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));, d3 e! o3 g' f: x" o  U
  416.         c++;
    ) n% R6 d9 h' I; E+ @
  417.       }  S( G( O( G5 }
  418.     }
    8 s; D. |& E( `5 G" T2 R
  419.   }: m: x3 x, Q$ Y1 O3 [
  420.   unlink(".\\DownLoad\\update.txt");
      Q9 l" e% b/ R6 S5 }
  421.   if(UpdateLocal.size()) return TRUE;
    ) ?8 G% e6 K' \6 U' P: K: ^
  422.   else                   return FALSE;, ]& ?% T1 ^3 s5 B
  423. }
    " }% J1 I0 E/ ?* t! g5 {' P

  424. 7 g/ w7 k" G3 e! |+ X2 w" X# g* b
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"' X) n& u5 J, H. o1 z7 S
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn"
    8 @) [7 D3 b+ w) q; @6 I" F

  427. 4 |9 u: N9 Q9 F: t/ z; i
  428. # ], ^1 s* B0 S+ I

  429. 4 k: f- @  Y( X0 W1 @1 g' x# F1 o
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile)
    , ~8 b! J. G; p" ?
  431. {: i+ s4 z# f8 |2 e8 J
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;
    / U2 I- A# d# }$ @3 A" F9 o+ {, S1 S( |* d
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    + I% U5 E9 I9 M5 t: \0 @
  434.   {# S( H. _8 t$ _( n, z6 U
  435.     char szLanguage[50];: O9 r1 R3 a+ x+ E
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");0 m" j+ ~* `9 q8 Y* l& Z" O9 V
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;* K2 l! E/ c$ b# s* x8 R
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    . f- o6 Y" u6 C2 `; n3 E( u
  439.     else                                   m_iLanguage=ENGLISH;* T1 b. Z1 S- z
  440.     char szRegister[100];& X, F! x5 w- `4 X3 j
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");% _3 h) I  P9 {4 o. C% s
  442.     strRegsName=szRegister;
    # S- P' N% |& M7 ~+ Q; F
  443.     char szPatchURL[100];* \6 f1 v: L- ~' R: c. f
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
    2 }1 S9 ~/ W$ t6 Z! x
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);1 c3 x# m* E' s3 Z9 T$ |# q/ T
  446.   }
    # y) \! m. x8 q/ v8 D
  447.   else7 G5 K5 F/ |+ A7 J! a) z
  448.   {
    / D1 c. ?2 p8 r
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    ) S' ]" ]) @& g3 A  I: J8 s4 b
  450.     strRegsName=DEFAULT_REG_URL;9 c, P0 p# n; D0 w
  451.   }
    2 V$ e, V) u' ~" t* \1 l$ j; I
  452.   if(GetFileAttributes("hosts.ini")!=-1)( X, o; {  ]& e; {* z
  453.   {
    + h: G5 D' M% ^3 w! K% w' _
  454.     char szIP[50];
    $ Z' ^5 Q, e5 y% I. z% n* a5 W  d+ n
  455.     char szDIR[300];
    % e7 b  n% _+ n1 c; W4 |
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))
    8 b9 d7 r  \1 ]- {8 O" {9 T
  457.     {  E2 i/ {; L# q2 g3 g* Y
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");$ M: h4 ]4 m' I" r
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");
    4 ^9 R  i5 B& }2 e4 A
  460.       strHostName=szIP;1 T. Z& Z, F' y# G9 q$ X) [$ k
  461.       strHostPath.Format("/%s",szDIR);0 w2 E. U1 F) v" F4 ~* v/ p
  462.     }
    * w: t" ?0 O( N% s1 [8 r* {) E  n9 K
  463.     else
    # }8 K8 d' w1 s
  464.     {
    ; b0 ^& G8 w( ]: f$ n2 {1 X
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)/ S" b  j6 B. W! [% [
  466.       {4 Q( G8 d+ p: g
  467.         char szLanguage[50];
    ' [; b- u- t. `7 N
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");( K* k8 H! O5 S7 c2 u% I
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
      x" A, n+ ]& j7 e) w) |5 D
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    6 R& Z! M# {6 |! i" h2 H
  471.         else                                   m_iLanguage=ENGLISH;
    1 ~2 y' ^- @5 l6 K: u
  472.         char szRegister[100];: V; U. y4 y1 U3 D
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    $ I- m5 m7 Z0 f& _2 S1 Q
  474.         strRegsName=szRegister;0 i, _% P; ~$ A5 i3 w+ ]8 G" h
  475.         char szPatchURL[100];" d) L5 F4 U# K8 _% c4 y1 g
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
    4 l9 C% W3 n0 G" V- Q
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);5 ^/ o2 }! ?! w- o! g  Z
  478.       }0 j4 a2 Q2 V2 \9 R; D( H
  479.       else) c1 C* l: M1 Y+ j
  480.       {
      o  V& d7 a: v% T; e
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);  {6 P- V2 v8 d. C1 q! _* C3 m: q
  482.         strRegsName=DEFAULT_REG_URL;
    + d4 ~5 w7 z7 L" u" Y# \
  483.       }: X1 M6 z' k! W
  484.     }
    - m! \$ r1 H6 q2 a+ n  i
  485.   }6 }" [& I" B8 {# L8 j
  486.   return true;: I% m' _7 B2 @! I; W3 \4 \
  487. }1 G5 B5 N' z& c/ p; R

  488. 4 f7 E9 ]1 S! W' z6 ]7 _
  489. #include ".\ZLib\unzip.h"! }. B6 i8 `* E0 c9 ~" a
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);+ n' h0 J# L; v& m7 k0 Z
  491. /////////////////////////////////////////////////////////////////////////////
    8 b& h  `0 U, B) U- u/ W6 |7 j
  492. // CRevAppApp initialization* _" m. b) w3 a/ X+ N4 A
  493. ' r4 k, E" g1 Y8 e
  494. BOOL CRevAppApp::InitInstance()
      J. N' T& ?% k+ O, i9 r
  495. {! }5 Q" |$ ~1 i7 y  c: _( y
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];
    , C7 E% `! N) f% [, K2 Z
  497. " {# \: C' o( S. Z* ~: M$ x! \+ {
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);# a* D8 `/ ~7 }
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))1 X) Y, D: {. j
  500.   {! w  _, O3 T  e& X" s- N
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");
    : r% \; o- ^4 `/ {7 S; k
  502.     GetPathFromFullPath(szPathTarget,szPathSource);& R4 _9 x1 A4 ~# g# t
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))! W: m( L% O+ g6 f
  504.     {
    3 ]. [$ Q$ {/ n8 r# ?% L* M
  505.       strcpy(szPath,szPathTarget);- W8 p  K  W6 G+ c+ A
  506.       SetCurrentDirectory(szPath);
    1 d& H8 [2 c+ C5 ]
  507.     }9 k& @' Z7 a. a% Q
  508.   }
    + w! n* g& X1 e
  509. #ifdef _DEBUG
    7 ]' I* H; d  b& n, x
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))9 q9 n' Z3 @/ p1 _
  511. #else  u- q! @; V5 b1 V5 Q6 r
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    % U/ g( D9 W1 f- \3 \( |/ K
  513. #endif
    1 Y3 W* f! ~# \" W( w( Q
  514.   {' X8 \7 R5 U; O
  515.     char tempFileName[MAX_PATH];
    . B# l! `$ S# n
  516.     strcpy(tempFileName,szPathSource);
    : ^, l* m5 _0 U7 ^2 h; z0 G
  517.     tempFileName[strlen(szPathSource)-12]=0;& \  c4 `: z) s+ g0 Z9 H$ l
  518.     strcat(tempFileName,"\\$CSUpdate.exe");& f- O4 F9 _# S$ N
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);
    : O1 L. c+ T' R. J. d
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);
    % o: `% F8 L* j$ O3 l# m
  521.     return TRUE;
    5 v4 i- J# p9 V; E3 ]
  522.   }
      q8 f: D5 i- m! h5 W
  523.   // Nuke 0118: Delete run.exe- H' Z' ~# t* }+ Q! Z1 {! }. J: p
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );
    , q/ b& E, |. D! X# u) z
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");; e' Q* U0 S, [3 L
  526.   if(!ReadCfgFile("Config.ini"))
    ( A  i; X+ D; H* O0 w5 q# A7 l
  527.   {
    * L7 Z$ _/ x0 n; K. a* \
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);
    $ u9 a; B* g" d
  529.     return TRUE;
    ' B% L6 V5 Y2 a" N/ \6 U
  530.   }* h6 G. n) e' t+ S" J' q
  531.   HANDLE mutex;' z0 r, j# g5 x3 E& a) Y- b
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))
    ! k: S" K% p% b+ Q+ w
  533.   {
    $ W: O# Y, N9 m# F; ~
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)
    ) {) e( P3 G7 g6 _" f6 ~- V
  535.     {
    $ P% p8 t! }7 y0 o. P" s* \* X
  536.       CloseHandle(mutex);
    . c, h2 }5 \, y- A9 @! C! P* `4 [
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);+ O7 V& m/ n/ ^8 F0 m9 x& {( s
  538.       return TRUE;
    ; w0 d# M% S5 d9 A2 [) J
  539.     }) s/ b5 B+ `7 k0 [$ ^  C, Y3 w; ^( K
  540.   }  
    - K, b7 }0 o4 G
  541.   CloseHandle(mutex);
    - z0 e! U( n! r, u; x# j
  542. - ?$ t' j( t& x) J, B
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);- P( }9 t* y$ [) q) ]; g2 h! z

  544. 3 s6 N: |4 J; i' W' H) |
  545.         AfxEnableControlContainer();
    . l2 i; Q' h$ Z! u! f# z

  546. " s( z& x: e; p1 |
  547.   bCanUpdate=FALSE;7 X1 z" Q8 y/ [. n
  548.   dwStartUpSteps=1;
    6 \7 w. p! Z2 S4 M) G  ?; g% F" Y
  549.   dwProgramState=AP_NOTHING;) i. e# g5 V; h$ M( |$ K
  550. ( e6 \' O' k+ I$ v% @  [
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);# D' }2 f+ g$ V3 m5 M
  552. : M& G' G2 Z4 d
  553.         // Standard initialization- J) p. G1 S% a. x1 X- |, f& @
  554.         // If you are not using these features and wish to reduce the size  w( S: j. x+ W
  555.         //  of your final executable, you should remove from the following
    ' X2 h' E! Q0 F7 u7 ]* C' j  L
  556.         //  the specific initialization routines you do not need.
    * Y/ R( E0 L2 i' G

  557. 5 z) _9 w: w0 H  v/ G; q
  558. #ifdef _AFXDLL
    ! v' f) T4 b2 O3 h
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL- V. B8 M( _5 T, j! [
  560. #else+ v  u% ?9 K  H9 }) V+ Q
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically
    " l, M+ ~8 j, |" b1 Y! B8 _5 e! Q( H
  562. #endif
    * Y; S  I( l3 b# T, k8 @0 q' h/ f
  563. 9 n7 g6 k, @" ~3 I
  564.   dlg=new CRevAppDlg;
    3 c3 U! c7 f. x5 H* A6 ]  Z
  565.   dlg->Create(IDD_REVAPP_DIALOG);$ }5 ^7 ]+ T- H
  566.   dlg->ShowWindow(SW_SHOWNORMAL);
    + Z' s" D% A; g# G) N" M
  567.   m_pMainWnd=dlg;% w$ o1 `" f( V8 v9 J: |
  568. 1 \* |# ^3 E0 w1 L
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);
    % m0 z! c3 K9 m* i5 G# _0 C
  570. " H4 [+ t% t0 i! }4 N' }
  571. //  GdiplusStartupInput gdiplusStartupInput;
    5 b, V2 H. d& X" d+ k; A# x
  572. //  ULONG_PTR gdiplusToken;
    3 ?  ^. Y. G& C) Z  S% I
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);
    : M2 ]# e2 G) D* T) {
  574. / l" f* Z4 e( Z% I4 j
  575. //        CRevAppDlg dlg;
    4 e4 `5 L& B" u" b' c( c! |
  576. //        int nResponse = dlg.DoModal();- B/ C9 }: }- h2 v- x1 N" H5 p
  577. //        if (nResponse == IDOK)# K+ P7 z; l6 [+ z% I, Q$ |
  578. //        {
    # P4 x( c0 v6 q9 D! k
  579. //                // TODO: Place code here to handle when the dialog is1 h# _4 M7 }' _) B6 G( @
  580. //                //  dismissed with OK& l: l+ m/ \6 i& L: t
  581. //        }
    9 k; v) ]  H' K/ p
  582. //        else if (nResponse == IDCANCEL)
    2 P: c) W( d7 L% g# p
  583. //        {) t: I: B( H+ [" c) g! A
  584. //                // TODO: Place code here to handle when the dialog is
    % t8 u/ |( [+ K7 y& A5 l
  585. //                //  dismissed with Cancel$ l0 x# t; z7 O! i  H- p" D8 V
  586. //        }
    ) p8 f/ i. l4 I2 [7 {
  587. 3 S! X" a, V, ~2 a" |7 L
  588.         // Since the dialog has been closed, return FALSE so that we exit the  `( B5 M# ?( i- p- K9 e
  589.         //  application, rather than start the application's message pump.
    1 V7 `, |  S; e! z1 l
  590.         return TRUE;) \$ ~- {; U9 k+ v! V. z
  591. }: ~# Y& |5 r0 G

  592. 8 p, l+ K1 ?6 \$ E7 o2 _
  593. char *CRevAppApp::strtok3(char *pSource,char *token)* b' g/ N9 n8 r6 K* L7 o
  594. {
    3 A( Y4 M1 }7 t: R
  595.   int i;
    " Y6 z6 z1 R1 p
  596.   char *szRet;) W' p: {1 l) M6 o. R  X$ j
  597. 7 \! R9 S, U1 \( \* {1 Q& C; V: o
  598.   if(pSource) { itoken=0; sztoken=pSource; }
    0 T% C7 c8 C( f+ I
  599.   if(sztoken)6 ?; d: w1 y8 Q6 z+ L2 m/ B
  600.   {
    ! X! [" `7 g, P3 [# u( b: _
  601.     szRet=&sztoken[itoken];
    6 t; R" M9 J: a/ J/ R( ~* q( i- B. z
  602.     while(sztoken[itoken])' Y0 q, s# O" j3 H* S
  603.     {
    4 \, t% Q" o  _2 T2 c. y
  604.       for(i=0;i<(int)strlen(token);i++)
    % ^' R) \7 l# C6 ]7 U+ i$ ^
  605.       {* a9 @# Q& U* U% l
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])
      f- _" `* X: F
  607.         {1 G, h& j8 i( p8 U3 A! D! |
  608.           sztoken[itoken++]=0;
    1 @0 o9 S- Q3 {9 Y% `" _: U) r
  609.           sztoken[itoken++]=0;, F3 u: J: u1 q; p" C
  610.           return szRet;/ Z. ]' S. J1 D/ A8 {* a
  611.         }
    8 g* Z8 h, c% I4 {: X. M) B, m
  612.       }; D. ?# i. m6 {- V* B
  613.       itoken++;
    0 }1 l+ h0 e4 z; ]% }9 G0 m
  614.     }/ N# N% q# |8 N4 {! K: \, W
  615.   }
    0 D! C* L& a5 K
  616.   return NULL;
    8 N+ d' ~7 f# b* e- ^2 {' Q, R1 ~
  617. }
    3 Z0 S+ A% J0 r

  618. 7 `$ l  ]9 n% `- J( e
  619. void ProcessProc(long Total,long Current); t6 X' D! A  \# q, h1 g6 [
  620. {
    $ s% a3 M. v& N& ^
  621.         MSG msg;$ k) @" u. Z( I4 h( k( c5 G
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);$ i& y$ ^( Q( p
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));# h, r7 V2 |* j
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))6 H- h- G6 Z8 T7 s- F  k
  625.         {
    7 G# J! {: h) p; y- |; g  B
  626.                 if(!GetMessage(&msg,NULL,0,0))
    0 t2 E. s+ t- }" r
  627.                 {
    4 I: Q, h! n1 r, d1 n* H
  628.                         return;
    ) M0 F: w4 I' [6 b+ w4 I( g' z
  629.                 }
    $ |+ f6 r# _  z' p) T! ^
  630.                 TranslateMessage(&msg);
    7 x0 v" W# h. t1 b
  631.                 DispatchMessage(&msg);
    : D7 q% `; k& |4 Q' l( @
  632.         }       
    + ?+ `9 M8 [* \% a  J7 Y
  633. }2 J9 ^0 H" q2 c" _1 A

  634. ! n9 P: K8 [* }0 {. d2 y, U. _
  635. BOOL bFirstChar=TRUE;0 H  r  S; J+ m  L- k! M

  636. " Y6 ?) J+ O3 ]
  637. BOOL CRevAppApp::OnIdle(LONG lCount)
    & L6 v$ B9 \$ Q  C! X6 s
  638. {
    8 y) E3 s( g! f5 F
  639.         // TODO: Add your specialized code here and/or call the base class3 @  J* K- {9 V
  640.   switch(dwProgramState)( t1 @7 \. L2 \. y: {
  641.   {
    + c8 C- T5 H5 ^" E& T+ {& `
  642.   case AP_NOTHING:
    + x9 ]5 m+ K& A6 F
  643.     switch(dwStartUpSteps)
    ; s9 }& l+ a& c0 Z: x
  644.     {$ U  D3 U* F" E2 E9 P8 f
  645.     case 1:
    * z6 {( q2 ~6 G* k  o. M
  646.       {0 ~9 i3 ?; x/ X
  647.         int i;/ N) M. c( b% A+ `+ ?5 a1 S5 {4 [
  648.         CDC *pCDC=dlg->GetDC();
    4 \/ C  p3 J( f
  649.         HDC hdcwnd=pCDC->m_hDC;
    ) V8 y7 \7 e7 k6 l' K  m
  650. //        Graphics graphics(hdcwnd);
    & l  [6 N- H/ _" y  f" n( }& U3 A
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");
    4 G* o% [0 o4 {5 {  z6 b+ F9 c
  652. //        INT iWidth=bitmap.GetWidth();9 z+ E! w  i) [, p- i
  653. //        INT iHeight=bitmap.GetHeight();
    " g' X, N  d9 c; T3 j
  654. //        Color color,colorTemp;
    " q2 X. m' g: x6 O
  655. //        for(INT iRow=0;iRow<iHeight;iRow++)8 a7 \1 C. j2 l& g/ S! r! ^4 W
  656. //        {1 e2 I5 H& U; L* }+ u- d- l; M
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)
    ( M' }1 i  w) _8 Q
  658. //          {
    ) m  z( b" c2 D' o0 X
  659. //            bitmap.GetPixel(iColumn,iRow,&color);
    1 o2 r' ]# N8 r" Z4 g
  660. //            colorTemp.SetValue(color.MakeARGB(# H) V/ s) P- I
  661. //              (BYTE)(255*iColumn/iWidth),9 ~4 p" h: V0 H* O2 P
  662. //              color.GetRed(),
    / u3 ~' i; u0 m1 W5 J
  663. //              color.GetGreen(),2 s0 T+ t7 ^# `' U* ^# U5 S
  664. //              color.GetBlue()));
    ( ~' D) f5 q4 w
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);
    ; I$ ^% a* K5 ]: M$ ]8 k
  666. //          }5 i& ]/ r9 ?3 N8 a0 j2 J% |
  667. //        }! G6 Z5 h# {0 R+ H
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);
    3 }3 Q: U8 Y- R7 Z
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    8 ^1 ?7 U5 R$ l$ N  W
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");
    # f6 j0 M/ N8 o
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    3 d3 b0 f+ [: K) i
  672.         for(i=0;i<240;i+=8)
    7 T4 }$ z  H9 P- d! @
  673.         {! _7 d4 x" C# k* K9 `" ?- I! z
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    - @8 p6 N- z# A, n# M4 J
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    . w: U1 \& |+ x9 ?4 F2 w5 n
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);
    9 D9 s7 L% f( ^
  677.           Sleep(33);/ E; k0 q% q8 U" C, U  i
  678.         }/ |7 M) p5 o1 Z- M+ K6 {5 O
  679.         Sleep(1000);& @2 ~* E. F; m" K! K
  680.         for(i=240;i>0;i-=8)
    % l, k* F+ W+ G: ?0 h  @
  681.         {
    ! q2 d8 T; T( y2 l8 q* [
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    9 {/ G- z; W( d( q/ W
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    / T9 i# G; _8 `0 o$ z
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);6 Z+ M* i+ p. t. ~" M9 ]
  685.           Sleep(33);2 @* G+ G  i8 Q3 P- Y
  686.         }
    $ Q$ X1 N7 \& f% V- A; A
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);
    ' R/ h1 t, D& c* f3 C
  688.         dlg->ReleaseDC(pCDC);
    : H5 |! n3 T! q: `$ {
  689.         DeleteDC(hdctar);
    - [) g! U9 B( x8 T. {7 o
  690.         DeleteDC(hdcsrc);" S9 q" n. _- u0 d6 q2 T1 f
  691.         DeleteDC(hdcorg);
    7 t& i$ b9 \+ N' @4 ~, @8 l
  692.       }
    # Z7 J! t4 ^+ v( |; u  y
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);
    * ?3 D$ X9 l* h- v# ]$ s
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");: J. p7 g3 |" [* I. {
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");
    1 N. q- y3 k" i3 ]" a
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");! z2 h. g$ D) K1 Z
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    " N; @, `- i% H1 S& {
  698.       if(!Dn.Connected()): F) Y- r7 k9 [) I  [; b( S
  699.       {" `0 M: ~  t2 V4 R3 [2 p5 n
  700.         dwTotalFiles=1;
    6 p3 i8 m5 ~& D8 m
  701.         dwDownLoaded=0;
    # G" O6 Z" T: |& k( S# K+ h+ i
  702.         bSilentStep=TRUE;2 C" l  ?- h3 F6 Q5 a8 }- `  A+ M3 k. U
  703.         bCompressed=FALSE;
    % g6 O; m4 o! Y6 }* J3 \7 w8 `5 y* l- N
  704.         strExtLocal.Empty();
    & E& @  L5 ?. @$ h7 r6 W
  705.         strFullName="readme.txt";( X4 D5 s# i- f0 H. L! J3 h+ [4 R' z" m
  706.         dwProgramState=AP_CONNECT;5 i3 i1 d! [0 x' H) k0 Y
  707.       }
    / b) o$ J: l; D0 j( f. s: N) T
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();
    5 k9 b. ]) D3 y. O  [' k
  709.       dwStartUpSteps=2;# Q5 b1 P* S/ l5 c. {" k
  710.       break;
    & H2 |, ^/ {! a3 B% `
  711.     case 2:, @$ X1 _9 H' ~# ~
  712.       {
    . n% Q/ @+ \0 Z7 y* a
  713.         int iEOF;3 t$ S, m6 A# Y8 h. `) R4 R
  714.         FILE *fp;
    3 A6 R. y$ d1 i& J' J4 e1 d  i
  715.         char szString[512];
    ; Y# s9 D9 P: Q/ t! `
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");
    : @, [/ z2 P( L$ ^2 r+ w
  717.         if(fp)2 A! A2 Y/ Y; q1 D% t
  718.         {
    ' Q/ e( M5 \7 E7 f' z  n2 l
  719.           do% I2 r  w; z) d/ U
  720.           {
    # l" V* G2 M6 B3 [
  721.             iEOF=fscanf(fp,"%s",szString);# s6 M% f# c( U
  722.             if(strlen(szString))
    . @. ^& y6 H, V3 ]9 E
  723.             {) _" E' H* q' c3 n4 L
  724.               if(bFirstChar)
    $ B: H, h; p! s8 B& m1 q
  725.               {
    5 Z0 Y& c4 s5 b7 d
  726.                 bFirstChar=FALSE;: L/ L& [; G' d6 L0 S
  727.                 bConnectIsBig5=FALSE;
    3 R/ k" l7 h5 \2 n/ a
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;% e$ _+ m& i8 A% R
  729.               }( r3 N9 ?. Z( O' `# w
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));% w# t; U8 \& x
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));" k  e  X5 b# o" I
  732.               dlg->m_ListText.AddString(szString);) W+ b* M$ Z  K1 g
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);8 {; A) i9 j7 \
  734.               *szString=0;8 ], j) a2 c6 ?9 Q  B% {
  735.             }
    0 x" I( f1 N' Q, c" }
  736.           } while(iEOF!=EOF);7 s4 R' S- t0 k/ v, ?1 k! C, U
  737.           fclose(fp);0 ~+ O. u6 n( l5 C$ F' u  \+ U
  738.           unlink(".\\DownLoad\\readme.txt");
    / Y8 z$ D2 X9 t  w
  739.           dwStartUpSteps=3;% \& `! c1 z0 m0 b7 ]
  740.         }. m9 v, O9 e1 N- i# K- ?
  741.       }
    3 w' ]% ?8 q7 g4 U- \1 b2 s: P
  742.       break;- ^( }, P- k* E: T" X7 I6 p) F1 T
  743.     case 3:& T- G' G7 m) n+ o$ c( _* |
  744.       if(!Dn.Connected())
    * ?9 @. p+ F' _" n
  745.       {0 z1 j7 o. ]2 h# v
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);1 u0 Y- h8 L+ Z. P
  747.         dwTotalFiles=1;: ~% l$ l, n7 \8 y3 B8 u
  748.         dwDownLoaded=0;
    1 B4 V+ Y$ w6 Y/ S7 F
  749.         bSilentStep=TRUE;
    . [2 G: ?! W0 V
  750.         bCompressed=FALSE;9 c* v% E. D; ^, J( |! I4 s
  751.         strExtLocal.Empty();
    ; E, W& h* [+ u0 u7 Y. R6 j7 t0 O
  752.         strFullName="checkversion.txt";
    - n- a. d/ D5 N7 b$ ?$ R. I
  753.         dwProgramState=AP_CONNECT;
    ' U9 h; X/ x- R* P
  754.       }
    9 D3 K" C# {( u
  755.       dwStartUpSteps=4;4 \; O) P7 H3 R4 g; L
  756.       break;
    6 }/ q' P8 v1 O5 F0 {( }; N
  757.     case 4:8 {2 T0 u1 e  a2 h0 t
  758.       {
    ' V% W& d# g1 d" g6 V; G9 j  q
  759.         FILE *fp;6 Z: v' _$ ?" L- c* w4 J* b% W
  760.         char szString1[128];: Q; \) ?) e3 o/ J* |, o; {# ?
  761.         char szString2[128];
    8 g/ M8 ]0 z6 o3 e3 f1 G( {
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");
    " B- y* v6 H' Y6 z* @
  763.         if(fp)
    ! e$ s7 z; w. j9 n0 Y1 @
  764.         {, N5 B+ Z4 j. a7 }) G6 e
  765.           fscanf(fp,"%s",szString1);0 `6 @6 C6 c  ~3 [! U  ]4 t
  766.           fclose(fp);
    9 {# [% f* ?5 ~6 Q- M
  767.           fCheckVersion=atof(szString1);+ |& l. F. y" x
  768.           fp=fopen(".\\checkversion.dat","r");4 {1 K( m3 }) i3 P% l$ D
  769.           if(fp)
    5 Y' m. K2 E; m$ {( w
  770.           {
    8 P! N" t; n) P- v  x8 {
  771.             fscanf(fp,"%s",szString2);" m1 p' s% v  o  @$ B* K8 B# |
  772.             fclose(fp);
    # M% |+ o7 ^! q; w. A
  773.             if(atof(szString1)!=atof(szString2))2 Z1 V* K. y' L2 r+ L) a, u' ?
  774.             {
    + D$ n! o+ l, q* O# z' @
  775.               if(!Dn.Connected())9 O: N. u6 Z2 i  f7 t4 \* S* m! g
  776.               {) d; O# i4 ~  ?3 T( a
  777.                 bFirstUpdate=TRUE;/ s# C8 ~9 j4 K9 |( m, E
  778.                 dwTotalFiles=1;. Y# @6 R# Q  m: U& ^; G# l  K
  779.                 dwDownLoaded=0;, Q) e) K$ @: I1 w* G8 }
  780.                 bSilentStep=FALSE;
    $ q: i! O1 x7 ]
  781.                 bCompressed=TRUE;4 O$ f! F- m3 R  A8 _( B
  782.                 strExtLocal=".\\DownLoad\";
    % r' Y5 n6 }0 A8 ]7 N8 P
  783.                 strFullName="update.txt";
    9 g, M5 a* m8 y8 w
  784.                 dwProgramState=AP_CONNECT;- h2 o) u' d& E4 W5 {& a" N/ ~/ j
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");/ y& F- y& W* ^2 x; [  U: @
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    3 b3 H" i6 S9 a# f6 o
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");% d/ j" a' c8 [# C
  788. 0 ~$ C5 [6 G. y! O) l0 X$ j
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);7 V" J$ w( M' \9 R
  790.                 unlink(".\\DownLoad\\checkversion.txt");$ i" d4 V& d! F/ F6 m4 Z  v
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)
    : g% k6 r* n8 _# _# }) ^
  792.                 {' J3 J0 Q; J" V  p+ p# r
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");
    ' E3 o2 \% }% _$ j( s5 t
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");9 |7 W) \* W, y& G! ?7 U
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");
      ^4 L' @1 {9 H  j5 t4 r
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);. k( R. F+ m# b+ W# ?
  797. 2 I) _2 U" y) N8 T, G5 Z
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    & V. z. T3 @$ `' `% @4 ?( l
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    ' {& G& ^; t6 ]# m
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");& H8 f+ v6 ?( p
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);7 Z' W4 u* u' R5 e1 a; }
  802.                 }
    3 e4 O; Z/ a" T, Q4 f; S" O  L: j
  803.                 dwStartUpSteps=5;3 e( a) [4 Q4 T
  804.               }
    1 U3 z* P' J, v3 J6 E* y  P
  805.             }
    4 G+ @0 b  _# R' a% [0 `
  806.             else" V1 K' p0 z3 U" n9 [/ O7 ^" i. P
  807.             {
    $ Q, ]* ]% v4 Z, @' o  e) [5 s
  808.               unlink(".\\DownLoad\\checkversion.txt");: w" T) S# P9 |3 ], r" S
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");" X+ l. S4 x2 e8 N2 o+ J
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    , ]- u4 g( m6 {# _/ R2 B' J. R% h
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");
    , ^4 e7 D, S& J" S$ l
  812. & t( S7 F! o  G
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);1 X/ i) Z2 x2 {0 \( T
  814.               dwStartUpSteps=99;
    ; H2 r) w9 q* o+ a3 D
  815.               bFinishUpdated=TRUE;& l8 d, `: m8 V- g# q9 a1 R
  816.               bCanUpdate=TRUE;( }5 G% w0 W7 z% k
  817.             }
    6 D' S* _8 ~9 w9 o# {
  818.           }
    ( o8 K- S- ^, c! Q/ A
  819.           else
    " o5 v/ }" f1 l3 p4 I- o
  820.           {
    0 N# Y( i7 }& X
  821.             if(!Dn.Connected())
    9 @& E9 v. t2 h$ H  V, L) c9 f, [
  822.             {3 j/ ]4 I1 G# C' \, o1 b
  823.               bFirstUpdate=TRUE;
    8 D4 |. O0 t/ O5 x; V
  824.               dwTotalFiles=1;  }, A( W& E/ i* m: A
  825.               dwDownLoaded=0;
    9 Y$ N0 N+ K# c2 |
  826.               bSilentStep=FALSE;
    ( T+ x6 k: m8 s& a
  827.               bCompressed=TRUE;
    0 C8 R8 t- z1 G/ ^' @; w
  828.               strExtLocal=".\\DownLoad\";
    $ t. L+ }* R$ j# p0 Y+ H  ]1 B' |
  829.               strFullName="update.txt";
    ! h6 m0 [3 R- s& h
  830.               dwProgramState=AP_CONNECT;& ~; j$ P7 x/ @; b. S8 z
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");( ?% R$ l/ x: O: k2 _
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    0 J* t' I. }) X) ^/ a# g, \$ }
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");
    , w4 O! Y' E8 J* o! Y
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);% S# d* M4 O# F" P
  835.               unlink(".\\DownLoad\\checkversion.txt");
    8 }2 {6 }) y/ p1 g3 }; [- h) E0 L
  836.               if(GetFileAttributes("Wsa.zip" )!=-1)
    2 n% j8 I4 z) |5 l% j
  837.               {! y6 @6 Y2 K, k% |# W7 U* Y
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");
    ! J' v  G- t9 H! V5 h" Z0 ]
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");+ u* x' |1 `& k3 Q, L3 y/ C
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");* x$ w' {; ?8 y
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    * g) J( ], m# Z' a/ z* _1 c
  842.                 8 s. z& s' T, d0 B' X* u
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");  P/ ^" L' M3 Z8 O
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    ! E$ o2 F, C% ~& P8 u+ l% g2 R2 x
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");" t7 M% ]9 u" t6 S; r( U
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    ) O. M" C# M' k
  847.               }
    ' o2 I" F2 H2 {
  848.               dwStartUpSteps=5;
    7 ~' }6 I2 k1 o
  849.             }
      |) g1 B. n. D/ d# J
  850.           }8 r8 h+ q$ M$ _. t0 o* m7 \
  851.         }4 g9 F, j# x& z
  852.         else. w+ f5 _% I  Z. r1 R# h& Q
  853.         {
    , X5 I, `- n/ S
  854.           dwStartUpSteps=3;! ~+ W' g- c: C2 U/ S
  855.         }" n- \/ e" Z" b6 R! t$ @
  856.       }' A6 ^  N5 b3 ]) b
  857.       break;; _% \  @* h7 u, Z
  858.     case 5:5 I; R. K4 w. `0 a
  859.       {- [- n7 y8 b& E% ?. L. B
  860.         if(GetFileAttributes("Wsa.zip" )!=-1)5 X3 |5 {% x8 x. f
  861.         {
    - w3 o/ S! f" X4 Q; `1 o* B
  862.           int opt_overwrite=1;
    ! s5 j* Z$ ^5 b6 A; P# C
  863.           int opt_do_extract_withoutpath=0;
    2 N( ~3 w- A  g1 `
  864.           unzFile uf=NULL;) H3 k* z3 J# p( T5 x' D
  865. 7 T0 L2 F# c/ m3 v9 A2 X! G9 z
  866.           uf=unzOpen("Wsa.zip");
    . @' [+ r7 s6 M) b( W% ^
  867.           if(uf)
    5 {4 B4 k+ f! t' A
  868.           {- ]$ j, l9 C0 R  h' `
  869.             do_extract(uf,opt_do_extract_withoutpath,opt_overwrite,NULL,ProcessProc);
    4 e; L2 I7 ?; o. b& W7 O" P; d* ^0 \
  870.             unzClose(uf);$ A7 L* h6 E) K3 ?
  871.             if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃ЧΘ.....");
    6 l: G4 T$ v# K2 d$ ]
  872.             else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压完成.....");( a3 N, M/ y! \% g" ^) [2 Z) H
  873.             else                                                      dlg->m_ListText.AddString("Unzip OK.....");/ f/ A1 p8 ^2 J% P% V1 {
  874.                                           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    6 r. t0 \0 l4 P* }! D1 M% x5 j
  875.           }9 R9 y* F, D8 j6 w) H( u/ L
  876.           DeleteFile("Wsa.zip" );
    0 |1 Y9 o9 D# ~1 K
  877.         }
    1 B, @7 Z/ I9 M: T! N* l
  878. " ?) e+ K7 T: Z* t$ G" Q+ Z- v
  879.         if(CheckLocalVersion())
    7 I6 Q. p7 g% ^1 {+ I/ h* {
  880.         {
    1 r/ t: H9 T  E  n% t  t$ i
  881.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫磅︽絬穝戈.....");2 C' d" x5 A7 b* H# i( n; ?
  882.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请执行线上更新资料.....");$ z' ^% M" k2 [$ N# s; B1 L( b* x6 ]
  883.           else                                                      dlg->m_ListText.AddString("Please update.....");
    ; P7 d  a" ]& o1 Q+ n
  884.           dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    & o, h/ z( y2 O
  885.           SendMessage(GetDlgItem(m_pMainWnd->GetSafeHwnd(),IDC_BUTTON1),WM_USER+2,3,0);2 @  s7 x2 ?4 M" R
  886.           dwStartUpSteps=99;
    5 H6 U5 t; a. `$ J
  887.         }
    $ z+ P) R. h( h5 A
  888.         else
    / B. P% s# J' P$ ?
  889.         {  V, T- S: B% U2 V8 m
  890.           if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    7 f" `; m& g4 Q& V* a: N& T
  891.           else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");( w: }: D  `2 Q* I
  892.           else                                                      dlg->m_ListText.AddString("no new file update.....");
    7 _) E- J% [* N; i& o

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

  a6 Z" m1 m' D! v# o4 C
2 E0 J- x: Z1 t6 S1 C; T

評分

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

查看全部評分

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

本版積分規則

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

GMT+8, 2026-2-22 02:58

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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