Rev 6366 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6366 | Rev 6374 | ||
---|---|---|---|
Line 1... | Line 1... | ||
1 | #ifdef LANG_RUS |
1 | #ifdef LANG_RUS |
2 | #define DL_WINDOW_HEADER "¥¥¤¦¥à § £à㧮ª" |
2 | #define DL_WINDOW_HEADER "¥¥¤¦¥à § £à㧮ª" |
3 | #define START_DOWNLOADING " ç âì § ª çªã" |
3 | #define START_DOWNLOADING " ç âì § ª çªã" |
4 | #define STOP_DOWNLOADING "áâ ®¢¨âì" |
4 | #define STOP_DOWNLOADING "áâ ®¢¨âì" |
5 | #define SHOW_IN_FOLDER "®ª § âì ¢ ¯ ¯ª¥" |
5 | #define SHOW_IN_FOLDER "®ª § âì ¢ ¯ ¯ª¥" |
6 | #define OPEN_FILE_TEXT "âªàëâì ä ©«" |
6 | #define OPEN_FILE_TEXT "âªàëâì ä ©«" |
7 | #define FILE_SAVED_AS "'¥¥¤¦¥à § £à㧮ª\n ©« á®åà ¥ ª ª " |
7 | #define FILE_SAVED_AS "'¥¥¤¦¥à § £à㧮ª\n ©« á®åà ¥ ª ª " |
8 | #define KB_RECEIVED " ¯®«ã祮" |
8 | #define KB_RECEIVED " ¯®«ã祮" |
9 | #else |
9 | #else |
10 | #define DL_WINDOW_HEADER "Download Manager" |
10 | #define DL_WINDOW_HEADER "Download Manager" |
11 | #define START_DOWNLOADING "Start downloading" |
11 | #define START_DOWNLOADING "Start downloading" |
12 | #define STOP_DOWNLOADING "Stop downloading" |
12 | #define STOP_DOWNLOADING "Stop downloading" |
Line 24... | Line 24... | ||
24 | edit_box ed = {250,20,20,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(downloader_edit),#downloader_edit,#mouse_twbi,2,19,19}; |
24 | edit_box ed = {250,20,20,0xffffff,0x94AECE,0xffffff,0xffffff,0,sizeof(downloader_edit),#downloader_edit,#mouse_twbi,2,19,19}; |
25 | progress_bar pb = {0, 170, 51, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F}; |
25 | progress_bar pb = {0, 170, 51, 225, 12, 0, 0, 100, 0xFFFfff, 0x74DA00, 0x9F9F9F}; |
Line 26... | Line 26... | ||
26 | 26 | ||
27 | byte downloader_opened; |
27 | byte downloader_opened; |
- | 28 | char downloader_stak[4096]; |
|
- | 29 | char str[2048]; |
|
- | 30 | char aux[2048]; |
|
Line 28... | Line 31... | ||
28 | char downloader_stak[4096]; |
31 | |
29 | 32 | ||
30 | 33 | ||
Line 39... | Line 42... | ||
39 | if (downloader_edit[0]) StartDownloading(); else strcpy(#downloader_edit, "http://"); |
42 | if (downloader_edit[0]) StartDownloading(); else strcpy(#downloader_edit, "http://"); |
40 | ed.size = ed.pos = ed.shift = ed.shift_old = strlen(#downloader_edit); |
43 | ed.size = ed.pos = ed.shift = ed.shift_old = strlen(#downloader_edit); |
Line 41... | Line 44... | ||
41 | 44 | ||
42 | loop() |
45 | loop() |
43 | { |
46 | { |
44 | WaitEventTimeout(40); |
47 | WaitEventTimeout(30); |
45 | switch(EAX & 0xFF) |
48 | switch(EAX & 0xFF) |
46 | { |
49 | { |
47 | CASE evMouse: |
50 | CASE evMouse: |
48 | if (!CheckActiveProcess(DL_Form.ID)) break; |
51 | if (!CheckActiveProcess(DL_Form.ID)) break; |
Line 82... | Line 85... | ||
82 | if (downloader.state == STATE_COMPLETED) |
85 | if (downloader.state == STATE_COMPLETED) |
83 | { |
86 | { |
84 | if (!dir_exists(#save_to)) CreateDir(#save_to); |
87 | if (!dir_exists(#save_to)) CreateDir(#save_to); |
85 | strcpy(#filepath, #save_to); |
88 | strcpy(#filepath, #save_to); |
86 | chrcat(#filepath, '/'); |
89 | chrcat(#filepath, '/'); |
- | 90 | // Clean all slashes at the end |
|
- | 91 | strcpy(#aux, #downloader_edit); |
|
- | 92 | while (aux[strlen(#aux)-1] == '/') { |
|
- | 93 | aux[strlen(#aux)-1] = 0; |
|
- | 94 | } |
|
87 | strcat(#filepath, #downloader_edit+strrchr(#downloader_edit, '/')); |
95 | strcat(#filepath, #aux+strrchr(#aux, '/')); |
- | 96 | ||
88 | if (WriteFile(downloader.data_downloaded_size, downloader.bufpointer, #filepath)==0) |
97 | if (WriteFile(downloader.data_downloaded_size, downloader.bufpointer, #filepath)==0) |
89 | sprintf(#notify_message, "%s%s%s",FILE_SAVED_AS,#filepath,"' -Dt"); |
98 | sprintf(#notify_message, "%s%s%s",FILE_SAVED_AS,#filepath,"' -Dt"); |
90 | else |
99 | else |
91 | sprintf(#notify_message, "%s%s%s","'Download manager\nError! Can\96t save file as ",#filepath,"' -Et"); |
100 | sprintf(#notify_message, "%s%s%s","'Download manager\nError! Can\96t save file as ",#filepath,"' -Et"); |
- | 101 | ||
92 | notify(#notify_message); |
102 | notify(#notify_message); |
93 | StopDownloading(); |
103 | StopDownloading(); |
94 | DL_Draw_Window(); |
104 | DL_Draw_Window(); |
95 | break; |
105 | break; |
96 | } |
106 | } |
Line 170... | Line 180... | ||
170 | downloader.Stop(); |
180 | downloader.Stop(); |
171 | ed.blur_border_color = 0xFFFfff; |
181 | ed.blur_border_color = 0xFFFfff; |
172 | ed.flags = 10b; |
182 | ed.flags = 10b; |
173 | DL_Draw_Window(); |
183 | DL_Draw_Window(); |
174 | }=>280)>120)>><> |
184 | }=>280)>120)>><> |
175 | - | ||
176 | - |