5 Windows,Messages, ShellAPI, SysUtils, Classes,StdCtrls,StrUtils;
13 Ftokens : array of array of string;
15 FRetStrings : TStringList;
16 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é
17 procedure SetTokens(index: integer ; argline:String);
21 constructor Create; //
\83R
\83\93\83X
\83g
\83\89\83N
\83^
22 destructor Destroy; override; //
\83f
\83X
\83g
\83\89\83N
\83^
24 procedure Setroot(root :String);
25 function Getroot() : String;
26 procedure SetNGwordpath(path :String);
27 function GetNGwordpath() : String;
28 procedure SetCutoffNum(value : Integer);
29 function GetCutoffNum() : Integer;
30 function LoadFromNGwordFile(path :String) : Boolean;
31 function ReLoadFromNGwordFile() : Boolean;
32 function FindNGwords(line : String) : Boolean; //1
\83\89\83C
\83\93\82¸
\82Â
\97p
\81B
33 function Cutoff(line : String) : String; //CutOff
\92l
\88È
\8fã
\8cÂ
\82Ì
\93¯
\82¶
\89p
\90\94\82ª
\95À
\82ñ
\82Å
\82¢
\82½
\82çtrue
34 //
\82 \82Ú
\81`
\82ñ
\82Ì
\8e\9e\82É
\82Â
\82¢
\82Å
\82É&rlo;
\82ð
\82³
\82
\82é
\81A<ul>
\83^
\83O
\82ð<br>
\83^
\83O
\82É
\92u
\8a·
\82·
\82é
\82©
\81A
\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
35 function Execute(DestStrings : TStringList; deleterlo : Boolean; replaceul :Boolean ; reverse : Boolean) : TStringList; overload;
36 function Execute(DestStrings : TStringList; NGwords : TStringList ; deleterlo : Boolean; replaceul :Boolean ;reverse : Boolean) : TStringList; overload;
37 function Execute(DestStrings : TStringList; NGwords : TStrings ; deleterlo : Boolean; replaceul :Boolean ;reverse : Boolean) : TStringList; overload;
39 function ExecuteFile(datfilepath : String; NGwordpath : String) : Boolean; overload;//DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
40 function ExecuteFile(datfilepath : String; resnum : Integer) : Boolean; overload; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
41 function ExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean; overload; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
42 function ReverseExecuteFile(datfilepath : String) : Boolean; overload; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
43 function ReverseExecuteFile(datfilepath : String; resnum : Integer) : Boolean; overload; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
44 function ReverseExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean; overload; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
46 procedure EditNGwords(); //NGword.txt
\82ð
\8aJ
\82
\81B
47 function ShowAllTokens() : String; //
\83f
\83o
\83b
\83O
\97p
54 constructor TAbon.Create;
57 FAbonString := ' <> <> <> <><>';
58 FRetStrings := TStringList.Create;
62 destructor TAbon.Destroy;
70 //root
\82ÍExe
\82Ì
\82¢
\82é
\83t
\83H
\83\8b\83_
71 procedure TAbon.Setroot(root :String);
75 function TAbon.Getroot() : String;
79 //NGwordpath
\82ÍNGword.txt
\82Ì
\83t
\83\8b\83p
\83X
80 procedure TAbon.SetNGwordpath(path :String);
83 LoadFromNGwordFile(FNGwordpath);
85 function TAbon.GetNGwordpath() : String;
87 Result := FNGwordpath;
89 //NGword
\83t
\83@
\83C
\83\8b\82Ì
\93Ç
\82Ý
\8d\9e\82Ý
90 function TAbon.LoadFromNGwordFile(path :String) : boolean;
95 if AnsiPos(':\',path) <> 2 then begin //
\83h
\83\89\83C
\83u
\82©
\82ç
\82Ì
\83t
\83\8b\83p
\83X
\82ª
\96³
\82¯
\82ê
\82Î
96 if Getroot() = '' then begin
97 Result := false; //root
\83p
\83X
\82ª
\90Ý
\92è
\82³
\82ê
\82Ä
\82È
\82¢
\82©
\82çfalse
100 if (Froot[Length(Froot)] = '\') and (path[1] = '\') then begin //
\90æ
\93ª
\82Ì\
\82ð
\8dí
\8f\9c
103 Insert( Getroot(), path , 1);//root
\83p
\83X
\82ð
\91}
\93ü
106 bufstl := TStringList.Create;
108 bufstl.LoadFromFile(path);
109 SetLength(Ftokens,bufstl.Count);
110 for i := 0 to bufstl.Count -1 do begin
111 SetTokens(i , bufstl.Strings[i]);
122 //NGwordpath
\82ª
\8aù
\82É
\90Ý
\92è
\82³
\82ê
\82Ä
\82¢
\82é
\82Æ
\82«
\82Ì
\83\8a\83\8d\81[
\83h
\97p
\8aÖ
\90\94
123 function TAbon.ReLoadFromNGwordFile() : boolean;
125 if GetNGwordpath() ='' then begin
128 Result := LoadFromNGwordFile( GetNGwordpath() );
132 //
\88ê
\8ds
\82Ì
\92\86\82Ì
\83g
\81[
\83N
\83\93\82ð
\90Ø
\82è
\95ª
\82¯
\82Ä
\83Z
\83b
\83g
133 procedure TAbon.SetTokens(index: integer ; argline : String);
136 bufstl : TStringList;
139 bufstl := TStringList.Create;
140 bufstl.Delimiter := #9; //
\8bæ
\90Ø
\82è
\8eq
\82ð
\81f
\83^
\83u
\81f
\82É
\90Ý
\92è
141 bufstl.DelimitedText := argline;
143 SetLength(Ftokens[index],ret);
144 for i := 0 to bufstl.Count - 1 do begin
145 Ftokens[index][i] := bufstl.Strings[i];
150 procedure TAbon.SetCutoffNum(value : Integer);
152 if value > 2 then begin
158 function TAbon.GetCutoffNum() : Integer;
160 Result := FCutoffNum;
162 function TAbon.ShowAllTokens() : String;
168 for i := 0 to High(Ftokens) do begin
169 for j := 0 to High(Ftokens[i]) do begin
170 ret := ret + Ftokens[i][j];
179 //****************************************************************************//
180 //NG
\83\8f\81[
\83h
\82ª
\8aÜ
\82Ü
\82ê
\82Ä
\82½
\82çtrue
\82ð
\95Ô
\82·
\81B
181 function TAbon.FindNGwords(line : String) : Boolean;
188 if AnsiPos(FAbonString,line) <> 1 then begin
189 for i := 0 to High(Ftokens) do begin
191 for j := 0 to High(Ftokens[i]) do begin
192 if AnsiPos(Ftokens[i][j],line) = 0 then begin
197 if hit = true then begin
205 //CutOff
\92l
\88È
\8fã
\8cÂ
\82Ì
\93¯
\82¶
\89p
\90\94\82ª
\95À
\82ñ
\82Å
\82¢
\82½
\82ç
\82 \82Ú
\81`
\82ñ
206 function TAbon.Cutoff(line : String) : String;
214 if FCutoffNum <> 0 then begin
215 for i := 65 to 90 do begin
217 buf := DupeString(sheed, FCutoffNum);
218 if AnsiContainsText(line, buf) = true then begin
226 //
\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
227 function TAbon.Execute(DestStrings : TStringList; deleterlo : Boolean; replaceul :Boolean ;reverse : Boolean) : TStringList;
234 if reverse = false then begin
235 for i:=0 to DestStrings.Count - 1 do begin
236 if FindNGwords(DestStrings.Strings[i]) = true then begin
237 FRetStrings.Append(FAbonString);
239 bufline := DestStrings.Strings[i];
240 if deleterlo = true then begin
241 bufline := AnsiReplaceText( bufline,'&rlo;','' );
243 if replaceul = true then begin
244 bufline := AnsiReplaceText( bufline,'<ul>','<br>' );
245 bufline := AnsiReplaceText( bufline,'</ul>','<br>' );
247 FRetStrings.Append(bufline);
251 for i:=0 to DestStrings.Count - 1 do begin
252 if FindNGwords(DestStrings.Strings[i]) = false then begin
253 FRetStrings.Append(FAbonString);
255 bufline := DestStrings.Strings[i];
256 if deleterlo = true then begin
257 while AnsiPos('&rlo',bufline) <> 0 do begin
258 Delete(bufline,AnsiPos('&rlo',bufline),4);
261 if replaceul = true then begin
262 bufline := AnsiReplaceText( bufline,'<ul>','<br>' );
263 bufline := AnsiReplaceText( bufline,'</ul>','<br>' );
265 FRetStrings.Append(bufline);
270 Result := FRetStrings;
273 function TAbon.Execute(DestStrings : TStringList; NGwords : TStringList ; deleterlo : Boolean; replaceul :Boolean ; reverse : Boolean) : TStringList;
277 SetLength(Ftokens,NGwords.Count);
278 for i := 0 to NGwords.Count -1 do begin
279 SetTokens(i , NGwords.Strings[i]);
281 Result := Execute(DestStrings,deleterlo,replaceul,reverse);
284 function TAbon.Execute(DestStrings : TStringList; NGwords : TStrings ; deleterlo : Boolean; replaceul :Boolean ;reverse : Boolean) : TStringList;
289 buf := TStringList.Create;
290 buf.AddStrings(NGwords);
291 SetLength(Ftokens,buf.Count);
292 for i := 0 to buf.Count -1 do begin
293 SetTokens(i , buf.Strings[i]);
295 Result := Execute(DestStrings,deleterlo,replaceul,reverse);
300 //****************************************************************************//
301 //DAT
\82ð
\92¼
\82É
\82¢
\82¶
\82é
\93z
\82ç===========================================================
302 //NG
\83\8f\81[
\83h
\82ð
\8aÜ
\82Þ
\83\8c\83X
\82Ì
\90æ
\93ª
\82É
\82 \82Ú
\81[
\82ñ
\82ð
\91}
\93ü
303 function TAbon.ExecuteFile(datfilepath : String; NGwordpath : String) : Boolean; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
305 datstl : TStringList;
309 datstl := TStringList.Create;
313 datstl.LoadFromFile(datfilepath);
314 for i := 0 to datstl.Count -1 do begin
315 if FindNGwords(datstl.Strings[i]) = true then begin
316 datstl.Strings[i] := FAbonString + datstl.Strings[i]
320 datstl.SaveToFile(datfilepath);
330 //
\8ew
\92è
\82³
\82ê
\82½
\83\8c\83X
\94Ô
\82Ì
\90æ
\93ª
\82É
\82 \82Ú
\81[
\82ñ
\91}
\93ü
331 function TAbon.ExecuteFile(datfilepath : String; resnum : Integer) : Boolean; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
333 datstl : TStringList;
337 datstl := TStringList.Create;
340 datstl.LoadFromFile(datfilepath);
341 if (resnum > 0) and (resnum <= datstl.Count) then begin
342 if AnsiPos(FAbonString, datstl.Strings[resnum-1]) <> 1 then begin
343 datstl.Strings[resnum-1] := FAbonString + datstl.Strings[resnum-1];
346 datstl.SaveToFile(datfilepath);
355 //firstres
\82©
\82çcount
\8cÂ
\82Ì
\83\8c\83X
\82Ì
\90æ
\93ª
\82É
\82 \82Ú
\81[
\82ñ
\91}
\93ü
356 function TAbon.ExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
358 datstl : TStringList;
360 endnum : Integer; //
\8fI
\82í
\82è
\82Ì
\83\8c\83X
\94Ô
364 datstl := TStringList.Create;
367 datstl.LoadFromFile(datfilepath);
368 if (firstres > 0) and (firstres <= datstl.Count) then begin
369 if firstres + count -1 > datstl.Count then begin
370 endnum := datstl.Count;
371 end else if count <= 0 then begin
372 endnum := firstres + 1;
374 endnum := firstres + count -1;
377 for i := firstres to endnum do begin
378 if AnsiPos(FAbonString, datstl.Strings[i-1]) <> 1 then begin
379 datstl.Strings[i-1] := FAbonString + datstl.Strings[i-1];
383 datstl.SaveToFile(datfilepath);
392 //DAT
\82ð
\92¼
\82É
\82¢
\82¶
\82é
\93z
\82ç==========
\82±
\82±
\82Ü
\82Å=========================================
394 //
\8c³
\82É
\96ß
\82·
\93z
\82ç==================================================================
395 function TAbon.ReverseExecuteFile(datfilepath : String) : Boolean; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
397 datstl : TStringList;
403 datstl := TStringList.Create;
406 datstl.LoadFromFile(datfilepath);
407 for i:=0 to datstl.Count -1 do begin
408 if AnsiPos(FAbonString, datstl.Strings[i]) = 1 then begin
409 buf := datstl.Strings[i];
410 Delete(buf,1,Length(FAbonString));
411 datstl.Strings[i] := buf;
414 datstl.SaveToFile(datfilepath);
424 function TAbon.ReverseExecuteFile(datfilepath : String; resnum : Integer) : Boolean; //DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
426 datstl : TStringList;
431 datstl := TStringList.Create;
434 datstl.LoadFromFile(datfilepath);
435 if (resnum > 0) and (resnum <= datstl.Count) then begin
436 if AnsiPos(FAbonString, datstl.Strings[resnum-1]) = 1 then begin
437 buf := datstl.Strings[resnum-1];
438 Delete(buf,1,Length(FAbonString));
439 datstl.Strings[resnum-1] := buf;
442 datstl.SaveToFile(datfilepath);
452 function TAbon.ReverseExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean;//DAT
\83t
\83@
\83C
\83\8b\82ð
\92¼
\82É
\82¢
\82¶
\82é
454 datstl : TStringList;
456 endnum : Integer; //
\8fI
\82í
\82è
\82Ì
\83\8c\83X
\94Ô
461 datstl := TStringList.Create;
464 datstl.LoadFromFile(datfilepath);
465 if (firstres > 0) and (firstres <= datstl.Count) then begin
466 if firstres + count -1 > datstl.Count then begin
467 endnum := datstl.Count;
468 end else if count <= 0 then begin
469 endnum := firstres + 1;
471 endnum := firstres + count -1;
473 for i := firstres to endnum do begin
474 if AnsiPos(FAbonString, datstl.Strings[i-1]) = 1 then begin
475 buf := datstl.Strings[i-1];
476 Delete(buf,1,Length(FAbonString));
477 datstl.Strings[i-1] := buf;
481 datstl.SaveToFile(datfilepath);
490 //
\8c³
\82É
\96ß
\82·
\93z
\82ç=================
\82±
\82±
\82Ü
\82Å=========================================
491 //
\8c»
\8dÝ
\83Z
\83b
\83g
\82³
\82ê
\82Ä
\82¢
\82éNGword.txt
\82ð
\8aJ
\82
492 procedure TAbon.EditNGwords();
494 ShellExecute(0 ,nil,PChar(FNGwordpath),nil,nil,SW_SHOW);