Subversion Repositories Kolibri OS

Rev

Rev 5094 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5094 Rev 5534
Line 1... Line 1...
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                                 ;;
2
;;                                                                 ;;
3
;; Copyright (C) KolibriOS team 2009-2013. All rights reserved.    ;;
3
;; Copyright (C) KolibriOS team 2009-2015. All rights reserved.    ;;
4
;; Distributed under terms of the GNU General Public License       ;;
4
;; Distributed under terms of the GNU General Public License       ;;
5
;;                                                                 ;;
5
;;                                                                 ;;
6
;;  downloader.asm - HTTP client for KolibriOS                     ;;
6
;;  downloader.asm - HTTP client for KolibriOS                     ;;
7
;;                                                                 ;;
7
;;                                                                 ;;
8
;;                                                                 ;;
8
;;                                                                 ;;
Line 61... Line 61...
61
; load libraries
61
; load libraries
62
        stdcall dll.Load, @IMPORT
62
        stdcall dll.Load, @IMPORT
63
        test    eax, eax
63
        test    eax, eax
64
        jnz     exit
64
        jnz     exit
65
;---------------------------------------------------------------------
65
;---------------------------------------------------------------------
66
	mov	edi,filename_area
66
        mov     edi,filename_area
67
	mov	esi,start_temp_file_name
67
        mov     esi,start_temp_file_name
68
	call	copy_file_name_path
68
        call    copy_file_name_path
69
 
69
 
70
	mov	edi,fname_buf
70
        mov     edi,fname_buf
71
	mov	esi,start_file_path
71
        mov     esi,start_file_path
72
	call	copy_file_name_path
72
        call    copy_file_name_path
Line 73... Line 73...
73
 
73
 
74
;OpenDialog     initialisation
74
;OpenDialog     initialisation
75
        push    dword OpenDialog_data
75
        push    dword OpenDialog_data
Line 84... Line 84...
84
        je      reset_events            ; load the GUI
84
        je      reset_events            ; load the GUI
Line 85... Line 85...
85
 
85
 
Line 86... Line 86...
86
        inc     [silently]
86
        inc     [silently]
87
 
87
 
Line 88... Line 88...
88
download:
88
download:
89
	call	download_1
89
        call    download_1
Line 90... Line 90...
90
 
90
 
Line 149... Line 149...
149
        jmp     still
149
        jmp     still
150
@@:
150
@@:
151
        cmp     ah, 1   ; button id=1 ?
151
        cmp     ah, 1   ; button id=1 ?
152
        je      exit
152
        je      exit
Line 153... Line 153...
153
 
153
 
154
	call	download_1
154
        call    download_1
155
        jmp     save
155
        jmp     save
156
;---------------------------------------------------------------------
156
;---------------------------------------------------------------------
157
mouse:
157
mouse:
158
        stdcall [edit_box_mouse], edit1
158
        stdcall [edit_box_mouse], edit1
Line 166... Line 166...
166
        mcall
166
        mcall
167
;---------------------------------------------------------------------
167
;---------------------------------------------------------------------
168
download_1:
168
download_1:
169
        DEBUGF  1, "Starting download\n"
169
        DEBUGF  1, "Starting download\n"
Line 170... Line 170...
170
 
170
 
171
        invoke  HTTP_get, params, 0
171
        invoke  HTTP_get, 0, 0, params, 0
172
        test    eax, eax
172
        test    eax, eax
173
        jz      fail
173
        jz      fail
Line 174... Line 174...
174
        mov     [identifier], eax
174
        mov     [identifier], eax
175
 
175
 
176
  .loop:
176
  .loop:
177
        invoke  HTTP_process, [identifier]
177
        invoke  HTTP_receive, [identifier]
178
        test    eax, eax
178
        test    eax, eax
179
        jnz     .loop
179
        jnz     .loop
180
	ret
180
        ret
181
;---------------------------------------------------------------------
181
;---------------------------------------------------------------------
182
save:
182
save:
183
        mov     ebp, [identifier]
183
        mov     ebp, [identifier]
Line 197... Line 197...
197
        mcall   4, <10, frame_2.y+frame_2.height+7>, , download_complete
197
        mcall   4, <10, frame_2.y+frame_2.height+7>, , download_complete
Line 198... Line 198...
198
 
198
 
199
        jmp     still
199
        jmp     still
200
;---------------------------------------------------------------------
200
;---------------------------------------------------------------------
201
copy_file_name_path:
201
copy_file_name_path:
202
	xor	eax,eax
202
        xor     eax,eax
203
	cld
203
        cld
204
@@:
204
@@:
205
	lodsb
205
        lodsb
206
	stosb
206
        stosb
207
	test	eax,eax
207
        test    eax,eax
208
	jnz	@r
208
        jnz     @r
209
	ret
209
        ret
210
;---------------------------------------------------------------------
210
;---------------------------------------------------------------------
211
;   *********************************************
211
;   *********************************************
212
;   *******  WINDOW DEFINITIONS AND DRAW ********
212
;   *******  WINDOW DEFINITIONS AND DRAW ********
Line 223... Line 223...
223
        mov     edx, [sc.work]
223
        mov     edx, [sc.work]
224
        or      edx, 0x34000000
224
        or      edx, 0x34000000
225
        mcall   0, <50, 370>, <350, 170>, , 0, title
225
        mcall   0, <50, 370>, <350, 170>, , 0, title
226
;-----------------------------------
226
;-----------------------------------
227
; draw frames
227
; draw frames
228
	mov	[frame_data.x],dword frame_1.x shl 16+frame_1.width
228
        mov     [frame_data.x],dword frame_1.x shl 16+frame_1.width
229
	mov	[frame_data.y],dword frame_1.y shl 16+frame_1.height
229
        mov     [frame_data.y],dword frame_1.y shl 16+frame_1.height
230
	mov	[frame_data.text_pointer],dword select_addr_text
230
        mov     [frame_data.text_pointer],dword select_addr_text
231
	mov	eax,[sc.work]
231
        mov     eax,[sc.work]
232
	mov	[frame_data.font_backgr_color],eax
232
        mov     [frame_data.font_backgr_color],eax
233
	mov	eax,[sc.work_text]
233
        mov     eax,[sc.work_text]
234
	mov	[frame_data.font_color],eax
234
        mov     [frame_data.font_color],eax
235
	
235
        
236
	push	dword frame_data
236
        push    dword frame_data
237
	call	[Frame_draw]
237
        call    [Frame_draw]
238
;-----------------------------------
238
;-----------------------------------
239
	mov	[frame_data.x],dword frame_2.x shl 16+frame_2.width
239
        mov     [frame_data.x],dword frame_2.x shl 16+frame_2.width
240
	mov	[frame_data.y],dword frame_2.y shl 16+frame_2.height
240
        mov     [frame_data.y],dword frame_2.y shl 16+frame_2.height
241
	mov	[frame_data.text_pointer],dword select_path_text
241
        mov     [frame_data.text_pointer],dword select_path_text
Line 242... Line 242...
242
 
242
 
243
	push	dword frame_data
243
        push    dword frame_data
244
	call	[Frame_draw]
244
        call    [Frame_draw]
245
;-----------------------------------
245
;-----------------------------------
246
; draw "url:" text
246
; draw "url:" text
247
        mov     ecx, [sc.work_text]
247
        mov     ecx, [sc.work_text]
248
        or      ecx, 80000000h
248
        or      ecx, 80000000h
Line 253... Line 253...
253
        stdcall [edit_box_draw], edit1
253
        stdcall [edit_box_draw], edit1
254
;-----------------------------------
254
;-----------------------------------
255
; draw buttons
255
; draw buttons
256
        mcall   8,,,22,[sc.work_button] ; reload
256
        mcall   8,,,22,[sc.work_button] ; reload
257
        mcall   ,,, 24 ; stop
257
        mcall   ,,, 24 ; stop
258
	
258
        
259
        mcall   , ,,26 ; save
259
        mcall   , ,,26 ; save
260
;-----------------------------------
260
;-----------------------------------
261
; draw buttons text
261
; draw buttons text
262
        mov     ecx, [sc.work_button_text]
262
        mov     ecx, [sc.work_button_text]
263
        or      ecx, 80000000h
263
        or      ecx, 80000000h
264
        mcall   4, , , button_text.1
264
        mcall   4, , , button_text.1
265
        mcall   , , , button_text.2
265
        mcall   , , , button_text.2
266
        mcall   , , , button_text.3
266
        mcall   , , , button_text.3
267
	
267
        
268
        mcall   13,,,0xffffff
268
        mcall   13,,,0xffffff
269
        push    dword PathShow_data_1
269
        push    dword PathShow_data_1
270
        call    [PathShow_draw]
270
        call    [PathShow_draw]
271
	
271
        
272
        mcall   12, 2   ; end window redraw
272
        mcall   12, 2   ; end window redraw
Line 273... Line 273...
273
 
273
 
274
        ret
274
        ret
275
;---------------------------------------------------------------------
275
;---------------------------------------------------------------------
Line 281... Line 281...
281
library lib_http,       'http.obj', \
281
library lib_http,       'http.obj', \
282
        box_lib,        'box_lib.obj', \
282
        box_lib,        'box_lib.obj', \
283
        proc_lib,       'proc_lib.obj'
283
        proc_lib,       'proc_lib.obj'
Line 284... Line 284...
284
 
284
 
285
import  lib_http, \
285
import  lib_http, \
286
        HTTP_get                , 'get' , \
286
        HTTP_get                , 'get', \
287
        HTTP_process            , 'process'     ,\
287
        HTTP_receive            , 'receive', \
Line 288... Line 288...
288
        HTTP_free               , 'free'
288
        HTTP_free               , 'free'
289
 
289
 
290
import  box_lib, \
290
import  box_lib, \
Line 328... Line 328...
328
;---------------------------------------------------------------------
328
;---------------------------------------------------------------------
329
select_addr_text db ' NETWORK ADDRESS: ',0
329
select_addr_text db ' NETWORK ADDRESS: ',0
330
select_path_text db ' PATH TO SAVE FILE: ',0
330
select_path_text db ' PATH TO SAVE FILE: ',0
331
;---------------------------------------------------------------------
331
;---------------------------------------------------------------------
332
frame_data:
332
frame_data:
333
.type			dd 0 ;+0
333
.type                   dd 0 ;+0
334
.x:
334
.x:
335
.x_size			dw 0 ;+4
335
.x_size                 dw 0 ;+4
336
.x_start		dw 0 ;+6
336
.x_start                dw 0 ;+6
337
.y:
337
.y:
338
.y_size			dw 0 ;+8
338
.y_size                 dw 0 ;+8
339
.y_start		dw 0 ;+10
339
.y_start                dw 0 ;+10
340
.ext_fr_col		dd 0x0 ;+12
340
.ext_fr_col             dd 0x0 ;+12
341
.int_fr_col		dd 0xffffff ;+16
341
.int_fr_col             dd 0xffffff ;+16
342
.draw_text_flag		dd 1 ;+20
342
.draw_text_flag         dd 1 ;+20
343
.text_pointer		dd 0 ;+24
343
.text_pointer           dd 0 ;+24
344
.text_position		dd 0 ;+28
344
.text_position          dd 0 ;+28
345
.font_number		dd 0 ;+32
345
.font_number            dd 0 ;+32
346
.font_size_y		dd 9 ;+36
346
.font_size_y            dd 9 ;+36
347
.font_color		dd 0x0 ;+40
347
.font_color             dd 0x0 ;+40
348
.font_backgr_color	dd 0xffffff ;+44
348
.font_backgr_color      dd 0xffffff ;+44
349
;---------------------------------------------------------------------
349
;---------------------------------------------------------------------
350
PathShow_data_1:
350
PathShow_data_1:
351
.type                   dd 0    ;+0
351
.type                   dd 0    ;+0
352
.start_y                dw frame_2.y+14   ;+4
352
.start_y                dw frame_2.y+14   ;+4
353
.start_x                dw frame_2.x+20   ;+6
353
.start_x                dw frame_2.x+20   ;+6