From b1993e41ef35eb327e326ee2607736bfb7982154 Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Tue, 17 Dec 2013 12:56:15 +0000 Subject: 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 --- tools/replacer/unit1.pas | 143 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 143 insertions(+) create mode 100644 tools/replacer/unit1.pas (limited to 'tools/replacer/unit1.pas') 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. + -- cgit v1.2.3