-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUnit2.pas
More file actions
232 lines (194 loc) · 5.81 KB
/
Copy pathUnit2.pas
File metadata and controls
232 lines (194 loc) · 5.81 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdMessage, IdSocks, IdServerIOHandler, IdSSLOpenSSL,
IdIOHandler, IdIOHandlerSocket, IdBaseComponent, IdComponent,
IdTCPConnection, IdTCPClient, IdHTTP, StdCtrls, ComCtrls,
Menus;
const
cmRxByte = wm_User + $55;
type
TForm1 = class(TForm)
logEd: TEdit;
pasEd: TEdit;
LinkEd: TEdit;
BookName: TEdit;
AuthBut: TButton;
GetBut: TButton;
downBut: TButton;
IdHTTP1: TIdHTTP;
IdIOHandlerSocket1: TIdIOHandlerSocket;
IdSocksInfo1: TIdSocksInfo;
ProgressBar1: TProgressBar;
Memo1: TMemo;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
MainMenu1: TMainMenu;
File1: TMenuItem;
Exit1: TMenuItem;
Help1: TMenuItem;
About1: TMenuItem;
Label5: TLabel;
procedure AuthButClick(Sender: TObject);
procedure GetButClick(Sender: TObject);
procedure downButClick(Sender: TObject);
procedure RecivBytes(var Msg: TMessage); message cmRxByte;
procedure Exit1Click(Sender: TObject);
procedure About1Click(Sender: TObject);
procedure Help1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
idNum: Integer; // Íîìåð Id
pageNum: Integer; // Êîëè÷åñòâî ñòðàíèö â êíèãå
title: String; // Íàçâàíèå êíèãè
Msg: TIdMessage;
dataName: String;
newPassword, login, password: String;
isDownload, isAuthorization, isGet, isMail: bool;
implementation
uses ThreadUnit;
{$R *.dfm}
procedure TForm1.About1Click(Sender: TObject);
begin
ShowMessage('Ñïàñèáî çà òî ÷òî ïîëüçóåòåñü ïðèëîæåíèåì' + #13+#10 +
'Åñëè åñòü êàêèå ëèáî ïðåäëîæåíèÿ/ïîæåëàíèÿ è ñïîñîáíîñòè ñâÿçàòüñÿ ñî ìíîé - ïèøèòå!' +#13+#10 +
'Ãîòîâ ïðèíÿòü íåáîëüøèå äîíàòû çà áåñîííûå íî÷è :)))' +#13+#10 +
'QIWI:https://qiwi.com/n/AGOOM395' + #13+#10+
'Ïîïîëíåíèå ïî íèêíåéìó:AGOOM395' +#13+#10+
'Ñëåäèòå çà íîâîñòÿìè è îáíîâëåíèÿìè' +#13+#10 +
'Äàåøü ñâîáîäíóþ ëèòåðàòóðó!');
end;
procedure TForm1.AuthButClick(Sender: TObject);
var
pasBytes: array of string;
temp: Integer;
i: Integer;
begin
if (logEd.Text <> '') and (pasEd.Text <> '') then
begin
FillChar(newPassword, SizeOf(newPassword), 0);
login := logEd.Text;
password := pasEd.Text;
setlength(pasBytes, length(password));
for i := 1 to length(password) do
begin
temp := Ord(password[i]);
if (temp < 1088) or (temp > 1103) then // Çíà÷åíèÿ ñèìâîëîâ E0 è EF
begin
pasBytes[i] := '%D0%' + IntToHex(((temp) - 896), 2);
// + 128 - 1024 äëÿ øèôðîâàíèÿ
newPassword := newPassword + pasBytes[i];
end
else
begin
pasBytes[i] := '%D1%' + IntToHex(((temp) - 960), 2);
// +64 -1024 äëÿ øèôðîâàíèÿ
newPassword := newPassword + pasBytes[i];
end;
end;
isAuthorization := true;
MyThread := TMyThread.Create(true);
MyThread.FreeOnTerminate := true;
MyThread.Priority := tpNormal;
MyThread.Resume;
end
else
ShowMessage('Çàïîëíèòå ëîãèí è ïàðîëü');
end;
procedure TForm1.GetButClick(Sender: TObject);
begin
isGet := true;
MyThread := TMyThread.Create(true);
MyThread.FreeOnTerminate := true;
MyThread.Priority := tpNormal;
MyThread.Resume;
end;
procedure TForm1.Help1Click(Sender: TObject);
begin
ShowMessage('Ââåäèòå ñâîè äàííûå: Ëîãèí è Ïàðîëü -> Íàæìèòå êíîïêó àâòîðèçàöèè' +#13+#10+
'Ïîñëå ñîîáùåíèÿ îá óñïåõå, ñêîïèðóéòå ññûëêó íà êíèãó â ñòðîêó -> íàæìèòå êíîïêó Get' +#13+#10+
'Íàæìèòå êíîïêó Download -> Æäèòå êîíöà çàãðóçêè');
end;
procedure TForm1.downButClick(Sender: TObject);
begin
if BookName.Text <> '' then
begin
isDownload := true;
MyThread := TMyThread.Create(true);
MyThread.FreeOnTerminate := true;
MyThread.Priority := tpNormal;
MyThread.Resume;
end
else
ShowMessage('Ââåäèòå íàçâàíèå êíèãè');
end;
procedure TForm1.Exit1Click(Sender: TObject);
begin
Application.Terminate;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
if not DirectoryExists('C:\_Books') then
CreateDir('C:\_Books');
end;
procedure TForm1.RecivBytes(var Msg: TMessage); // Messages from second thread
begin
case Msg.WParam of
// Succesfull login
1:
begin
ShowMessage('Login:' + #13 + #10 + ' Succesfully');
Application.ProcessMessages;
end;
// Issues with login
2:
begin
ShowMessage('Check your data');
Application.ProcessMessages;
end;
// Issues with login
3:
begin
ShowMessage('Connection error' + #13 + #10 + 'Chech your data');
Application.ProcessMessages;
end;
// Connecting protocol
4:
begin
ShowMessage('Download compleated succesfylly' + #13 + #10 +
'C:\_Books\' + Form1.BookName.Text + '.pdf' + #13 + #10 +
'Succesfully');
isMail := true;
MyThread := TMyThread.Create(true);
MyThread.FreeOnTerminate := true;
MyThread.Priority := tpNormal;
MyThread.Resume;
Application.ProcessMessages;
end;
5:
begin
ShowMessage('Error occured, try again');
Application.ProcessMessages;
end;
6:
begin
ShowMessage('Error with book link' + #13 + #10 +
'Please, check the link');
Application.ProcessMessages;
end;
7:
begin
ShowMessage('Your link is working, now press "Download" button');
end;
end;
end;
end.