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.12 - (hide annotations) (download) (as text)
Tue Sep 2 14:45:28 2003 UTC (20 years, 7 months ago) by h677
Branch: MAIN
Changes since 1.11: +27 -2 lines
File MIME type: text/x-pascal
個別あぼーんのバグ修正

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     begin
233     bufstl := TStringList.Create;
234     bufstl.Delimiter := #9; //?阪????絖??????帥??????┃絎?
235     bufstl.DelimitedText := argline;
236     ret := bufstl.Count;
237 h677 1.2 SetLength(Ftokens[index],ret);
238 h677 1.1 for i := 0 to bufstl.Count - 1 do begin
239 h677 1.2 Ftokens[index][i] := bufstl.Strings[i];
240 h677 1.1 end;
241     bufstl.Free;
242    
243     end;
244 h677 1.8 //Debug???<??????G???若?????障??????????
245 h677 1.1 function TAbon.ShowAllTokens() : String;
246     var
247     i : Integer;
248     j : Integer;
249     ret : String;
250     begin
251 h677 1.2 for i := 0 to High(Ftokens) do begin
252     for j := 0 to High(Ftokens[i]) do begin
253     ret := ret + Ftokens[i][j];
254 h677 1.1 end;
255     end;
256     Result := ret;
257    
258    
259    
260     end;
261    
262     //****************************************************************************//
263     //NG???若???????障????????true??菴?????
264     function TAbon.FindNGwords(line : String) : Boolean;
265     var
266 h677 1.11 lines : Integer;
267     cells : Integer;
268 h677 1.1 hit : Boolean;
269 h677 1.11 bufline : String;
270 h677 1.1 begin
271     hit := false;
272     if AnsiPos(FAbonString,line) <> 1 then begin
273 h677 1.11 for lines := 0 to High(Ftokens) do begin
274 h677 1.1 hit := true;
275 h677 1.11 bufline := line;
276     for cells := 0 to High(Ftokens[lines]) do begin
277     if AnsiPos(Ftokens[lines][cells],bufline) = 0 then begin
278 h677 1.1 hit := false;
279     break;
280 h677 1.10 end else begin
281 h677 1.11 Delete(bufline,AnsiPos(Ftokens[lines][cells],bufline),Length(Ftokens[lines][cells]));
282 h677 1.1 end;
283     end;
284     if hit = true then begin
285     break;
286     end;
287     end;
288     end;
289     Result := hit;
290    
291     end;
292 h677 1.3 //CutOff?や札筝??????????掩?違??筝????с??????true
293     function TAbon.Cutoff(line : String) : Boolean;
294 h677 1.2 var
295     i : Integer;
296     sheed : AnsiChar;
297     buf : String;
298 h677 1.3 ret : Bool;
299 h677 1.2 begin
300 h677 1.3 ret := false;
301 h677 1.2 if FCutoffNum <> 0 then begin
302     for i := 65 to 90 do begin
303     sheed := Chr(i);
304     buf := DupeString(sheed, FCutoffNum);
305     if AnsiContainsText(line, buf) = true then begin
306 h677 1.3 ret := true;
307 h677 1.2 break;
308     end;
309     end;
310     end;
311     Result := ret;
312     end;
313 h677 1.1 //??鮎?????若???ゃ??rue??????NG???若??????????????????菴?????
314 h677 1.7 procedure TAbon.Execute(var ThreadStrings : TStringList);
315 h677 1.1 var
316     i : Integer;
317 h677 1.2 bufline : String;
318     begin
319 h677 1.7 //FRetStrings.Clear;
320 h677 1.1
321 h677 1.7 for i:=0 to ThreadStrings.Count - 1 do begin
322     if FindNGwords(ThreadStrings.Strings[i]) <> Reverse then begin
323     ThreadStrings.Strings[i] := FAbonString;
324     end else begin
325     bufline := ThreadStrings.Strings[i];
326     if Deleterlo = true then begin
327     bufline := AnsiReplaceText( bufline,'&rlo;','' );
328 h677 1.1 end;
329 h677 1.7 if Replaceul = true then begin
330     bufline := AnsiReplaceText( bufline,'<ul>','<br>' );
331     bufline := AnsiReplaceText( bufline,'</ul>','<br>' );
332 h677 1.1 end;
333 h677 1.7 ThreadStrings.Strings[i] := bufline;
334 h677 1.1 end;
335 h677 1.7 end;
336 h677 1.1
337     end;
338 h677 1.7 procedure TAbon.Execute(var ThreadStrings : TStringList; NGwords : TStringList);
339 h677 1.1 var
340     i : Integer;
341     begin
342 h677 1.2 SetLength(Ftokens,NGwords.Count);
343 h677 1.1 for i := 0 to NGwords.Count -1 do begin
344     SetTokens(i , NGwords.Strings[i]);
345     end;
346 h677 1.7 Execute(ThreadStrings);
347 h677 1.1
348     end;
349 h677 1.7 procedure TAbon.Execute(var ThreadStrings : TStringList; NGwords : TStrings);
350 h677 1.1 var
351     i : Integer;
352     buf : TStringList;
353     begin
354     buf := TStringList.Create;
355     buf.AddStrings(NGwords);
356 h677 1.2 SetLength(Ftokens,buf.Count);
357 h677 1.1 for i := 0 to buf.Count -1 do begin
358     SetTokens(i , buf.Strings[i]);
359     end;
360 h677 1.7 Execute(ThreadStrings);
361 h677 1.1 buf.Free;
362     end;
363    
364    
365     //****************************************************************************//
366     //DAT???眼????????絅眼??===========================================================
367     //NG???若???????????鴻???????????若?若?????水??/span>
368     function TAbon.ExecuteFile(datfilepath : String; NGwordpath : String) : Boolean; //DAT???<?ゃ?????眼????????
369     var
370     datstl : TStringList;
371     ret : Boolean;
372     i : Integer;
373     begin
374     datstl := TStringList.Create;
375     ret := true;
376     try
377     try
378     datstl.LoadFromFile(datfilepath);
379     for i := 0 to datstl.Count -1 do begin
380     if FindNGwords(datstl.Strings[i]) = true then begin
381     datstl.Strings[i] := FAbonString + datstl.Strings[i]
382     end;
383     end;
384    
385     datstl.SaveToFile(datfilepath);
386     except
387     ret := false;
388     end;
389     finally
390     datstl.Free;
391     end;
392     Result := ret;
393    
394     end;
395     //??絎??????????合?????????????若?若???水??/span>
396     function TAbon.ExecuteFile(datfilepath : String; resnum : Integer) : Boolean; //DAT???<?ゃ?????眼????????
397     var
398     datstl : TStringList;
399     ret : Boolean;
400     begin
401     ret := true;
402     datstl := TStringList.Create;
403     try
404     try
405     datstl.LoadFromFile(datfilepath);
406     if (resnum > 0) and (resnum <= datstl.Count) then begin
407     if AnsiPos(FAbonString, datstl.Strings[resnum-1]) <> 1 then begin
408     datstl.Strings[resnum-1] := FAbonString + datstl.Strings[resnum-1];
409     end;
410     end;
411     datstl.SaveToFile(datfilepath);
412     except
413     ret := false;
414     end;
415     finally
416     datstl.Free;
417     end;
418     Result := ret;
419     end;
420     //firstres????count???????鴻???????????若?若???水??/span>
421     function TAbon.ExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean; //DAT???<?ゃ?????眼????????
422     var
423     datstl : TStringList;
424     i : Integer;
425     endnum : Integer; //腟?????????合??/span>
426     ret : Boolean;
427     begin
428     ret := true;
429     datstl := TStringList.Create;
430     try
431     try
432     datstl.LoadFromFile(datfilepath);
433     if (firstres > 0) and (firstres <= datstl.Count) then begin
434     if firstres + count -1 > datstl.Count then begin
435     endnum := datstl.Count;
436     end else if count <= 0 then begin
437     endnum := firstres + 1;
438     end else begin
439     endnum := firstres + count -1;
440     end;
441    
442     for i := firstres to endnum do begin
443     if AnsiPos(FAbonString, datstl.Strings[i-1]) <> 1 then begin
444     datstl.Strings[i-1] := FAbonString + datstl.Strings[i-1];
445     end;
446     end;
447     end;
448     datstl.SaveToFile(datfilepath);
449     except
450     ret := false;
451     end;
452     finally
453     datstl.Free;
454     end;
455     Result := ret;
456     end;
457     //DAT???眼????????絅眼??==========?????障??========================================
458    
459     //?????祉??絅眼??==================================================================
460     function TAbon.ReverseExecuteFile(datfilepath : String) : Boolean; //DAT???<?ゃ?????眼????????
461     var
462     datstl : TStringList;
463     i : Integer;
464     buf : String;
465     ret : Boolean;
466     begin
467     ret := true;
468     datstl := TStringList.Create;
469     try
470     try
471     datstl.LoadFromFile(datfilepath);
472     for i:=0 to datstl.Count -1 do begin
473     if AnsiPos(FAbonString, datstl.Strings[i]) = 1 then begin
474     buf := datstl.Strings[i];
475     Delete(buf,1,Length(FAbonString));
476     datstl.Strings[i] := buf;
477     end;
478     end;
479     datstl.SaveToFile(datfilepath);
480     except
481     ret := false;
482     end;
483     finally
484     datstl.Free;
485     end;
486     Result := ret;
487    
488     end;
489     function TAbon.ReverseExecuteFile(datfilepath : String; resnum : Integer) : Boolean; //DAT???<?ゃ?????眼????????
490     var
491     datstl : TStringList;
492     buf : String;
493     ret : Boolean;
494     begin
495     ret := true;
496     datstl := TStringList.Create;
497     try
498     try
499     datstl.LoadFromFile(datfilepath);
500     if (resnum > 0) and (resnum <= datstl.Count) then begin
501     if AnsiPos(FAbonString, datstl.Strings[resnum-1]) = 1 then begin
502     buf := datstl.Strings[resnum-1];
503     Delete(buf,1,Length(FAbonString));
504     datstl.Strings[resnum-1] := buf;
505     end;
506     end;
507     datstl.SaveToFile(datfilepath);
508     except
509     ret := false;
510     end;
511     finally
512     datstl.Free;
513     end;
514     Result := ret;
515    
516     end;
517     function TAbon.ReverseExecuteFile(datfilepath : String; firstres : Integer; count : Integer) : Boolean;//DAT???<?ゃ?????眼????????
518     var
519     datstl : TStringList;
520     i : Integer;
521     endnum : Integer; //腟?????????合??/span>
522     buf : String;
523     ret : Boolean;
524     begin
525     ret := true;
526     datstl := TStringList.Create;
527     try
528     try
529     datstl.LoadFromFile(datfilepath);
530     if (firstres > 0) and (firstres <= datstl.Count) then begin
531     if firstres + count -1 > datstl.Count then begin
532     endnum := datstl.Count;
533     end else if count <= 0 then begin
534     endnum := firstres + 1;
535     end else begin
536     endnum := firstres + count -1;
537     end;
538     for i := firstres to endnum do begin
539     if AnsiPos(FAbonString, datstl.Strings[i-1]) = 1 then begin
540     buf := datstl.Strings[i-1];
541     Delete(buf,1,Length(FAbonString));
542     datstl.Strings[i-1] := buf;
543     end;
544     end;
545     end;
546     datstl.SaveToFile(datfilepath);
547     except
548     ret := false;
549     end;
550     finally
551     datstl.Free;
552     end;
553     Result := ret;
554     end;
555     //?????祉??絅眼??=================?????障??========================================
556     //?上???祉??????????????NGword.txt??????span>
557     procedure TAbon.EditNGwords();
558     begin
559     ShellExecute(0 ,nil,PChar(FNGwordpath),nil,nil,SW_SHOW);
560     end;
561 h677 1.12 //???????≪???????ゅ??∽??/span>
562 h677 1.3 function TAbon.CheckAbonPopupRes(line : String) :Boolean;
563 h677 1.9 begin
564     if AbonPopupRes = true then begin
565     Result := FindNGwords(line);
566     end else begin
567     Result := false;
568     end;
569     end;
570 h677 1.10 //茲??違??G???若???????鴻????茯??粋昭??==============================================
571 h677 1.9 //List???<?ゃ????茯??粋昭??
572     function TAbon.LoadListFile(path :String; listStringList : TStringList) : Boolean;
573     begin
574     try
575     listStringList.LoadFromFile(path);
576     Result := true;
577     except
578     listStringList.Append('筝???NGword.txt');
579     listStringList.SaveToFile(path);
580     Result := false;
581     end;
582     end;
583     //List????ゆ???G???若?????<?ゃ????茯??粋昭??
584     function TAbon.GoForward() : Boolean;
585 h677 1.10 begin
586     FNGwordFileIndex := FNGwordFileIndex + 1;
587     Result := ReadNGwordslist(FNGwordFileIndex);
588     end;
589     //List????ゅ????G???若?????<?ゃ????茯??粋昭??
590     function TAbon.GoBack() : Boolean;
591     begin
592     FNGwordFileIndex := FNGwordFileIndex -1;
593     Result := ReadNGwordslist(FNGwordFileIndex);
594     end;
595     //List???茵?????茯???
596     procedure TAbon.GoHome();
597     begin
598     FNGwordFileIndex := 0;
599     ReadNGwordslist(FNGwordFileIndex);
600     end;
601     //List??ine茵?????茯???
602     function TAbon.ReadNGwordslist(line : Integer) : Boolean;
603 h677 1.3 var
604 h677 1.9 liststl : TStringList;
605     linebuf : String;
606 h677 1.3 begin
607 h677 1.9 liststl := TStringList.Create;
608     try
609     if LoadListFile(Flistpath,liststl) = true then begin
610 h677 1.10 if line < 0 then begin
611     line := liststl.Count - 1;
612     FNGwordFileIndex := liststl.Count - 1;
613     end else if line > liststl.Count - 1 then begin
614     line := 0;
615 h677 1.9 FNGwordFileIndex := 0;
616     end;
617 h677 1.10 linebuf := liststl.Strings[line];
618 h677 1.9 FNGwordname := Copy(linebuf,1,AnsiPos('=',linebuf)-1);
619     Delete(linebuf,1,AnsiPos('=',linebuf));
620     SetNGwordpath(linebuf);
621     Result := true;
622 h677 1.3 end else begin
623     Result := false;
624 h677 1.9 end
625     finally
626     liststl.Free;
627 h677 1.3 end;
628 h677 1.9
629     end;
630 h677 1.10 //茲??違??G???若???????鴻????茯??粋昭??=====?????障??================================
631 h677 1.11 //???ャ???若????絎?茵??∽??/span>
632     procedure TAbon.IndividualAbon(var ThreadStrings : TStringList; SetResNumFile : String);
633     var
634     i : Integer;
635     begin
636     if FileExists(SetResNumFile) = true then begin
637     if LoadFromSetResNumFile(SetResNumFile) = true then begin
638     for i := 0 to High(FAbonRes) do begin
639     if (FAbonRes[i].Res <= ThreadStrings.Count) and (FAbonRes[i].Res > 0) then begin
640     if FAbonRes[i].option = 0 then begin
641     ThreadStrings.Strings[FAbonRes[i].Res-1] := '';
642     end else begin
643     ThreadStrings.Strings[FAbonRes[i].Res-1] := '???若?若??<>???若?若??<>???若?若??<>???若?若??<>';
644     end;
645     end;
646    
647     end;
648     end;
649     end else begin
650     FIndividualFileName := SetResNumFile;
651     SetLength(FAbonRes,1);
652     FAbonRes[0].Res := 0;
653     FAbonRes[0].option := -1;
654     end;
655     end;
656     //???ャ???若???????<?ゃ????粋昭?翠?∽??/span>
657     function TAbon.LoadFromSetResNumFile(SetResNumFile : String) : Boolean;
658     var
659     bufStringList : TStringList;
660     bufLine : String;
661     i : Integer;
662     begin
663     bufStringList := TStringList.Create;
664     try
665     try
666     bufStringList.LoadFromFile(SetResNumFile);
667     FIndividualFileName := SetResNumFile;
668     //腥肴?????/span>
669     for i := bufStringList.Count-1 downto 0 do begin
670     if bufStringList.Strings[i] = '' then begin
671     bufStringList.Delete(i);
672     end;
673     end;
674    
675     //?<?≪??∈篆?
676     SetLength(FAbonRes,bufStringList.Count);
677     //篁e??/span>
678     for i :=0 to bufStringList.Count - 1 do begin
679     bufLine := Trim(bufStringList.Strings[i]);
680     FAbonRes[i].Res := StrToInt(Copy(bufLine,1,AnsiPos('-',bufLine)-1));
681     FAbonRes[i].option := StrToInt(Copy(bufLine,AnsiPos('-',bufLine)+1,1));
682     end;
683     except
684     Result := false;
685     Exit;
686     end;
687     finally
688     bufStringList.Free;
689     end;
690     Result := true;
691     end;
692     //???ャ???若???????<?ゃ????申??
693     procedure TAbon.AddIndividualAbon( ResNum : Integer ; option : Integer);
694     var
695     IndividualFile : TStringList;
696     linebuf : String;
697     i : Integer;
698     begin
699     IndividualFile := TStringList.Create;
700     if FAbonRes[0].Res <> 0 then begin
701     for i := 0 to High(FAbonRes) do begin
702     if FAbonRes[i].Res <> ResNum then begin
703     linebuf := IntToStr(FAbonRes[i].Res) + '-' + IntToStr(FabonRes[i].option);
704     IndividualFile.Append(linebuf);
705     end;
706     end;
707     end;
708     linebuf := IntToStr(ResNum) + '-' + IntToStr(option);
709     IndividualFile.Append(linebuf);
710     try
711     IndividualFile.SaveToFile(FIndividualFileName);
712     finally
713     IndividualFile.Free;
714     end;
715     end;
716     //???ャ???若???????<?ゃ??????????/span>
717     procedure TAbon.DeleteIndividualAbon( ResNum : Integer);
718     var
719     IndividualFile : TStringList;
720     linebuf : String;
721     i : Integer;
722     begin
723     IndividualFile := TStringList.Create;
724     if FAbonRes[0].Res <> 0 then begin
725     for i := 0 to High(FAbonRes) do begin
726     if FAbonRes[i].Res <> ResNum then begin
727     linebuf := IntToStr(FAbonRes[i].Res) + '-' + IntToStr(FabonRes[i].option);
728     IndividualFile.Append(linebuf);
729     end;
730     end;
731     end;
732     if IndividualFile.Count <> 0 then begin
733     try
734     IndividualFile.SaveToFile(FIndividualFileName);
735     finally
736     IndividualFile.Free;
737     end;
738     end else begin
739     if FileExists(FIndividualFileName) = true then begin
740     DeleteFile(FIndividualFileName);
741     end;
742     end;
743     end;
744     //???ャ???若?????????鴻???????違??菴???
745     function TAbon.GetAbonResCount() : Integer;
746 h677 1.12 var
747     i : Integer;
748 h677 1.11 begin
749 h677 1.12 if FAbonRes[0].Res = 0 then begin
750     Result := 0
751     end else begin
752     i := High(FAbonRes);
753     Result := i+1;
754     end;
755 h677 1.11 end;
756     //???ャ???若?????????鴻?????茵????????鴻????絖????ц???
757     function TAbon.GetAbonResString(Num : Integer) : String;
758     begin
759 h677 1.12 if (Num <= High(FAbonRes)) and (Num >= 0) then begin
760 h677 1.11 Result := IntToStr(FAbonRes[Num].Res);
761     end else begin
762     Result := '';
763     end;
764 h677 1.12 end;
765     //???????≪???????ゅ???/span>
766     function TAbon.CheckIndividualAbonList(ResNum : Integer) : Boolean;
767     var
768     i : Integer;
769     begin
770     if FAbonRes[0].Res <> 0 then begin
771     for i := 0 to High(FAbonRes) do begin
772     if FAbonRes[i].Res = ResNum then begin
773     Result := true;
774     Exit;
775     end;
776     end;
777     end;
778     Result := false;
779    
780 h677 1.11 end;
781 h677 1.1 end.
782    

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