5 Windows,Messages, ShellAPI, SysUtils, Classes,StdCtrls,StrUtils;
13 Ftokens : array of array of string;
15 FCutoffNum : Integer; //
\82±
\82Ì
\90\94\88È
\8fã
\98A
\91±
\82·
\82é
\93¯
\82¶
\89p
\8e\9a\82ðNG
\83\8f\81[
\83h
\82Æ
\82·
\82é
16 FDeleterlo : Boolean; //&rlo;
\82ð
\8dí
\82é
\82©
17 FReplaceul :Boolean ; //<ul>
\83^
\83O
\82ð<br>
\83^
\83O
\82É
\92u
\8a·
\82·
\82é
\82©
18 FReverse : Boolean ; //NG
\83\8f\81[
\83h
\82Å
\82Ì
\82 \82Ú
\81`
\82ñ
\82Ì
\8c\8b\89Ê
\82ð
\94½
\93]
\82³
\82¹
\82é
\82©
19 FAbonPopupRes : Boolean; //
\83\8c\83X
\83|
\83b
\83v
\83A
\83b
\83v
\82Ì
\8e\9e\82É
\82 \82Ú
\81[
\82ñ
\82·
\82é
\82©
20 FCreateNGwordFile : Boolean; //
\8ew
\92è
\82³
\82ê
\82½path
\82ÉNG
\83\8f\81[
\83htxt
\82ª
\96³
\82©
\82Á
\82½
\82Æ
\82«
\82É
\8e©
\93®
\93I
\82É
\90¶
\90¬
\82·
\82é
\82©
21 procedure SetTokens(index: integer ; argline:String);
25 constructor Create; //
\83R
\83\93\83X
\83g
\83\89\83N
\83^
26 destructor Destroy; override; //
\83f
\83X
\83g
\83\89\83N
\83^
27 property Deleterlo: Boolean read FDeleterlo write FDeleterlo default false;
28 property Replaceul: Boolean read FReplaceul write FReplaceul default false;
29 property Reverse: Boolean read FReverse write FReverse default false;
30 property CreateNGwordFile: Boolean read FCreateNGwordFile write FCreateNGwordFile;
31 property AbonString : String read FAbonString write FAbonString;
32 property AbonPopupRes : Boolean read FAbonPopupRes write FAbonPopupRes default false;
33 procedure Setroot(root :String);
34 function Getroot() : String;
35 procedure SetNGwordpath(path :String);
36 function GetNGwordpath() : String;
37 procedure SetCutoffNum(value : Integer);
38 function GetCutoffNum() : Integer;
39 function LoadFromNGwordFile(path :String) : Boolean;
40 function ReLoadFromNGwordFile() : Boolean;
41 procedure LoadFromStringList( bufstl : TStringList );
42 function CheckAbonPopupRes(line : String) :Boolean;
43 function FindNGwords(line : String) : Boolean; //1
\83\89\83C
\83\93\82¸
\82Â
\97p
\81B
44 function Cutoff(line : String) : Boolean; //CutOff
\92l
\88È
\8fã
\8cÂ
\82Ì
\93¯
\82¶
\89p
\90\94\82ª
\95À
\82ñ
\82Å
\82¢
\82½
\82çtrue
45 //
\82 \82Ú
\81`
\82ñ
\8f\88\97\9d
46 procedure Execute(var ThreadStrings : TStringList); overload;
47 procedure Execute(var ThreadStrings : TStringList; NGwords : TStringList); overload;
48 procedure Execute(var ThreadStrings : TStringList; NGwords : TStrings); overload;
50 function ExecuteFile(datfilepath : String; NGwordpath : String) : Boolean; overload;//DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
51 function ExecuteFile(datfilepath : String; resnum : Integer) : Boolean; overload; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
52 function ExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean; overload; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
53 function ReverseExecuteFile(datfilepath : String) : Boolean; overload; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
54 function ReverseExecuteFile(datfilepath : String; resnum : Integer) : Boolean; overload; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
55 function ReverseExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean; overload; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
57 procedure EditNGwords(); //NGword.txt
\82ð
\8aJ
\82
\81B
58 function ShowAllTokens() : String; //
\83f
\83o
\83b
\83O
\97p
65 constructor TAbon.Create;
68 FAbonString := ' <> <> <> <><>';
69 //FRetStrings := TStringList.Create;
70 FCreateNGwordFile := true;
74 destructor TAbon.Destroy;
82 //root
\82ÍExe
\82Ì
\82¢
\82é
\83t
\83H
\83\8b\83_
83 procedure TAbon.Setroot(root :String);
87 function TAbon.Getroot() : String;
91 //NGwordpath
\82ÍNGword.txt
\82Ì
\83t
\83\8b\83p
\83X
92 procedure TAbon.SetNGwordpath(path :String);
95 LoadFromNGwordFile(FNGwordpath);
97 function TAbon.GetNGwordpath() : String;
99 Result := FNGwordpath;
101 //NGword
\83t
\83@
\83C
\83\8b\82Ì
\93Ç
\82Ý
\8d\9e\82Ý
102 function TAbon.LoadFromNGwordFile(path :String) : boolean;
104 bufstl : TStringList;
107 if AnsiPos(':\',path) <> 2 then begin //
\83h
\83\89\83C
\83u
\82©
\82ç
\82Ì
\83t
\83\8b\83p
\83X
\82ª
\96³
\82¯
\82ê
\82Î
108 if Getroot() = '' then begin
109 Result := false; //root
\83p
\83X
\82ª
\90Ý
\92è
\82³
\82ê
\82Ä
\82È
\82¢
\82©
\82çfalse
112 if (Froot[Length(Froot)] = '\') and (path[1] = '\') then begin //
\90æ
\93ª
\82Ì\
\82ð
\8dí
\8f\9c
115 Insert( Getroot(), path , 1);//root
\83p
\83X
\82ð
\91}
\93ü
118 bufstl := TStringList.Create;
120 bufstl.LoadFromFile(path);
121 LoadFromStringList( bufstl );
124 if CreateNGwordFile = true then begin
125 bufstl.SaveToFile(path);
134 //NGword
\83\8a\83X
\83g
\93Ç
\82Ý
\8d\9e\82Ý
135 procedure TAbon.LoadFromStringList( bufstl : TStringList );
140 for i := bufstl.Count -1 downto 0 do begin
141 if bufstl.Strings[i] = '' then begin
145 SetLength(Ftokens,bufstl.Count);
146 for i := 0 to bufstl.Count -1 do begin
147 SetTokens(i , bufstl.Strings[i]);
154 //NGwordpath
\82ª
\8aù
\82É
\90Ý
\92è
\82³
\82ê
\82Ä
\82¢
\82é
\82Æ
\82«
\82Ì
\83\8a\83\8d\81[
\83h
\97p
\8aÖ
\90\94
155 function TAbon.ReLoadFromNGwordFile() : boolean;
157 if GetNGwordpath() ='' then begin
160 Result := LoadFromNGwordFile( GetNGwordpath() );
164 //
\88ê
\8ds
\82Ì
\92\86\82Ì
\83g
\81[
\83N
\83\93\82ð
\90Ø
\82è
\95ª
\82¯
\82Ä
\83Z
\83b
\83g
165 procedure TAbon.SetTokens(index: integer ; argline : String);
168 bufstl : TStringList;
171 bufstl := TStringList.Create;
172 bufstl.Delimiter := #9; //
\8bæ
\90Ø
\82è
\8eq
\82ð
\81f
\83^
\83u
\81f
\82É
\90Ý
\92è
173 bufstl.DelimitedText := argline;
175 SetLength(Ftokens[index],ret);
176 for i := 0 to bufstl.Count - 1 do begin
177 Ftokens[index][i] := bufstl.Strings[i];
182 procedure TAbon.SetCutoffNum(value : Integer);
184 if value > 0 then begin
190 function TAbon.GetCutoffNum() : Integer;
192 Result := FCutoffNum;
194 function TAbon.ShowAllTokens() : String;
200 for i := 0 to High(Ftokens) do begin
201 for j := 0 to High(Ftokens[i]) do begin
202 ret := ret + Ftokens[i][j];
211 //****************************************************************************//
212 //NG
\83\8f\81[
\83h
\82ª
\8aÜ
\82Ü
\82ê
\82Ä
\82½
\82çtrue
\82ð
\95Ô
\82·
\81B
213 function TAbon.FindNGwords(line : String) : Boolean;
220 if AnsiPos(FAbonString,line) <> 1 then begin
221 for i := 0 to High(Ftokens) do begin
223 for j := 0 to High(Ftokens[i]) do begin
224 if AnsiPos(Ftokens[i][j],line) = 0 then begin
229 if hit = true then begin
237 //CutOff
\92l
\88È
\8fã
\8cÂ
\82Ì
\93¯
\82¶
\89p
\90\94\82ª
\95À
\82ñ
\82Å
\82¢
\82½
\82çtrue
238 function TAbon.Cutoff(line : String) : Boolean;
246 if FCutoffNum <> 0 then begin
247 for i := 65 to 90 do begin
249 buf := DupeString(sheed, FCutoffNum);
250 if AnsiContainsText(line, buf) = true then begin
258 //
\96\96\94ö
\82Ì
\83u
\81[
\83\8b\92l
\82Ítrue
\82¾
\82Æ
\81ANG
\83\8f\81[
\83h
\82ð
\8aÜ
\82Þ
\82à
\82Ì
\82¾
\82¯
\82ð
\95Ô
\82·
\81B
259 procedure TAbon.Execute(var ThreadStrings : TStringList);
267 for i:=0 to ThreadStrings.Count - 1 do begin
268 if FindNGwords(ThreadStrings.Strings[i]) <> Reverse then begin
269 ThreadStrings.Strings[i] := FAbonString;
270 end else if FCutoffNum > 0 then begin
271 bufline := ThreadStrings.Strings[i];
272 for j := 0 to 2 do begin
273 Delete(bufline,1,Ansipos('<>',bufline)+1);
275 Delete(bufline,Ansipos('<>',bufline),Length(bufline)-Ansipos('<>',bufline)+1);
276 if Cutoff(bufline) = true then begin
277 ThreadStrings.Strings[i] := FAbonString;
279 bufline := ThreadStrings.Strings[i];
280 if Deleterlo = true then begin
281 bufline := AnsiReplaceText( bufline,'&rlo;','' );
283 if Replaceul = true then begin
284 bufline := AnsiReplaceText( bufline,'<ul>','<br>' );
285 bufline := AnsiReplaceText( bufline,'</ul>','<br>' );
287 ThreadStrings.Strings[i] := bufline;
290 bufline := ThreadStrings.Strings[i];
291 if Deleterlo = true then begin
292 bufline := AnsiReplaceText( bufline,'&rlo;','' );
294 if Replaceul = true then begin
295 bufline := AnsiReplaceText( bufline,'<ul>','<br>' );
296 bufline := AnsiReplaceText( bufline,'</ul>','<br>' );
298 ThreadStrings.Strings[i] := bufline;
301 //Result := FRetStrings;
304 procedure TAbon.Execute(var ThreadStrings : TStringList; NGwords : TStringList);
308 SetLength(Ftokens,NGwords.Count);
309 for i := 0 to NGwords.Count -1 do begin
310 SetTokens(i , NGwords.Strings[i]);
312 Execute(ThreadStrings);
315 procedure TAbon.Execute(var ThreadStrings : TStringList; NGwords : TStrings);
320 buf := TStringList.Create;
321 buf.AddStrings(NGwords);
322 SetLength(Ftokens,buf.Count);
323 for i := 0 to buf.Count -1 do begin
324 SetTokens(i , buf.Strings[i]);
326 Execute(ThreadStrings);
331 //****************************************************************************//
332 //DAT
\82ð
\92¼
\82É
\82¢
\82¶
\82é
\93z
\82ç===========================================================
333 //NG
\83\8f\81[
\83h
\82ð
\8aÜ
\82Þ
\83\8c\83X
\82Ì
\90æ
\93ª
\82É
\82 \82Ú
\81[
\82ñ
\82ð
\91}
\93ü
334 function TAbon.ExecuteFile(datfilepath : String; NGwordpath : String) : Boolean; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
336 datstl : TStringList;
340 datstl := TStringList.Create;
344 datstl.LoadFromFile(datfilepath);
345 for i := 0 to datstl.Count -1 do begin
346 if FindNGwords(datstl.Strings[i]) = true then begin
347 datstl.Strings[i] := FAbonString + datstl.Strings[i]
351 datstl.SaveToFile(datfilepath);
361 //
\8ew
\92è
\82³
\82ê
\82½
\83\8c\83X
\94Ô
\82Ì
\90æ
\93ª
\82É
\82 \82Ú
\81[
\82ñ
\91}
\93ü
362 function TAbon.ExecuteFile(datfilepath : String; resnum : Integer) : Boolean; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
364 datstl : TStringList;
368 datstl := TStringList.Create;
371 datstl.LoadFromFile(datfilepath);
372 if (resnum > 0) and (resnum <= datstl.Count) then begin
373 if AnsiPos(FAbonString, datstl.Strings[resnum-1]) <> 1 then begin
374 datstl.Strings[resnum-1] := FAbonString + datstl.Strings[resnum-1];
377 datstl.SaveToFile(datfilepath);
386 //firstres
\82©
\82çcount
\8cÂ
\82Ì
\83\8c\83X
\82Ì
\90æ
\93ª
\82É
\82 \82Ú
\81[
\82ñ
\91}
\93ü
387 function TAbon.ExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
389 datstl : TStringList;
391 endnum : Integer; //
\8fI
\82í
\82è
\82Ì
\83\8c\83X
\94Ô
395 datstl := TStringList.Create;
398 datstl.LoadFromFile(datfilepath);
399 if (firstres > 0) and (firstres <= datstl.Count) then begin
400 if firstres + count -1 > datstl.Count then begin
401 endnum := datstl.Count;
402 end else if count <= 0 then begin
403 endnum := firstres + 1;
405 endnum := firstres + count -1;
408 for i := firstres to endnum do begin
409 if AnsiPos(FAbonString, datstl.Strings[i-1]) <> 1 then begin
410 datstl.Strings[i-1] := FAbonString + datstl.Strings[i-1];
414 datstl.SaveToFile(datfilepath);
423 //DAT
\82ð
\92¼
\82É
\82¢
\82¶
\82é
\93z
\82ç==========
\82±
\82±
\82Ü
\82Å=========================================
425 //
\8c³
\82É
\96ß
\82·
\93z
\82ç==================================================================
426 function TAbon.ReverseExecuteFile(datfilepath : String) : Boolean; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
428 datstl : TStringList;
434 datstl := TStringList.Create;
437 datstl.LoadFromFile(datfilepath);
438 for i:=0 to datstl.Count -1 do begin
439 if AnsiPos(FAbonString, datstl.Strings[i]) = 1 then begin
440 buf := datstl.Strings[i];
441 Delete(buf,1,Length(FAbonString));
442 datstl.Strings[i] := buf;
445 datstl.SaveToFile(datfilepath);
455 function TAbon.ReverseExecuteFile(datfilepath : String; resnum : Integer) : Boolean; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
457 datstl : TStringList;
462 datstl := TStringList.Create;
465 datstl.LoadFromFile(datfilepath);
466 if (resnum > 0) and (resnum <= datstl.Count) then begin
467 if AnsiPos(FAbonString, datstl.Strings[resnum-1]) = 1 then begin
468 buf := datstl.Strings[resnum-1];
469 Delete(buf,1,Length(FAbonString));
470 datstl.Strings[resnum-1] := buf;
473 datstl.SaveToFile(datfilepath);
483 function TAbon.ReverseExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean;//DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
485 datstl : TStringList;
487 endnum : Integer; //
\8fI
\82í
\82è
\82Ì
\83\8c\83X
\94Ô
492 datstl := TStringList.Create;
495 datstl.LoadFromFile(datfilepath);
496 if (firstres > 0) and (firstres <= datstl.Count) then begin
497 if firstres + count -1 > datstl.Count then begin
498 endnum := datstl.Count;
499 end else if count <= 0 then begin
500 endnum := firstres + 1;
502 endnum := firstres + count -1;
504 for i := firstres to endnum do begin
505 if AnsiPos(FAbonString, datstl.Strings[i-1]) = 1 then begin
506 buf := datstl.Strings[i-1];
507 Delete(buf,1,Length(FAbonString));
508 datstl.Strings[i-1] := buf;
512 datstl.SaveToFile(datfilepath);
521 //
\8c³
\82É
\96ß
\82·
\93z
\82ç=================
\82±
\82±
\82Ü
\82Å=========================================
522 //
\8c»
\8dÝ
\83Z
\83b
\83g
\82³
\82ê
\82Ä
\82¢
\82éNGword.txt
\82ð
\8aJ
\82
523 procedure TAbon.EditNGwords();
525 ShellExecute(0 ,nil,PChar(FNGwordpath),nil,nil,SW_SHOW);
527 function TAbon.CheckAbonPopupRes(line : String) :Boolean;
531 if FCutoffNum = 0 then begin
532 if AbonPopupRes = true then begin
533 Result := FindNGwords(line);
538 if AbonPopupRes = true then begin
539 Result := FindNGwords(line);
540 if Result = false then begin
541 for i := 0 to 2 do begin
542 Delete(line,1,Ansipos('<>',line)+1);
544 Delete(line,Ansipos('<>',line),Length(line)-Ansipos('<>',line)+1);
545 Result := Cutoff(line);