unit Unit_SVN2Code;
interface
uses
Winapi.Windows,
Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
Vcl.Graphics,
Vcl.Controls,
Vcl.Forms,
Vcl.Dialogs,
Vcl.StdCtrls,
Vcl.Buttons, addons;
/// this file is with SVN key words, it is changed by SVN with very update / commit
const SVNINFO='
C:\.....\svn_infot.txt';
/// This file is written and contains the SVN info now as a pascal file
NEWPASFILE='
C:\....\svn_info.inc';
type
TMainForm =
class(TForm)
edt_svninfofile: TEdit;
edt_newpascalfile: TEdit;
btn_writeIncludeFile: TBitBtn;
procedure FormCreate(Sender: TObject);
procedure btn_writeIncludeFileClick(Sender: TObject);
procedure FormShow(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
MainForm: TMainForm;
implementation
{$R *.dfm}
procedure TMainForm.btn_writeIncludeFileClick(Sender: TObject);
var Infile : TStringList;
OutFile : TStringList;
WordList: TStringList;
i : Integer;
begin
Infile :=TStringList.Create;
OutFile :=TStringList.Create;
Infile.LoadFromFile(SVNINFO);
OutFile.Add('
/// -------------------------------------');
OutFile.Add('
/// automatic generated include file ');
OutFile.Add('
/// -------------------------------------');
OutFile.Add('
CONST');
for I := 0
to Infile.Count-1
do
begin
WordList:=TStringList.Create;
StringToWordList(Infile[i], WordList);
case i
of
0: OutFile.Add('
SVN_REVISION='+'
''
'+WordList[1]+'
''
;');
1: OutFile.Add('
SVN_AUTHOR='+'
''
'+WordList[1]+'
''
;');
2: OutFile.Add('
SVN_DATE='+'
''
'+WordList[1]+'
''
;');
else
OutFile.Add('
/// -------------------------------------');
end;
end;
OutFile.SaveToFile(NEWPASFILE);
end;
procedure TMainForm.FormCreate(Sender: TObject);
begin
edt_svninfofile.Text := SVNINFO;
edt_newpascalfile.Text := NEWPASFILE;
end;
procedure TMainForm.FormShow(Sender: TObject);
begin
/// form 5 sec anzeigen
Sleep(5000);
/// datei schreiben
btn_writeIncludeFileClick(Sender);
/// fertig
Close;
end;
end.