找回密碼
 立即注册

CSUpdate.exe源代码

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

/ i/ E& V# }! ?( ?5 D
  1. / RevApp.cpp : Defines the class behaviors for the application.
    . }: a& V" d( F& v
  2. //7 Y% s, D! O( o/ c
  3. ; R# W+ v" E3 K) y
  4. #include "stdafx.h"
    5 d4 t* z- }7 K' g: ]* G

  5. 8 G; p8 E+ {+ K6 M8 r9 Y
  6. //#define UNICODE& J3 l; s# P- ?. v! u. G
  7. //#include <gdiplus.h>
    4 M9 B# D# Y, C6 `' L0 _! W
  8. //using namespace Gdiplus;4 a) {, [7 _+ N8 X# k
  9.   V8 A/ U9 g( _0 Z: E
  10. #include "RevApp.h". Z/ O6 h% q, R" ^7 V! p# k
  11. #include "RevAppDlg.h"
    8 ~6 b* n3 y3 T8 q

  12. $ D7 a6 f( g, b
  13. #pragma warning(disable:4786)
    5 A4 l8 Q' n. E3 M, c0 C# z
  14. #include <map>
    # v9 d- ^2 Z" r, {0 T# Z: w
  15. #include <list>
    ) }# K3 l1 g+ ?
  16. #include <direct.h>
    : f) j4 H9 @' O" b' N+ j
  17.   ~& q" Z9 E, q6 z- ^
  18. #ifdef _DEBUG
    ) d' A, a1 B# J5 d6 T* m  l
  19. #define new DEBUG_NEW* l+ z: N$ C5 o' M9 K1 h% |
  20. #undef THIS_FILE4 d* l  G6 v2 J  c/ _* O
  21. static char THIS_FILE[] = __FILE__;. l5 O- B/ O# u! a! U" W
  22. #endif! c2 W4 n7 F7 O' ?
  23. #include "SkinResDef.h"
    : b! K/ F* N0 m" v
  24. #include "ChangeBG.h"
    0 Q7 t5 v3 Y4 v- B* N
  25. #include "AFXINET.H"6 \1 h/ s5 r- c
  26. 5 `' U! i7 Z5 U5 s3 l, S3 y9 ~& h) n
  27. #define TRADITIONAL_CHINESE 0
    # @, j8 b8 U! u/ [9 J
  28. #define SIMPLIFY_CHINESE 1/ s. D) J0 F2 [8 h) v- n$ A
  29. #define ENGLISH 2
    * c) w, \5 y8 ^$ _" X* [$ v
  30. int m_iLanguage = ENGLISH;4 J, V* d1 v$ n/ h4 D$ e1 I. X
  31. /////////////////////////////////////////////////////////////////////////////9 d  R- f3 M% b. U# l2 y4 c
  32. // CRevAppApp6 Z. l% ~$ J6 g; r

  33. 8 d/ |. n: t+ y$ T* x/ _+ y9 _4 I8 y1 O
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)
    % F. A) J1 A# Q( i5 Q% v) N* j
  35.         //{{AFX_MSG_MAP(CRevAppApp)
    . b5 Z: q6 m; \# |
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.1 m4 D/ v% T3 S# W' U. T9 g
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!5 A$ n8 A# N' b" C. l
  38.         //}}AFX_MSG
    + Q. r  ^8 B# |$ i) _  S
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)
    : H7 i2 E* l: ~+ J5 V# i, x
  40. END_MESSAGE_MAP()' D* c; V5 |" q! |" Z! A4 Q1 d4 C! @$ \5 `
  41. , `9 x) _0 S" C3 T# b
  42. /////////////////////////////////////////////////////////////////////////////( w5 {9 S* u5 N2 G5 b. N
  43. // CRevAppApp construction$ x9 ^& Z9 E* a; W

  44. 5 b( d; I1 u6 v5 S- s
  45. CRevAppApp::CRevAppApp()2 ~$ y- O5 y, e" g+ N
  46. {7 y3 V. o* Q0 p! V4 N
  47.         // TODO: add construction code here,8 o1 r- ~6 x" B8 K- X% c/ M) e
  48.         // Place all significant initialization in InitInstance
    1 G) I5 ]9 m3 G! l% S6 z
  49.   bDisplayIsBig5=FALSE;
    ' a, k2 J- K8 S$ s0 C+ q5 U- }
  50.   bRestartUpdater=FALSE;/ C  C. E3 m6 T7 h4 j3 R
  51.   bFinishUpdated=FALSE;1 ~- I& n6 {; y- L% \
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;+ p) f( o  {- \( u/ h' J; Z
  53.   InitChangeDataBig52GBKS();6 I; N+ k  h3 i! y4 ]. K: c9 p" i
  54.   InitChangeDataGBKS2Big5();
    " |9 k  a+ T( d0 k/ V* J) x
  55.         //
    ( w  }* y: m! s& S2 p) X( i
  56.         bClickRunExe = FALSE;2 I5 {6 l4 J! B$ ^8 c$ W
  57.         //
    - h, l( x2 \( r% O8 e
  58. }- w$ U4 @2 V; c$ Z$ T: V- q1 `' m

  59. % N6 Q4 u* C8 V
  60. CRevAppApp::~CRevAppApp(), q9 u6 l8 h$ t* n. m8 e
  61. {
    5 n4 m  c9 p# r0 a, J' j( l. Y
  62.         // TODO: add construction code here,8 W6 k7 `: p" k. M
  63.         // Place all significant initialization in InitInstance
    / U8 t8 x+ f& }8 \* Q! q
  64.   EndChangeData();
    6 |) [. y6 L0 Q9 l5 s# @
  65. }. e& W; @8 h+ w8 C9 E
  66. 5 M. e2 z( e* V
  67. /////////////////////////////////////////////////////////////////////////////
    7 V/ X( k* g8 r( J
  68. // The one and only CRevAppApp object4 v& G( l9 l4 g& K1 X

  69. 9 B9 `' S! A6 P. ?6 o
  70. CRevAppApp theApp;, Y" ~+ p) c1 B! j( W

  71. ' h9 S- Z, L. w6 U; Y
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName)6 U# n& W# D# ?# U
  73. {
    ; }* g% ?8 n- q( I' \* p. A1 M& k6 {% i
  74.   int iEOF=0;
    0 I4 b9 b1 r) F% A7 W. X) m3 q
  75.   char szTempName[MAX_PATH];: }) }& y6 m$ `; R$ S
  76.   *szFileName=0;1 a& n: _: e& L) Z2 w
  77.   iEOF=fscanf(fp,"%s",szTempName);0 \0 l+ G+ r, Z+ }% |
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')
    # ?$ r" B. c; P, x
  79.   {  m6 j* e* ^1 U8 t, A: F
  80.     strcpy(szFileName,&szTempName[1]);
    ! N( D  O- O: H6 B% H
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)
    ) N: Q- F* Q9 R( @
  82.     {) o& z6 h1 t. j, F9 `8 ~
  83.       iEOF=fscanf(fp,"%s",szTempName);
    . {3 g( |8 m1 n
  84.       strcat(szFileName," ");
    3 Y9 k4 v; X- K. Y
  85.       strcat(szFileName,szTempName);7 `1 }# G& N5 m4 r/ T. P
  86.     }
    3 ~! J- Z' ~. }) |% X: A
  87.     if(strlen(szFileName)>=1)6 I, e: n0 z3 c! G
  88.     {
    1 L" g7 Z8 H/ w
  89.       szFileName[strlen(szFileName)-1]=0;
    * }! J( s( r8 L0 ~% K$ A$ k2 A
  90.     }  ^9 \( o5 Q  L( v& _& u  ]# @
  91.   }# `2 {( q& ]' ?( W7 t4 l- r  h
  92.   return szFileName;7 I/ e5 N3 R0 a
  93. }
    # R$ }/ ?3 `+ K' O2 W3 I' V
  94. ; F5 s, E5 \6 e+ C8 d$ j4 P
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)
    2 w% Z( \' C$ z  i$ G- M! e
  96. {
    % A8 b4 M6 v. i* n: D7 ^* N+ w3 s5 P
  97.   FILE *fp;$ \9 s7 h" Y0 |4 K/ e" O
  98.   char *key=NULL;3 G1 ]3 X7 @& G, M- X
  99.   char version[MAX_PATH];
    ; z* H, a! h% s1 e- C8 x
  100.   LPUPDATEFILE file,olds;8 P  M1 \  s- q1 K$ X$ q+ ]( h& Z$ g
  101.   std::map<CString,LPUPDATEFILE>::iterator p;
    1 n$ ?# n0 p$ J% E2 M6 A
  102. : k# _& E1 ~4 l% |) y
  103.   UpdateList.clear();) v' v, k& |/ g3 P" T3 c
  104.   UpdateFile.clear();& d5 q% Z$ Z+ {
  105.   if(GetFileAttributes(filename)==-1) return false;' }, |! W# v- H6 q7 j+ c
  106.   if(!(fp=fopen(filename,"r"))) return false;
    # }' {6 R: e: B) A& n
  107.   fscanf(fp,"%s",version);3 y2 o; s" h5 w7 S# \9 y- [
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }9 r9 \8 \; u2 }3 `
  109.   while(fscanf(fp,"%s",version)!=EOF)
    ; _; `2 }2 t% B8 y5 l
  110.   {
    , G1 D. _2 b- J! I+ i. g0 K
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    " |% k/ {! M% L6 R" h
  112.     fscanf(fp,"%s",file->path);0 d! s6 M: X  b  z7 U( w
  113.     ReadFileNames(fp,file->file);
    9 R+ o; m& V$ U" H4 }
  114.     strcpy(file->full,".");; T+ w+ c5 H1 R1 x! F( @
  115.     strcat(file->full,file->path);& z( y$ R  a/ q3 E
  116.     strcat(file->full,file->file);# ]* [/ m9 G, U8 ]7 H
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())9 Y, e9 k  G( R
  118.     {
    2 K8 |. C8 `6 g" U. m8 z2 J
  119.       file->vers=(float)atof(version);
    8 {8 Q$ K: u9 M' O; I$ H: \* e
  120.       UpdateList.push_back(file->full);
    . B4 {) w6 Y' {) w& u5 G; \  B8 u8 v
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));/ C0 L$ `5 P( k  Q6 }+ j/ i
  122.     }! B0 \# e0 z0 Y+ R, x$ G
  123.     else: m7 Q* }3 D1 y6 T
  124.     {3 q- w/ z$ f2 }$ _/ ]4 V
  125.       olds=(*p).second;
    $ o( W) o% \2 j4 ^- k- v3 z" \6 }" y+ Y
  126.       if(olds->vers<(float)atof(version))
    * N3 j5 j: u+ X5 o9 a
  127.       {( t6 |# z( `8 B# H: f3 O
  128.         olds->vers=(float)atof(version);( A; n* B0 o% T
  129.       }4 c) }% n7 w& l% q- c
  130.       free(file);
    % C  t+ ?9 `4 y' b2 v" x
  131.     }
    ! Y$ P: ?* u6 _$ ^. H
  132.   }
    0 b5 i; i* @- p
  133.   fclose(fp);
    : d- u3 }$ g3 \! L
  134.   return true;1 x& ]/ l, r' ?" [
  135. }
    3 B! h1 |+ B/ l7 p) B

  136. ! J: C. V) d) U- U; b, d/ T* J" `
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)- _9 b+ N. I- M+ z( d
  138. {
    % Z. H, \- @9 a! W
  139.   TCHAR  szFull[MAX_PATH];% o7 W  B+ b* f  F  ]4 E# c5 J
  140.   TCHAR *token,*inter;% N- g. a" a# N( I# [
  141.   *szPath=0;( f( w  Z" e) z. O
  142.   strcpy(szFull,szFullPath);5 h' ^/ D: q$ [% |
  143.   token=strtok(szFull,"\\/");6 h: E' g" @. I
  144.   inter=token;; j# k3 T% k$ G5 z
  145.   while(token=strtok(NULL,"\\/"))& k5 p9 m) d, `& `5 `1 ?
  146.   {
    / }; \3 H" ^, w  k
  147.     strcat(szPath,inter);/ @! A, v% ~1 _; _: ~- T
  148.     strcat(szPath,"\");2 i; c  g8 d" h7 x- [* P0 c
  149.     inter=token;
    " T4 d) F% q& A) ~9 u7 Y
  150.   }* {! D' b* I# |$ ~' ?$ a& h
  151.   return strlen(szPath);4 s0 j$ V7 F5 C. ~  D
  152. }
    ! W' x; W4 ?. k

  153. 4 A8 H/ B) X1 A; g+ F0 n6 n& H$ [
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase)! ^" e0 x& O+ f
  155. {; o" n2 q5 e, O% x
  156.   DWORD attrib=GetFileAttributes(Target);
    4 V: g$ R% r3 \$ s
  157.   if(attrib!=-1)5 K$ I; v+ L; o9 F2 g$ H, a
  158.   {( p& h( @3 V/ p, y& G
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))( {* w  M$ v3 D7 j& w
  160.     {
    : d" W9 I, O; K4 n. |2 w
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);
    * M5 H2 x/ b0 {: L
  162.       SetFileAttributes(Target,attrib);0 _4 B2 c3 ^9 n/ u
  163.     }
      t0 I7 F% F4 C0 q0 ]
  164.   }. ?3 T3 J$ e2 h: H9 i
  165.   CopyFile(Source,Target,Erase);
    0 J" O8 T4 d- R" T; x. k5 O
  166. }/ I' W' O. T0 f0 }
  167. , W4 h9 T+ o% m) \" `/ u
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)1 @  d- f4 C; J1 X
  169. {
    6 h1 m+ E, Z$ @) {. |
  170.      FILE *fp;
    0 E' r7 H# R( _* p9 l! p) q, p
  171.      char  szBuffer[8192];
    6 R- o' e4 M! S
  172.   va_list  argptr;' E3 v' n8 v) f  T1 X8 c

  173. 2 L" P) Y4 h% t: N
  174.         va_start(argptr,message);
    1 D6 Q0 P! q. W9 p, `6 \' G2 b7 f
  175.         vsprintf(szBuffer,message,argptr);# `( V, e% a+ m+ N
  176.         va_end(argptr);- j0 K& k7 _8 y' ^
  177.   fp=fopen(FileName,"a");
    ( w2 m. r9 ?* c, ~* `0 s
  178.   if(fp)  R5 X: R) @& o& @9 S& g2 N2 O
  179.   {: i/ a4 @* z% B% d9 @+ b5 e
  180.     fprintf(fp,szBuffer);0 g5 ~0 R1 z- t
  181.     fclose(fp);# W9 T7 q3 t* E3 T
  182.           _flushall();. _  L* l2 X" E  G) J
  183.   }/ I* A. M4 e* U1 ]* {- O+ L+ n
  184. }
    # I; V/ u1 q4 X% s+ s

  185. - _* p# r  m% U& s: x8 K  h
  186. BOOL CRevAppApp::Fclearf(char *FileName)
    ' P& b4 i( L. n+ M$ m% u
  187. {5 o/ P! m0 f% H4 }% Y+ d6 {
  188.      FILE *fp;9 m3 j2 [+ r4 |: }6 ~1 B" p
  189.     DWORD  attrib;
    % u8 y9 @; L& Z& [
  190.   attrib=GetFileAttributes(FileName);- Z$ }0 b* b& z9 e/ {% \
  191.   if(attrib!=-1)
    6 ^# Z, I; X" w6 F% Q4 r0 b5 \( t
  192.   {
    ; {9 r- }0 i* I) e$ s$ Z
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);) c  `2 `3 J" y  A" S9 ]# d
  194.     if(!SetFileAttributes(FileName,attrib))
    % d& C. g) R+ k3 s
  195.     {; e4 ^7 ?: E& v# m! P" V
  196.       return FALSE;. w8 z( P% _2 D1 K
  197.     }
    % m  t4 ]  h8 o
  198.   }
    % t1 y, X, F  P1 R5 U
  199.   fp=fopen(FileName,"wb");( E4 i9 [3 P  \! E6 c0 D+ C8 m
  200.   if(fp)+ |- v9 F' g: J& E
  201.   {
    3 U% j* ^$ b9 h% E0 r  t
  202.     fclose(fp);
    7 M3 V: q3 k9 n4 L9 Y" c
  203.   }4 T& c6 S, l! B0 B' `% q' h; o
  204.   return TRUE;
    % d& e, j. n/ R9 T- X5 Z( P  F
  205. }3 a, e9 a9 l3 U, q# ^" k& l# K" K
  206. / ^( U% W( Z, B; ]6 ^& [! \( J
  207. BOOL CRevAppApp::UpdateLocalVersion(void)1 V( n: {2 _8 ?" u1 C1 X
  208. {
    . j. y5 O9 x$ i# j% ]2 s3 o
  209.   char filename[MAX_PATH];  q( e" s: E" Q8 |9 k: Y# k9 _
  210.   LPUPDATEFILE file,olds;
    4 q$ H& v$ d8 f+ @7 \5 B
  211.   std::map<int,CString>::iterator i;
    ! d- g" @4 W, B, u4 N
  212.   std::map<CString,LPUPDATEFILE>::iterator p;
    - R3 `2 A- R/ ?8 a* @+ X# x# n
  213.   std::list<CString>::iterator l;
    9 {; I/ ~0 ~0 B! W/ B

  214. % S  @! @2 F' O0 m: t( ?
  215.   if(bFirstUpdate)
    ) ~; x8 `9 W8 M2 d- |
  216.   {4 F2 h9 q' B3 ?2 W5 A$ A
  217.     dwCurrFile=0;4 c- l* k% Q+ g) @
  218.     bFirstUpdate=FALSE;- ~; v% i  X: p' j0 j" N1 V
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    ; i6 X5 A) F+ P, m# D. B- A# F
  220.     {
    , w' t) O0 F+ C' X1 z) R
  221.       dwTotalFiles=UpdateLocal.size();3 }1 B1 N+ u7 `, ~' U
  222.       dwDownLoaded=0;2 i; y0 ^. q# u9 b/ o; f
  223.       bSilentStep=FALSE;
    6 `+ G; u9 {$ X" y
  224.       bCompressed=TRUE;* `( \' W# |8 P% [, i
  225.       strExtLocal.Empty();
    , f2 I. v6 Q" v- D1 g
  226.       strFullName=(*i).second;
    ( A! b4 a2 O6 G& f
  227.       dwProgramState=AP_CONNECT;, R, y) \% X0 g! ]7 d
  228.       return TRUE;
    9 j- n: ^. f! E( E
  229.     }
    0 |# B; G( N/ ?+ S! }: S  A1 F5 [, a
  230.   }' ]* @9 a8 S1 Q! V% M9 g1 B1 E
  231.   else if(bRestartUpdater==FALSE)2 z6 C3 P9 V  ~8 b' `* B7 b
  232.   {* i! Q/ r$ J, y1 J. W  @
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end())
    - T$ a* H2 w& ~6 b6 r4 e' {7 ^7 u
  234.     {6 {* v: m' J; Z! `$ A4 W: A
  235.       file=(*p).second;
    # w) Z4 M; Z8 J+ _9 T! ^7 G/ i$ ~
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end())* h/ R2 \: P4 p4 H& M
  237.       {) N0 o: H, l& R! |8 [: m
  238.         olds=(*p).second;
    4 R8 x4 f& s* p3 c0 H- Y& ]* d% a
  239.         olds->vers=file->vers;. n& r9 {3 I" n( |2 h# `. m
  240.       }
    % z8 [5 U0 Y* }
  241.       else, c; m" h( F2 o. A: S: c
  242.       {0 y1 u- C( V2 j6 }
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));
    8 B5 g' `6 a" |- v9 e0 \) Q4 ~- L
  244.         memcpy(olds,file,sizeof(UPDATEFILE));& ]3 E7 w) [2 J. B# G
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));( D# j5 t, k2 k& }& ?5 ^2 p
  246.       }
    7 V8 p. }5 n# \/ ?8 m
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");* E% B) r, t7 x* W- C$ ^
  248.       sprintf(filename,"(%s)",file->file);, s, W9 _5 q2 H) j5 Q) Z+ s
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);& g+ x5 Y* g! C2 v* J* y% r
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }
    8 ?3 b* Q$ h1 M7 V& V+ f
  251.     }6 ]; l& i( H6 h2 h
  252.     dwCurrFile++;
    * t' _1 P0 t* T  F' H: b# Z
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end()): j7 V  V* ^3 H. a! e5 W* r- ?
  254.     {
    9 t8 G7 i7 w; u% J& t: T
  255.       bSilentStep=FALSE;
    ( L" l8 m6 ]9 c. ?% d8 a
  256.       bCompressed=TRUE;8 @) S" d. d+ [2 t1 Z
  257.       strExtLocal.Empty();3 b! C7 w  ?4 {9 Y0 L3 S
  258.       strFullName=(*i).second;" Y& b3 A/ L$ K' @1 d) R
  259.       dwProgramState=AP_CONNECT;
    3 K% w# s6 {2 M8 @  e9 P6 S: L
  260.       return TRUE;
    3 c) N3 u  \' G5 [; `) Z
  261.     }
    - m+ z& ?6 C% Q+ L
  262.     if(!bRestartUpdater)
    ; ?8 }" U: z' Q' {& A: J1 S8 c
  263.     {
    - \+ T/ X8 L7 `0 f
  264.       int iCurrSize,iFileSize;
    / T% i! M7 E  Z7 }4 c
  265.       iCurrSize=0;: W( [/ b. o% Q( ]
  266.       iFileSize=UpdateList2.size();
    + i) o! g, R& G* N5 G" x
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");, }6 M: W! z# {5 h: y
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");
    + {4 ]& h) G9 u1 }: F+ v6 I0 V& N
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");
    + m0 N1 E9 {& |. o
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);; k8 b4 q7 V2 ~
  271.       Fclearf(".\\update.dat");
      Y: k3 c6 J* P0 M* h) F
  272.       Fprintf(".\\update.dat","Bloodyf\n");8 W: C' f9 T, h' \, c1 U
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)
    . s6 u5 _6 O! y& ~
  274.       {. W8 \# N. n* y" r& }6 }2 A4 ~0 |
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())7 j/ ]' k; s6 w0 g( L0 N: h
  276.         {
    1 J, h7 V# P* k; {) n; E
  277.           file=(*p).second;
    3 Q8 L8 z  H, |" s$ w4 Q
  278.           sprintf(filename,"(%s)",file->file);! O) {# h0 t, m2 \
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    / P' Y. q' U$ g4 {4 t8 B, B8 V
  280.           iCurrSize++;
    , l5 u# O8 l# F  N) P, w
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));
    * @: T* I, r0 w3 p- k5 `
  282.         }7 k) E+ \8 _& R* o& ~0 j
  283.       }
    5 N& |. N5 U0 q+ |  i
  284.       unlink(".\\update.txt");
    + I% Z: E- ]! {1 c( \& h
  285.       unlink(".\\update.tmp");2 P& R! Z9 s4 ?; u+ r- F, u' E
  286.       Fclearf(".\\checkversion.dat");
    3 L( m0 f+ Q2 d
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);
    7 J/ n: A- y  y9 K1 Y' h% o
  288.       if(UpdateLocal.size())
    - {' f; r) w( v$ F% J& D# A; V
  289.       {
    # U8 e- W  T  i0 p
  290.         UpdateLocal.clear();/ d# I  ~4 m* {& L
  291.       }  g5 F2 ]4 K( y0 n0 U3 D
  292.       if(UpdateFile3.size())1 S9 i1 J  Z" C& M7 R
  293.       {3 \- G6 d$ n7 u
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)
    1 k4 E' g# E( T  E+ f& |% H3 k' Y
  295.         {) W- g7 s: G2 Y  @
  296.           file=(*p).second;' q, Z6 e1 e% V) {( G8 z  n
  297.           free(file);
    2 i0 `6 R' U' y
  298.         }
    - j1 t& m4 B2 R% b( c, b9 L  }
  299.         UpdateFile3.clear();9 b8 D! E6 X& Q! T: E
  300.         UpdateList3.clear();
    4 \6 u: [( H" t
  301.       }
    ( n7 w8 }/ T+ f0 H( \* q* P" F5 }$ I
  302.       if(UpdateFile2.size())1 Y+ \" [9 f2 d2 ~' s$ A  \  M
  303.       {
      P+ O0 f0 l# c* I
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)! l7 L, [; ]. }: a- ~
  305.         {
    3 `/ e4 t, T7 G/ p! o$ P4 w2 w
  306.           file=(*p).second;+ ~, i4 A* \, V6 D7 |
  307.           free(file);
    ! i3 \; L. ]6 J9 k; S
  308.         }
    2 U2 k3 F* u5 c" R2 v
  309.         UpdateFile2.clear();( }) f8 Z5 q! F' B
  310.         UpdateList2.clear();
    " z. m: z" M! ?+ x
  311.       }. h  Q; L5 X7 t. |
  312.       if(UpdateFile1.size())
    ; G2 L& R: l( d' w) l1 K
  313.       {9 ^0 o5 z% R$ M& h: F  [8 ]
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)
    1 N5 Z6 G2 s9 k+ e, k; E& x
  315.         {: ~- L& I4 u3 E4 V3 R
  316.           file=(*p).second;
    8 Y2 k! Y: {! m% j
  317.           free(file);
    % t9 S- C! ?, K% F9 }
  318.         }5 W0 y. Y! h/ |& f* f
  319.         UpdateFile1.clear();
    6 k- w1 l, G/ o/ X& Y! [$ X0 ?
  320.         UpdateList1.clear();# ?% A. N# H1 \/ @
  321.       }  d* k& H* J$ h5 m
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));6 J, p0 p# f2 l6 }1 `, V
  323.     }7 [0 A* x0 y/ E* }! i9 {
  324.   }
    / i( H! J* ?- z+ |0 x% ^
  325.   return FALSE;% d# O; Z, M. v/ Z/ d6 Q
  326. }. O2 i; S; y# q$ l3 W8 B4 @9 F: }% K
  327. 1 q+ W# C' u- ^% V
  328. void CRevAppApp::ClearAll(void)
    # i7 g& ~% x1 \, N2 G/ A7 M
  329. {3 _# `2 v$ e- X8 K& T& ~1 [
  330.   LPUPDATEFILE file;
    6 y! s9 L. y9 J! O1 Z: Q0 l$ C
  331.   std::map<CString,LPUPDATEFILE>::iterator p;
    ' O3 d9 m' {; C9 P. q4 }' g
  332. ; r6 d9 {6 P, H' o3 Z) Z3 e5 Q0 G
  333.   if(UpdateLocal.size())
    4 e; r! G0 z. N2 a
  334.   {. i  p4 N" Y8 ^* A6 c1 f$ g
  335.     UpdateLocal.clear();
    3 d  X- K" {& U8 ]. t  g3 e5 B
  336.   }# d" H, I7 Q: B  L8 _2 n
  337.   if(UpdateFile3.size())& Z9 `& r: q& L
  338.   {
    # F% r: w% _: A- ]+ a) z* D
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)
    7 _0 W% O5 C$ f; y2 N4 Y, I1 t
  340.     {: b; A7 k1 e4 t2 e) _
  341.       file=(*p).second;/ q' s7 z8 {% a
  342.       free(file);( l0 ?4 r4 D: |
  343.     }3 ?1 H3 \7 A9 m8 n# ~! n; H
  344.     UpdateFile3.clear();- a6 J7 X8 W2 u0 ^- X
  345.     UpdateList3.clear();
    0 X3 s  z+ W: J$ d# W
  346.   }' K4 [6 X  k" B6 i
  347.   if(UpdateFile2.size())6 m1 }( P. Q( m5 H
  348.   {! Y. G: V  y3 S$ H+ H  R3 M
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    , O: i* k; z! c" i; F
  350.     {
    # \8 V3 S% F/ R1 D
  351.       file=(*p).second;
    - U5 d+ S& ^* y$ F# L1 O, Q
  352.       free(file);
    6 s) }/ ~* F. H3 O4 Y/ G6 `7 D; {5 l/ ]
  353.     }( V/ F- z) u/ x& N0 K
  354.     UpdateFile2.clear();
    & l; r2 n; E6 }0 M( k! Y
  355.     UpdateList2.clear();
    $ Z1 U7 f6 B% e. O# f
  356.   }
    $ k2 r7 I+ y  }# [, m" R9 y
  357.   if(UpdateFile1.size())1 Q. a! B3 a# x
  358.   {5 S. S- c. B; U2 V+ c/ z
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)% D- g; p& c1 L- i/ @+ r
  360.     {" u6 q  i2 c. z+ C' m9 F
  361.       file=(*p).second;2 b& k$ M2 m/ F, U: e
  362.       free(file);% S. N: Z7 S& |8 F3 l" a) M) M4 n
  363.     }$ |$ v9 a' r' x8 u
  364.     UpdateFile1.clear();
    7 m" T- x+ |* o0 l
  365.     UpdateList1.clear();- |! p* N- ?8 L4 g7 M$ x9 }+ h* r5 m
  366.   }4 v( K2 ^, l& S! Z( n
  367. }  
    ) @5 ?. M$ p6 \" |  r
  368.   2 s+ {; _& t  e1 L
  369. BOOL CRevAppApp::CheckLocalVersion(void)
    # i0 U; _. q. u2 G2 _
  370. {
    ' d, ^) }( K5 O  C& h0 n: q3 J
  371.   int c;
    " f% `2 {: ?0 \# f" u
  372.   LPUPDATEFILE file1,file2;
    % g& J" v  z/ v  f
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;5 ?1 p, j% b4 R% e1 q9 |; v5 |
  374.   std::list<CString>::iterator l;8 U  E, `# P; R  s
  375. & l7 u3 [, x# z' |$ T
  376.   UpdateLocal.clear();$ h- a- C  T1 r- T1 H3 W- D
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);  U( u! S0 I9 k9 z- Z  v
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);2 E/ |1 Z& ]) q
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);' g5 A) c! Q" m0 ~; O6 u
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);
    4 ?- ?! ?  W; i! y: V- ~4 Y
  381.   if(UpdateFile3.size())
    7 M3 l# U/ w7 i, L( P
  382.   {
    " x8 V1 h! \' A( s3 }+ G7 ?0 C: x
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++)
    9 `! q3 i: v( d. J2 I& y
  384.     {3 M) Q" k3 e3 }1 \2 j4 S" e- |
  385.       file2=(LPUPDATEFILE)(*i).second;
    - x; d8 G9 H+ F* E$ |& L% [
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())$ K+ A* w2 S9 G
  387.       {
    ; _3 A) g7 I% s, G
  388.         file1=(LPUPDATEFILE)(*p).second;
    + E4 s% P1 Q7 {: g
  389.         file1->vers=file2->vers;$ n- t4 U) |2 c1 z) Y* D
  390.       }
    , ^9 x7 F' r) h4 L" w8 U3 e( a
  391.       else6 |- o7 o6 s* Y
  392.       {; r! N0 m7 I8 u3 c8 C7 M" c
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));2 b  y/ M" ^: _) ^
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));% K' G! I6 K! V1 h- @. y; |$ Q
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));
    ) w7 O9 w& N7 J" i- f
  396.       }' V! h9 R: w5 ?0 S4 v% j* d" k
  397.     }0 y8 u) k. J* A4 S  e
  398.   }
    ) V2 q5 ?' w' M3 M2 t' _  C, L
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++)2 {8 @4 C8 C. D6 {  Q3 z
  400.   {
    9 A; k1 d. O$ b+ S" J3 e
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())
    0 W" `' z) B* R& ~$ q0 W+ H7 F6 j$ c
  402.     {! o8 e$ V0 E5 P
  403.       file2=(LPUPDATEFILE)(*i).second;3 M/ b! l+ U2 G- L1 x4 D- k
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end()); y5 I+ C& Z, V/ L- ~, D
  405.       {
    ! t6 x* T( E  A* p& Q/ `# G/ T
  406.         file1=(LPUPDATEFILE)(*p).second;
    : d' E, N, x2 q# k+ b0 n# k
  407.         if(file1->vers!=file2->vers)5 W3 r8 `0 F3 p' w, G- e
  408.         {  V  v' d; G' r% E3 h: q( x
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));
    1 B9 G0 P4 H" }
  410.           c++;
    % l( b9 s) _7 X; T# ~9 m
  411.         }% D) L. a/ v  f9 i9 V, V
  412.       }- t" G7 K7 m3 D) p. ^
  413.       else
    ( j9 k( l" {" }8 F1 e
  414.       {
    % H8 E( U" r" D, z/ w. n
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));. Q- L! O( t3 \$ p
  416.         c++;
    + S3 `" R1 C, d& O% T* q
  417.       }' @& ]" J* L; [0 e7 `
  418.     }
    0 `8 {" E0 B( k! U. b
  419.   }: d& Z+ @! p& }3 c3 A) x
  420.   unlink(".\\DownLoad\\update.txt");; n) y5 }4 O% B/ B
  421.   if(UpdateLocal.size()) return TRUE;
      f6 a: R$ U5 M; C8 j9 p/ W
  422.   else                   return FALSE;
    ' z0 u( l0 j  S' b9 z5 i0 A
  423. }
    1 W. M, E: K$ }" @

  424. ! I! k# O8 C7 e& e3 m" D
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"7 J  q+ |0 Q6 ]6 C  G# ~4 z4 @# k8 Q! I
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn"6 F$ Z4 B: Z8 n7 v
  427. 5 d3 ?* I9 ~3 G0 s" T5 D0 f- C
  428. 5 E6 u0 I5 O2 n; i& a' K# N# P( e

  429. + w2 ]& A# `6 j; ^; g- C3 S
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile)
    ' Q& @/ b8 }9 R+ X6 S3 W
  431. {! F$ [6 k# c, W0 X1 Y0 Y
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;9 V$ ]/ }# R" F6 g7 B+ m
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)
    * w# P' `& b8 |$ u2 @
  434.   {7 K6 h7 X1 r( [9 }, @  Q
  435.     char szLanguage[50];
    3 T8 @% U& H+ f3 S( Z
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    & H4 U9 W7 ?; o+ z0 N' \# g7 i
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
    * s; b) z6 v5 f$ Q+ F/ m
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    6 j0 b/ B. b# _* T  X; P2 \
  439.     else                                   m_iLanguage=ENGLISH;
    9 ~$ y9 R% e& K* t% @) R
  440.     char szRegister[100];) m; m; w+ N9 E4 a
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    9 g# w+ A7 B9 m$ @
  442.     strRegsName=szRegister;0 E& J: G  b0 n' y
  443.     char szPatchURL[100];
    ( u! s3 x4 \% [& r+ E# V. t& J" F6 B9 R
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
    6 I- x* h+ j( k' L0 _
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);4 Z8 F. ]6 M: K  S0 b) E. e) a
  446.   }: Q8 V; F# F$ m" l& p
  447.   else
    ' |/ j! F" A/ x! _3 w
  448.   {, \8 @  B$ E2 W# Q0 z( {( @: g( F+ }
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);
    ) ?0 G% c  h" i
  450.     strRegsName=DEFAULT_REG_URL;
    8 Z# Y% r5 M+ ?
  451.   }
    1 {) C7 W1 V  g. n" f" A/ J
  452.   if(GetFileAttributes("hosts.ini")!=-1)
    4 [; `' T$ e% q: B0 ]- ~( s) B
  453.   {6 c3 |7 O* }/ T/ |: l6 W6 y4 L8 {
  454.     char szIP[50];
    . N* P# }' k7 y0 U$ e: Z4 O" {
  455.     char szDIR[300];
    5 _9 s; m6 t0 D* P5 `3 T* ?9 j
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))
    * R( ^0 n! s* T  O) o1 `
  457.     {
    4 d! q  q, v+ Y, J
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");) E! Q8 g3 S) p6 K
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");
    9 L8 K" |0 w% |) c1 @& Q9 C+ a
  460.       strHostName=szIP;1 q" s- k  d% S$ k2 l. r
  461.       strHostPath.Format("/%s",szDIR);- ^4 T6 p  t0 ?3 H3 n( n# w5 `! B" |
  462.     }$ F0 J0 g8 c8 Q, B, a
  463.     else1 U2 t2 m9 l- C3 H7 w/ x
  464.     {
    5 R0 I* p; O) c9 c( y# o& Q' x
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)7 d  G: h% `2 q1 Q
  466.       {) h6 I( f2 o. q) y
  467.         char szLanguage[50];6 a  o; f3 n: ?& `1 Y2 v0 T$ R: ?
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");5 O5 ^1 m6 i: }( \5 e/ ?
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;& j2 C+ O- t7 d0 |7 g! s
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;
    % z# ~) o% z0 d6 U) y! T% o+ T' A
  471.         else                                   m_iLanguage=ENGLISH;: s/ G- q) ~  \+ G
  472.         char szRegister[100];) D2 K. U0 q6 p0 j& c/ l# H) N; A
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");+ U$ C; C# ?  u* s7 Y3 y, r
  474.         strRegsName=szRegister;1 U. Q2 ]3 r8 `! p7 S) a; F
  475.         char szPatchURL[100];
    - @1 _' ~7 B/ [* s7 T1 a; k3 t* ?
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
    % a; Y3 q0 j1 D# d6 ]0 J/ m
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);
    5 _8 @. i) r8 J2 `. @
  478.       }
    # z1 \( Y" ^; `. F0 {, ?
  479.       else
      }# U+ ?! f7 o4 g
  480.       {
    + c3 u2 n; l  T; Y) L
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);. z; [" M' p* Z' e
  482.         strRegsName=DEFAULT_REG_URL;
    & ?4 ?0 K5 U8 B1 T. g5 f' i
  483.       }& I$ a% z2 I* f, o4 Z  j
  484.     }
    * c9 n3 w  ~0 S
  485.   }
    , n$ g. O5 ~6 s* ~4 Z
  486.   return true;+ J- l4 q" K" p+ Q3 r6 a, D! u
  487. }) m3 N, g7 Y% i: _4 H" ^6 N7 ]
  488. 4 C& \$ j) Y" S6 q( U- e5 n8 {
  489. #include ".\ZLib\unzip.h"" c4 R  O- Q( Q8 T- C$ v4 m8 Q: f& C2 Q
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);
    7 Z' w  F9 T3 C; f7 W7 t
  491. /////////////////////////////////////////////////////////////////////////////
    # v; I9 |* K8 `1 X8 U" |9 ^
  492. // CRevAppApp initialization
      k9 m# S4 J' e

  493. ( Q, l. C5 X: b. f; m. b
  494. BOOL CRevAppApp::InitInstance()5 U, Z7 t' d3 I5 ^& ]9 l  N5 Z! W
  495. {
    ! t1 y: D3 n( D
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];
    ; V  a/ ~% Y: G' v( M, S
  497. - z' }8 G; j  g# |+ N" `# p
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);; h# E; E+ ?" G
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))
    + M9 Z5 t" _% P4 c0 _6 k$ L3 d
  500.   {
    " e  W( o$ y# a3 m4 J
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");
    & w, y4 B4 B3 s  q1 k
  502.     GetPathFromFullPath(szPathTarget,szPathSource);( N& M+ P2 O  D1 y! B
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget)))( {; Q; {* b" s1 v+ G8 _
  504.     {
    0 R* ?% g; Z7 A( w# o3 p- F
  505.       strcpy(szPath,szPathTarget);
    ! |. G3 v+ @7 R* j* V2 M, [
  506.       SetCurrentDirectory(szPath);
    % J+ h) ]  k" W, x( N$ d* @
  507.     }7 C6 N8 v- T5 Y' K$ {. \7 O
  508.   }. O- q6 _1 S/ }  ]; b# b# C
  509. #ifdef _DEBUG
    % ^+ q3 i# Y. \2 S) t' b
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))
    1 r' O: u1 D: z0 \+ h) b1 |
  511. #else, ^/ j, l  F0 [! N$ l8 S
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))' t& u/ W4 y9 M5 W/ v' f( A( V
  513. #endif
    6 Y/ X4 ?* d0 P+ l: h& b9 P
  514.   {! v' h  U+ |( w9 i
  515.     char tempFileName[MAX_PATH];: Q5 E; @. T9 h8 Q
  516.     strcpy(tempFileName,szPathSource);0 p8 N+ x: l6 x0 @) X2 S
  517.     tempFileName[strlen(szPathSource)-12]=0;
    + T% ?8 q* P& }
  518.     strcat(tempFileName,"\\$CSUpdate.exe");! Z' ^9 g( \4 i0 R- B$ u5 @
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);
    3 r3 H7 {5 y+ O
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);
    6 e9 v* M& O) f/ ]$ L
  521.     return TRUE;, D# R6 {: R  \8 e$ c: |/ A4 w
  522.   }
    & l! I- ~' c8 z4 @
  523.   // Nuke 0118: Delete run.exe
    % c( h6 f9 E) n+ K2 [; n
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );
    # h0 G4 j# R5 l( P) |3 w
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");
    . t; E& F" S+ T5 y1 J. v9 {
  526.   if(!ReadCfgFile("Config.ini"))
    , L7 M' R6 P  I  C
  527.   {
    7 r7 b+ H: W# ~
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);  M3 c. N- M3 q5 C' q/ |' Y: ~" s
  529.     return TRUE;
    1 Z* x$ {" t) L8 k6 R$ b3 e3 M
  530.   }1 Z- G' J; L9 S
  531.   HANDLE mutex;
    6 [7 e2 p( Y( x! i' Q+ M- X1 \
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))
    ( V8 Q7 n" P. z& h* ^
  533.   {
    ' V" f! ^2 ?* B& R5 W' U
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)
    : s5 l/ d+ B4 ~
  535.     {
    ( z) W' g! u9 |8 _6 K. w* h
  536.       CloseHandle(mutex);
    0 f3 b+ U9 [" S- c& k" @
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);
    * {. J6 c2 ^: H+ A
  538.       return TRUE;
    0 Y% [  t" b' v, [, o8 [
  539.     }
    ; w0 S! n7 j, A+ |4 {
  540.   }  
    * S. H) ]% ~7 e
  541.   CloseHandle(mutex);3 W) Z& x' Z! g4 v% A* z

  542. 0 w$ F( g  p) ?
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);
    ; V0 L' U7 }# r6 y: V
  544. ' g' A) T% n) p# E* q& Z
  545.         AfxEnableControlContainer();
    5 }0 v) [) N; g8 v+ }7 R
  546. 0 Z0 N" P/ k. r1 f4 @
  547.   bCanUpdate=FALSE;
    ; N3 i% p& U- Y* S; C" c1 |
  548.   dwStartUpSteps=1;$ B9 x0 d* E: t2 z3 g; ]. t' O  B9 L
  549.   dwProgramState=AP_NOTHING;
    1 \- a; x% Y6 ?6 B6 r) @
  550. ' [; Z, l4 |* W- @( P
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);
    5 ^2 }: U" p6 h/ k: W( l$ z; x8 Q

  552. " }9 r; V& {9 r. U) a
  553.         // Standard initialization
    : A; ]- p: ?$ S
  554.         // If you are not using these features and wish to reduce the size
    6 V( a7 [4 K3 i# O" F- X3 h
  555.         //  of your final executable, you should remove from the following
    & ~: l5 O8 f; W4 }' }
  556.         //  the specific initialization routines you do not need.# O# l6 m- B2 ]

  557. : u, J5 @+ {- \3 s
  558. #ifdef _AFXDLL
    . [) s- i" i  V& j+ Q& K; _
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL2 n" v) @4 E# x2 b  ^
  560. #else
    ( h, U' @" G* J4 v1 Z+ S
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically
    ! A2 \* \; C% ?- V6 C
  562. #endif
      G# ]& x9 X) J' }0 ]% S
  563. ; `. P( Z. {$ ~+ Q5 C6 \7 x
  564.   dlg=new CRevAppDlg;* l& T( P# m! L/ _4 Z
  565.   dlg->Create(IDD_REVAPP_DIALOG);
    - ?. u3 }3 E6 s9 ^( J/ o2 J3 l6 s
  566.   dlg->ShowWindow(SW_SHOWNORMAL);
    0 V' W3 y' X( C1 g2 o
  567.   m_pMainWnd=dlg;) Z! v6 [8 _& A7 x, u

  568. : a$ K! l  j6 n1 d! d
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);
    & B7 ]9 F" N; x: h

  570. ; L+ F" E* v; Z7 T% a
  571. //  GdiplusStartupInput gdiplusStartupInput;" d# j* `7 a; [
  572. //  ULONG_PTR gdiplusToken;
    5 G- P; f7 a9 O- F3 Q5 @% @+ J
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);
    4 f& Y4 r0 D; G( X5 [
  574. 3 K) D" A' w& K* u
  575. //        CRevAppDlg dlg;8 Y* Q, E) t. s9 t# a; u
  576. //        int nResponse = dlg.DoModal();3 }5 _) S( W" ~
  577. //        if (nResponse == IDOK)1 C! t+ n# I0 [) L
  578. //        {: g. R* u7 Y1 c! r
  579. //                // TODO: Place code here to handle when the dialog is) K$ R3 ?6 F2 g( i" ~2 Y
  580. //                //  dismissed with OK
    ) }5 G& e) {* V7 j) H4 h
  581. //        }
    5 h$ p+ G2 |; Z* [/ s
  582. //        else if (nResponse == IDCANCEL)
    $ @* y. i  z3 E  q/ d5 g9 ]& _1 v
  583. //        {
    / L7 k. q) r7 Y5 \+ I
  584. //                // TODO: Place code here to handle when the dialog is" t5 [. S& F" m. L) {
  585. //                //  dismissed with Cancel
    ( s! ?" {% I1 Q; t
  586. //        }& h4 U7 V; q% k! _0 g; B
  587. - X1 T- o1 e& @7 K
  588.         // Since the dialog has been closed, return FALSE so that we exit the  H9 `/ s" ?( ~: |; o7 n7 Z
  589.         //  application, rather than start the application's message pump.
    / N8 w3 |5 F. D! ]2 k. z
  590.         return TRUE;) a2 Q" ~) \6 J9 [/ o
  591. }  |2 f: n2 `, I0 a; r! Y

  592. ; u) n& b  t* A8 I: S) |
  593. char *CRevAppApp::strtok3(char *pSource,char *token)
    4 p$ a! h6 |9 M! z7 f+ N
  594. {
    ' L3 B; a7 v8 i; d) \: I
  595.   int i;) w3 p3 A: k: H3 L  L0 w% d
  596.   char *szRet;
    2 }3 Y. x8 B% M

  597. ( E" `; r4 Q, H, z5 Y% N
  598.   if(pSource) { itoken=0; sztoken=pSource; }# e: d( z& g1 V0 X
  599.   if(sztoken)
    / Y* C: V1 T/ j. N5 a; J
  600.   {5 v8 g! ]% P! \' \: r, k, B
  601.     szRet=&sztoken[itoken];3 u5 g: l+ L+ d$ O
  602.     while(sztoken[itoken])
    5 }  j7 z1 q, A5 _% i0 L- [
  603.     {
    & y& ]+ G6 J/ T" E+ u7 O
  604.       for(i=0;i<(int)strlen(token);i++)" l+ ?! N/ _* ^* j# }7 E
  605.       {
    . H* A- K* P! P! [! o5 B
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])
    / _5 R! K. e9 R, m
  607.         {
    6 b9 f) x, |( V  s, h: N6 a2 e
  608.           sztoken[itoken++]=0;* w2 j% U4 A4 l! [. J! w
  609.           sztoken[itoken++]=0;
    ) O7 ]2 r" ^/ c% y/ G
  610.           return szRet;
    , [7 X8 \, j% d% `$ c' i5 h
  611.         }
      p& }: i: W5 ?7 r0 ?% W) e
  612.       }
    3 p7 O2 I7 i% M0 U# s+ X! c6 T
  613.       itoken++;
    . z( Y2 x3 M8 ?% E+ o$ _
  614.     }
    1 D" ], k8 |" D. P" D9 z) X
  615.   }# n8 \/ s2 Q# c! {9 q2 j
  616.   return NULL;
    : @. l+ F% ?% l" r2 o
  617. }
    ' ~5 K& ^, Y0 K

  618. : s6 K' p8 p8 z
  619. void ProcessProc(long Total,long Current)
    ( L6 E# Y+ U0 M* O; G
  620. {$ _+ R+ ~; `% y7 I8 x' G
  621.         MSG msg;
    ! |7 K& F& r/ K' Q  h7 ?
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);9 x) f2 t$ X+ ^7 `7 Z
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));" e1 l8 |% w5 \3 f+ S! s5 ]$ w
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))
    + t& a- s4 Q/ X$ k. l
  625.         {
    . G$ S# \" [+ N) q+ B5 T8 r
  626.                 if(!GetMessage(&msg,NULL,0,0))' ~; s9 A( _- E' S2 n2 Q. {
  627.                 {( y6 c$ c7 D& ?6 w" s' e
  628.                         return;
    # P& Z7 X; g) q6 T( Z  X
  629.                 }
    ( o& w* y" ~2 W$ R" h$ r
  630.                 TranslateMessage(&msg);; U/ t. B1 f2 s: E( o; n' O# p
  631.                 DispatchMessage(&msg);  I- Z& b; P3 y) z8 o: E; x' i
  632.         }       
    + ?/ j" T1 d- A, t$ G& f
  633. }
    , m" \" f5 l  Z; C+ T
  634. ) V1 v8 y4 A$ S9 V# ~% u
  635. BOOL bFirstChar=TRUE;6 W2 X: q! T8 l$ ^& A# F1 {8 M3 i3 m

  636. + E( ]3 x# ?5 C( l) u* k* k  p) v" [
  637. BOOL CRevAppApp::OnIdle(LONG lCount)0 W- y" [' N* o. `
  638. {
    6 Z. b+ v! t3 t0 ~
  639.         // TODO: Add your specialized code here and/or call the base class
    - |, E& I' J% O: Y: [
  640.   switch(dwProgramState)1 Q/ C  @2 Z/ R/ a1 l1 c/ X' r
  641.   {
    ( u# L; U: e% s4 Z
  642.   case AP_NOTHING:
    : e5 |- T4 Q  w) v0 b
  643.     switch(dwStartUpSteps)
    3 [  z" d: j, p% N4 V
  644.     {
    5 y1 u) U4 P- e
  645.     case 1:2 t2 g9 }' {. u' c4 H
  646.       {/ W. O2 F7 B# K5 D; Q& j+ |9 M
  647.         int i;
    5 W- j8 d3 s# W- `
  648.         CDC *pCDC=dlg->GetDC();
    . [* C; B8 ?/ Z
  649.         HDC hdcwnd=pCDC->m_hDC;
    0 f& ^' e6 y, z2 R# T' Y! F) n
  650. //        Graphics graphics(hdcwnd);4 N( m  N0 @# j, B- E
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");
    " P7 B: ^' k, U1 P8 [
  652. //        INT iWidth=bitmap.GetWidth();
    . L+ S" ^! b. p. X/ j  J! w* O# T2 D# C
  653. //        INT iHeight=bitmap.GetHeight();' ]% i0 {5 P% t# u. N/ U: `
  654. //        Color color,colorTemp;
    + r; I" a+ J' s9 Y6 o
  655. //        for(INT iRow=0;iRow<iHeight;iRow++)
    6 o, u9 F2 E$ e$ c
  656. //        {2 i, m9 {* q9 u+ w+ d) |5 E
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)
    ' d# I# v0 a2 i; |8 B
  658. //          {% |1 V2 ?. }2 H& R3 P
  659. //            bitmap.GetPixel(iColumn,iRow,&color);
    6 q9 _! d5 E- Q( }  d
  660. //            colorTemp.SetValue(color.MakeARGB(
    ! G7 r$ O0 |. k7 e7 K
  661. //              (BYTE)(255*iColumn/iWidth),4 U% Z1 X+ t4 N$ y9 ?' j9 k. K; Y' [
  662. //              color.GetRed(),
    7 h1 w) B( _# C3 E' K& J& E
  663. //              color.GetGreen(),7 m3 o( ?  J8 @$ P( N7 A! J" }
  664. //              color.GetBlue()));3 M. p1 b7 i( m/ G
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);* K$ C1 T: c) |, ~3 |
  666. //          }9 L: q4 C( c  [( J* _
  667. //        }9 U# O, z5 k# \# t( M) {
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);
      O$ o& J" h% v  Z% I  v
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");
    4 Z: q$ T0 J2 L0 C$ k9 [
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");4 W' H" z" m" H* }4 V- d- E! t
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");3 f/ K1 N' t) t3 z# K
  672.         for(i=0;i<240;i+=8)
    / G4 v  l7 x3 K
  673.         {  [* o0 V# @7 @
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);9 ^- j: b; r$ y
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    ; g2 ?* }* f$ b2 B! ~1 C4 g
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);) q( Z6 D9 \, U  E+ |' U
  677.           Sleep(33);5 |- B6 K. f8 w3 F
  678.         }" I* `1 P: A) R) {3 l" Q
  679.         Sleep(1000);
    / H+ u7 {+ J, ^  |' P) G8 c% [. V
  680.         for(i=240;i>0;i-=8)
    - s: }: Y9 ]+ ?0 d
  681.         {, D8 k' [  U- @$ P) Y. q& _6 Y3 P
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    2 o6 L; z% M7 b$ |- p
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);
    0 z& F6 O% O: r; |
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);6 O2 Z$ s7 M/ A; r0 U
  685.           Sleep(33);
    + s& ^( Z# s: ]
  686.         }
    . K5 H  o; K# e, E
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);8 U! ~. D$ Z; {. h& V6 o9 G2 T
  688.         dlg->ReleaseDC(pCDC);' H0 i/ O7 P5 r  S( w; p) H
  689.         DeleteDC(hdctar);* R5 \8 A6 m6 l, y& Q3 s
  690.         DeleteDC(hdcsrc);2 H: F1 c) i9 N$ k' o5 ]
  691.         DeleteDC(hdcorg);% O# ^' D9 E2 Q7 J2 C
  692.       }7 j2 X$ B$ J0 p1 I# ?
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);
    ) x5 g4 F6 k+ ~' S. V* h: T7 }
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");/ z; A3 x# i, l% k/ u
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");  C3 G6 u; N- p8 y0 H- R  g
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");; z9 l& q8 N3 O+ S# ~3 L6 q8 G
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    / i% b4 [, i. v
  698.       if(!Dn.Connected())5 D3 a' K8 H1 i# k7 J8 m
  699.       {0 T5 _% F& J0 U' {5 q& B/ E% E" F8 N
  700.         dwTotalFiles=1;& ~9 j% e6 V# q7 w) N' y8 L* t8 F+ q
  701.         dwDownLoaded=0;
    " j) a- _4 E' v7 l& E
  702.         bSilentStep=TRUE;1 S# ~% }) d1 t7 O
  703.         bCompressed=FALSE;! K) I9 |) L8 ]. c+ J7 `: U
  704.         strExtLocal.Empty();
    2 W. ~% G' ]! S' s2 ~+ G
  705.         strFullName="readme.txt";6 t3 q' j) }  _, L" _# t! Z
  706.         dwProgramState=AP_CONNECT;8 {/ X5 d7 d- G7 m" h( j
  707.       }
    & P: S1 P# C' l: ~) M
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();
    5 W/ Q9 x1 o/ G2 M
  709.       dwStartUpSteps=2;
    # E3 X# H! P! s! g; F
  710.       break;
    0 z' z" f7 v2 l' O5 M2 Q, A" F
  711.     case 2:
    6 E% Q3 h( _; U
  712.       {
    ! ^1 K. I: W* l, o
  713.         int iEOF;4 l' ^4 Q  r/ k* [" w$ P
  714.         FILE *fp;
    8 W$ [4 L  r; P8 Z  Q: Z
  715.         char szString[512];, w. G+ B8 w& B, K
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");
    % M& d5 |+ G3 T. C. B+ f
  717.         if(fp): m( H' j% Q* R5 V; y) u9 S$ K' G
  718.         {) ]8 j$ ~/ F7 u# N! z
  719.           do
    % i6 D/ e% W7 Q% v1 M) d/ n
  720.           {. r' X( U: e* W" m" N: N4 f
  721.             iEOF=fscanf(fp,"%s",szString);
    ' X& K2 Q% m  @  k+ ?
  722.             if(strlen(szString))
    - V4 y8 M$ \( b% X' P
  723.             {
    , @. t0 T* d+ l2 D
  724.               if(bFirstChar)
    3 H3 w* b/ U; A$ k5 s/ f( q
  725.               {! i' g- ^! V2 c1 }
  726.                 bFirstChar=FALSE;
    6 k: R) a- t' F  v) W1 l- _) Z
  727.                 bConnectIsBig5=FALSE;+ M6 a% u" t! I' v3 X0 F" L
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;
    - N. h. K9 H+ t* ]- T" f1 g
  729.               }! M/ x- V) E+ u# J1 o
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));1 `# `7 g$ m) O1 O0 X
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));' @$ @) _9 l3 m+ a: G1 ]2 V2 B, _
  732.               dlg->m_ListText.AddString(szString);& Y" L0 ^' K  o( s& |: @5 j# V5 T
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);  [# a0 _4 y1 `! t; E% ?
  734.               *szString=0;6 T3 J- H. |" @; U" Y( @
  735.             }* Q* \! n2 z  V- ~% S7 J) S4 L
  736.           } while(iEOF!=EOF);
    7 v' }' l: \9 @. G, ]  g
  737.           fclose(fp);2 q3 r" Q& P- R* I2 n  P; o: x; C3 X8 z
  738.           unlink(".\\DownLoad\\readme.txt");
    3 _' T( F; Y/ T0 _4 X8 f
  739.           dwStartUpSteps=3;( f0 b( g! Z- i+ B( m2 D! E+ M
  740.         }
      l% @" i) u# w1 A9 [
  741.       }
    7 E: g5 n' B/ c: k' S
  742.       break;7 y, s3 t3 t# c
  743.     case 3:
    * l. ]6 A4 d" Y2 R3 ]
  744.       if(!Dn.Connected())
    0 p0 n3 L; N3 r/ T: f$ A
  745.       {
    5 D7 K; A8 s4 v
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);
    & ~. @4 g2 f1 L8 [2 @) f
  747.         dwTotalFiles=1;" l: x0 x# h- \2 f! \* _; r
  748.         dwDownLoaded=0;
    + O: j  h7 L5 r1 m+ N/ B
  749.         bSilentStep=TRUE;
    1 ~% ^" t0 M/ }; x) g4 u
  750.         bCompressed=FALSE;' ^+ {: n8 [; d) l
  751.         strExtLocal.Empty();$ ]4 w& z6 {+ M& B
  752.         strFullName="checkversion.txt";4 Y0 R6 [+ h! C2 O
  753.         dwProgramState=AP_CONNECT;& V) M4 c0 v; T
  754.       }
    " m0 `. `, c+ h) g) W
  755.       dwStartUpSteps=4;' D, r" F9 g5 u" ^; V
  756.       break;
    ) V) R3 m9 W0 a# q+ g2 M! g1 P
  757.     case 4:
    ( R1 U$ @; S6 J
  758.       {: S9 G+ s7 l" o# ]) O- l  N
  759.         FILE *fp;
    % W- I$ i2 x. j. o! A0 [
  760.         char szString1[128];% G( {8 |4 K) q( W- Z
  761.         char szString2[128];3 r/ B9 x( j6 d
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");* t( Z& F6 N& s- q+ X+ d9 C6 H
  763.         if(fp)* i4 v, T3 ^1 v; u
  764.         {
    8 x& h! d" J0 N/ g& W# j3 s' C
  765.           fscanf(fp,"%s",szString1);
    - p  U  r6 e& L3 x$ ]
  766.           fclose(fp);
    6 d' r( x* s1 f5 N0 W2 i4 i* Y
  767.           fCheckVersion=atof(szString1);
    - I" t. S: x! K2 X
  768.           fp=fopen(".\\checkversion.dat","r");
    6 @: L1 r/ }; G) m
  769.           if(fp): {; `7 z  e" y
  770.           {' ?0 n$ y# w% I) f
  771.             fscanf(fp,"%s",szString2);2 W8 z- d- Q0 K1 o+ Q
  772.             fclose(fp);
    & H/ k7 A7 y! B' D) S( C6 m& S; f
  773.             if(atof(szString1)!=atof(szString2))
    0 a1 G1 m0 d9 {5 W" P
  774.             {$ Z- y  s9 @- b! ^7 Y* L+ D
  775.               if(!Dn.Connected())" {) z5 T3 j4 [  p/ i9 z% O
  776.               {
    ) ^8 x2 L4 B7 p0 w4 M% M
  777.                 bFirstUpdate=TRUE;
    : _; Y6 s6 v; ?" s& I
  778.                 dwTotalFiles=1;# |$ ]9 a- \  q
  779.                 dwDownLoaded=0;
    + w9 `" z3 B6 j: O) l+ N; J9 ?
  780.                 bSilentStep=FALSE;
    . C# ?6 ]2 Q9 {! u1 l( K
  781.                 bCompressed=TRUE;/ o/ Y/ K, Z. D
  782.                 strExtLocal=".\\DownLoad\";
    9 ^9 W; p* o: ~* P& a
  783.                 strFullName="update.txt";9 ]! R' |- A3 ]1 Z. L# c- r8 S- i
  784.                 dwProgramState=AP_CONNECT;* Z6 ~3 i8 M4 [
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");% f* s  c$ B  q4 ~* @/ ~
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    : D5 {9 b: j2 o! J" l# R3 ?
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");
    : N5 B" Z2 R  J% }* ?" m9 s* E

  788. * e& s7 b) h, G& D
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
      _. `& Q, k$ L2 c, L
  790.                 unlink(".\\DownLoad\\checkversion.txt");
    * b, V2 L# ^" r
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)
    6 ~4 z% `6 B: o' K& ^
  792.                 {
    . M8 p4 p% t0 P
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");
    9 b: H# ]/ E6 ?+ _4 G
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");0 O! `' V% Y  h: p/ C! K
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");" ]4 y$ f, H- o+ `0 P. N
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    . M/ I% V- A- E. G" q& V. o

  797. $ `  o) ]' w- P
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    + K; x8 h, E+ z, ?% z2 R. E
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    0 J, w2 Q$ A+ n* E6 K" |
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");2 \0 e2 h! u0 m# E3 Z8 y
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    * j$ U3 `2 S$ \2 v
  802.                 }
    1 o3 @/ O- e& }, A
  803.                 dwStartUpSteps=5;% W9 Y' A9 R: H# g' Y/ U/ ^8 a
  804.               }4 d# Z3 T- t3 Z" g- g1 C% T
  805.             }
    / ]4 |$ J0 q  Y" U) y# n
  806.             else
      _! D6 k# Y3 W
  807.             {
    9 U" H$ I* c+ V& Z: @
  808.               unlink(".\\DownLoad\\checkversion.txt");
    + ]# {( R9 `+ Y( o
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");" @; h  _5 B* E9 |. ?) c; Y
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    " w7 z6 B$ k' v/ \
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");9 Z3 {" ]1 z4 k& L7 X

  812. 0 S* C) `6 m4 C/ G' N8 d& z
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);, v& y. `- H' j
  814.               dwStartUpSteps=99;
    # b/ U' M, f' J9 R" I
  815.               bFinishUpdated=TRUE;. {% g4 C0 G4 q
  816.               bCanUpdate=TRUE;
    7 y/ g% Q0 I8 D( h* p- T( h) Q
  817.             }9 Q; l0 U4 d, m. ^) |: W0 W, J
  818.           }
    * a/ O3 W6 T5 k8 \3 K  k
  819.           else: D6 W% O9 V& g: S# B
  820.           {
    + c  U' C+ I& H( S( `
  821.             if(!Dn.Connected())
    - W5 v+ Q3 b. Q" w' s
  822.             {* j8 M" J9 h) h( `' Y& b
  823.               bFirstUpdate=TRUE;$ ]/ m% C2 N7 Y# E
  824.               dwTotalFiles=1;
    ! z! h; s/ ~( b. Q. @
  825.               dwDownLoaded=0;: x7 U+ F2 d7 }; [
  826.               bSilentStep=FALSE;
    2 Y# z7 u9 y5 `6 V% b% v5 J
  827.               bCompressed=TRUE;2 A9 m; P$ T0 _7 r0 w3 m
  828.               strExtLocal=".\\DownLoad\";( w5 M, T  X4 N, Q
  829.               strFullName="update.txt";
    * L' g2 O5 w- ~! W: {: [# J
  830.               dwProgramState=AP_CONNECT;
    9 U5 c0 C, `' C* P
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");
    & U$ l+ }' G+ @' P0 H* ~! r
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");0 F$ c  D, {# ~$ z8 ]! r
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");
    & y* s6 e' W( O5 m4 V* o- k
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    / J+ `5 _. m7 g
  835.               unlink(".\\DownLoad\\checkversion.txt");
    * Q1 j4 e0 @' z7 n+ b
  836.               if(GetFileAttributes("Wsa.zip" )!=-1)
    ; A8 R$ W  u" @, t' m
  837.               {4 b3 a) r' g6 p& D" [
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");6 b2 A2 O5 W, u# \
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");
    ' B' ]% w5 t% i. j, e# V
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");
    . V( }. t) k. p
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);1 T# {! y! h$ i  f& h3 o3 Q- o7 Y
  842.                 / ?% t5 S9 i7 V' Q1 M
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");$ V7 R" z( ]9 u& o# o
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");
    & ?, q( ]7 b3 u7 _* U
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");9 ^# K" _  Y9 f) b; z& M
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);- l2 L( e* F4 j
  847.               }3 `. }# q6 R- W
  848.               dwStartUpSteps=5;" I* a" z5 ^6 W4 g; A' r9 R
  849.             }
    - V7 I$ ]' F. U
  850.           }
    + D. T* Z0 J+ E3 q! w" g, Z8 `
  851.         }) I. i: w- v( N: y# n- y7 _
  852.         else
    ) Y7 {- Y( n& p7 R
  853.         {
    9 E! j3 p6 {2 Q5 d/ i
  854.           dwStartUpSteps=3;0 U7 T8 k) G: f6 F3 C
  855.         }
    2 Z5 s4 l4 n: Q- F& V/ L
  856.       }  N7 z7 P& ]3 }4 b$ j' h6 K9 g
  857.       break;
    ( H( T- O  M/ m
  858.     case 5:* x' Y; F0 }1 o' u! U2 |  @) q4 ~
  859.       {
    . X& i" ~  K' J2 S/ k3 m: D
  860.         if(GetFileAttributes("Wsa.zip" )!=-1)
    ; v7 ^! D; l: w" M1 K7 O5 b4 H
  861.         {
    1 b/ o$ O# T: M, X% G1 K' A
  862.           int opt_overwrite=1;6 c' w$ u" V) x  K# |  X
  863.           int opt_do_extract_withoutpath=0;
    8 {8 [; m& Z* g5 l; f& x! f
  864.           unzFile uf=NULL;
    . m( {8 w, h1 M

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

評分

參與人數 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-1-23 05:33

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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