?? unit1.pas
字號:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Spin;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
GroupBox1: TGroupBox;
SpinEdit1: TSpinEdit;
GroupBox2: TGroupBox;
Label1: TLabel;
Label2: TLabel;
Button2: TButton;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
function ValidFile(cPos:longint):Boolean;
procedure ReadFile(FileName:string;var FileBuffer:string);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
//---------------------------------------------------------STRTOINT
function strtoint(s:string):longint;
var code:integer;
begin
val(s,result,code);
if code<>0 then result:=0;
end;
function TForm1.ValidFile(cPos:longint):Boolean;
var
r: Boolean;
begin
r := cPos > 0;
if not r then
MessageBox(0,PChar('Invalid server or packed files.'), PChar('COLD FUSION'),MB_OK + MB_APPLMODAL);
ValidFile:=r;
end;
procedure TForm1.ReadFile(FileName:string;var FileBuffer:string);
var
F: File of Char;
Buff: array [1..1024] of Char;
r,Len: LongInt;
begin
FileBuffer := '';
AssignFile(F, FileName);
Reset(F);
Len := FileSize(F);
while not Eof(F) do
begin
BlockRead(F, Buff, 1024, r);
FileBuffer := FileBuffer + string(Buff)
end;
CloseFile(F);
if Length(FileBuffer) > Len then
FileBuffer := Copy(FileBuffer, 1, Len);
end;
procedure TForm1.Button1Click(Sender: TObject);
var
S, fContent: String;
p: longint;
begin
if OpenDialog1.Execute then
Edit1.Text := LowerCase(OpenDialog1.FileName);
if OpenDialog1.FileName = '' then exit;
//**********OPEN FILE TO READ**********//
Application.ProcessMessages;
ReadFile(OpenDialog1.FileName, fContent);
//**********READ PAGER SETTINGS**********//
//serverPORT - 5 CHARS
p := Pos('srvprt=',fContent);
if not ValidFile(p) then Exit;
S := Copy(fContent, p + 7, 5);
S := StringReplace(S, '
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -