|
|
unit sett;
|
|
|
|
|
|
interface
|
|
|
|
|
|
uses
|
|
|
Windows, SysUtils, Classes, Controls, Forms, StdCtrls, IniFiles, callexec, idhttp, IdComponent,
|
|
|
Graphics, ExtCtrls, Signal, action, setpassform, ImgList, ComCtrls, Vcl.Imaging.pngimage,
|
|
|
System.ImageList;
|
|
|
|
|
|
{$I NoRTTI.inc}
|
|
|
|
|
|
type
|
|
|
TFormSet = class(TForm)
|
|
|
Edit1: TEdit;
|
|
|
Label1: TLabel;
|
|
|
Label2: TLabel;
|
|
|
Label3: TLabel;
|
|
|
Edit2: TEdit;
|
|
|
Label4: TLabel;
|
|
|
Edit3: TEdit;
|
|
|
Label5: TLabel;
|
|
|
Edit4: TEdit;
|
|
|
CheckBox1: TCheckBox;
|
|
|
CheckBox2: TCheckBox;
|
|
|
Glyphs: TImageList;
|
|
|
Label7: TLabel;
|
|
|
UpDown1: TUpDown;
|
|
|
Label8: TLabel;
|
|
|
CheckBox4: TCheckBox;
|
|
|
CheckBox5: TCheckBox;
|
|
|
Timer1: TTimer;
|
|
|
Image5: TImage;
|
|
|
RadioGroup1: TRadioGroup;
|
|
|
Icons: TImageList;
|
|
|
test: TImage;
|
|
|
tbTipPos: TImage;
|
|
|
tbTipDir: TImage;
|
|
|
TestPopup: TImage;
|
|
|
PopupPos: TEdit;
|
|
|
closeBtn: TButton;
|
|
|
applyBtn: TButton;
|
|
|
procedure closeBtnClick(Sender: TObject);
|
|
|
procedure applyBtnClick(Sender: TObject);
|
|
|
procedure FormCreate(Sender: TObject);
|
|
|
procedure FormShow(Sender: TObject);
|
|
|
procedure tbTipPosClick(Sender: TObject);
|
|
|
procedure tbTipDirClick(Sender: TObject);
|
|
|
procedure TestPopupClick(Sender: TObject);
|
|
|
procedure testClick(Sender: TObject);
|
|
|
procedure Timer1Timer(Sender: TObject);
|
|
|
procedure Image5MouseEnter(Sender: TObject);
|
|
|
procedure Image5MouseLeave(Sender: TObject);
|
|
|
procedure Image5Click(Sender: TObject);
|
|
|
procedure FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
|
|
private
|
|
|
{ Private declarations }
|
|
|
public
|
|
|
procedure httpWork(ASender: TObject; AWorkMode: TWorkMode; AWorkCount: Int64);
|
|
|
procedure SetProxy(http: TidHTTP);
|
|
|
function ShowWait(msge1: string): TSForm;
|
|
|
{ Public declarations }
|
|
|
end;
|
|
|
|
|
|
var
|
|
|
setfrm: TFormSet;
|
|
|
TipPos: boolean = false;
|
|
|
TipDir: boolean = false;
|
|
|
ListOfForms: TStringList;
|
|
|
poswait: integer;
|
|
|
LXTForm: TSForm;
|
|
|
|
|
|
implementation
|
|
|
|
|
|
{$R *.dfm}
|
|
|
|
|
|
function XorEncode(const Key, Source: ansistring): ansistring;
|
|
|
var
|
|
|
i: integer;
|
|
|
c: Byte;
|
|
|
begin
|
|
|
Result := '';
|
|
|
for i := 1 to Length(Source) do
|
|
|
begin
|
|
|
if Length(Key) > 0 then
|
|
|
c := Byte(Key[1 + ((i - 1) mod Length(Key))]) xor Byte(Source[i])
|
|
|
else
|
|
|
c := Byte(Source[i]);
|
|
|
Result := Result + ansistring(AnsiLowerCase(IntToHex(c, 2)));
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function XorDecode(const Key, Source: ansistring): ansistring;
|
|
|
var
|
|
|
i: integer;
|
|
|
c: Char;
|
|
|
begin
|
|
|
Result := '';
|
|
|
for i := 0 to Length(Source) div 2 - 1 do
|
|
|
begin
|
|
|
c := Chr(StrToIntDef('$' + Copy(Source, (i * 2) + 1, 2), Ord(' ')));
|
|
|
if Length(Key) > 0 then
|
|
|
c := Chr(Byte(Key[1 + (i mod Length(Key))]) xor Byte(c));
|
|
|
Result := Result + c;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.httpWork(ASender: TObject; AWorkMode: TWorkMode; AWorkCount: Int64);
|
|
|
begin
|
|
|
if Assigned(LXSForm) then
|
|
|
begin
|
|
|
LXSForm.procbar.Position := round(AWorkCount / httpsize * 100);
|
|
|
if LXSForm.procbar.Position > 100 then
|
|
|
LXSForm.procbar.Position := 100;
|
|
|
LXSForm.procl.caption := IntToStr(LXSForm.procbar.Position) + '%';
|
|
|
Application.ProcessMessages;
|
|
|
end;
|
|
|
|
|
|
if Assigned(LXBForm) then
|
|
|
begin
|
|
|
LXBForm.procbar.Position := round(AWorkCount / httpsize * 100);
|
|
|
if LXBForm.procbar.Position > 100 then
|
|
|
LXBForm.procbar.Position := 100;
|
|
|
LXBForm.procl.caption := IntToStr(LXBForm.procbar.Position) + '%';
|
|
|
Application.ProcessMessages;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.Image5Click(Sender: TObject);
|
|
|
var
|
|
|
isX64: string;
|
|
|
begin
|
|
|
{$IFDEF CPUX64}
|
|
|
isX64 := ' x64';
|
|
|
{$ENDIF CPUX64}
|
|
|
MessageBox(0, PWideChar(namepl + isX64 +
|
|
|
#13#10#13#10'ICQ: 230-490'#13#10'WWW: http://code.highspec.ru'#13#10#13#10'2008-2015 <20> Mikanoshi'), '<27> <20><>', 0);
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.Image5MouseEnter(Sender: TObject);
|
|
|
begin
|
|
|
Icons.GetIcon(1, Image5.Picture.Icon);
|
|
|
Image5.Refresh;
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.Image5MouseLeave(Sender: TObject);
|
|
|
begin
|
|
|
Icons.GetIcon(0, Image5.Picture.Icon);
|
|
|
Image5.Refresh;
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.SetProxy(http: TidHTTP);
|
|
|
begin
|
|
|
with http.ProxyParams do
|
|
|
if CheckBox1.Checked then
|
|
|
begin
|
|
|
ProxyServer := Edit1.Text;
|
|
|
ProxyPort := StrToInt(Edit2.Text);
|
|
|
if CheckBox2.Checked then
|
|
|
begin
|
|
|
BasicAuthentication := true;
|
|
|
ProxyUsername := Edit3.Text;
|
|
|
ProxyPassword := Edit4.Text;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
BasicAuthentication := false;
|
|
|
ProxyUsername := '';
|
|
|
ProxyPassword := '';
|
|
|
end
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
BasicAuthentication := false;
|
|
|
ProxyServer := '';
|
|
|
ProxyPort := 0;
|
|
|
ProxyUsername := '';
|
|
|
ProxyPassword := '';
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
function BoolToIntStr(b: boolean): string;
|
|
|
begin
|
|
|
if b then
|
|
|
Result := '1'
|
|
|
else
|
|
|
Result := '0'
|
|
|
end;
|
|
|
|
|
|
function TFormSet.ShowWait(msge1: string): TSForm;
|
|
|
var
|
|
|
XSForm: TSForm;
|
|
|
i: integer;
|
|
|
begin
|
|
|
while XTimerOn = true do
|
|
|
Application.ProcessMessages;
|
|
|
|
|
|
try
|
|
|
XSForm := TSForm.Create(Application);
|
|
|
XSForm.Label2.caption := msge1;
|
|
|
|
|
|
poswait := ListOfForms.count;
|
|
|
for i := 0 to ListOfForms.count - 1 do
|
|
|
if ListOfForms[i] = '' then
|
|
|
begin
|
|
|
poswait := i;
|
|
|
break;
|
|
|
end;
|
|
|
|
|
|
if poswait = ListOfForms.count then
|
|
|
ListOfForms.Add('-')
|
|
|
else
|
|
|
ListOfForms[poswait] := '-';
|
|
|
|
|
|
XSForm.Tag := poswait;
|
|
|
if TipDir then
|
|
|
XSForm.Top := screen.Height - XSForm.Height - UpDown1.Position + poswait * 65
|
|
|
else
|
|
|
XSForm.Top := screen.Height - XSForm.Height - UpDown1.Position - poswait * 65;
|
|
|
|
|
|
x := 0;
|
|
|
XSForm.StartXTimer;
|
|
|
Result := XSForm;
|
|
|
except end;
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.closeBtnClick(Sender: TObject);
|
|
|
begin
|
|
|
close
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.applyBtnClick(Sender: TObject);
|
|
|
var
|
|
|
ini: TIniFile;
|
|
|
x: integer;
|
|
|
begin
|
|
|
if (not trystrtoint(Edit2.Text, x)) and (Edit2.Text <> '') then
|
|
|
begin
|
|
|
MessageBox(0, '<27><> <20><> <20><>', '<27><>', 0);
|
|
|
exit;
|
|
|
end;
|
|
|
|
|
|
ini := TIniFile.Create(userpath + 'Pic-Is-Big-Set.ini');
|
|
|
ini.WriteString('Settings', 'UseProxy', booltostr(CheckBox1.Checked));
|
|
|
ini.WriteString('Settings', 'UseAuth', booltostr(CheckBox2.Checked));
|
|
|
ini.WriteString('Settings', 'ShowProgress', booltostr(CheckBox4.Checked));
|
|
|
ini.WriteString('Settings', 'NoPartCount', booltostr(CheckBox5.Checked));
|
|
|
ini.WriteString('Settings', 'Host', Edit1.Text);
|
|
|
ini.WriteString('Settings', 'Port', Edit2.Text);
|
|
|
ini.WriteString('Settings', 'Login', Edit3.Text);
|
|
|
ini.WriteString('Settings', 'Password', XorEncode('picisbigkey', Edit4.Text));
|
|
|
ini.WriteString('Settings', 'TipPosition', IntToStr(UpDown1.Position));
|
|
|
ini.WriteString('Settings', 'TipPos', BoolToIntStr(TipPos));
|
|
|
ini.WriteString('Settings', 'TipDir', BoolToIntStr(TipDir));
|
|
|
ini.WriteString('Settings', 'WinOrMenu', IntToStr(RadioGroup1.ItemIndex));
|
|
|
ini.Free;
|
|
|
|
|
|
setfrm.OnCreate(nil);
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.FormCreate(Sender: TObject);
|
|
|
var
|
|
|
ini: TIniFile;
|
|
|
begin
|
|
|
Application.ShowHint := true;
|
|
|
Application.HintPause := 200;
|
|
|
Application.HintHidePause := 10000;
|
|
|
ini := TIniFile.Create(userpath + 'Pic-Is-Big-Set.ini');
|
|
|
UpDown1.Position := StrToInt(ini.ReadString('Settings', 'TipPosition', '150'));
|
|
|
TipPos := StrToBool(ini.ReadString('Settings', 'TipPos', '0'));
|
|
|
TipDir := StrToBool(ini.ReadString('Settings', 'TipDir', '0'));
|
|
|
CheckBox1.Checked := StrToBool(ini.ReadString('Settings', 'UseProxy', '0'));
|
|
|
CheckBox2.Checked := StrToBool(ini.ReadString('Settings', 'UseAuth', '0'));
|
|
|
CheckBox4.Checked := StrToBool(ini.ReadString('Settings', 'ShowProgress', '-1'));
|
|
|
CheckBox5.Checked := StrToBool(ini.ReadString('Settings', 'NoPartCount', '-1'));
|
|
|
Edit1.Text := ini.ReadString('Settings', 'Host', '');
|
|
|
Edit2.Text := ini.ReadString('Settings', 'Port', '');
|
|
|
Edit3.Text := ini.ReadString('Settings', 'Login', '');
|
|
|
Edit4.Text := XorDecode('picisbigkey', ini.ReadString('Settings', 'Password', ''));
|
|
|
RadioGroup1.ItemIndex := StrToInt(ini.ReadString('Settings', 'WinOrMenu', '0'));
|
|
|
ini.Free;
|
|
|
|
|
|
Icons.GetIcon(0, Image5.Picture.Icon);
|
|
|
Glyphs.GetIcon(4, test.Picture.Icon);
|
|
|
Glyphs.GetIcon(8, TestPopup.Picture.Icon);
|
|
|
|
|
|
if TipPos then
|
|
|
begin
|
|
|
Glyphs.GetIcon(1, tbTipPos.Picture.Icon);
|
|
|
tbTipPos.Tag := 1;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Glyphs.GetIcon(0, tbTipPos.Picture.Icon);
|
|
|
tbTipPos.Tag := 0;
|
|
|
end;
|
|
|
|
|
|
if TipDir then
|
|
|
begin
|
|
|
Glyphs.GetIcon(2, tbTipDir.Picture.Icon);
|
|
|
tbTipDir.Tag := 2;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Glyphs.GetIcon(3, tbTipDir.Picture.Icon);
|
|
|
tbTipDir.Tag := 3;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
|
|
begin
|
|
|
if Key = VK_ESCAPE then
|
|
|
close;
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.FormShow(Sender: TObject);
|
|
|
var
|
|
|
MonNum: integer;
|
|
|
begin
|
|
|
setfrm.OnCreate(nil);
|
|
|
MonNum := screen.MonitorFromWindow(GetForegroundWindow, mdNearest).MonitorNum;
|
|
|
Self.Top := screen.Monitors[MonNum].Top + ((screen.Monitors[MonNum].Height div 2) - (Self.Height div 2));
|
|
|
Self.Left := screen.Monitors[MonNum].Left + ((screen.Monitors[MonNum].Width div 2) - (Self.Width div 2));
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.tbTipPosClick(Sender: TObject);
|
|
|
begin
|
|
|
if tbTipPos.Tag = 0 then
|
|
|
begin
|
|
|
TipPos := true;
|
|
|
Glyphs.GetIcon(1, tbTipPos.Picture.Icon);
|
|
|
tbTipPos.Tag := 1;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
TipPos := false;
|
|
|
Glyphs.GetIcon(0, tbTipPos.Picture.Icon);
|
|
|
tbTipPos.Tag := 0;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.tbTipDirClick(Sender: TObject);
|
|
|
begin
|
|
|
if tbTipDir.Tag = 2 then
|
|
|
begin
|
|
|
TipDir := false;
|
|
|
Glyphs.GetIcon(3, tbTipDir.Picture.Icon);
|
|
|
tbTipDir.Tag := 3;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
TipDir := true;
|
|
|
Glyphs.GetIcon(2, tbTipDir.Picture.Icon);
|
|
|
tbTipDir.Tag := 2;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.TestPopupClick(Sender: TObject);
|
|
|
var
|
|
|
m: integer;
|
|
|
begin
|
|
|
for m := 0 to ListOfForms.count - 1 do
|
|
|
if ListOfForms[m] <> '' then
|
|
|
exit;
|
|
|
|
|
|
LXTForm := setfrm.ShowWait('<27><> JPEG <20><>');
|
|
|
if Assigned(LXTForm) then
|
|
|
begin
|
|
|
LXTForm.procbar.Hide;
|
|
|
LXTForm.proclb.Hide;
|
|
|
LXTForm.procl.Hide;
|
|
|
LXTForm.Label1.Show;
|
|
|
LXTForm.Label1.Tag := Random(100) + 100;
|
|
|
LXTForm.Label2.Tag := Random(100);
|
|
|
LXTForm.Timer2.Enabled := true;
|
|
|
end;
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.testClick(Sender: TObject);
|
|
|
var
|
|
|
http: TidHTTP;
|
|
|
begin
|
|
|
test.Enabled := false;
|
|
|
Timer1.Enabled := true;
|
|
|
Application.ProcessMessages;
|
|
|
|
|
|
http := TidHTTP.Create(nil);
|
|
|
with http do
|
|
|
begin
|
|
|
ConnectTimeout := 7000;
|
|
|
ReadTimeout := 7000;
|
|
|
HandleRedirects := true;
|
|
|
HTTPOptions := [];
|
|
|
Request.UserAgent := 'Mozilla/3.0 (compatible; Kira Desu)';
|
|
|
OnWork := httpWork;
|
|
|
end;
|
|
|
SetProxy(http);
|
|
|
|
|
|
try
|
|
|
http.Head('http://code.highspec.ru');
|
|
|
Timer1.Enabled := false;
|
|
|
test.Enabled := true;
|
|
|
Glyphs.GetIcon(6, test.Picture.Icon);
|
|
|
MessageBox(0, PWideChar('<27><> <20> <20><> <20><> <20><> <20><> <20><> <20><>. <20><> <20><>:'#13#10 +
|
|
|
http.ResponseText), '<27><> <20><>', MB_ICONINFORMATION);
|
|
|
except
|
|
|
Timer1.Enabled := false;
|
|
|
test.Enabled := true;
|
|
|
Glyphs.GetIcon(7, test.Picture.Icon);
|
|
|
MessageBox(0, '<27><> <20><>, <20><> <20><> <20><> <20><>', '<27><> <20><>', MB_ICONINFORMATION);
|
|
|
end;
|
|
|
|
|
|
http.Free;
|
|
|
end;
|
|
|
|
|
|
procedure TFormSet.Timer1Timer(Sender: TObject);
|
|
|
begin
|
|
|
Timer1.Tag := Timer1.Tag + 1;
|
|
|
|
|
|
if Timer1.Tag mod 2 = 0 then
|
|
|
begin
|
|
|
Glyphs.GetIcon(5, test.Picture.Icon);
|
|
|
test.Refresh;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
|
Glyphs.GetIcon(4, test.Picture.Icon);
|
|
|
test.Refresh;
|
|
|
end;
|
|
|
|
|
|
Application.ProcessMessages;
|
|
|
end;
|
|
|
|
|
|
end.
|