 |
Срочно - Вопросы и ответы, обсуждения - Ваши вопросы по Pascal/Delphi только в данном разделе |
11.03.2013, 17:38
|
#1
|
|
|
|
Разведчик
|
 Регистрация: 24.09.2011
 Сообщений: 0
 Популярность: 10
 Сказал(а) спасибо: 0
Поблагодарили 0 раз(а) в 0 сообщениях
|
Срочно
Код:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, IdBaseComponent, IdComponent, IdTCPConnection, IdTCPClient, IdHTTP,
StdCtrls, ComCtrls, Gauges, SyncObjs, sEdit;
type
TForm1 = class(TForm)
Edit1: TEdit;
UpDown1: TUpDown;
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
OpenDialog1: TOpenDialog;
GoodLabel: TLabel;
BadLabel: TLabel;
IdHTTP1: TIdHTTP;
Gauge1: TGauge;
Button2: TButton;
sEdit1: TsEdit;
Label3: TLabel;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button2Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
TNewThread = class(TThread)
private
FAcc : string;
FPas : string;
Rez : Integer;
protected
procedure Execute; override;
public
procedure Sync;
constructor Create(CreateSuspended: Boolean);
end;
var
Form1: TForm1;
Accounts:Tstringlist;
Thread, Acc:integer;
Work:boolean;
CS:TcriticalSection;
GoodFile, BadFile: textfile;
CurAcc,o,z:integer;
implementation
{$R *.dfm}
constructor TNewThread.Create(CreateSuspended: Boolean);
begin
inherited Create(CreateSuspended);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
OpenDialog1.InitialDir:=ExtractFilePath(Application.ExeName);
if OpenDialog1.Execute then
begin
Accounts.Clear;
Accounts.LoadFromFile(OpenDialog1.FileName);
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Assignfile(GoodFile, ExtractFilePath(Application.ExeName)+'good.txt');
Rewrite(GoodFile);
Closefile(GoodFile);
Assignfile(BadFile, ExtractFilePath(Application.ExeName)+'bad.txt');
Rewrite(BadFile);
Closefile(BadFile);
GoodLabel.Caption:='0';
BadLabel.Caption:='0';
Gauge1.MaxValue:=Accounts.Count;
Gauge1.Progress:=0;
Acc:=-1;
Work:=true;
for Thread:=1 to strtoint(Edit1.Text) do
TNewThread.Create(false);
Thread:=strtoint(Edit1.Text);
end;
procedure TNewThread.Execute;
var CurAcc:integer;
data:Tstringlist;
HTTP: TIdHTTP;
S : String;
begin
while Work do
begin
CS.Enter;
Inc(Acc);
if acc CS.Leave;
if Work then
begin
FAcc:= Copy(mail[CurAcc],1,Pos(form1.sEdit1.Text,mail[CurAcc])-1);
FPas:= Copy(mail[CurAcc],Pos(form1.sEdit1.Text,mail[CurAcc])+1,Length(mails[CurAcc]));
HTTP:=TIdHTTP.Create(nil);
HTTP.HandleRedirects := true;
try
response:=send('GET','http://store.steampo....l/?email=' FAcc);
except
end;
if Pos('{"bAvailable":false}', s)<>0 then
Rez:=1
else
Rez:=2;
end;
Synchronize(Sync);
end;
dec(Thread);
if Thread=0 then ShowMessage('OK');
end;
procedure TNewThread.Sync;
begin
case Rez of
0:begin
Accounts.Add(FAcc+';'+FPas);
end;
1:begin
Append(GoodFile);
Writeln(GoodFile,FAcc+';'+FPas);
Closefile(GoodFile);
Form1.GoodLabel.Caption:=IntToStr(StrToInt(Form1.GoodLabel.Caption)+1);
Form1.Gauge1.Progress:=Form1.Gauge1.Progress+1;
end;
-1:begin
Append(BadFile);
Writeln(BadFile,FAcc+';'+FPas);
Closefile(BadFile);
Form1.BadLabel.Caption:=IntToStr(StrToInt(Form1.BadLabel.Caption)+1);
Form1.Gauge1.Progress:=Form1.Gauge1.Progress+1;
end;
end;
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Accounts.Free;
CS.Free;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Accounts:=Tstringlist.create;
CS:=TcriticalSection.create;
end;
end.
Я не могу понять какой переменной не хватает!
все говорять не хватает переменной.
Последний раз редактировалось VeTaL_UA; 12.03.2013 в 01:28.
Причина: Учимся пользоваться тегом CODE
|
|
|
11.03.2013, 17:48
|
#2
|
|
|
|
Разведчик
|
 Регистрация: 22.11.2012
 Сообщений: 2
 Популярность: 464
 Сказал(а) спасибо: 0
Поблагодарили 22 раз(а) в 13 сообщениях
|
Re: Срочно
Код отформатируй нечитабельно нифига!
Делфи чего сказала?
|
|
|
11.03.2013, 18:33
|
#3
|
|
|
|
Сержант
|
 Регистрация: 10.08.2011
 Сообщений: 136
 Популярность: 1781
 Сказал(а) спасибо: 60
Поблагодарили 246 раз(а) в 145 сообщениях
|
Re: Срочно
 |
Цитата: |
 |
|
|
|
|
|
|
|
|
response:=send('GET','http://store.steampo....l/?email=' FAcc);
|
|
 |
|
 |
|
response:= HTTP.GET( '[ Ссылки могут видеть только зарегистрированные пользователи. ] '+FAcc);
Еще ошибка тут:
Заменить на Rez:=-1;
Добавлено через 14 минут
И еще тут ошибка:
 |
Цитата: |
 |
|
|
|
|
|
|
|
|
if Pos('{"bAvailable":false}', s)<>0 then
|
|
 |
|
 |
|
Заменить на:
 |
Цитата: |
 |
|
|
|
|
|
|
|
if Pos('{"bAvailable":false}',response)<>0 then |
|
 |
|
 |
|
Последний раз редактировалось Роспотребнадзор; 11.03.2013 в 18:47.
Причина: Добавлено сообщение
|
|
|
Ваши права в разделе
|
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения
HTML код Выкл.
|
|
|
Заявление об ответственности / Список мошенников
Часовой пояс GMT +4, время: 17:54.
|
 |