kilng 发表于 2009-12-7 11:49:40

CS登陆器有Delphi源码

随意写的一个,基本代码完整,自己还要什么功能自己加吧。
编译环境:WinXp + SP3 + Delphi 7 + FlatStyle 4.42unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, FlatBtns, FlatUtils, FlatBoxs, StdCtrls, shellapi, inifiles, FlatCtrls;

type
TForm1 = class(TForm)
    FlatEdit1: TFlatEdit;
    FlatEdit2: TFlatEdit;
    FlatEdit3: TFlatEdit;
    FlatEdit4: TFlatEdit;
    FlatButton1: TFlatButton;
    FlatButton2: TFlatButton;
    FlatButton3: TFlatButton;
    FlatEdit5: TFlatEdit;
    OpenDialog1: TOpenDialog;
    FlatCheckBox1: TFlatCheckBox;
    FlatCheckBox2: TFlatCheckBox;
    FlatCheckBox3: TFlatCheckBox;
    FlatComboBox1: TFlatComboBox;
    FlatEdit6: TFlatEdit;
    Label1: TLabel;
    FlatRadioButton1: TFlatRadioButton;
    FlatRadioButton2: TFlatRadioButton;
    Label2: TLabel;
    procedure FlatButton1Click(Sender: TObject);
    procedure FlatButton2Click(Sender: TObject);
    procedure FlatButton3Click(Sender: TObject);
    procedure FormCreate(Sender: TObject);
private
    { Private declarations }
public
    { Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FlatButton1Click(Sender: TObject);
begin
if opendialog1.Execute then
begin
FlatEdit4.Text:= opendialog1.FileName;
end;
end;

procedure TForm1.FlatButton2Click(Sender: TObject);
var
Filedir,cstrike,console,S,tmp,accel,parms,spd,Physics,refresh,version: string;
F: TextFile ;
myini: Tinifile;
begin
myini:= Tinifile.Create(ExtractFilePath(Paramstr(0))+'config.ini');
myini.WriteString('config','cstrike',FlatEdit4.Text);
myini.WriteString('config','serverip',FlatEdit5.Text);
myini.WriteString('config','amxxpw',FlatEdit1.Text);
myini.WriteString('config','user',FlatEdit2.Text);
myini.WriteString('config','pass',FlatEdit3.Text);
if FlatCheckBox1.checked then myini.WriteString('other','accel','1') else myini.WriteString('other','accel','0');
if FlatCheckBox2.checked then myini.WriteString('other','parms','1') else myini.WriteString('other','parms','0');
if FlatCheckBox3.checked then myini.WriteString('other','spd','1') else myini.WriteString('other','spd','0');
myini.WriteString('other','Physics',FlatComboBox1.Text);
myini.WriteString('other','refresh',FlatEdit6.Text);
if FlatRadioButton1.Checked then myini.WriteString('other','version','cn') else myini.WriteString('other','version','en');
myini.Destroy;
console:= '';
Filedir:= ExtractFileDir(FlatEdit4.Text);
console:= ' -console';
if FlatCheckBox1.Checked then console:= console + ' -noforcemaccel';
if FlatCheckBox2.Checked then console:= console + ' -noforcemparms';
if FlatCheckBox3.Checked then console:= console + ' -noforcemspd';
if FlatComboBox1.Text= '32位' then console:= console + ' -32bpp' else console:= console + ' -16bpp';
console:= console + ' -freq '+FlatEdit6.Text;
console:= console + ' +connect '+FlatEdit5.Text;
if FlatRadioButton1.Checked then cstrike:= Filedir + '\cstrike_schinese';
if FlatRadioButton2.Checked then cstrike:= Filedir + '\cstrike';
if fileExists(cstrike+'\dingo.cfg') then deleteFile(cstrike+'\dingo.cfg');
AssignFile(F,cstrike+'\dingo.cfg');
rewrite(F);
writeln(F,'name "'+FlatEdit2.Text+'"');
writeln(F,'setinfo '+FlatEdit1.Text+' '+FlatEdit3.Text);
closefile(F);
AssignFile(F,cstrike+'\config.cfg');
Reset(F);
tmp:= '';
while not EOF(F)do
begin
    Readln(F,S); // 读取一行文本
    tmp:= tmp + S;
end;
closefile(F);
if pos('dingo.cfg',tmp)=0 then
begin
    //MessageBox(0,pchar(cstrike),'aaa',mb_okcancel);
    AssignFile(F,cstrike+'\config.cfg');
    Append(F);
    writeln(F,'exec dingo.cfg');
    closefile(F);
end;
ShellExecute(Handle, 'open', PChar(FlatEdit4.Text), PChar(console), nil, SW_SHOW);
end;

procedure TForm1.FlatButton3Click(Sender: TObject);
begin
close;
end;

procedure TForm1.FormCreate(Sender: TObject);
var
myini: Tinifile;
accel,parms,spd,Physics,refresh,version: string;
begin
myini:= Tinifile.Create(ExtractFilePath(Paramstr(0))+'config.ini');
FlatEdit4.Text:= myini.ReadString('config','cstrike','');
FlatEdit5.Text:= myini.ReadString('config','serverip','121.101.211.61:27015');
FlatEdit1.Text:= myini.ReadString('config','amxxpw','');
FlatEdit2.Text:= myini.ReadString('config','user','');
FlatEdit3.Text:= myini.ReadString('config','pass','');
accel:= myini.ReadString('other','accel','1');
parms:= myini.ReadString('other','parms','1');
spd:= myini.ReadString('other','spd','0');
Physics:= myini.ReadString('other','Physics','');
refresh:= myini.ReadString('other','refresh','75');
version:= myini.ReadString('other','version','');
myini.Destroy;
if pos('1',accel)>0 then FlatCheckBox1.checked:= true else FlatCheckBox1.checked:= false;
if pos('1',parms)>0 then FlatCheckBox2.checked:= true else FlatCheckBox2.checked:= false;
if pos('1',spd)>0 then FlatCheckBox3.checked:= true else FlatCheckBox3.checked:= false;
FlatComboBox1.Text:= Physics;
FlatEdit6.Text:= refresh;
if pos('cn',version)>0 then FlatRadioButton1.Checked:= true else FlatRadioButton2.Checked:= true;
//MessageBox(0,pchar(version),'aaa',mb_okcancel);
end;

procedure saveini(co,key,value:string);
var
myini: Tinifile;
begin
myini:= Tinifile.Create(ExtractFilePath(Paramstr(0))+'config.ini');
myini.writestring(co,key,value);
myini.Destroy;
end;

end.

INSUN 发表于 2009-12-7 17:29:37

不下也顶一下。

d4server 发表于 2009-12-7 18:41:34

当然要顶顶

ande598 发表于 2009-12-8 01:43:25

不下也顶一下。

小白 发表于 2009-12-8 04:01:03

楼主奉献精神可佳,不知道支持HL2协议不?

kilng 发表于 2009-12-8 09:32:02

5# 小白

跟协议没关系,运行方式是程序加参数改config,

d4server 发表于 2009-12-8 10:47:20

可不可以改下支持多服务器?

linoff 发表于 2009-12-14 21:42:20

我的天,被扣了两次钱。

starbaby 发表于 2009-12-16 11:27:01

楼主我来下载。。。给你加点人气。。鼓励奉献。。。
虽然俺暂时不需要这东西

qilei518 发表于 2009-12-16 21:00:16

强烈支持!
页: [1] 2 3
查看完整版本: CS登陆器有Delphi源码