diff options
author | Vadim Dashevskiy <watcherhd@gmail.com> | 2013-12-17 12:56:15 +0000 |
---|---|---|
committer | Vadim Dashevskiy <watcherhd@gmail.com> | 2013-12-17 12:56:15 +0000 |
commit | b1993e41ef35eb327e326ee2607736bfb7982154 (patch) | |
tree | ad3b9449c041519bd0d8b6fa34bf42c915452f60 /tools/replacer/unit1.pas | |
parent | df1bdfee3a692232d91a4a07c525d9f3664813dc (diff) |
source code of replacer.exe - http://forum.miranda-ng.org/index.php?topic=117.0
git-svn-id: http://svn.miranda-ng.org/main/trunk@7263 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'tools/replacer/unit1.pas')
-rw-r--r-- | tools/replacer/unit1.pas | 143 |
1 files changed, 143 insertions, 0 deletions
diff --git a/tools/replacer/unit1.pas b/tools/replacer/unit1.pas new file mode 100644 index 0000000000..48fb0f9e03 --- /dev/null +++ b/tools/replacer/unit1.pas @@ -0,0 +1,143 @@ +unit Unit1;
+
+
+
+interface
+
+uses
+ Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
+ CheckLst;
+
+type
+
+ { TForm1 }
+
+ TForm1 = class(TForm)
+ Button1: TButton;
+ Button2: TButton;
+ CheckListBox1: TCheckListBox;
+ Edit1: TEdit;
+ Edit2: TEdit;
+ procedure Button1Click(Sender: TObject);
+ procedure Button2Click(Sender: TObject);
+
+ private
+ { private declarations }
+ public
+ { public declarations }
+ end;
+
+var
+
+ Form1: TForm1;
+ d:tsearchrec;
+ a:TStringList;
+ langs:TStringList;
+ i,j:integer;
+ s:string;
+ r,t:integer;
+
+
+implementation
+
+{$R *.lfm}
+
+{ TForm1 }
+
+procedure TForm1.Button1Click(Sender: TObject);
+begin
+ CheckListBox1.Items.clear;
+ langs:=TstringList.Create;
+ r:=findfirst(extractfilePath(application.exename)+'*',faanyfile,d);
+ while r = 0 do
+ begin
+ if ((d.attr and fadirectory)=fadirectory)
+ and ((d.name='.')or(d.name='..')) then
+ begin r:=findnext(d); continue; end;
+ if ((d.attr and fadirectory)=fadirectory)
+ and (fileexists(extractfilepath(application.exename)+
+ '/'+d.name+'/=HEAD=.txt')) then
+ begin
+ langs.Add(d.name);
+ end;
+ r:=FindNext(d);
+ end;
+FindClose(d);
+
+
+for i := 0 to langs.Count-1 do
+begin
+ a:=TstringList.Create;
+ if fileexists(extractfilepath(application.exename)+langs[i]+'/'+'=CORE=.txt') then
+ begin
+ a.LoadFromFile(extractfilepath(application.exename)+langs[i]+'/'+'=CORE=.txt');
+ for j := 0 to a.count-1 do
+ if a[j]=edit1.text then
+ begin
+ CheckListBox1.Items.Add(langs[i]+'/'+'=CORE=.txt');
+ break;
+ end;
+
+ end;
+ a.Free;
+
+ r:=FindFirst(ExtractFilePath(Application.ExeName)+'/'
++langs[i]+'/plugins/*.txt', faAnyFile, d);
+ while r = 0 do
+ begin
+ a:=TstringList.Create;
+ a.LoadFromFile(extractfilepath(application.exename)
+ +'/'+langs[i]+'/'+'plugins/'+d.name);
+ for j := 0 to a.count-1 do
+ if a[j]=edit1.text then
+ begin
+ CheckListBox1.Items.Add(langs[i]+'/'+'plugins/'+d.name);
+ break;
+ end;
+ a.free;
+ r:=FindNext(d);
+ end;
+ FindClose(d);
+
+r:=FindFirst(ExtractFilePath(Application.ExeName)+'/'
++langs[i]+'/weather/*.txt', faAnyFile, d);
+ while r = 0 do
+ begin
+ a:=TstringList.Create;
+ a.LoadFromFile(extractfilepath(application.exename)
+ +'/'+langs[i]+'/'+'weather/'+d.name);
+ for j := 0 to a.count-1 do
+ if a[j]=edit1.text then
+ begin
+ CheckListBox1.Items.Add(langs[i]+'/'+'plugins/'+d.name);
+ break;
+ end;
+ a.free;
+ r:=FindNext(d);
+ end;
+ FindClose(d);
+
+end;
+
+for i := 0 to CheckListBox1.Count-1 do
+ CheckListBox1.Checked[i]:=true;
+
+end;
+
+procedure TForm1.Button2Click(Sender: TObject);
+begin
+ for i := 0 to CheckListBox1.Count-1 do
+ if CheckListBox1.Checked[i]=true then
+ begin
+ a:=TstringList.Create;
+ a.LoadFromFile(extractfilepath(application.exename)
+ +'/'+CheckListBox1.Items[i]);
+ for j := 1 to a.Count-1 do
+ if a[j]=edit1.text then a[j]:=edit2.text;
+ a.SaveToFile(extractfilepath(application.exename)
+ +'/'+CheckListBox1.Items[i]);
+ end;
+end;
+
+end.
+
|