Develop and Download Open Source Software

Browse CVS Repository

Annotation of /gikonavigoeson/gikonavi/AbonUnit.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.15 - (hide annotations) (download) (as text)
Thu Sep 18 12:06:46 2003 UTC (20 years, 7 months ago) by h677
Branch: MAIN
CVS Tags: b41, b40
Changes since 1.14: +12 -16 lines
File MIME type: text/x-pascal
NULLワード回避のつもりがレス絞込みで障害が出たので元に戻した

1 h677 1.1 unit AbonUnit;
2    
3     interface
4     uses
5 h677 1.2 Windows,Messages, ShellAPI, SysUtils, Classes,StdCtrls,StrUtils;
6 h677 1.1
7     type
8 h677 1.11 TIndiviAbon = record
9     Res: Integer;
10     option: Integer; // 0:?? 1:??絽吾???若?若??
11     end;
12    
13 h677 1.1 TAbon = class(TObject)
14     private
15     { Private 絎h? }
16     Froot : String;
17 h677 1.9 Flistpath : String;
18 h677 1.1 FNGwordpath : String;
19 h677 1.2 Ftokens : array of array of string;
20 h677 1.11 FAbonRes : array of TIndiviAbon;
21 h677 1.1 FAbonString : String;
22 h677 1.2 FCutoffNum : Integer; //?????遺札筝??g??????????怨???NG???若????????
23 h677 1.3 FDeleterlo : Boolean; //&rlo;????????
24     FReplaceul :Boolean ; //<ul>?帥?違??<br>?帥?違??舟????????
25     FReverse : Boolean ; //NG???若???с?????若?????????????荵≪????????
26     FAbonPopupRes : Boolean; //???鴻???????≪?????????????若?若????????
27     FCreateNGwordFile : Boolean; //??絎???????path??G???若??txt???<???c??????????????????????????
28 h677 1.9 FNGwordFileIndex : Integer; //?上????粋昭???с??NG???若????list???茵?????
29     FNGwordname : String; //?上????粋昭???с??NG???若????;腓阪??
30 h677 1.11 FIndividualFileName : String; //???ャ???若?????????<?ゃ????
31 h677 1.1 procedure SetTokens(index: integer ; argline:String);
32 h677 1.9 function Getlistpath() : String;
33     procedure Setlistpath(const Value : String);
34     function LoadListFile(path :String;listStringList : TStringList) : Boolean;
35 h677 1.10 function ReadNGwordslist(line : Integer) : Boolean;
36 h677 1.11 function LoadFromSetResNumFile(SetResNumFile : String) : Boolean;
37 h677 1.1 public
38     { Public 絎h? }
39     constructor Create; // ?潟?潟?鴻????????/span>
40     destructor Destroy; override; // ???鴻????????/span>
41 h677 1.3 property Deleterlo: Boolean read FDeleterlo write FDeleterlo default false;
42     property Replaceul: Boolean read FReplaceul write FReplaceul default false;
43     property Reverse: Boolean read FReverse write FReverse default false;
44 h677 1.4 property CreateNGwordFile: Boolean read FCreateNGwordFile write FCreateNGwordFile;
45 h677 1.3 property AbonString : String read FAbonString write FAbonString;
46     property AbonPopupRes : Boolean read FAbonPopupRes write FAbonPopupRes default false;
47 h677 1.9 property listpath : String read Getlistpath write Setlistpath;
48     property NGwordFileIndex : Integer read FNGwordFileIndex write FNGwordFileIndex default 0;
49     property NGwordname : String read FNGwordname write FNGwordname;
50 h677 1.1 procedure Setroot(root :String);
51     function Getroot() : String;
52 h677 1.9
53     function Getfullpath(argpath : String) : String;
54 h677 1.1 procedure SetNGwordpath(path :String);
55     function GetNGwordpath() : String;
56     function LoadFromNGwordFile(path :String) : Boolean;
57     function ReLoadFromNGwordFile() : Boolean;
58 yoffy 1.6 procedure LoadFromStringList( bufstl : TStringList );
59 h677 1.3 function CheckAbonPopupRes(line : String) :Boolean;
60 h677 1.1 function FindNGwords(line : String) : Boolean; //1???ゃ?潟???ょ????
61 h677 1.3 function Cutoff(line : String) : Boolean; //CutOff?や札筝??????????掩?違??筝????с??????true
62 h677 1.11 //???若????????(NG???若???с?????c???帥???潟??
63 h677 1.7 procedure Execute(var ThreadStrings : TStringList); overload;
64     procedure Execute(var ThreadStrings : TStringList; NGwords : TStringList); overload;
65     procedure Execute(var ThreadStrings : TStringList; NGwords : TStrings); overload;
66 h677 1.11 //???ャ???若??????????
67     procedure IndividualAbon(var ThreadStrings : TStringList; SetResNumFile : String);
68     procedure AddIndividualAbon( ResNum : Integer ; option : Integer);
69     procedure DeleteIndividualAbon( ResNum : Integer);
70     function GetAbonResCount() : Integer;
71     function GetAbonResString(Num : Integer) : String;
72 h677 1.12 function CheckIndividualAbonList(ResNum : Integer) : Boolean;
73 h677 1.1 //--
74     function ExecuteFile(datfilepath : String; NGwordpath : String) : Boolean; overload;//DAT???<?ゃ?????眼????????
75     function ExecuteFile(datfilepath : String; resnum : Integer) : Boolean; overload; //DAT???<?ゃ?????眼????????
76     function ExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean; overload; //DAT???<?ゃ?????眼????????
77     function ReverseExecuteFile(datfilepath : String) : Boolean; overload; //DAT???<?ゃ?????眼????????
78     function ReverseExecuteFile(datfilepath : String; resnum : Integer) : Boolean; overload; //DAT???<?ゃ?????眼????????
79     function ReverseExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean; overload; //DAT???<?ゃ?????眼????????
80     //--
81     procedure EditNGwords(); //NGword.txt???????
82     function ShowAllTokens() : String; //???????亥??/span>
83 h677 1.9 //--
84     procedure GoHome();//List???茵?????茯???
85     function GoForward() : Boolean; //List????ゆ???G???若?????<?ゃ????茯??粋昭??
86     function GoBack() : Boolean; //List????ゅ????G???若?????<?ゃ????茯??粋昭??
87 h677 1.1 end;
88     var
89     Abon1 :TAbon;
90 h677 1.9 const
91     NGwordListFileName : String = 'NGwords.list';
92 h677 1.1
93     implementation
94    
95     constructor TAbon.Create;
96     begin
97     // ??????
98     FAbonString := '&nbsp;<>&nbsp;<>&nbsp;<>&nbsp;&nbsp;<><>';
99 h677 1.4 FCreateNGwordFile := true;
100 h677 1.11 SetLength(FAbonRes,1);
101     FAbonRes[0].Res := 0;
102     FAbonRes[0].option := -1;
103    
104 h677 1.1 end;
105    
106     destructor TAbon.Destroy;
107     begin
108     inherited;
109     end;
110 h677 1.9 //root??xe\config\NGwords????????
111 h677 1.1 procedure TAbon.Setroot(root :String);
112 h677 1.9 var
113     bufStringList : TStringList;
114 h677 1.1 begin
115 h677 1.9 bufStringList := TStringList.Create;
116     try
117     if not DirectoryExists(root) then begin
118     CreateDir(root);
119     end;
120     if root[Length(root)] <> '\' then begin
121     root := root + '\';
122     end;
123     Flistpath := root + NGwordListFileName;
124     LoadListFile(Flistpath, bufStringList);
125     finally
126     bufStringList.Free;
127     end;
128 h677 1.1 Froot := root;
129     end;
130     function TAbon.Getroot() : String;
131     begin
132     Result := Froot;
133     end;
134     //NGwordpath??Gword.txt??????????/span>
135     procedure TAbon.SetNGwordpath(path :String);
136     begin
137 h677 1.9 FNGwordpath := Getfullpath(path);
138 h677 1.1 LoadFromNGwordFile(FNGwordpath);
139     end;
140     function TAbon.GetNGwordpath() : String;
141     begin
142     Result := FNGwordpath;
143     end;
144 h677 1.9 //???????鴻?с???????違???????鴻???????????
145     function TAbon.Getfullpath(argpath : String) : String;
146     begin
147     if AnsiPos(':\',argpath) <> 2 then begin //?????ゃ???????????????鴻???<??????/span>
148     if Getroot() = '' then begin
149     Result := ''; //root???鴻??荐??????????????腥冴??????
150     end else begin
151     if (Froot[Length(Froot)] = '\') and (argpath[1] = '\') then begin //????????????/span>
152     Delete(argpath,1,1);
153     end;
154     Insert( Getroot(), argpath , 1);//root???鴻???水??/span>
155     Result := argpath;
156     end;
157     end else begin
158     Result := argpath;
159     end;
160    
161     end;
162 h677 1.1 //NGword???<?ゃ??????粋昭??/span>
163     function TAbon.LoadFromNGwordFile(path :String) : boolean;
164     var
165     bufstl : TStringList;
166     begin
167 h677 1.9 path := Getfullpath(path);
168     if path = '' then begin
169     Result := false;
170     end else begin
171     bufstl := TStringList.Create;
172     try
173     try
174     bufstl.LoadFromFile(path);
175     LoadFromStringList( bufstl );
176     Result := true;
177     except
178     if CreateNGwordFile = true then begin
179     bufstl.SaveToFile(path);
180     end;
181     Result := false;
182 h677 1.1 end;
183 h677 1.9 finally
184     bufstl.Free;
185 h677 1.1 end;
186     end;
187 yoffy 1.6
188     end;
189     //NGword???鴻??茯??粋昭??/span>
190     procedure TAbon.LoadFromStringList( bufstl : TStringList );
191     var
192     i : integer;
193     begin
194     try
195 h677 1.3 for i := bufstl.Count -1 downto 0 do begin
196     if bufstl.Strings[i] = '' then begin
197     bufstl.Delete(i);
198     end;
199     end;
200 h677 1.2 SetLength(Ftokens,bufstl.Count);
201 h677 1.1 for i := 0 to bufstl.Count -1 do begin
202     SetTokens(i , bufstl.Strings[i]);
203     end;
204    
205     except
206     Exit;
207     end;
208     end;
209     //NGwordpath???≪??┃絎??????????????????????若?????∽??/span>
210     function TAbon.ReLoadFromNGwordFile() : boolean;
211     begin
212     if GetNGwordpath() ='' then begin
213     Result := false;
214     end else begin
215     Result := LoadFromNGwordFile( GetNGwordpath() );
216     end;
217     end;
218 h677 1.9 function TAbon.Getlistpath() : String;
219     begin
220     Result := Flistpath;
221     end;
222     procedure TAbon.Setlistpath(const Value : String);
223     begin
224     Flistpath := Getfullpath(Value);
225     end;
226 h677 1.1 //筝?茵???賢?????若???潟?????????????祉????
227     procedure TAbon.SetTokens(index: integer ; argline : String);
228     var
229     ret : Integer;
230     bufstl : TStringList;
231     i : Integer;
232 h677 1.14 pos : Integer;
233     buftoken : String;
234 h677 1.1 begin
235 h677 1.14 pos := 0;
236 h677 1.1 bufstl := TStringList.Create;
237 h677 1.14 try
238     if Length(argline) > 0 then begin
239     pos := AnsiPos(#9,argline);
240     while pos <> 0 DO begin
241     buftoken := Copy(argline,1,pos-1);
242     Delete(argline,1,pos);
243     if Length(buftoken) > 0 then begin
244     bufstl.Append(buftoken);
245     end;
246     pos := AnsiPos(#9,argline);
247     end;
248     if Length(argline) > 0 then begin
249     bufstl.Append(argline);
250     end;
251     ret := bufstl.Count;
252     SetLength(Ftokens[index],ret);
253     for i := 0 to bufstl.Count - 1 do begin
254     Ftokens[index][i] := bufstl.Strings[i];
255     end;
256     end;
257     finally
258     bufstl.Free;
259 h677 1.1 end;
260    
261     end;
262 h677 1.8 //Debug???<??????G???若?????障??????????
263 h677 1.1 function TAbon.ShowAllTokens() : String;
264     var
265     i : Integer;
266     j : Integer;
267     ret : String;
268     begin
269 h677 1.2 for i := 0 to High(Ftokens) do begin
270     for j := 0 to High(Ftokens[i]) do begin
271     ret := ret + Ftokens[i][j];
272 h677 1.1 end;
273     end;
274     Result := ret;
275    
276    
277    
278     end;
279    
280     //****************************************************************************//
281     //NG???若???????障????????true??菴?????
282     function TAbon.FindNGwords(line : String) : Boolean;
283     var
284 h677 1.11 lines : Integer;
285     cells : Integer;
286 h677 1.1 hit : Boolean;
287 h677 1.11 bufline : String;
288 h677 1.1 begin
289     hit := false;
290     if AnsiPos(FAbonString,line) <> 1 then begin
291 h677 1.11 for lines := 0 to High(Ftokens) do begin
292 h677 1.15 hit := true;
293     bufline := line;
294     for cells := 0 to High(Ftokens[lines]) do begin
295     if AnsiPos(Ftokens[lines][cells],bufline) = 0 then begin
296     hit := false;
297     break;
298     end else begin
299     Delete(bufline,AnsiPos(Ftokens[lines][cells],bufline),Length(Ftokens[lines][cells]));
300     end;
301     end;
302     if hit = true then begin
303     break;
304 h677 1.1 end;
305     end;
306     end;
307     Result := hit;
308    
309     end;
310 h677 1.3 //CutOff?や札筝??????????掩?違??筝????с??????true
311     function TAbon.Cutoff(line : String) : Boolean;
312 h677 1.2 var
313     i : Integer;
314     sheed : AnsiChar;
315     buf : String;
316 h677 1.3 ret : Bool;
317 h677 1.2 begin
318 h677 1.3 ret := false;
319 h677 1.2 if FCutoffNum <> 0 then begin
320     for i := 65 to 90 do begin
321     sheed := Chr(i);
322     buf := DupeString(sheed, FCutoffNum);
323     if AnsiContainsText(line, buf) = true then begin
324 h677 1.3 ret := true;
325 h677 1.2 break;
326     end;
327     end;
328     end;
329     Result := ret;
330     end;
331 h677 1.1 //??鮎?????若???ゃ??rue??????NG???若??????????????????菴?????
332 h677 1.7 procedure TAbon.Execute(var ThreadStrings : TStringList);
333 h677 1.1 var
334     i : Integer;
335 h677 1.2 bufline : String;
336     begin
337 h677 1.7 //FRetStrings.Clear;
338 h677 1.1
339 h677 1.7 for i:=0 to ThreadStrings.Count - 1 do begin
340     if FindNGwords(ThreadStrings.Strings[i]) <> Reverse then begin
341     ThreadStrings.Strings[i] := FAbonString;
342     end else begin
343     bufline := ThreadStrings.Strings[i];
344     if Deleterlo = true then begin
345     bufline := AnsiReplaceText( bufline,'&rlo;','' );
346 h677 1.1 end;
347 h677 1.7 if Replaceul = true then begin
348     bufline := AnsiReplaceText( bufline,'<ul>','<br>' );
349     bufline := AnsiReplaceText( bufline,'</ul>','<br>' );
350 h677 1.1 end;
351 h677 1.7 ThreadStrings.Strings[i] := bufline;
352 h677 1.1 end;
353 h677 1.7 end;
354 h677 1.1
355     end;
356 h677 1.7 procedure TAbon.Execute(var ThreadStrings : TStringList; NGwords : TStringList);
357 h677 1.1 var
358     i : Integer;
359     begin
360 h677 1.2 SetLength(Ftokens,NGwords.Count);
361 h677 1.1 for i := 0 to NGwords.Count -1 do begin
362     SetTokens(i , NGwords.Strings[i]);
363     end;
364 h677 1.7 Execute(ThreadStrings);
365 h677 1.1
366     end;
367 h677 1.7 procedure TAbon.Execute(var ThreadStrings : TStringList; NGwords : TStrings);
368 h677 1.1 var
369     i : Integer;
370     buf : TStringList;
371     begin
372     buf := TStringList.Create;
373     buf.AddStrings(NGwords);
374 h677 1.2 SetLength(Ftokens,buf.Count);
375 h677 1.1 for i := 0 to buf.Count -1 do begin
376     SetTokens(i , buf.Strings[i]);
377     end;
378 h677 1.7 Execute(ThreadStrings);
379 h677 1.1 buf.Free;
380     end;
381    
382    
383     //****************************************************************************//
384     //DAT???眼????????絅眼??===========================================================
385     //NG???若???????????鴻???????????若?若?????水??/span>
386     function TAbon.ExecuteFile(datfilepath : String; NGwordpath : String) : Boolean; //DAT???<?ゃ?????眼????????
387     var
388     datstl : TStringList;
389     ret : Boolean;
390     i : Integer;
391     begin
392     datstl := TStringList.Create;
393     ret := true;
394     try
395     try
396     datstl.LoadFromFile(datfilepath);
397     for i := 0 to datstl.Count -1 do begin
398     if FindNGwords(datstl.Strings[i]) = true then begin
399     datstl.Strings[i] := FAbonString + datstl.Strings[i]
400     end;
401     end;
402    
403     datstl.SaveToFile(datfilepath);
404     except
405     ret := false;
406     end;
407     finally
408     datstl.Free;
409     end;
410     Result := ret;
411    
412     end;
413     //??絎??????????合?????????????若?若???水??/span>
414     function TAbon.ExecuteFile(datfilepath : String; resnum : Integer) : Boolean; //DAT???<?ゃ?????眼????????
415     var
416     datstl : TStringList;
417     ret : Boolean;
418     begin
419     ret := true;
420     datstl := TStringList.Create;
421     try
422     try
423     datstl.LoadFromFile(datfilepath);
424     if (resnum > 0) and (resnum <= datstl.Count) then begin
425     if AnsiPos(FAbonString, datstl.Strings[resnum-1]) <> 1 then begin
426     datstl.Strings[resnum-1] := FAbonString + datstl.Strings[resnum-1];
427     end;
428     end;
429     datstl.SaveToFile(datfilepath);
430     except
431     ret := false;
432     end;
433     finally
434     datstl.Free;
435     end;
436     Result := ret;
437     end;
438     //firstres????count???????鴻???????????若?若???水??/span>
439     function TAbon.ExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean; //DAT???<?ゃ?????眼????????
440     var
441     datstl : TStringList;
442     i : Integer;
443     endnum : Integer; //腟?????????合??/span>
444     ret : Boolean;
445     begin
446     ret := true;
447     datstl := TStringList.Create;
448     try
449     try
450     datstl.LoadFromFile(datfilepath);
451     if (firstres > 0) and (firstres <= datstl.Count) then begin
452     if firstres + count -1 > datstl.Count then begin
453     endnum := datstl.Count;
454     end else if count <= 0 then begin
455     endnum := firstres + 1;
456     end else begin
457     endnum := firstres + count -1;
458     end;
459    
460     for i := firstres to endnum do begin
461     if AnsiPos(FAbonString, datstl.Strings[i-1]) <> 1 then begin
462     datstl.Strings[i-1] := FAbonString + datstl.Strings[i-1];
463     end;
464     end;
465     end;
466     datstl.SaveToFile(datfilepath);
467     except
468     ret := false;
469     end;
470     finally
471     datstl.Free;
472     end;
473     Result := ret;
474     end;
475     //DAT???眼????????絅眼??==========?????障??========================================
476    
477     //?????祉??絅眼??==================================================================
478     function TAbon.ReverseExecuteFile(datfilepath : String) : Boolean; //DAT???<?ゃ?????眼????????
479     var
480     datstl : TStringList;
481     i : Integer;
482     buf : String;
483     ret : Boolean;
484     begin
485     ret := true;
486     datstl := TStringList.Create;
487     try
488     try
489     datstl.LoadFromFile(datfilepath);
490     for i:=0 to datstl.Count -1 do begin
491     if AnsiPos(FAbonString, datstl.Strings[i]) = 1 then begin
492     buf := datstl.Strings[i];
493     Delete(buf,1,Length(FAbonString));
494     datstl.Strings[i] := buf;
495     end;
496     end;
497     datstl.SaveToFile(datfilepath);
498     except
499     ret := false;
500     end;
501     finally
502     datstl.Free;
503     end;
504     Result := ret;
505    
506     end;
507     function TAbon.ReverseExecuteFile(datfilepath : String; resnum : Integer) : Boolean; //DAT???<?ゃ?????眼????????
508     var
509     datstl : TStringList;
510     buf : String;
511     ret : Boolean;
512     begin
513     ret := true;
514     datstl := TStringList.Create;
515     try
516     try
517     datstl.LoadFromFile(datfilepath);
518     if (resnum > 0) and (resnum <= datstl.Count) then begin
519     if AnsiPos(FAbonString, datstl.Strings[resnum-1]) = 1 then begin
520     buf := datstl.Strings[resnum-1];
521     Delete(buf,1,Length(FAbonString));
522     datstl.Strings[resnum-1] := buf;
523     end;
524     end;
525     datstl.SaveToFile(datfilepath);
526     except
527     ret := false;
528     end;
529     finally
530     datstl.Free;
531     end;
532     Result := ret;
533    
534     end;
535     function TAbon.ReverseExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean;//DAT???<?ゃ?????眼????????
536     var
537     datstl : TStringList;
538     i : Integer;
539     endnum : Integer; //腟?????????合??/span>
540     buf : String;
541     ret : Boolean;
542     begin
543     ret := true;
544     datstl := TStringList.Create;
545     try
546     try
547     datstl.LoadFromFile(datfilepath);
548     if (firstres > 0) and (firstres <= datstl.Count) then begin
549     if firstres + count -1 > datstl.Count then begin
550     endnum := datstl.Count;
551     end else if count <= 0 then begin
552     endnum := firstres + 1;
553     end else begin
554     endnum := firstres + count -1;
555     end;
556     for i := firstres to endnum do begin
557     if AnsiPos(FAbonString, datstl.Strings[i-1]) = 1 then begin
558     buf := datstl.Strings[i-1];
559     Delete(buf,1,Length(FAbonString));
560     datstl.Strings[i-1] := buf;
561     end;
562     end;
563     end;
564     datstl.SaveToFile(datfilepath);
565     except
566     ret := false;
567     end;
568     finally
569     datstl.Free;
570     end;
571     Result := ret;
572     end;
573     //?????祉??絅眼??=================?????障??========================================
574     //?上???祉??????????????NGword.txt??????span>
575     procedure TAbon.EditNGwords();
576     begin
577     ShellExecute(0 ,nil,PChar(FNGwordpath),nil,nil,SW_SHOW);
578     end;
579 h677 1.12 //???????≪???????ゅ??∽??/span>
580 h677 1.3 function TAbon.CheckAbonPopupRes(line : String) :Boolean;
581 h677 1.9 begin
582     if AbonPopupRes = true then begin
583     Result := FindNGwords(line);
584     end else begin
585     Result := false;
586     end;
587     end;
588 h677 1.10 //茲??違??G???若???????鴻????茯??粋昭??==============================================
589 h677 1.9 //List???<?ゃ????茯??粋昭??
590     function TAbon.LoadListFile(path :String; listStringList : TStringList) : Boolean;
591     begin
592     try
593     listStringList.LoadFromFile(path);
594     Result := true;
595     except
596     listStringList.Append('筝???NGword.txt');
597     listStringList.SaveToFile(path);
598     Result := false;
599     end;
600     end;
601     //List????ゆ???G???若?????<?ゃ????茯??粋昭??
602     function TAbon.GoForward() : Boolean;
603 h677 1.10 begin
604     FNGwordFileIndex := FNGwordFileIndex + 1;
605     Result := ReadNGwordslist(FNGwordFileIndex);
606     end;
607     //List????ゅ????G???若?????<?ゃ????茯??粋昭??
608     function TAbon.GoBack() : Boolean;
609     begin
610     FNGwordFileIndex := FNGwordFileIndex -1;
611     Result := ReadNGwordslist(FNGwordFileIndex);
612     end;
613     //List???茵?????茯???
614     procedure TAbon.GoHome();
615     begin
616     FNGwordFileIndex := 0;
617     ReadNGwordslist(FNGwordFileIndex);
618     end;
619     //List??ine茵?????茯???
620     function TAbon.ReadNGwordslist(line : Integer) : Boolean;
621 h677 1.3 var
622 h677 1.9 liststl : TStringList;
623     linebuf : String;
624 h677 1.3 begin
625 h677 1.9 liststl := TStringList.Create;
626     try
627     if LoadListFile(Flistpath,liststl) = true then begin
628 h677 1.10 if line < 0 then begin
629     line := liststl.Count - 1;
630     FNGwordFileIndex := liststl.Count - 1;
631     end else if line > liststl.Count - 1 then begin
632     line := 0;
633 h677 1.9 FNGwordFileIndex := 0;
634     end;
635 h677 1.10 linebuf := liststl.Strings[line];
636 h677 1.9 FNGwordname := Copy(linebuf,1,AnsiPos('=',linebuf)-1);
637     Delete(linebuf,1,AnsiPos('=',linebuf));
638     SetNGwordpath(linebuf);
639     Result := true;
640 h677 1.3 end else begin
641     Result := false;
642 h677 1.9 end
643     finally
644     liststl.Free;
645 h677 1.3 end;
646 h677 1.9
647     end;
648 h677 1.10 //茲??違??G???若???????鴻????茯??粋昭??=====?????障??================================
649 h677 1.11 //???ャ???若????絎?茵??∽??/span>
650     procedure TAbon.IndividualAbon(var ThreadStrings : TStringList; SetResNumFile : String);
651     var
652     i : Integer;
653     begin
654     if FileExists(SetResNumFile) = true then begin
655     if LoadFromSetResNumFile(SetResNumFile) = true then begin
656     for i := 0 to High(FAbonRes) do begin
657     if (FAbonRes[i].Res <= ThreadStrings.Count) and (FAbonRes[i].Res > 0) then begin
658     if FAbonRes[i].option = 0 then begin
659     ThreadStrings.Strings[FAbonRes[i].Res-1] := '';
660     end else begin
661 hi_ 1.13 ThreadStrings.Strings[FAbonRes[i].Res-1] := '???若????<>???若????<>???若????<>???若????<>';
662 h677 1.11 end;
663     end;
664    
665     end;
666     end;
667     end else begin
668     FIndividualFileName := SetResNumFile;
669     SetLength(FAbonRes,1);
670     FAbonRes[0].Res := 0;
671     FAbonRes[0].option := -1;
672     end;
673     end;
674     //???ャ???若???????<?ゃ????粋昭?翠?∽??/span>
675     function TAbon.LoadFromSetResNumFile(SetResNumFile : String) : Boolean;
676     var
677     bufStringList : TStringList;
678     bufLine : String;
679     i : Integer;
680     begin
681     bufStringList := TStringList.Create;
682     try
683     try
684     bufStringList.LoadFromFile(SetResNumFile);
685     FIndividualFileName := SetResNumFile;
686     //腥肴?????/span>
687     for i := bufStringList.Count-1 downto 0 do begin
688     if bufStringList.Strings[i] = '' then begin
689     bufStringList.Delete(i);
690     end;
691     end;
692    
693     //?<?≪??∈篆?
694     SetLength(FAbonRes,bufStringList.Count);
695     //篁e??/span>
696     for i :=0 to bufStringList.Count - 1 do begin
697     bufLine := Trim(bufStringList.Strings[i]);
698     FAbonRes[i].Res := StrToInt(Copy(bufLine,1,AnsiPos('-',bufLine)-1));
699     FAbonRes[i].option := StrToInt(Copy(bufLine,AnsiPos('-',bufLine)+1,1));
700     end;
701     except
702     Result := false;
703     Exit;
704     end;
705     finally
706     bufStringList.Free;
707     end;
708     Result := true;
709     end;
710     //???ャ???若???????<?ゃ????申??
711     procedure TAbon.AddIndividualAbon( ResNum : Integer ; option : Integer);
712     var
713     IndividualFile : TStringList;
714     linebuf : String;
715     i : Integer;
716     begin
717     IndividualFile := TStringList.Create;
718     if FAbonRes[0].Res <> 0 then begin
719     for i := 0 to High(FAbonRes) do begin
720     if FAbonRes[i].Res <> ResNum then begin
721     linebuf := IntToStr(FAbonRes[i].Res) + '-' + IntToStr(FabonRes[i].option);
722     IndividualFile.Append(linebuf);
723     end;
724     end;
725     end;
726     linebuf := IntToStr(ResNum) + '-' + IntToStr(option);
727     IndividualFile.Append(linebuf);
728     try
729     IndividualFile.SaveToFile(FIndividualFileName);
730     finally
731     IndividualFile.Free;
732     end;
733     end;
734     //???ャ???若???????<?ゃ??????????/span>
735     procedure TAbon.DeleteIndividualAbon( ResNum : Integer);
736     var
737     IndividualFile : TStringList;
738     linebuf : String;
739     i : Integer;
740     begin
741     IndividualFile := TStringList.Create;
742     if FAbonRes[0].Res <> 0 then begin
743     for i := 0 to High(FAbonRes) do begin
744     if FAbonRes[i].Res <> ResNum then begin
745     linebuf := IntToStr(FAbonRes[i].Res) + '-' + IntToStr(FabonRes[i].option);
746     IndividualFile.Append(linebuf);
747     end;
748     end;
749     end;
750     if IndividualFile.Count <> 0 then begin
751     try
752     IndividualFile.SaveToFile(FIndividualFileName);
753     finally
754     IndividualFile.Free;
755     end;
756     end else begin
757     if FileExists(FIndividualFileName) = true then begin
758     DeleteFile(FIndividualFileName);
759     end;
760     end;
761     end;
762     //???ャ???若?????????鴻???????違??菴???
763     function TAbon.GetAbonResCount() : Integer;
764 h677 1.12 var
765     i : Integer;
766 h677 1.11 begin
767 h677 1.12 if FAbonRes[0].Res = 0 then begin
768     Result := 0
769     end else begin
770     i := High(FAbonRes);
771     Result := i+1;
772     end;
773 h677 1.11 end;
774     //???ャ???若?????????鴻?????茵????????鴻????絖????ц???
775     function TAbon.GetAbonResString(Num : Integer) : String;
776     begin
777 h677 1.12 if (Num <= High(FAbonRes)) and (Num >= 0) then begin
778 h677 1.11 Result := IntToStr(FAbonRes[Num].Res);
779     end else begin
780     Result := '';
781     end;
782 h677 1.12 end;
783     //???????≪???????ゅ???/span>
784     function TAbon.CheckIndividualAbonList(ResNum : Integer) : Boolean;
785     var
786     i : Integer;
787     begin
788     if FAbonRes[0].Res <> 0 then begin
789     for i := 0 to High(FAbonRes) do begin
790     if FAbonRes[i].Res = ResNum then begin
791     Result := true;
792     Exit;
793     end;
794     end;
795     end;
796     Result := false;
797    
798 h677 1.11 end;
799 h677 1.1 end.
800    

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26