找回密碼
 立即注册

CSUpdate.exe源代码

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

# d/ X& i! t4 s& {% |3 Q! }: T
  1. / RevApp.cpp : Defines the class behaviors for the application.* K7 l1 }& S, }& R
  2. //
    6 x2 k8 O5 J6 x

  3. 7 V7 y7 c: p9 L
  4. #include "stdafx.h"
    % X, e+ w$ x& ]2 P! W7 i, g7 c
  5. 4 r; s3 t5 s6 f+ Y( |
  6. //#define UNICODE
    2 _4 t3 D" _5 ^, S- C; k
  7. //#include <gdiplus.h>8 c5 k: A+ t: i( n& h+ B
  8. //using namespace Gdiplus;
    - x5 P. g5 f( ]! \6 Q
  9. 7 G8 S5 q: B  Q: ^" h
  10. #include "RevApp.h": N/ S8 @$ c& a, j2 m& C2 l
  11. #include "RevAppDlg.h"5 W/ x5 p& q% E

  12. / x5 A+ C0 H5 ~3 o" B3 j% c
  13. #pragma warning(disable:4786)
    % Q4 K8 r! i! Y, q7 `: Y
  14. #include <map>$ A! G6 l' ~: j3 q: ~0 w& Y" a
  15. #include <list>+ E" k2 w8 E, n" l& J* d) g/ k) |
  16. #include <direct.h>9 ]: n' E! i, g+ f9 R- A

  17. # y! \$ C+ F! t+ ~; Y
  18. #ifdef _DEBUG
    " }: f7 ^5 ]$ s* R4 J: |8 p" n0 N
  19. #define new DEBUG_NEW
    6 P# W8 M" o" p5 G; v0 U% m
  20. #undef THIS_FILE3 k& Z9 f8 k/ E+ R6 g5 i
  21. static char THIS_FILE[] = __FILE__;
    4 z0 O+ \: l; E. j
  22. #endif
    8 W& a" _& q0 D  |4 q* F: a  K1 _
  23. #include "SkinResDef.h"
    , a2 t5 N; H/ Y9 N6 G% m
  24. #include "ChangeBG.h"6 C0 k, y3 I6 g- V/ K
  25. #include "AFXINET.H"" L. Z1 [% x" v8 {: j0 c. p) ]  }

  26. : E% _5 w. {% W  _
  27. #define TRADITIONAL_CHINESE 03 _3 q# u4 P8 H1 `/ i0 B
  28. #define SIMPLIFY_CHINESE 1$ R6 C& Y/ l5 l- o6 j" u4 Z9 }+ F
  29. #define ENGLISH 2  ~1 B: n. Z' L9 e1 h$ w. p
  30. int m_iLanguage = ENGLISH;
    2 S5 o% v0 z) \  _- l, v# W7 }% |5 e
  31. /////////////////////////////////////////////////////////////////////////////& D$ n. d, [% E+ _$ T. {9 D+ i
  32. // CRevAppApp- W* f  N5 h/ ]0 ~7 q8 k5 I

  33. - K% d) w7 X+ U5 H% ^
  34. BEGIN_MESSAGE_MAP(CRevAppApp, CWinApp)  K& `5 o8 @+ G6 t* C% O0 a
  35.         //{{AFX_MSG_MAP(CRevAppApp)
    - O( T3 o. B7 V: `9 c4 z7 P5 i5 m
  36.                 // NOTE - the ClassWizard will add and remove mapping macros here.+ r6 K! w7 D3 ~, l) t% h0 v
  37.                 //    DO NOT EDIT what you see in these blocks of generated code!
    ; [4 H+ c8 Z1 f
  38.         //}}AFX_MSG
    % I) F/ |7 _. M4 p1 k" }" _: |9 I
  39.         //ON_COMMAND(ID_HELP, CWinApp::OnHelp)8 Y; i9 g# x5 \6 h  L. g5 ?1 W
  40. END_MESSAGE_MAP()
    % C0 b: R7 J4 l8 a
  41. 9 R5 @/ ]; `  B3 B0 n1 u
  42. /////////////////////////////////////////////////////////////////////////////1 C& W+ z/ w6 P7 }6 J1 v4 }1 a
  43. // CRevAppApp construction
    # x& d( h& D# H

  44. 6 c& o8 j) F, J% ]# F
  45. CRevAppApp::CRevAppApp()3 G, K0 z5 b; s, U& r
  46. {1 i7 b# t) r5 e1 D* N4 ?
  47.         // TODO: add construction code here,
    5 V* C3 A$ t+ u7 c+ f) E
  48.         // Place all significant initialization in InitInstance, S6 f- v% b5 J/ b! X. B3 u
  49.   bDisplayIsBig5=FALSE;
    . F. u8 M, X6 t8 W, A$ @  Q
  50.   bRestartUpdater=FALSE;
    + Y% {+ q" s! u/ |* T6 o
  51.   bFinishUpdated=FALSE;
    : n" A% L$ K  {5 Y6 a9 z
  52.   if(GetACP()==950) bDisplayIsBig5=TRUE;: Q3 n" ~& [) v1 ?7 ~8 T3 M* i
  53.   InitChangeDataBig52GBKS();
    $ f: q5 m) @* L% H1 [7 O) V0 y
  54.   InitChangeDataGBKS2Big5();3 G. c) \+ @& W2 n  Z( M
  55.         //" f- n# Z: B1 ]( y  d$ f3 p6 n
  56.         bClickRunExe = FALSE;/ c2 t; h/ N- }; R5 F
  57.         //
    ; M, @0 K6 o8 N; u9 }4 ?$ N
  58. }
    9 J; d% Y+ T9 w) ]' K1 K  _$ n- [

  59. ( _9 [3 y  B) U* G$ @1 \
  60. CRevAppApp::~CRevAppApp()
    ! A/ V5 A' |8 v, Z7 ]& ~
  61. {$ k0 j7 R7 z9 k+ ^( F3 f
  62.         // TODO: add construction code here,' a) g0 @2 V7 C9 V* ^& C* Z
  63.         // Place all significant initialization in InitInstance& t! q+ M, E5 k0 L
  64.   EndChangeData();
    4 I2 X1 w# B, R& I+ ]
  65. }; w) z# n3 I# X3 e! e$ `2 O- Q

  66. 6 G# f' z' G/ _& B3 f1 s8 m
  67. /////////////////////////////////////////////////////////////////////////////
    : W; S; S; S( @+ b  _/ D
  68. // The one and only CRevAppApp object& G3 j, n6 U# T1 y. Q

  69. ( k9 @' g/ i+ D$ X0 d* Q. q
  70. CRevAppApp theApp;
    6 I/ F& Y- a2 g  w
  71.   q+ S1 \1 _/ J5 Y; c' {
  72. char *CRevAppApp::ReadFileNames(FILE *fp,char *szFileName); [5 n. ?) e+ u3 u
  73. {1 ]. C( H: j; W+ Q
  74.   int iEOF=0;) }: b7 R9 [  r  z2 ]
  75.   char szTempName[MAX_PATH];! b" y4 r& n% x; d. ^$ ?
  76.   *szFileName=0;4 p$ @" \  Q6 E" {
  77.   iEOF=fscanf(fp,"%s",szTempName);  Z) R% t1 I7 v
  78.   if(strlen(szTempName)>=1&&szTempName[0]=='(')+ h! y$ f7 `# |# H: }
  79.   {
    0 g3 k- E5 a. O7 B5 Z% P9 b
  80.     strcpy(szFileName,&szTempName[1]);
    ) W( ^, B0 w: ]: [
  81.     while(!strchr(szTempName,')')&&iEOF!=EOF)
    ! w& r# |& k& M: m2 b
  82.     {
    ! v, g; Z8 U; ~% X1 q
  83.       iEOF=fscanf(fp,"%s",szTempName);
    / E8 k' U- H1 Z) l0 ~
  84.       strcat(szFileName," ");
    9 w: Z( T% _2 f' }5 t( ~
  85.       strcat(szFileName,szTempName);
    ; [  K+ E& @7 \9 \0 h
  86.     }
    - u* Q  d0 n9 H! W! X
  87.     if(strlen(szFileName)>=1)
    $ {( X8 u5 X' \  ]; _' m& g) M
  88.     {  W! G" g2 w* `- w. ?
  89.       szFileName[strlen(szFileName)-1]=0;
    % `9 \7 R- J+ \( i$ K; d8 _2 @
  90.     }
    % }/ ~7 M* `# D& H1 I7 ^* W1 f7 p+ ~
  91.   }
    , y: X* Y3 f2 c4 U+ H5 L+ J
  92.   return szFileName;! H2 s/ n2 D, Z  Z1 l) n
  93. }
    $ L0 w3 [. y7 F2 r4 i7 M# l7 G( r

  94. 3 o* n0 _! t$ Y. _. ^4 e
  95. bool CRevAppApp::LoadLogFile(char *filename,std::list<CString>& UpdateList,std::map<CString,LPUPDATEFILE>& UpdateFile)
    ' A5 b* z5 \, |' r5 _: z
  96. {
      n" b, E1 K1 G/ S1 E; a
  97.   FILE *fp;
    ; S7 x' U0 X! y+ t7 T  R# h8 i
  98.   char *key=NULL;" g9 p" q4 A( L- f$ B- q
  99.   char version[MAX_PATH];6 E* f. m2 r% T: U2 U* }. b$ k! }
  100.   LPUPDATEFILE file,olds;& |. I. @) z( K( l5 D/ |
  101.   std::map<CString,LPUPDATEFILE>::iterator p;
    3 M. s. }9 N/ @$ h
  102. . A  ~2 ?8 I7 j
  103.   UpdateList.clear();
    $ X" i* l" R1 D9 r0 G' x
  104.   UpdateFile.clear();
    / x8 ?$ X5 |! u5 a) Q: f1 S5 I( ^/ `# T
  105.   if(GetFileAttributes(filename)==-1) return false;
    ' J- d- h% o9 t0 L, `' P+ }5 n* n
  106.   if(!(fp=fopen(filename,"r"))) return false;
    ) e9 Y7 h! ~, E
  107.   fscanf(fp,"%s",version);8 b7 H  t) K) B9 b0 p, y9 h! \  d
  108.   if(stricmp(version,"Bloodyf")) { fclose(fp); return false; }' u2 Z  m4 E! d; ]
  109.   while(fscanf(fp,"%s",version)!=EOF); O4 ^1 T6 R  G0 E& T8 P7 Z! B
  110.   {
    6 q! p4 x# u. K  D2 g
  111.     file=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));$ ~" j( A! Y% x6 g5 _  ]
  112.     fscanf(fp,"%s",file->path);
    2 X/ X7 ^/ l0 j" E3 {- L* y
  113.     ReadFileNames(fp,file->file);  q" ~) m- }' f+ a
  114.     strcpy(file->full,".");
    2 T3 F& ^& B" K5 c! o4 |" H' P
  115.     strcat(file->full,file->path);
    : b+ I! g% U5 l
  116.     strcat(file->full,file->file);  O2 C/ e2 M8 U, N# o* q( J( u
  117.     if((p=UpdateFile.find(file->full))==UpdateFile.end())
    " `0 q4 U1 R+ i- n
  118.     {2 x/ Z# \: [- d7 t) M
  119.       file->vers=(float)atof(version);$ i& y0 G/ ~. V
  120.       UpdateList.push_back(file->full);2 g8 j0 x+ I. l; ?4 n! {0 q
  121.       UpdateFile.insert(std::map<CString,LPUPDATEFILE>::value_type(file->full,file));2 H/ |" O% K, M! i! ?6 H4 o
  122.     }" k% ]0 T* K; f- g$ |
  123.     else' Y0 i+ E9 ~" p
  124.     {
    1 c( W! c( ^! {; Q
  125.       olds=(*p).second;
    9 A4 N( {& _; v8 y8 ^
  126.       if(olds->vers<(float)atof(version))7 T) j% W* j% `9 N* T  v$ U) e! c
  127.       {
    % l1 w, j3 Q( d% |7 g& V) @1 z
  128.         olds->vers=(float)atof(version);1 j  g# e* M1 h- i' G% q
  129.       }
    - L. W: f* O* o. a! U1 w
  130.       free(file);$ h4 n% N8 d( W8 }. J3 L
  131.     }
    , O5 Y) @9 \0 o* H0 f1 g
  132.   }, ]' h& Y$ y! y' [
  133.   fclose(fp);
    / `! s) e8 y, o3 H" P% h
  134.   return true;
    ! D, R, l( b4 g  X
  135. }
    , ?; Q0 ]& ~; \: l) T& k& o8 r% I

  136. * V+ q0 [; _2 o9 g
  137. DWORD CRevAppApp::GetPathFromFullPath(TCHAR *szPath,TCHAR *szFullPath)' `- N, F2 e) W! \' v. u' Y: ~
  138. {+ ]* d: W4 v: _. H( |$ o6 I2 c* [
  139.   TCHAR  szFull[MAX_PATH];
    6 U6 {, M( e+ ?4 f1 t" P0 ~; n
  140.   TCHAR *token,*inter;% q; Q% O' G4 {- T* L  @, I3 J
  141.   *szPath=0;
    7 E' d! _. V- g' w/ ?; ]0 n' v6 A
  142.   strcpy(szFull,szFullPath);' R1 m0 f5 e2 }: `0 G
  143.   token=strtok(szFull,"\\/");
    9 U% d; U; E* g$ Y
  144.   inter=token;
    - ]! O7 [' `0 T5 G, F
  145.   while(token=strtok(NULL,"\\/"))
    1 u+ o, Z+ h8 z7 F) o+ a" S- L; }9 t
  146.   {
    , M- i+ E. j8 L3 A1 r
  147.     strcat(szPath,inter);
    ) I/ Q- U/ e. O) ?- N
  148.     strcat(szPath,"\");+ J9 g! B7 j( @3 ^: o
  149.     inter=token;
    & D! W) [( x  T& [
  150.   }
    : d2 z( `  R2 n& c7 |3 I* L& y
  151.   return strlen(szPath);( H  R2 w% Q  [# b. V; K% r' {9 c
  152. }
    $ f2 M4 i9 J3 k- S0 _
  153. & L0 u+ f0 ^9 [; S4 }
  154. void CRevAppApp::ForceCopyFile(LPCTSTR Source,LPCTSTR Target,BOOL Erase): a% X% w% I! g
  155. {
    " \/ \; j$ T$ Q4 y0 ]
  156.   DWORD attrib=GetFileAttributes(Target);2 ~  E+ ?2 [# f3 ~! ~6 K
  157.   if(attrib!=-1)! B" ]& l0 |3 }
  158.   {% R- O% G8 V; ~$ ?
  159.     if((attrib&FILE_ATTRIBUTE_HIDDEN)||(attrib&FILE_ATTRIBUTE_READONLY))5 x: |( M( h" t' I% |
  160.     {. t3 v7 |) V' @% ^( k
  161.       attrib&=~(FILE_ATTRIBUTE_HIDDEN|FILE_ATTRIBUTE_READONLY);
    - B) m6 w) z3 P9 _7 c* N; ]9 x' v
  162.       SetFileAttributes(Target,attrib);
    8 f  M' v6 ~4 W/ ]! s
  163.     }, H+ N& s! J* z
  164.   }4 n+ \+ c& e2 F9 ^% V" w5 ^9 K
  165.   CopyFile(Source,Target,Erase);
    ) y# R1 a4 o# I4 O
  166. }
    , S, Z8 B% a/ Z/ H
  167. 2 t7 d$ }7 C# X0 Q. y
  168. void CRevAppApp::Fprintf(char *FileName,char *message, ...)
    3 t) A5 u# P# A# g
  169. {, F; h: Q  Y3 o% {. q
  170.      FILE *fp;
    - k% d- K# P+ T# H( [
  171.      char  szBuffer[8192];
    3 K' @: e, E' D
  172.   va_list  argptr;
    * e9 Q+ e7 y5 d; o

  173. & T8 V# V' k) e  f8 s
  174.         va_start(argptr,message);3 T2 {( `9 ]  m% i, {
  175.         vsprintf(szBuffer,message,argptr);
    $ _: I0 o6 q5 Z9 t4 L
  176.         va_end(argptr);
    ; L! Y/ c% z9 V( s
  177.   fp=fopen(FileName,"a");
    1 Z' ?% [- O) ?6 D
  178.   if(fp)
    6 h! [* G3 M) `. p9 j
  179.   {
    . y; r, q+ P9 i4 G( p" w# ?" F
  180.     fprintf(fp,szBuffer);+ Z3 \9 k/ k6 t3 ]4 [
  181.     fclose(fp);
    1 E- T2 ?! c# t
  182.           _flushall();
    . ]- b: x$ X$ O
  183.   }
    + @3 e% N8 ]2 m5 T/ x( y" J( v
  184. }9 d: _& `( m' S& N, c- W: V1 o0 i) Y

  185. + l( Z- u7 }# s( A3 X/ T
  186. BOOL CRevAppApp::Fclearf(char *FileName)3 i) u/ j3 H* w) t. J2 ]
  187. {
    : U. r) f. `) K* J  f  g, A
  188.      FILE *fp;
    % R& I0 N# ]/ }4 m, Q/ j
  189.     DWORD  attrib;  h4 I- e" J1 x" D4 R# Z
  190.   attrib=GetFileAttributes(FileName);2 j. l5 i6 t* H, s, E
  191.   if(attrib!=-1)
    5 b" {3 h( `! @. Z: x
  192.   {& y3 [! T3 t) K+ H, a( b3 M
  193.     attrib&=~(FILE_ATTRIBUTE_READONLY|FILE_ATTRIBUTE_SYSTEM|FILE_ATTRIBUTE_HIDDEN);8 K0 ^) b0 _! Y. I5 d
  194.     if(!SetFileAttributes(FileName,attrib))
    0 j6 M  k% _4 `6 w" J
  195.     {+ S+ a2 f2 t  J# Y
  196.       return FALSE;
    # ~2 v: ~4 D' m/ }
  197.     }
    8 ^; W% j0 S2 l' B8 C) J
  198.   }% v9 ?( l/ u5 \. r6 ~: S
  199.   fp=fopen(FileName,"wb");: K" b8 z/ C- f
  200.   if(fp)3 h5 k+ |; Q. ?) O4 M
  201.   {$ `. h2 Z0 g" x8 p' e3 }
  202.     fclose(fp);2 ?' y4 U4 o" ^* |
  203.   }' |9 X* u( M5 J- m8 B8 ?' ]: ~
  204.   return TRUE;+ B( Y( O& \' S( c8 q
  205. }
    2 h6 R" ^, I; ]2 w, [7 ~
  206. 2 z& k4 }* d$ P  T7 B' k
  207. BOOL CRevAppApp::UpdateLocalVersion(void)
    % F. f* A2 c0 `; a. B
  208. {, |3 |) Z$ v0 X/ W9 w
  209.   char filename[MAX_PATH];
    3 @$ ]/ p$ v! X( J$ S
  210.   LPUPDATEFILE file,olds;
    & ^7 s3 ^2 a5 i3 Y
  211.   std::map<int,CString>::iterator i;
    ' [: w. u1 H! y! u4 D, H, @! ?
  212.   std::map<CString,LPUPDATEFILE>::iterator p;# z! g* K& k0 m8 G  K) o; Q
  213.   std::list<CString>::iterator l;
    4 m5 \9 [  U2 Q" V5 R, S

  214. . P& M2 G  `+ B, ]/ B
  215.   if(bFirstUpdate)
    , F0 R* z5 O  {9 u- O, z
  216.   {6 p; J% e9 y5 p0 [+ _
  217.     dwCurrFile=0;
    4 D9 |* w2 A5 c9 |( _
  218.     bFirstUpdate=FALSE;
    - T( J% s. n1 e
  219.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    ( b- o3 h$ s) E  T) _
  220.     {
    : R3 g* l0 u2 Q. K) N  @
  221.       dwTotalFiles=UpdateLocal.size();% n) j$ z7 y% c0 n2 Z  R0 g
  222.       dwDownLoaded=0;5 b' f  w8 d2 J. V/ K% J4 Y
  223.       bSilentStep=FALSE;
    & n$ n% j) x% J$ \) y8 x
  224.       bCompressed=TRUE;
    " O. @' @+ b" f; d1 O1 H4 i
  225.       strExtLocal.Empty();
    7 f% G9 Y. b" Q, @
  226.       strFullName=(*i).second;
    9 Q% X* N( e" P
  227.       dwProgramState=AP_CONNECT;! I  p; _# N$ m8 ~
  228.       return TRUE;: N' H- q. D2 X: ?; `
  229.     }2 a" A9 Q+ p% C; S( i, m
  230.   }
    ! t/ W9 Z1 Z' P* H1 k# ~+ B
  231.   else if(bRestartUpdater==FALSE)9 _) v! Q) ?9 q* K; A' ]8 [. h
  232.   {, U0 g( F! l' h- M' A
  233.     if((p=UpdateFile2.find(strFullName))!=UpdateFile2.end())
    ' T& N3 p7 |- M+ ?
  234.     {
    ; |4 k, N- i6 N: @
  235.       file=(*p).second;
    # f" i8 ^4 r" B4 f  `
  236.       if((p=UpdateFile1.find(strFullName))!=UpdateFile1.end()). R( u/ K+ l+ C' r
  237.       {/ r/ i7 }4 r& G
  238.         olds=(*p).second;& i7 ~" e. N$ ^/ V) r) R/ t
  239.         olds->vers=file->vers;( c' s- o6 j/ O" ^
  240.       }) `9 w* Y3 a0 z/ G4 x* D" ~
  241.       else8 j% y9 \/ K& ~- \: m  F, \
  242.       {
    ; c$ x  @# S  T; n8 V5 f7 N5 s+ i
  243.         olds=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));: z* \$ I3 I) W' Q! e7 H) K+ J) ?
  244.         memcpy(olds,file,sizeof(UPDATEFILE));
    / {. L8 ^* B0 `2 D. ?" G! j
  245.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(olds->full,olds));% y3 N9 m0 E6 V! x/ f& R& u: c
  246.       }
    & z3 l7 t) J0 b# _/ m2 h
  247.       if(GetFileAttributes(".\\update.tmp")==-1) Fprintf(".\\update.tmp","Bloodyf\n");6 }1 p' M/ a" g6 n- A
  248.       sprintf(filename,"(%s)",file->file);
    , u% ]% |/ v! R9 K% W& t
  249.       Fprintf(".\\update.tmp","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    " n% O' h, P- Q3 N
  250.       if(!stricmp(file->file,"csupdate.exe")) { bRestartUpdater=TRUE; return FALSE; }) v3 W3 U; L/ K1 W) W$ K
  251.     }) ]- l$ S6 y* G! f* m6 q  v
  252.     dwCurrFile++;
    # w7 ^3 d  d* @
  253.     if((i=UpdateLocal.find(dwCurrFile))!=UpdateLocal.end())
    + |# t2 _( W, T
  254.     {
      T4 l3 f7 J* @: X  o
  255.       bSilentStep=FALSE;% m" I+ z8 a: o
  256.       bCompressed=TRUE;
    # D# b' r/ R: r' Q2 h& x4 p2 R$ J
  257.       strExtLocal.Empty();0 a. R& Y5 a; W2 [( F/ v8 E
  258.       strFullName=(*i).second;
    6 c) a  [; V0 G  l
  259.       dwProgramState=AP_CONNECT;& R, S8 Y) P% H) I2 D, z" {7 A
  260.       return TRUE;
    2 H+ n3 R; o; \+ I' w2 x+ P( j
  261.     }. v! G3 v1 u/ w$ E- V- ]
  262.     if(!bRestartUpdater)  |  |5 Q+ `- [9 N
  263.     {9 A/ C$ G' w# e2 T
  264.       int iCurrSize,iFileSize;2 p* x7 v  H6 k( ]3 D& B2 W4 _
  265.       iCurrSize=0;! Z: @& f; W3 z
  266.       iFileSize=UpdateList2.size();
    9 z6 q' t5 ]' `0 e# ]) i) I  f
  267.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝戈い.....");) O9 u# }2 J" B2 w8 j+ X' O
  268.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新资料列表回存中.....");# D; w+ Q* v% X1 i  V2 V1 B, C
  269.                         else                                                      dlg->m_ListText.AddString("saving updated files.....");
    ( e; t8 B5 ~7 Z( ]' Z
  270.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    . K; ]. P: E9 r
  271.       Fclearf(".\\update.dat");
    ( N  m2 D2 u1 s9 @% w5 a
  272.       Fprintf(".\\update.dat","Bloodyf\n");5 V0 i- K3 b7 v4 u; ~, P
  273.       for(l=UpdateList2.begin();l!=UpdateList2.end();l++)
    : G; U: w* t" A) X
  274.       {9 t, o# H6 ~) J4 J( _( N& N
  275.         if((p=UpdateFile1.find((*l)))!=UpdateFile1.end())7 M% I) o" M/ v6 q% B) ]& M5 |
  276.         {/ L7 F! T+ A8 ], Z) S* E( T
  277.           file=(*p).second;
    / D* N+ B3 F5 c  V+ `: G
  278.           sprintf(filename,"(%s)",file->file);+ ]5 Z1 |( F/ g1 \1 C
  279.           Fprintf(".\\update.dat","%4.3f %-48s %-24s\n",file->vers,file->path,filename);
    . J. i9 x# t3 f# x1 x9 t# X* O
  280.           iCurrSize++;
    9 x+ k8 o' V/ Z
  281.           dlg->m_Process2.SetPos(100*iCurrSize/(iFileSize<=0?1:iFileSize));
    ; T/ \8 m' v/ r& E( m
  282.         }' L+ y1 K4 l! p7 O! W/ v
  283.       }
    ! y) |0 y( e5 g0 ^
  284.       unlink(".\\update.txt");
    9 X( Y, u, G, p( a9 Y9 |3 _% c) O. _. W
  285.       unlink(".\\update.tmp");
    4 o* l8 c. |. T; i! W9 i1 I) B, x
  286.       Fclearf(".\\checkversion.dat");
    ' `% e3 r% m! ~4 z
  287.       Fprintf(".\\checkversion.dat","%4.3f",fCheckVersion);  @# {7 f/ W. I/ S& u5 I
  288.       if(UpdateLocal.size())
    5 L5 w' W) c; E* M3 \; v, z2 j
  289.       {
    9 X# H5 l" c5 d1 J7 {9 d( \
  290.         UpdateLocal.clear();. i6 C7 Y; H& m) s8 j$ l: z% z4 r
  291.       }
    9 j3 ^. a- k6 V
  292.       if(UpdateFile3.size())
    1 A# ]( j. l0 r9 a
  293.       {
    6 i* k% e! {; n3 y2 r* g, V
  294.         for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)
    ' s4 N+ A- j7 M0 s  ~+ Q: @6 |
  295.         {
    ) s, }! s- c4 L. D1 b" q
  296.           file=(*p).second;
    # X/ N! B9 |" a3 ?6 L" a% G# {
  297.           free(file);' p5 g+ [7 I( l2 E! @0 G
  298.         }
    3 s0 P+ E: W$ `$ j
  299.         UpdateFile3.clear();
    ' y. H  O) }# y2 h" Y# i
  300.         UpdateList3.clear();
    0 ]( d& J' q  t7 k$ O# H
  301.       }6 x1 u9 r2 D# w- t
  302.       if(UpdateFile2.size())
    1 r- j' I- |6 t, t8 ^8 T; i% y% ?1 t# A
  303.       {
    ' J/ V5 k3 f, @
  304.         for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    % z* m2 |* ?4 N- K- k# r
  305.         {
    0 }- d7 E) Q9 N( V/ p& f
  306.           file=(*p).second;
    . Y7 @  e1 E6 o7 N% f
  307.           free(file);
    ; U7 t3 x7 q, `2 D
  308.         }! v, i; M# p, D$ W! I
  309.         UpdateFile2.clear();
    & @" W1 n/ }4 f( ]( \
  310.         UpdateList2.clear();% d% h5 S/ g5 K* U! k
  311.       }7 D# H9 @1 n6 K: a; _6 f
  312.       if(UpdateFile1.size())
    4 @# e  I/ Q) u, ^
  313.       {" f' G! j+ l& A4 B+ N- o# _
  314.         for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)5 O+ }- ]  n+ B
  315.         {: W# f3 c) U& `4 c& h
  316.           file=(*p).second;
    % [: D' \! s/ }% N; d
  317.           free(file);
    $ ]  S2 a3 w$ l4 U( {; K
  318.         }! B3 r2 f0 l- A0 N
  319.         UpdateFile1.clear();( {  [; x1 R0 t0 ]) i* I& g0 F# S: f
  320.         UpdateList1.clear();! G, G( r$ z- f
  321.       }
    ; O; |# p) p# S. Z/ q+ v' v  d
  322.       dlg->m_Process1.SetPos(100*dwDownLoaded/(dwTotalFiles<=0?1:dwTotalFiles));
    . d* S* @/ e# Y5 d' ^
  323.     }# N% D; T% Y- \4 l% {
  324.   }2 G& R! w; F* m6 o* c
  325.   return FALSE;
    / T; P! B$ b- g  W
  326. }3 U7 A  s. @" w' O

  327. % h: s* E! I/ V- E( y; K+ r
  328. void CRevAppApp::ClearAll(void)7 G" P) C  M5 O0 {8 V( e
  329. {
    ; t& B0 R/ ]. Q* N
  330.   LPUPDATEFILE file;; \- J2 \7 Q: c* S0 x6 v
  331.   std::map<CString,LPUPDATEFILE>::iterator p;
    8 R! {, f7 P. ^' v  y3 C- o; l

  332. 8 E1 s- c" X* }, _& |
  333.   if(UpdateLocal.size())
    4 K5 [6 B. {9 z4 F
  334.   {! h( @% D5 F' ~% T$ G& R7 P
  335.     UpdateLocal.clear();, I8 @; [% |* n% M0 t% l8 J
  336.   }( n% \! G5 P9 h
  337.   if(UpdateFile3.size()); M4 H9 z3 q9 m8 X6 W! d
  338.   {0 u! p0 r- k" _. j9 ~, C- Z
  339.     for(p=UpdateFile3.begin();p!=UpdateFile3.end();p++)
    : M. h8 V8 N" a( Y) N
  340.     {
    0 q+ ~8 R8 l1 T1 \
  341.       file=(*p).second;; w( [6 Q" G* S
  342.       free(file);
    ) J) ^4 G. u3 O( W
  343.     }
    + x, }7 l. N; \
  344.     UpdateFile3.clear();! r% A4 a0 h; Z; w' h' n. F" Y
  345.     UpdateList3.clear();4 g( D, S/ c6 z# A
  346.   }
    / |6 T) e7 ?8 t( ]% g* t. R) J
  347.   if(UpdateFile2.size())# k0 r+ B5 a5 y5 V8 e
  348.   {* I9 I3 }, \" E+ w, H7 D
  349.     for(p=UpdateFile2.begin();p!=UpdateFile2.end();p++)
    1 i5 [, j3 G3 {4 M0 J
  350.     {4 K8 c7 p; ~  ~8 v
  351.       file=(*p).second;0 c3 S+ A3 W) y" q. {0 g
  352.       free(file);: O* o/ ^; A* a4 Q# J) |% _
  353.     }
    5 {$ I3 {+ A4 t6 W3 E
  354.     UpdateFile2.clear();9 z6 r- o8 `( b- l: R
  355.     UpdateList2.clear();
    8 h- S  l2 H9 W0 v2 v0 n
  356.   }& X: N) ?* U5 u' M9 z) A+ f
  357.   if(UpdateFile1.size())$ v% X- ]9 g7 c' b$ s& O
  358.   {* {' J/ D$ h* Y" J  ?* u
  359.     for(p=UpdateFile1.begin();p!=UpdateFile1.end();p++)" j" P( L$ q, ^0 F& T' l
  360.     {9 {/ k! d6 ~. g8 J4 p% w# P8 ~5 K
  361.       file=(*p).second;2 Q/ Z* Y2 w" I* d
  362.       free(file);8 K0 g: c6 @, J# n
  363.     }% |) O/ ?7 U4 H/ e; Z5 H
  364.     UpdateFile1.clear();5 M6 A, v' O. Z1 Z9 Y9 ^
  365.     UpdateList1.clear();7 j2 }* W1 S/ r+ S" O% A" F
  366.   }4 a0 t* @; A$ Q7 x# n) V5 _
  367. }  
    2 C8 ^" M8 {* s1 N
  368.   
    ' d2 A' D6 I; J4 l# _$ s5 f. v6 c
  369. BOOL CRevAppApp::CheckLocalVersion(void); X' k3 D7 E+ y1 T# C' E
  370. {
    + z7 N% E" f: \  k9 w+ H; Y
  371.   int c;
    * d  p4 _9 B7 r6 u5 H1 |, A
  372.   LPUPDATEFILE file1,file2;3 Q3 ]5 H& `6 g
  373.   std::map<CString,LPUPDATEFILE>::iterator i,p;, D5 d, Q: `8 b% B  Y$ B: s( x
  374.   std::list<CString>::iterator l;! Y/ C2 }8 D. m* m8 Y

  375.   \, T( ?; {# b8 w5 I/ i
  376.   UpdateLocal.clear();
    : M" Q* n; q/ Y- F# P0 Z! m
  377.   LoadLogFile(".\\update.dat",UpdateList1,UpdateFile1);
    : Q- @+ E: `7 v2 n! H
  378.   LoadLogFile(".\\DownLoad\\update.txt",UpdateList2,UpdateFile2);) \" [8 `4 ^1 M4 u7 I0 k
  379.   LoadLogFile(".\\update.tmp",UpdateList3,UpdateFile3);
    + E& ]: a  _* e; |) a' K
  380. //  if(!UpdateList1.size()) MessageBox(GetActiveWindow(),"Cannot read update.dat file !","Error",MB_OK|MB_ICONERROR);3 n' C! o( b) Q+ R# R0 w3 P- `1 j0 }
  381.   if(UpdateFile3.size())
    % b2 {! X8 z( l: G
  382.   {
    4 e/ D( `6 h7 p1 q( _
  383.     for(i=UpdateFile3.begin();i!=UpdateFile3.end();i++)
    ' E% r+ V7 u7 x3 }* s/ T
  384.     {( G0 b2 ?9 Q( E2 L6 \+ w7 z
  385.       file2=(LPUPDATEFILE)(*i).second;
    6 P/ U; T( }9 Q* e
  386.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end()). E: D% }! N2 Z, W4 B3 E$ C$ D
  387.       {. W5 R* r& _3 W, x! k. \
  388.         file1=(LPUPDATEFILE)(*p).second;, `. M- d  C: o* j1 h
  389.         file1->vers=file2->vers;
    4 F2 [' H) E& x" S# I3 o
  390.       }; E" i/ Y# m. k& @; g) x0 M
  391.       else
    - J+ W# j( m0 O( x: A' d9 M
  392.       {
    ' t$ Y5 i* P3 [
  393.         file1=(LPUPDATEFILE)malloc(sizeof(UPDATEFILE));9 Q3 x+ S. T8 C6 |5 D' Z( n( H! ?
  394.         memcpy(file1,file2,sizeof(UPDATEFILE));
      c, H. W& r; n4 w/ n8 k! h* X7 d
  395.         UpdateFile1.insert(std::map<CString,LPUPDATEFILE>::value_type(file1->full,file1));
    7 |- R  J! q- _3 t, I1 T
  396.       }
    8 c: `9 w+ H1 ^# o
  397.     }; z$ X# E, ?5 e8 J* J  U2 e; C
  398.   }- [# U% [* h$ Y$ {4 I- L2 h
  399.   for(c=0,l=UpdateList2.begin();l!=UpdateList2.end();l++)
    ) n6 r8 l4 }, V4 V2 Z: |0 [, l3 U
  400.   {
    3 H8 w$ A% B: H, f" D
  401.     if((i=UpdateFile2.find(*l))!=UpdateFile2.end())
    5 X9 K. _* g. l8 s! y* w- |- t
  402.     {" f; [9 D. l& T
  403.       file2=(LPUPDATEFILE)(*i).second;
    8 T8 d7 X: J$ l& M4 m
  404.       if((p=UpdateFile1.find(file2->full))!=UpdateFile1.end())
    5 n) a; O+ G2 d" g0 k1 o
  405.       {- x6 e& Z) }1 D  N
  406.         file1=(LPUPDATEFILE)(*p).second;9 I) S. R+ `8 l$ |! C7 h" [, {' R
  407.         if(file1->vers!=file2->vers)& D! N! G' K+ e
  408.         {
    + Y5 {+ r  I1 b+ E/ Y$ M; Q
  409.           UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));
    6 a; a. w$ |* f! K  R. {
  410.           c++;
    6 `2 V/ o  r) b8 t8 y0 L1 n/ b
  411.         }6 \" p9 f5 e4 @$ H! Z
  412.       }
    ' r0 `9 S& n; o2 j
  413.       else
    6 l# p& w6 K% T( C0 ], h8 R$ a
  414.       {; k9 n# o. N6 \+ ?  C- ]+ E  W
  415.         UpdateLocal.insert(std::map<int,CString>::value_type(c,file2->full));
    ; K0 s  {9 S( v% M
  416.         c++;
    * P, x* b' ^0 ^
  417.       }. o5 G, t9 p( m
  418.     }8 e7 N; d% K! @! ^# F
  419.   }
    ) {& }7 p* x: P  _) U) t
  420.   unlink(".\\DownLoad\\update.txt");
    ! _: f1 F6 u) O% C  I. K
  421.   if(UpdateLocal.size()) return TRUE;
    ) c0 Z' c/ V8 B" q: _" D/ M
  422.   else                   return FALSE;& ?7 s5 |; p% ^
  423. }
    6 H% j- W- t" w: o

  424. . \$ M* L0 u1 W0 G" \) V( _; r
  425. #define DEFAULT_PATCH_URL "http://elysium.waei.com.cn:8080/~elysium/Alpha/"
    ; h7 v. C' D( N2 R9 r
  426. #define DEFAULT_REG_URL   "www.wgs.com.cn"
    ; f% J/ o. d# J5 }4 |9 |# w

  427. ) Q% ]' N' b, R1 c! n

  428. ) A& I7 X: ~1 O: B: d0 O
  429. , K0 v8 E$ M1 O/ C' k2 ^/ X  O/ U
  430. BOOL CRevAppApp::ReadCfgFile(CString sCfgFile), U4 \0 V5 D. T. g, H
  431. {, N: W2 f7 r2 D# l* H
  432.   DWORD dwType=AFX_INET_SERVICE_HTTP;
    ) R, i  i" [( p, F; L
  433.   if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1)# g. q2 s# B3 r+ {/ q
  434.   {
    / I( t) x/ j' b* m8 k
  435.     char szLanguage[50];2 W- I* |' y+ o1 W' Z
  436.     GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");
    & L' U0 c5 x- u
  437.     if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
    0 Y) @: |" P9 l9 v; {* m
  438.     else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;$ O# S( ]: G! ^* \/ u+ G3 Z
  439.     else                                   m_iLanguage=ENGLISH;2 T* C, `/ L5 ]. F4 k* H
  440.     char szRegister[100];
    5 k) g+ ^' K5 Z  a. {
  441.     GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");) v4 q7 O! g8 r# Y3 j
  442.     strRegsName=szRegister;4 k5 @  f' B; N6 r7 b
  443.     char szPatchURL[100];
    : G, [% [1 S- A9 E
  444.     GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");9 ]. x. p* B; s# ?: q* B& M
  445.     AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);
    : W8 J1 Z9 w8 \, s' X
  446.   }
    " n3 y7 c) D+ `! U8 a) t- V. T
  447.   else
    - K7 k1 R$ R# G$ B, d* e0 Y: y% ~; q
  448.   {& J  P- B# ?6 |, ?" [" f0 O- D
  449.     AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);* ^' {: b4 y/ g7 i3 b- d( g
  450.     strRegsName=DEFAULT_REG_URL;
    3 ^& N: L, j5 q3 O/ p3 g! u1 M
  451.   }
    % l+ P" S+ k. D9 _
  452.   if(GetFileAttributes("hosts.ini")!=-1)( }- s% G: r8 v6 N6 g. S
  453.   {2 q  |, ]3 _+ i* u; y9 F- h' m
  454.     char szIP[50];! C# O2 N0 u: W
  455.     char szDIR[300];4 ^; x0 s) v3 `  q! W5 D
  456.     if(0!=GetPrivateProfileString("update","ip","",szIP,16,".\\Hosts.ini"))
    ; ^0 m( ^1 o' Z6 E
  457.     {
    ( g7 _. E. y, \
  458.       wPort=GetPrivateProfileInt("update","port",0,".\\hosts.ini");- V0 j- v7 {: W. |% A: r" Q
  459.       GetPrivateProfileString("update","dir","",szDIR,300,".\\Hosts.ini");
    * f- R9 V. B  {: A
  460.       strHostName=szIP;
    ' O/ q* X. Y$ e. d0 z9 S$ w7 I
  461.       strHostPath.Format("/%s",szDIR);6 q- B" ?; F3 H" s& _$ t$ D
  462.     }' \1 b1 t: f7 n4 \- C9 y' P  }/ A
  463.     else
    & z5 n3 K% i4 A+ Z- Y2 k8 P
  464.     {
    . ~0 G9 U9 ^; W, p) m
  465.       if(GetFileAttributes((LPCTSTR)sCfgFile)!=-1); Z7 E5 T, C( U
  466.       {
    2 u* a& [/ X" E- z. c
  467.         char szLanguage[50];- D0 x: i/ V+ B* g& f& z" M1 Y
  468.         GetPrivateProfileString("Interface","Language","",szLanguage,50,".\\Config.ini");1 M) L: s) w2 ]7 J4 j; c3 i: b
  469.         if(!strnicmp("BIG",szLanguage,3))      m_iLanguage=TRADITIONAL_CHINESE;
    / P) X, @' K4 G& e+ u) X2 o
  470.         else if(!strnicmp("GBK",szLanguage,3)) m_iLanguage=SIMPLIFY_CHINESE;" F& q! v- K4 F" \/ J. X
  471.         else                                   m_iLanguage=ENGLISH;
    9 e+ }: G; l! u" D
  472.         char szRegister[100];4 c, k. v9 U% b3 d
  473.         GetPrivateProfileString("Function","RegisterURL","",szRegister,100,".\\Config.ini");
    . W* R2 @, u# G
  474.         strRegsName=szRegister;
    0 m- B) \3 s. @0 E% H7 Q3 x) W: C- b
  475.         char szPatchURL[100];
    ( N0 l6 V! U; V& U
  476.         GetPrivateProfileString("Function","PatchURL","",szPatchURL,100,".\\Config.ini");
    ! n7 R$ T+ r  v5 g
  477.         AfxParseURL(szPatchURL,dwType,strHostName,strHostPath,wPort);
    ; V" ~8 _2 J1 q5 Z  a
  478.       }
    ! p9 P3 O8 ~1 k. h3 @
  479.       else. f9 s2 v# m) _2 t
  480.       {) R4 p- n' j# e" f2 u. r8 D
  481.         AfxParseURL(DEFAULT_PATCH_URL,dwType,strHostName,strHostPath,wPort);0 g, ?! {' j& E& J5 q
  482.         strRegsName=DEFAULT_REG_URL;6 K( ^' E  B, a1 W/ N
  483.       }; Y2 y  w5 \" X. l6 i/ \
  484.     }
    5 d2 L3 c9 |* x4 e+ Z( s% m
  485.   }, H9 W3 E  N  [$ o8 ]. v
  486.   return true;
    + C# v0 T, [! G+ |. d+ X
  487. }" N- J; J3 {! G0 @7 S8 @* Z3 v

  488. ; K& g3 o: K! |6 ]$ w, j  T- i
  489. #include ".\ZLib\unzip.h"
    8 O9 i  `9 A- O+ F- q
  490. extern "C" extern int do_extract(unzFile uf,int opt_extract_without_path,int opt_overwrite,char *extra_path,ZIPCALLBACK zip_callback);
    5 C  O8 [* L4 |+ ~$ e
  491. /////////////////////////////////////////////////////////////////////////////0 k7 w8 S! M4 w( Q! ?+ N$ q
  492. // CRevAppApp initialization
    ! R5 b& q) A7 a! W9 K: N
  493. 8 ^& J" C2 z, H& v6 m6 ^
  494. BOOL CRevAppApp::InitInstance()
    ) N) ?3 p3 d4 A2 n7 m
  495. {
    , C. z, f! b: v4 t1 l
  496.   TCHAR szPath[MAX_PATH],szPathSource[MAX_PATH],szPathTarget[MAX_PATH];4 q3 k' e& r! W1 a8 W- x8 n$ {3 f$ j: [

  497. ) r7 T3 Y9 B6 e( r/ }7 R' P
  498.   GetModuleFileName(NULL,szPathSource,MAX_PATH);$ R* w8 z9 `9 c1 |6 P; I" o' W% _: |
  499.   if(GetCurrentDirectory(MAX_PATH,szPath))+ B0 c  ], \+ [2 K( \" c
  500.   {
    : B) j2 d- m  T8 f2 ?! s$ ^
  501.     if(szPath[strlen(szPath)-1]!='\\') strcat(szPath,"\");
    : l2 q( i$ J& Y6 C3 Q, w
  502.     GetPathFromFullPath(szPathTarget,szPathSource);! ^; ?" X2 g# R5 _
  503.     if(strnicmp(szPath,szPathSource,strlen(szPathTarget))): ]. g9 d0 e7 B0 ]0 C" s1 L
  504.     {
    2 w3 p: c9 L& n- a0 k& S
  505.       strcpy(szPath,szPathTarget);6 z" x1 u5 s0 j. X5 a- D
  506.       SetCurrentDirectory(szPath);$ v; I) s0 t; V" i; d
  507.     }) h5 u3 x7 ^" W& C6 I5 r+ T
  508.   }
    9 D3 z7 U2 L5 @8 e' n2 i
  509. #ifdef _DEBUG
    ( j& Z- n, U; c' E( N: ?
  510.   if(strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))+ E& Z% y* ?( L) `: h. Z
  511. #else
    # T. j4 j- P, o
  512.   if(!strnicmp(&szPathSource[strlen(szPath)],"CSUpdate.exe",12))1 n  W2 _% ^# X/ J0 H# @( O' V
  513. #endif
    6 Y! F5 ^. @2 u" u% e3 n' C
  514.   {
    8 [7 k* q1 X" R$ Q1 ^+ C! M: Q
  515.     char tempFileName[MAX_PATH];, ^' L* E( g9 U" E! d3 J  `' ~
  516.     strcpy(tempFileName,szPathSource);
    # }0 ]# |6 \5 P, R! R* k0 H+ L
  517.     tempFileName[strlen(szPathSource)-12]=0;  Q) w4 F4 S' I" a. _( q
  518.     strcat(tempFileName,"\\$CSUpdate.exe");/ e8 I. v& ~5 R5 F& Y" X; h9 I
  519.     ForceCopyFile(szPathSource,tempFileName,FALSE);
    / Z1 f* C6 \" |: P
  520.     ShellExecute(NULL,"open",tempFileName,NULL,NULL,SW_SHOW);
    ' a# x" T, \: [1 f3 D
  521.     return TRUE;/ Y2 p: a  \1 K
  522.   }" l& \; Y- O; L, h0 L2 R
  523.   // Nuke 0118: Delete run.exe
    4 E( _2 m8 ~/ k, L
  524.   if(GetFileAttributes("Run.exe" )!=-1) DeleteFile("Run.exe" );4 {9 z! _0 X+ ^- G: ^& n9 ^
  525.   if(GetFileAttributes("$Run.exe")!=-1) DeleteFile("$Run.exe");- ~: I" w0 a+ [* P. L3 d2 _
  526.   if(!ReadCfgFile("Config.ini"))
    ! F. e/ }9 |2 J
  527.   {# F+ N0 N! E1 M- \3 I. i
  528.     MessageBox(GetActiveWindow(),"Cannot read Config.ini file !","Error",MB_OK|MB_ICONERROR);2 O. V2 M% L! V2 H/ S' A
  529.     return TRUE;
    . X! T! R3 m8 f2 i3 U
  530.   }
    2 ^" K& Q) E4 E# U2 o
  531.   HANDLE mutex;
    , y2 l) I, Q4 H
  532.   if(mutex=CreateMutex(NULL,FALSE,"Elysium"))
    3 I" f! Q) P/ \# y! T
  533.   {4 k6 d- h6 w- h/ {/ {" x4 z% p4 t
  534.     if(GetLastError()==ERROR_ALREADY_EXISTS)+ ?% s% y& H, Z/ X# c* e
  535.     {
    7 x# ~. R2 z: C% |8 y4 x. X4 i
  536.       CloseHandle(mutex);
    % U3 J7 o% z3 ~2 S5 l
  537.       MessageBox(GetActiveWindow(),"Please shut down your Elysium !","WARNING",MB_OK|MB_ICONERROR);
    # i* H, L5 w5 n2 j
  538.       return TRUE;: P5 J: f2 ~7 B
  539.     }
      `" @' f) f1 G, I: K' _$ m
  540.   }  
    " `, o' e4 C4 A% n1 e/ J" O8 ?
  541.   CloseHandle(mutex);
    * o* v& d4 S) a" r. Y9 t: Y! R) n

  542. 1 f' n! R. [, Q# s" D4 k! ?/ s
  543.   if(!strnicmp((LPCTSTR)strHostName,"http://",7)) strHostName.Delete(0,7);5 g( t/ S, P+ `$ y% p

  544. & v( @& g& D  C% G9 y/ K
  545.         AfxEnableControlContainer();
    - ?; y) j5 N) R5 A. q$ ^0 }+ w

  546. 4 c& \+ f7 O5 _! g5 S  E1 {
  547.   bCanUpdate=FALSE;
    9 y3 C7 G/ b! j1 ~
  548.   dwStartUpSteps=1;
    % d) {! s- s6 `9 f! x# f9 a. z5 q
  549.   dwProgramState=AP_NOTHING;
    ! y( X& t& h* I; _7 u  D9 G# G

  550. 0 P9 U; q* T4 L2 u0 O. w: d/ j/ ~
  551.   InstallRevUI(m_hInstance,&g_UIDefine,&g_ResIndex);
    + `, N2 k+ N# E6 [' J
  552. & D& l  K9 ~) T% `
  553.         // Standard initialization9 Q8 L# I. ~* z# g. G
  554.         // If you are not using these features and wish to reduce the size+ a9 [8 a8 E, ~  y5 v
  555.         //  of your final executable, you should remove from the following
    ; v  P! M+ M! W  R4 C7 G
  556.         //  the specific initialization routines you do not need., K& \4 R6 G' v# z
  557. 3 a0 j  i$ h% I/ B! x0 R$ ~; G
  558. #ifdef _AFXDLL; {- R1 u! V4 f' {
  559.         Enable3dControls();                        // Call this when using MFC in a shared DLL
    ; D( W' B: Y% P# _& [" G+ m
  560. #else' {' j% e+ f( s& U% l7 |% L- M
  561.         Enable3dControlsStatic();        // Call this when linking to MFC statically! c& K5 j' n9 Q9 F
  562. #endif( z7 O( m" b$ B% B8 e: g

  563. 2 }; [( [3 @% F! s; [; R: x
  564.   dlg=new CRevAppDlg;
    ( g' O, A$ r# L, l2 Y
  565.   dlg->Create(IDD_REVAPP_DIALOG);
    ( F  ]: S% c: H4 T; w4 H
  566.   dlg->ShowWindow(SW_SHOWNORMAL);
    . e( A2 z! ~) J7 r) U: P: A
  567.   m_pMainWnd=dlg;
    + `2 |' i( ?) h& M

  568. # ]! c5 B! U1 `1 p" V& [4 Q) a
  569.   SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,0,0);# O$ @! C) y8 J# t' x2 Z5 z

  570. $ e% p3 _' e2 }3 q
  571. //  GdiplusStartupInput gdiplusStartupInput;
    4 Q5 [9 |2 O2 C/ q; H! L
  572. //  ULONG_PTR gdiplusToken;
    & ~) ]: i/ V% x. @; r7 k4 K3 [
  573. //  GdiplusStartup(&gdiplusToken,&gdiplusStartupInput,NULL);
    # O5 A2 x( F4 E# \  Q0 H2 Z6 a
  574. " b% P7 m$ `- ^* v  `
  575. //        CRevAppDlg dlg;* ~) ?% j( A8 c' t0 ~0 F
  576. //        int nResponse = dlg.DoModal();
    ' V+ }( w: r' S/ {
  577. //        if (nResponse == IDOK)
    . L% s: \% f  [# _
  578. //        {6 v" z( |* A. u. X1 {
  579. //                // TODO: Place code here to handle when the dialog is# f; O, T- D$ a6 u4 ?+ S! G
  580. //                //  dismissed with OK
    9 n" F+ d: U& b. R
  581. //        }7 _! i, ]+ D) E& ^# M' ~: Y
  582. //        else if (nResponse == IDCANCEL)9 L$ O3 I( h: e
  583. //        {
    . h5 ~& F, S, W
  584. //                // TODO: Place code here to handle when the dialog is& e- ?, d) l( d# k( D, W; \3 M3 \
  585. //                //  dismissed with Cancel
    1 C9 w4 O1 |% x- |/ X; ~
  586. //        }
    & w1 n; v% F: v$ `3 O+ D8 t% F! H! \2 p
  587. & D3 b. F) N% K& s  A1 [
  588.         // Since the dialog has been closed, return FALSE so that we exit the
    , i, z$ j; g( `1 P% L% F
  589.         //  application, rather than start the application's message pump.
    . P" Z; U1 e! ?' A" S# n8 ]9 E
  590.         return TRUE;
    2 f4 F, C) V7 `" R0 C
  591. }
    2 Q* j5 K$ j# m$ G3 C3 P1 t' _- S8 R+ i

  592. 4 p" S9 [, m% m
  593. char *CRevAppApp::strtok3(char *pSource,char *token)% U! m. x  m: Q3 k1 V
  594. {
    0 b0 q) \* p$ C/ w+ T, q0 T' }
  595.   int i;( O7 g1 E3 Q3 c+ {" K
  596.   char *szRet;; f9 d6 d: ~* d! V4 _' O" r; k0 }
  597. 2 |8 s' E( S4 A# f% r! l3 G8 K7 q
  598.   if(pSource) { itoken=0; sztoken=pSource; }" n, l6 n) @9 N
  599.   if(sztoken)
    3 I1 b( y1 c7 L; g' Z2 Q: g$ j
  600.   {4 |- n7 L/ H% N$ f5 t. N; F0 W1 p
  601.     szRet=&sztoken[itoken];
    4 p# v% r. x+ y4 x8 _/ Z, v
  602.     while(sztoken[itoken])
    ( N+ F, U6 i: m" d/ N
  603.     {4 H: w5 A2 @( B7 g- G
  604.       for(i=0;i<(int)strlen(token);i++)
    1 C7 ?: p# D. M. g! p
  605.       {
    ) U, V3 T$ V9 y# h4 i
  606.         if(sztoken[itoken]==token[i]&&sztoken[itoken+1]==token[i+1])
      u# X1 I. c5 E  z! ]. c) O0 p" D
  607.         {
    ) ?. H+ h8 Q0 F
  608.           sztoken[itoken++]=0;6 G, m, T+ b' \
  609.           sztoken[itoken++]=0;
    " `7 F- u0 p- z1 y
  610.           return szRet;8 p* h! r6 n4 c7 p/ m. F( K
  611.         }
    # o% E5 \4 S! E2 H0 t: d4 Z
  612.       }
    % f8 F8 w9 u4 J2 k! W: w) O
  613.       itoken++;4 t- N  D+ v* W6 F7 x; p1 j1 D
  614.     }
    6 w  h# j. _! J3 n6 J& K' U' {
  615.   }
    % }! {9 u& L% K
  616.   return NULL;
    " f- r; w5 B$ S( o3 C1 R) v% v
  617. }3 G6 b) v- F# e* T1 G; v$ h

  618. 0 D1 K6 N, d  _6 H, z
  619. void ProcessProc(long Total,long Current). J8 g& v8 L7 z
  620. {
    4 X% F  m! B( Q5 j+ A& c
  621.         MSG msg;
    # q9 F0 E* k! `6 H9 Z
  622.         if(!IsWindow(theApp.dlg->m_hWnd)) exit(1);
    . Q. q3 l, ]  F0 W
  623.   theApp.dlg->m_Process2.SetPos(100*Current/(Total?Total:1));( c$ t: z9 r  i9 i3 b$ ^
  624.         if(PeekMessage(&msg,NULL,0,0,PM_NOREMOVE))3 E$ k, |! ^' `8 U+ W+ R
  625.         {
    9 U) L% S$ c0 k4 h
  626.                 if(!GetMessage(&msg,NULL,0,0))
    8 K2 {/ G+ N8 Q# ^! F7 c" K/ |
  627.                 {) Q' @3 H/ X* \2 E. {7 ^/ _
  628.                         return;
      S- y: J/ T* [( C9 x4 U6 D
  629.                 }
    ' y; f$ h2 j+ x2 p! L, g
  630.                 TranslateMessage(&msg);2 q3 Q  i, @6 G
  631.                 DispatchMessage(&msg);
    $ E9 y& w6 P8 O( [. _
  632.         }       
    8 `4 G0 s: b3 P: @2 e& g0 z
  633. }
    . m  I' Q  b% i( q
  634. + _* h% {- P+ }! ~9 z- L2 R
  635. BOOL bFirstChar=TRUE;
    & E/ U' N$ ?; _
  636.   S) \1 K9 y* T; u
  637. BOOL CRevAppApp::OnIdle(LONG lCount)
    9 ]1 s9 q7 D- t* b
  638. {1 J8 ?5 N2 q% Q& ~; d
  639.         // TODO: Add your specialized code here and/or call the base class8 ^; Z8 R; f2 O- \( V
  640.   switch(dwProgramState)
    2 g% j/ D3 T" y8 q3 h5 _/ V. q
  641.   {
    9 @3 R: |+ L4 r" N
  642.   case AP_NOTHING:
    3 ?4 A8 i- C# A1 ]/ M+ {; v. E
  643.     switch(dwStartUpSteps)& m+ l! j( i3 L2 S" ]0 F, k8 X
  644.     {
    ) H+ ]: D" _4 C7 m
  645.     case 1:
    ) c3 B; k5 Q* U8 }6 r
  646.       {
    , m* U& D5 Y* x& Z% @) W2 V8 }8 }
  647.         int i;& e4 I5 v7 }" a! U9 G$ v# i( S0 E
  648.         CDC *pCDC=dlg->GetDC();
    7 s5 K& J" ^6 X
  649.         HDC hdcwnd=pCDC->m_hDC;
    6 y1 W# |& ?; ^, p& m! M+ A8 O# C
  650. //        Graphics graphics(hdcwnd);- Q/ K9 d) w+ j. ^! G
  651. //        Bitmap bitmap(L".\\Elysium\\Back1.bmp");
    + G( B3 l" i* ^: R
  652. //        INT iWidth=bitmap.GetWidth();
    & T$ t$ n: L5 s: g, l2 \
  653. //        INT iHeight=bitmap.GetHeight();
    4 ~5 s+ }$ i. T9 }  T& n
  654. //        Color color,colorTemp;
    ' T  j' ]- q% O9 e
  655. //        for(INT iRow=0;iRow<iHeight;iRow++)
    " \+ w2 o( E) \/ M# S
  656. //        {$ C5 A, J, X; l" O. W5 D
  657. //          for(INT iColumn=0;iColumn<iWidth;iColumn++)
    ' S0 f3 @- f( G; \8 t- L+ n. d
  658. //          {% n/ L/ h3 L! X. F1 Z2 A, ?
  659. //            bitmap.GetPixel(iColumn,iRow,&color);8 p6 Q( i. B- y( w; h" g; G
  660. //            colorTemp.SetValue(color.MakeARGB(( v, U, @# t0 p; m( K/ n& k
  661. //              (BYTE)(255*iColumn/iWidth),
    3 v% k/ F' K8 g0 Z8 k
  662. //              color.GetRed(),
    0 Z1 J6 U3 p. Q  o9 K; {
  663. //              color.GetGreen(),
    " V$ D9 b9 e. |
  664. //              color.GetBlue()));" N! _! ]# e& H1 b& Y" ^
  665. //            bitmap.SetPixel(iColumn,iRow,colorTemp);! O/ T% U2 |. _3 _- |" o& B
  666. //          }. t' T: @5 _! g2 [( ]
  667. //        }
    " q7 l/ v! n' i- e. h9 M
  668. //        graphics.DrawImage(&bitmap,0,0,iWidth,iHeight);
    & W% d7 D% P3 m$ N) V' Q2 w" I
  669.         HDC hdcorg=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");8 p$ q; n- H8 @
  670.         HDC hdcsrc=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back1.bmp");4 m4 D" G4 y4 o0 X  e
  671.         HDC hdctar=ReadBMPRGBA(hdcwnd,".\\Elysium\\Back2.bmp");# H% F3 {$ i6 I6 p! ~
  672.         for(i=0;i<240;i+=8), S. G* x. `. i' r% [
  673.         {2 C; t) Z' _7 D9 l# Q
  674.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);( v/ }; E7 _5 B3 f
  675.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);# c4 k% R: i% M. K/ x$ Q
  676.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);. n' z, T3 Q$ N$ t
  677.           Sleep(33);
    # E: L0 D5 ~: ]3 s
  678.         }0 l5 s* j" k' c- z0 z/ y8 X8 h  Q
  679.         Sleep(1000);
    8 d) q) v9 }( D2 ~% H6 Q
  680.         for(i=240;i>0;i-=8)
    ( _  ]+ P* }  N, {" L
  681.         {
    # \" T4 D9 J8 v. ^
  682.           BitBlt(hdctar,164,72,408,318,hdcorg,164,72,SRCCOPY);
    & j) o1 G: R& u
  683.           DrawAlphaBlend(hdctar,hdcsrc,164,72,408,318,i);: H% I% a& \- D) Z
  684.           BitBlt(hdcwnd,164,72,408,318,hdctar,164,72,SRCCOPY);' a% w( F3 L& }* C
  685.           Sleep(33);
    ' r9 U: O) z3 @/ [' d3 g' y, @
  686.         }
    # |' @; Y: t9 V2 Q
  687.         SendMessage(m_pMainWnd->GetSafeHwnd(),WM_USER+1,1,0);
    8 q: K2 c) B$ n$ Z3 v
  688.         dlg->ReleaseDC(pCDC);6 }6 s, y3 [, U% B+ a( H: x
  689.         DeleteDC(hdctar);
    $ X" ^* b9 ~" H
  690.         DeleteDC(hdcsrc);
    4 ^* N$ x. S- g2 S
  691.         DeleteDC(hdcorg);; U- X, z; {9 V: p0 Q  U4 U
  692.       }3 ]) q' q5 x0 v7 {) x
  693. //      MessageBox(NULL,"Step 1","Elysium",MB_OK);1 t( u# @2 |3 Q8 w8 ]" {
  694.       if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝狝竟腹 :");( r  S& M+ M" A. o4 ?2 Z
  695.       else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新伺服器代号 :");
    : l* y8 ~  _& I5 G7 A) @/ l
  696.       else                                                      dlg->m_ListText.AddString("Updating the Server ID:");
    9 @# U& w2 R. l) p) j
  697.       dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    / n  j, w' J% L! j( K( h
  698.       if(!Dn.Connected())- E, ~/ A6 A% z7 n& m* _$ i4 J  |
  699.       {6 F, q6 D. I; }% K% H( b
  700.         dwTotalFiles=1;
    % z$ J( z. d8 ?  ^* r# y
  701.         dwDownLoaded=0;
    $ J8 P' ^* s+ r0 s" v
  702.         bSilentStep=TRUE;" i1 o) L7 p6 p2 c  z. K. ]" t
  703.         bCompressed=FALSE;
    * [+ c. G/ @- Q& @- q) j
  704.         strExtLocal.Empty();2 R* F$ [* q" n& b" M
  705.         strFullName="readme.txt";
    6 D; V- T* O4 J- b
  706.         dwProgramState=AP_CONNECT;- @  S0 r' w6 P  d
  707.       }
    - c, ^2 |# Y/ s. Q) o$ L
  708.       m_pMainWnd->GetActiveWindow()->Invalidate();; n- N7 B! ~$ @: B% x& Y
  709.       dwStartUpSteps=2;5 P8 b  [8 |' Z0 ^
  710.       break;
    , L) D) I7 m% k3 n" g
  711.     case 2:2 O3 \6 x* k* b7 A0 j$ j! P- u0 j( B
  712.       {. l& f+ N9 c: \' `4 X1 `
  713.         int iEOF;/ n" V& [7 z  M8 M- I
  714.         FILE *fp;
    - J: N1 r. D0 r$ @) ?0 }
  715.         char szString[512];# T% h0 d: f/ Y$ d
  716.         fp=fopen(".\\DownLoad\\readme.txt","r");
    & i+ `. B6 [' ?; r! y
  717.         if(fp)
    % c: N+ e6 l. u6 `* l* O6 [
  718.         {6 R# X, J+ I% \. W. E0 u
  719.           do) @6 A, N/ b/ K$ t
  720.           {
    8 m9 q" Q  M7 Z6 v9 `' K0 |
  721.             iEOF=fscanf(fp,"%s",szString);4 ?# V' r6 |. C3 b
  722.             if(strlen(szString))  r+ \( P$ K  o. J8 f9 O8 A
  723.             {
    , ~# r6 v% d) M
  724.               if(bFirstChar)4 x* _1 Y3 o6 a7 M
  725.               {
    6 E6 e! J9 S" E, L% ]
  726.                 bFirstChar=FALSE;
    6 Y: Z2 F- A2 a3 I0 b
  727.                 bConnectIsBig5=FALSE;9 c( G6 o( k2 F0 S1 Z) @; F( B
  728.                 if(*szString=='T') bConnectIsBig5=TRUE;
    5 v; X7 B- N/ A
  729.               }
    4 i  F3 T/ C% P8 ?/ }+ X7 m/ r/ ]) u
  730.               if( bDisplayIsBig5 && !bConnectIsBig5) GBKS2BIG5(szString,strlen(szString));
    & r: P# M& M' L+ l
  731.               if(!bDisplayIsBig5 &&  bConnectIsBig5) Big52GBKS(szString,strlen(szString));
    ( K. [( M! s3 N" i% c' E
  732.               dlg->m_ListText.AddString(szString);
    # |# k4 `' W5 e! z6 A! l5 u
  733.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);) R* ]. y# _) R
  734.               *szString=0;
    , M! f# j; P  w$ \2 C# ?7 Y
  735.             }! w1 _! m" i+ b8 K* \
  736.           } while(iEOF!=EOF);( L7 m: y8 K( Y- u' N1 H  }
  737.           fclose(fp);
    : g3 p; `" |) i2 W/ H. U5 o# g) `
  738.           unlink(".\\DownLoad\\readme.txt");7 z5 T# L4 i! ~( f1 L$ h3 ^
  739.           dwStartUpSteps=3;
    / c# X3 p$ t3 x- r; y% w9 G
  740.         }1 p+ Y; o* Z. @6 @, Z+ _) x
  741.       }
    % d: \9 N4 ?$ l6 V* W" f0 r8 Y' c5 d* I
  742.       break;2 ^. J8 Y2 k4 I9 n/ f1 M
  743.     case 3:4 U. |1 f+ a: o; B- `4 C9 U1 E! m: p
  744.       if(!Dn.Connected())6 b$ x' T2 z3 F  N: H! N) }
  745.       {) P! e8 k: b4 b& U4 [8 f  g
  746. //        MessageBox(NULL,"Step 2","Elysium",MB_OK);+ b  [+ \6 V, O8 y1 A# ~; h, A2 s
  747.         dwTotalFiles=1;; i6 h: |" E% }% ?. c) o' ]. a
  748.         dwDownLoaded=0;  B9 w3 {" Q3 E8 L- @! x& k
  749.         bSilentStep=TRUE;1 X3 r  i6 z  M! ~
  750.         bCompressed=FALSE;6 e0 F  n! x3 n, Z: L2 O
  751.         strExtLocal.Empty();  U' P: m) Y: e: c. m0 o5 @
  752.         strFullName="checkversion.txt";* R4 Q: t  C4 P( W# _
  753.         dwProgramState=AP_CONNECT;6 a+ m& e+ c& m- i* w( L5 |7 M  f7 g
  754.       }9 c$ b8 Y1 k- P0 N3 y
  755.       dwStartUpSteps=4;
    ' J2 {. V/ k5 m+ v. I" o9 O4 d
  756.       break;
    * `1 ^- J3 _. n0 j
  757.     case 4:
    / N8 j9 K% G; {  e( Z7 t
  758.       {
    - c* g$ U! n* D9 s5 ]
  759.         FILE *fp;" m) G! f; ]2 z0 K2 D
  760.         char szString1[128];
    0 W# h8 V: J* w, J+ S
  761.         char szString2[128];! @& a$ o. p# b3 |
  762.         fp=fopen(".\\DownLoad\\checkversion.txt","r");
    & l  a$ ~! a& L  {/ K
  763.         if(fp)+ a8 J% ^# y" B2 J8 F8 O1 }& d8 g
  764.         {5 C! c3 I" o; N# Z' T8 |
  765.           fscanf(fp,"%s",szString1);
    9 S1 A* t: d: @1 L2 Q  m; M  k1 b/ ~
  766.           fclose(fp);( n+ a. _/ P9 L7 ^, Q
  767.           fCheckVersion=atof(szString1);" R* a( i8 P% h1 G. n+ D
  768.           fp=fopen(".\\checkversion.dat","r");3 T& I+ V1 P3 d( v% s
  769.           if(fp)
    ; Q- U9 G  F: P& o& u) q* ^
  770.           {  u: R" h5 U( g. ~
  771.             fscanf(fp,"%s",szString2);
    ! A7 ~5 E( b( ~; L4 t/ G
  772.             fclose(fp);
    / M4 E$ m: O  b( w" _- h- z
  773.             if(atof(szString1)!=atof(szString2))8 z3 H# e9 N( x5 Z2 O) H
  774.             {4 J7 D7 k' _2 {
  775.               if(!Dn.Connected())" T$ O$ D/ u8 V& K6 B$ @' l
  776.               {
    2 O. s* H3 ?- p! n1 a
  777.                 bFirstUpdate=TRUE;
    , N2 k' [; P1 C' z4 ?( [
  778.                 dwTotalFiles=1;. T- U2 c9 v" Q
  779.                 dwDownLoaded=0;
    ( @- a# {, M1 {) |; t4 u/ n
  780.                 bSilentStep=FALSE;
    $ [& P9 W: Y; ~2 W
  781.                 bCompressed=TRUE;
    6 T1 i+ p* r  U' X, t% b; g: S
  782.                 strExtLocal=".\\DownLoad\";4 @) n0 _$ \# B5 B0 f% l* [
  783.                 strFullName="update.txt";+ p# c3 K; r# v) }) o; d6 p
  784.                 dwProgramState=AP_CONNECT;, h. P: B! C- ?% s1 Y# `1 T; p. y+ I
  785.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");) p7 j7 L2 U) I0 l
  786.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");$ i, v$ G0 [. G
  787.                 else                                                      dlg->m_ListText.AddString("downloading update list.....");
    9 r' ?- F6 F5 ?* |* y1 X5 U$ g+ w
  788. 2 I9 f; a& [4 C; p
  789.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);8 q2 w  F7 X3 z1 e
  790.                 unlink(".\\DownLoad\\checkversion.txt");
    - F& _9 j) I9 O) T8 t9 v( R
  791.                 if( GetFileAttributes("Wsa.zip" )!=-1)
    # K. Z2 m1 ^, a4 b8 U# m  Q
  792.                 {
    * T% Z* I8 ^3 c
  793.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃, 惠だ牧");
    - {; R/ _; \: u7 D* ^
  794.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压, 约需耗时十分钟");" v! A+ s2 V, z
  795.                   else                                                      dlg->m_ListText.AddString("Unzip Files,        Maybe cost 10 minutes");
    " q+ k+ Y) p3 O) L$ u) S
  796.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    " E9 {. {! X6 b: D) Y6 O

  797. " y' h  q$ _* `) t. P
  798.                   if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");
    2 g% k# D$ r$ }3 ]6 j8 O
  799.                   else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");5 }) o/ w4 d& j
  800.                   else                                                      dlg->m_ListText.AddString("Waiting..........");* v  D) W7 y- r/ {$ i9 Z
  801.                                                                         dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);( V5 M8 E3 Z5 W0 X7 G9 P& V
  802.                 }
    * r: k+ g/ Y$ K# F* T5 i" k' ^
  803.                 dwStartUpSteps=5;: _) E. W1 k, |1 G0 |
  804.               }
    ' X0 X( Q' @$ o6 ]1 M9 E
  805.             }
    ; |8 v5 J2 ^4 o9 r( U7 F- S; }- U- ^  _
  806.             else6 ]# f3 [9 e/ I. ]' l4 C6 Z
  807.             {
    ' \9 c  W2 E; f! R2 g7 [/ c* ]0 l
  808.               unlink(".\\DownLoad\\checkversion.txt");
    2 s! K+ f8 x% Q) n  @/ O
  809.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("⊿Τ惠璶穝戈.....");
    4 B1 J% p- @& F2 h
  810.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("没有需要更新的资料.....");
    % q2 t: a5 I9 g, D
  811.               else                                                      dlg->m_ListText.AddString("no new file update.....");* l) @% [# `* \
  812. / g2 b( K8 ?" y8 x' X
  813.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    ' s( [& q, u5 l0 _* p$ @2 I
  814.               dwStartUpSteps=99;7 M! o4 W$ B- R" j, z  k4 X
  815.               bFinishUpdated=TRUE;( T: S8 }7 R& X( K4 s% A/ v
  816.               bCanUpdate=TRUE;
    % [  |9 o! t8 X2 F  ]
  817.             }+ Y$ S! B  d& E" y4 a; d
  818.           }+ r# l" H) p/ c; s: L2 s/ B0 ^
  819.           else
    : V, A/ \$ w( o+ U  N" t  b
  820.           {: F  _2 V! ~5 E. W) e$ K+ S
  821.             if(!Dn.Connected())7 j1 t" J2 V8 N) `- o+ X$ g
  822.             {
    : Z9 z- T$ X( z# H
  823.               bFirstUpdate=TRUE;5 T( _0 ^- B4 @" B. y
  824.               dwTotalFiles=1;
    7 q# A. G% l) P
  825.               dwDownLoaded=0;
    ( F; A% H" Q2 U2 B) ], |: C! Q
  826.               bSilentStep=FALSE;
    : \- D1 [  W# y) u3 q  T+ k
  827.               bCompressed=TRUE;: [' L% |9 b4 J0 ~
  828.               strExtLocal=".\\DownLoad\";; R# F: n  Q/ l( m* v8 `
  829.               strFullName="update.txt";( @* P: ~" t! R. B( P
  830.               dwProgramState=AP_CONNECT;7 y, m/ Y# E' @7 S/ Y# E
  831.               if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("穝更い, 叫祔.....");
    . ]2 v7 Z1 ~- _% X5 v& O- }/ w# ~
  832.               else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("更新列表下载中, 请稍待.....");
    - Y! B7 u, _( N# ~) A% @
  833.               else                                                      dlg->m_ListText.AddString("downloading update list.....");
    % @0 E* Y* ^" \( \6 X7 i
  834.               dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    + q7 ?  `9 y6 I$ m
  835.               unlink(".\\DownLoad\\checkversion.txt");$ x/ Y+ N5 @) M4 y6 h
  836.               if(GetFileAttributes("Wsa.zip" )!=-1)
    2 B5 V, f4 O3 n) V5 y) D. e" p, j- H
  837.               {0 k9 K. H3 [0 Z8 N
  838.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("郎秆溃......");% f) B7 h$ a3 M$ h6 r
  839.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("档案解压.....");
    ' Y/ n/ Q  t5 F1 }2 c
  840.                 else                                                      dlg->m_ListText.AddString("Unzip Files.....");3 C6 F/ d- N# E  R, t
  841.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);
    3 m- C9 o& q+ Z
  842.                 ' i( X5 [9 L9 r9 V) B5 G, M
  843.                 if     ( m_iLanguage == TRADITIONAL_CHINESE )             dlg->m_ListText.AddString("叫瑻み单..........");4 }# H0 a4 q) v% |' P
  844.                 else if( m_iLanguage == SIMPLIFY_CHINESE )                dlg->m_ListText.AddString("请耐心等待..........");* T( P  h& B' x! ~) N5 z
  845.                 else                                                      dlg->m_ListText.AddString("Waiting..........");
    * O4 E2 A/ Y+ i9 j# v, U
  846.                 dlg->m_ListText.SetCurSel(dlg->m_ListText.GetCount()-1);% N4 R8 E9 Y* `' N' V) d9 q
  847.               }
    + q( d: h( v3 C
  848.               dwStartUpSteps=5;
    : `+ ]% n! w/ [/ {- H) d; T
  849.             }
    " Z2 C4 |1 `6 e1 R5 O5 I1 V9 \( N
  850.           }* F7 D# M7 H& e0 j7 q
  851.         }5 Y- S6 H2 Z' D* R/ y
  852.         else' P  C4 H5 L) L% G2 ?+ y3 h, K0 `
  853.         {3 g* j$ f8 t+ b6 s1 G- D" T
  854.           dwStartUpSteps=3;
    1 x+ S2 _( Q" T+ O" `5 E
  855.         }
    9 Q* @! Q$ x9 f1 V0 }6 A+ `" K
  856.       }
    ' g0 Z4 B$ Q5 P+ D: k1 ?
  857.       break;
    # y3 {; u" i5 S# T6 m" |: v
  858.     case 5:
    4 ?9 r, z- G/ m# x9 K+ N
  859.       {& @+ k4 P& t6 J
  860.         if(GetFileAttributes("Wsa.zip" )!=-1)& R+ b9 C$ e( \+ s
  861.         {: R& Y% T4 @8 l% I1 S3 P
  862.           int opt_overwrite=1;0 C" t+ y" ^" }$ f# s+ \$ t
  863.           int opt_do_extract_withoutpath=0;6 c$ T) k  V& A
  864.           unzFile uf=NULL;6 u2 ?- t4 H1 j& i. J* a, B( Y

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

評分

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

查看全部評分

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

使用道具 舉報

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

本版積分規則

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

GMT+8, 2026-2-19 04:21

Powered by Discuz! X3.5

© 2001-2026 Discuz! Team.

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