summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
Diffstat (limited to 'tools')
-rw-r--r--tools/replacer/replacer.icobin0 -> 15086 bytes
-rw-r--r--tools/replacer/replacer.lpi91
-rw-r--r--tools/replacer/replacer.lpr21
-rw-r--r--tools/replacer/replacer.lps57
-rw-r--r--tools/replacer/unit1.lfm50
-rw-r--r--tools/replacer/unit1.pas143
6 files changed, 362 insertions, 0 deletions
diff --git a/tools/replacer/replacer.ico b/tools/replacer/replacer.ico
new file mode 100644
index 0000000000..e5fe684d9c
--- /dev/null
+++ b/tools/replacer/replacer.ico
Binary files differ
diff --git a/tools/replacer/replacer.lpi b/tools/replacer/replacer.lpi
new file mode 100644
index 0000000000..4441bbc3e7
--- /dev/null
+++ b/tools/replacer/replacer.lpi
@@ -0,0 +1,91 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <Version Value="9"/>
+ <PathDelim Value="\"/>
+ <General>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <Title Value="replacer"/>
+ <ResourceType Value="res"/>
+ <UseXPManifest Value="True"/>
+ <Icon Value="0"/>
+ </General>
+ <i18n>
+ <EnableI18N LFM="False"/>
+ </i18n>
+ <VersionInfo>
+ <StringTable ProductVersion=""/>
+ </VersionInfo>
+ <BuildModes Count="1">
+ <Item1 Name="Default" Default="True"/>
+ </BuildModes>
+ <PublishOptions>
+ <Version Value="2"/>
+ <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+ <ExcludeFileFilter Value="*.(bak|ppu|o|so);*~;backup"/>
+ </PublishOptions>
+ <RunParams>
+ <local>
+ <FormatVersion Value="1"/>
+ </local>
+ </RunParams>
+ <RequiredPackages Count="1">
+ <Item1>
+ <PackageName Value="LCL"/>
+ </Item1>
+ </RequiredPackages>
+ <Units Count="2">
+ <Unit0>
+ <Filename Value="replacer.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="replacer"/>
+ </Unit0>
+ <Unit1>
+ <Filename Value="unit1.pas"/>
+ <IsPartOfProject Value="True"/>
+ <ComponentName Value="Form1"/>
+ <HasResources Value="True"/>
+ <ResourceBaseClass Value="Form"/>
+ <UnitName Value="Unit1"/>
+ </Unit1>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="11"/>
+ <PathDelim Value="\"/>
+ <Target>
+ <Filename Value="replacer"/>
+ </Target>
+ <SearchPaths>
+ <IncludeFiles Value="$(ProjOutDir)"/>
+ <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
+ </SearchPaths>
+ <Linking>
+ <Options>
+ <Win32>
+ <GraphicApplication Value="True"/>
+ </Win32>
+ </Options>
+ </Linking>
+ <Other>
+ <CompilerMessages>
+ <MsgFileName Value=""/>
+ </CompilerMessages>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+ <Debugging>
+ <Exceptions Count="3">
+ <Item1>
+ <Name Value="EAbort"/>
+ </Item1>
+ <Item2>
+ <Name Value="ECodetoolError"/>
+ </Item2>
+ <Item3>
+ <Name Value="EFOpenError"/>
+ </Item3>
+ </Exceptions>
+ </Debugging>
+</CONFIG>
diff --git a/tools/replacer/replacer.lpr b/tools/replacer/replacer.lpr
new file mode 100644
index 0000000000..f81d096866
--- /dev/null
+++ b/tools/replacer/replacer.lpr
@@ -0,0 +1,21 @@
+program replacer;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Interfaces, // this includes the LCL widgetset
+ Forms, Unit1
+ { you can add units after this };
+
+{$R *.res}
+
+begin
+ RequireDerivedFormResource := True;
+ Application.Initialize;
+ Application.CreateForm(TForm1, Form1);
+ Application.Run;
+end.
+
diff --git a/tools/replacer/replacer.lps b/tools/replacer/replacer.lps
new file mode 100644
index 0000000000..fd1bcc394f
--- /dev/null
+++ b/tools/replacer/replacer.lps
@@ -0,0 +1,57 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <ProjectSession>
+ <PathDelim Value="\"/>
+ <Version Value="9"/>
+ <BuildModes Active="Default"/>
+ <Units Count="2">
+ <Unit0>
+ <Filename Value="replacer.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="replacer"/>
+ <UsageCount Value="20"/>
+ </Unit0>
+ <Unit1>
+ <Filename Value="unit1.pas"/>
+ <IsPartOfProject Value="True"/>
+ <ComponentName Value="Form1"/>
+ <HasResources Value="True"/>
+ <ResourceBaseClass Value="Form"/>
+ <UnitName Value="Unit1"/>
+ <IsVisibleTab Value="True"/>
+ <EditorIndex Value="0"/>
+ <WindowIndex Value="0"/>
+ <TopLine Value="1"/>
+ <CursorPos X="1" Y="3"/>
+ <UsageCount Value="20"/>
+ <Loaded Value="True"/>
+ <LoadedDesigner Value="True"/>
+ </Unit1>
+ </Units>
+ <General>
+ <ActiveWindowIndexAtStart Value="0"/>
+ </General>
+ <JumpHistory Count="5" HistoryIndex="4">
+ <Position1>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="22" Column="2" TopLine="8"/>
+ </Position1>
+ <Position2>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="50" Column="3" TopLine="27"/>
+ </Position2>
+ <Position3>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="140" Column="5" TopLine="113"/>
+ </Position3>
+ <Position4>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="31" Column="1" TopLine="17"/>
+ </Position4>
+ <Position5>
+ <Filename Value="unit1.pas"/>
+ <Caret Line="59" Column="36" TopLine="38"/>
+ </Position5>
+ </JumpHistory>
+ </ProjectSession>
+</CONFIG>
diff --git a/tools/replacer/unit1.lfm b/tools/replacer/unit1.lfm
new file mode 100644
index 0000000000..e4aacdd189
--- /dev/null
+++ b/tools/replacer/unit1.lfm
@@ -0,0 +1,50 @@
+object Form1: TForm1
+ Left = 292
+ Height = 275
+ Top = 179
+ Width = 362
+ Caption = 'Miranda NG Langpack Tools: Replacer'
+ ClientHeight = 275
+ ClientWidth = 362
+ LCLVersion = '1.0.14.0'
+ object CheckListBox1: TCheckListBox
+ Left = 8
+ Height = 208
+ Top = 64
+ Width = 347
+ ItemHeight = 0
+ TabOrder = 0
+ end
+ object Edit1: TEdit
+ Left = 8
+ Height = 21
+ Top = 8
+ Width = 280
+ TabOrder = 1
+ end
+ object Button1: TButton
+ Left = 296
+ Height = 21
+ Top = 8
+ Width = 59
+ Caption = 'Find'
+ OnClick = Button1Click
+ TabOrder = 2
+ end
+ object Edit2: TEdit
+ Left = 8
+ Height = 21
+ Top = 36
+ Width = 280
+ TabOrder = 3
+ end
+ object Button2: TButton
+ Left = 296
+ Height = 21
+ Top = 36
+ Width = 59
+ Caption = 'Replace'
+ OnClick = Button2Click
+ TabOrder = 4
+ end
+end
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.
+