?? cs_settings.pas
字號:
unit CS_Settings;
interface
uses Registry, SysUtils, Classes;
Type
CSRegSettings=class
private
CSRegPath: String;
Reg:TRegistry;
function GetResWidth:Integer;
procedure SetResWidth(RWidth:Integer);
function GetResHeight:Integer;
procedure SetResHeight(RHeight:Integer);
function GetWindowMode:Boolean;
procedure SetWindowMode(WMode:Boolean);
function GetCDKey:String;
procedure SetCDKey(KeyStr:String);
public
constructor Create(RtlVer:Boolean); //是否 RETAIL 版
destructor Destroy;override;
property ResWidth:Integer read GetResWidth write SetResWidth;
property ResHeight:Integer read GetResHeight write SetResHeight;
property WindowMode:Boolean read GetWindowMode write SetWindowMode;
property CDKey:String read GetCDKey write SetCDKey;
end;
CSCfgSettings=class
private
sFilename:string;
Cont:TStringList;
Valid:Boolean;
function LocateIdent(Ident:string):Integer;
function Read:string;
procedure Write(Value:string);
public
constructor Create(Filename:string);
destructor Destroy;override;
function GetKey(KeyName:string):string;
procedure SetKey(KeyName:string;Action:string);
function GetCVar(VarName:string):string;
procedure SetCVar(VarName:string;Value:string);
procedure Save;
end;
CSCmdLineSettings=class
public
Console:Boolean;
NoIpx:Boolean;
NoJoy:Boolean;
NumericPing:Boolean;
Zone4096:Boolean;
D3d:Boolean;
GL:Boolean;
bpp32:Boolean;
noforcemaccel:Boolean;
noforcemparms:Boolean;
noforcemspd:Boolean;
Rcon_Password:String;
HeapSize:String;
Connect:String;
Password:String;
function GetString:String;
end;
const
RtlRegPath:String='\Software\Valve\CounterStrike\Settings';
ModRegPath:String='\Software\Valve\Half-Life\Settings';
implementation
{ CSRegSettings }
constructor CSRegSettings.Create(RtlVer: Boolean);
begin
if RtlVer then CSRegPath:=RtlRegPath else CSRegPath:=ModRegPath;
Reg:=TRegistry.Create ;
Reg.OpenKey(CSRegPath,True);
end;
destructor CSRegSettings.Destroy;
begin
Reg.Free ;
inherited;
end;
function CSRegSettings.GetCDKey: String;
begin
Result:=Reg.ReadString('Key');
end;
function CSRegSettings.GetResHeight: Integer;
begin
Result:=Reg.ReadInteger('EngineModeH');
end;
function CSRegSettings.GetResWidth: Integer;
begin
Result:=Reg.ReadInteger('EngineModeW');
end;
function CSRegSettings.GetWindowMode: Boolean;
begin
if Reg.ReadInteger('EngineModeWindowed')=1 then
Result:=True
else
Result:=False;
end;
procedure CSRegSettings.SetCDKey(KeyStr: String);
begin
Reg.WriteString('Key',KeyStr);
end;
procedure CSRegSettings.SetResHeight(RHeight: Integer);
begin
Reg.WriteInteger('EngineModeModeH',RHeight);
end;
procedure CSRegSettings.SetResWidth(RWidth: Integer);
begin
Reg.WriteInteger('EngineModeModeW',RWidth);
end;
procedure CSRegSettings.SetWindowMode(WMode: Boolean);
begin
if WMode then
Reg.WriteInteger('EngineModeWindowed',1)
else
Reg.WriteInteger('EngineModeWindowed',0);
end;
{ CSCmdLineSettings }
function CSCmdLineSettings.GetString: String;
Var
Str:string;
begin
if console then Str:=Str+' -console';
if noipx then Str:=Str+' -noipx';
if nojoy then Str:=Str+' -nojoy';
if numericping then Str:=Str+' -numericping';
if zone4096 then Str:=Str+' -zone 4096';
if bpp32 then Str:=Str+' -32bpp';
if noforcemaccel then Str:=Str+' -noforcemaccel';
if noforcemparms then Str:=Str+' -noforcemparms';
if noforcemspd then Str:=Str+' -noforcemspd';
if Trim(HeapSize)<>'' then Str:=Str+' -heapsize "'+Trim(HeapSize)+'"';
if Trim(Password)<>'' then Str:=Str+' +password "'+Trim(Password)+'"';
if Trim(RCon_Password)<>'' then Str:=Str+' +rcon_password "'+Trim(RCon_Password)+'"';
if Trim(Connect)<>'' then Str:=Str+' +connect '+Trim(Connect);
if GL then
begin
D3d:=False;
Str:=Str+' -gl';
end;
if D3d then
begin
Str:=Str+' -D3d';
end;
Result:=Str;
end;
{ CSCfgSettings }
constructor CSCfgSettings.Create(Filename: string);
begin
Cont:=TStringList.Create ;
try
Cont.LoadFromFile(Filename);
Valid:=True;
sFilename:=Filename;
except
cont.Free ;
Valid:=False;
raise Exception.Create('Could not LOAD file: "'+Filename+'"');
end;
end;
destructor CSCfgSettings.Destroy;
begin
Cont.Free ;
inherited;
end;
function CSCfgSettings.GetCVar(VarName: string): string;
begin
end;
function CSCfgSettings.GetKey(KeyName: string): string;
begin
end;
function CSCfgSettings.LocateIdent(Ident:string): Integer;
begin
end;
function CSCfgSettings.Read: string;
begin
end;
procedure CSCfgSettings.Save;
begin
try
Cont.SaveToFile(sFilename);
except
raise Exception.Create('Could not SAVE file: "'+sFilename+'"');
end;
end;
procedure CSCfgSettings.SetCVar(VarName, Value: string);
begin
end;
procedure CSCfgSettings.SetKey(KeyName, Action: string);
begin
end;
procedure CSCfgSettings.Write(Value: string);
begin
end;
end.
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -