ギコナビ
Revision | 1acca271ac91006889d012ef5011266bf7d58634 (tree) |
---|---|
Time | 2009-04-26 20:47:41 |
Author | h677 <h677> |
Commiter | h677 |
@@ -40,6 +40,35 @@ object UpdateCheckForm: TUpdateCheckForm | ||
40 | 40 | TabOrder = 1 |
41 | 41 | OnClick = NightBuildCheckButtonClick |
42 | 42 | end |
43 | + object CancelBitBtn: TBitBtn | |
44 | + Left = 96 | |
45 | + Top = 8 | |
46 | + Width = 97 | |
47 | + Height = 25 | |
48 | + Cancel = True | |
49 | + Caption = #12461#12515#12531#12475#12523 | |
50 | + Enabled = False | |
51 | + TabOrder = 2 | |
52 | + OnClick = CancelBitBtnClick | |
53 | + Glyph.Data = { | |
54 | + DE010000424DDE01000000000000760000002800000024000000120000000100 | |
55 | + 0400000000006801000000000000000000001000000000000000000000000000 | |
56 | + 80000080000000808000800000008000800080800000C0C0C000808080000000 | |
57 | + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00333333333333 | |
58 | + 333333333333333333333333000033338833333333333333333F333333333333 | |
59 | + 0000333911833333983333333388F333333F3333000033391118333911833333 | |
60 | + 38F38F333F88F33300003339111183911118333338F338F3F8338F3300003333 | |
61 | + 911118111118333338F3338F833338F3000033333911111111833333338F3338 | |
62 | + 3333F8330000333333911111183333333338F333333F83330000333333311111 | |
63 | + 8333333333338F3333383333000033333339111183333333333338F333833333 | |
64 | + 00003333339111118333333333333833338F3333000033333911181118333333 | |
65 | + 33338333338F333300003333911183911183333333383338F338F33300003333 | |
66 | + 9118333911183333338F33838F338F33000033333913333391113333338FF833 | |
67 | + 38F338F300003333333333333919333333388333338FFF830000333333333333 | |
68 | + 3333333333333333333888330000333333333333333333333333333333333333 | |
69 | + 0000} | |
70 | + NumGlyphs = 2 | |
71 | + end | |
43 | 72 | end |
44 | 73 | object Panel2: TPanel |
45 | 74 | Left = 0 |
@@ -5,7 +5,7 @@ interface | ||
5 | 5 | uses |
6 | 6 | Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
7 | 7 | Dialogs, IdAntiFreezeBase, IdAntiFreeze, IdBaseComponent, IdComponent, |
8 | - IdTCPConnection, IdTCPClient, IdHTTP, StdCtrls, ExtCtrls; | |
8 | + IdTCPConnection, IdTCPClient, IdHTTP, StdCtrls, ExtCtrls, Buttons; | |
9 | 9 | |
10 | 10 | type |
11 | 11 | TUpdateCheckForm = class(TForm) |
@@ -16,14 +16,17 @@ type | ||
16 | 16 | IdHTTP: TIdHTTP; |
17 | 17 | IdAntiFreeze: TIdAntiFreeze; |
18 | 18 | NightBuildCheckButton: TButton; |
19 | + CancelBitBtn: TBitBtn; | |
19 | 20 | procedure UpdateButtonClick(Sender: TObject); |
20 | 21 | procedure FormCreate(Sender: TObject); |
21 | 22 | procedure NightBuildCheckButtonClick(Sender: TObject); |
23 | + procedure CancelBitBtnClick(Sender: TObject); | |
22 | 24 | private |
23 | 25 | { Private é¾ } |
24 | 26 | FExecPath : string; |
25 | 27 | FExecArgs : string; |
26 | 28 | FAllowshutdown : Boolean; |
29 | + FCanceled : Boolean; | |
27 | 30 | function GetDesktopDir:string; |
28 | 31 | function GetDownloadFilePath(FileName: String): String; |
29 | 32 | function CreateShortCut(FileName, Argment, SavePath :string):boolean; |
@@ -92,6 +95,7 @@ begin | ||
92 | 95 | ResultMemo.Lines.Clear; |
93 | 96 | Screen.Cursor := crHourGlass; |
94 | 97 | UpdateButton.Enabled := False; |
98 | + NightBuildCheckButton.Enabled := False; | |
95 | 99 | |
96 | 100 | try |
97 | 101 | ResStream := TMemoryStream.Create; |
@@ -102,6 +106,7 @@ begin | ||
102 | 106 | |
103 | 107 | IdHTTP.Request.CacheControl := 'no-cache'; |
104 | 108 | IdHTTP.Request.CustomHeaders.Add('Pragma: no-cache'); |
109 | + IdHTTP.ReadTimeout := 0; | |
105 | 110 | IdHTTP.HandleRedirects := true; |
106 | 111 | downResult := TStringList.Create; |
107 | 112 | newest := TStringList.Create; |
@@ -110,7 +115,13 @@ begin | ||
110 | 115 | try |
111 | 116 | try |
112 | 117 | ResStream.Clear; |
118 | + FCanceled := False; | |
119 | + CancelBitBtn.Enabled := True; | |
113 | 120 | IdHTTP.Get(CHECK_URL, ResStream); |
121 | + CancelBitBtn.Enabled := False; | |
122 | + if (FCanceled) then begin | |
123 | + raise Exception.Create('_E[hªLZ³êܵ½B'); | |
124 | + end; | |
114 | 125 | value := GikoSys.GzipDecompress(ResStream, |
115 | 126 | IdHTTP.Response.ContentEncoding); |
116 | 127 | downResult.Text := value; |
@@ -169,6 +180,7 @@ begin | ||
169 | 180 | ResStream.Free; |
170 | 181 | end; |
171 | 182 | finally |
183 | + NightBuildCheckButton.Enabled := True; | |
172 | 184 | UpdateButton.Enabled := True; |
173 | 185 | Screen.Cursor := crDefault; |
174 | 186 | end; |
@@ -184,7 +196,12 @@ begin | ||
184 | 196 | filename := GetDownloadFilePath(Copy(url, LastDelimiter('/', url) + 1, Length(url))); |
185 | 197 | fileStrem := TFileStream.Create(filename, fmCreate); |
186 | 198 | try |
199 | + CancelBitBtn.Enabled := True; | |
187 | 200 | IdHTTP.Get(url, fileStrem); |
201 | + CancelBitBtn.Enabled := False; | |
202 | + if (FCanceled) then begin | |
203 | + raise Exception.Create('_E[hªLZ³êܵ½B'); | |
204 | + end; | |
188 | 205 | ResultMemo.Lines.Add( |
189 | 206 | IdHttp.ResponseText + '(' + IntToStr(IdHttp.ResponseCode) + ')'); |
190 | 207 | FExecPath := filename; |
@@ -268,5 +285,14 @@ begin | ||
268 | 285 | FExecArgs := ''; |
269 | 286 | FAllowshutdown := False; |
270 | 287 | end; |
288 | +//! LZ{^º | |
289 | +procedure TUpdateCheckForm.CancelBitBtnClick(Sender: TObject); | |
290 | +begin | |
291 | + CancelBitBtn.Enabled := False; | |
292 | + FCanceled := True; | |
293 | + if IdHTTP.Connected then begin | |
294 | + IdHTTP.Disconnect; | |
295 | + end; | |
296 | +end; | |
271 | 297 | |
272 | 298 | end. |