?? calcvb.pas
字號:
unit CalcVb;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics,
Forms, Controls, Calculate;
type
TCalcVb = class(TCalculate)
private
function GetLineCountForFrmFile(Lines: TStrings): integer;
public
constructor Create;
destructor Destroy; override;
function GetFileList(List: TStrings): boolean; override;
function GetLineCount(List: TStrings; Ret: TStrings): integer; override;
end;
implementation
constructor TCalcVb.Create;
begin
inherited Create;
end;
destructor TCalcVb.Destroy;
begin
inherited Destroy;
end;
function TCalcVb.GetLineCountForFrmFile(Lines: TStrings): integer;
var
i: integer;
begin
for i := Lines.Count - 1 downto 0 do
begin
if Pos('Attribute VB_', Lines[i]) = 1 then
begin
Result := Lines.Count - i;
exit;
end;
end;
Result := 0;
end;
function TCalcVb.GetFileList(List: TStrings): boolean;
var
Lines: TStrings;
i, j: integer;
LineStr, FileName: string;
Path: string;
begin
Result := true;
Path := ExtractFilePath(FPrjFilename);
List.Clear;
Lines := TStringList.Create;
try
Lines.LoadFromFile(FPrjFileName);
for i := 0 to Lines.Count - 1 do
begin
LineStr := UpperCase(Lines[i]);
j := Pos('FORM=', LineStr);
if j = 1 then
begin
FileName := '';
j := j + 5;
FileName := Path + Copy(Lines[i], j, 999);
FileName := ExpandFileName(FileName);
if FileName <> '' then
List.Add(FileName);
end;
j := Pos('CLASS=', LineStr);
if j = 1 then
begin
FileName := '';
j := j + 6;
FileName := Copy(Lines[i], j, 999);
FileName := Copy(FileName, Pos(';', FileName) + 1, 999);
FileName := Path + Trim(FileName);
FileName := ExpandFileName(FileName);
if FileName <> '' then
List.Add(FileName);
end;
j := Pos('MODULE=', LineStr);
if j = 1 then
begin
FileName := '';
j := j + 7;
FileName := Copy(Lines[i], j, 999);
FileName := Copy(FileName, Pos(';', FileName) + 1, 999);
FileName := Path + Trim(FileName);
FileName := ExpandFileName(FileName);
if FileName <> '' then
List.Add(FileName);
end;
end;
except
Result := false;
end;
Lines.Free;
end;
function TCalcVb.GetLineCount(List: TStrings; Ret: TStrings): integer;
var
i, j: integer;
Lines: TStrings;
Ext: string;
begin
Screen.Cursor := crHourGlass;
Lines := TStringList.Create;
Result := 0;
Ret.Clear;
for i := 0 to List.Count - 1 do
begin
try
Ext := UpperCase(ExtractFileExt(List[i]));
Lines.LoadFromFile(List[i]);
if Ext = '.FRM' then
j := GetLineCountForFrmFile(Lines)
else j := Lines.Count;
Inc(Result, j);
Ret.Add(IntToStr(j));
except
end;
end;
Lines.Free;
Screen.Cursor := crDefault;
end;
end.
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -