6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls, Buttons;
10 TIndividualAbonForm = class(TForm)
15 procedure Button1Click(Sender: TObject);
18 FThreadLogFileName: String;
24 function SetThreadLogFileName(AFileName: String): boolean;
25 function DeleteNG(AResNum: Integer): boolean;
29 IndividualAbonForm: TIndividualAbonForm;
35 procedure TIndividualAbonForm.Button1Click(Sender: TObject);
42 if (FileExists(FNGFileName)) and (ComboBox1.ItemIndex >= 0) then begin
43 NGFile := TStringList.Create;
46 NGFile.LoadFromFile(FNGFileName);
47 str := ComboBox1.Items[ComboBox1.ItemIndex] + '-';
49 for j := 0 to NGFile.Count - 1 do begin
50 if AnsiPos(str, NGFile[j]) = 1 then begin
56 //i := NGFile.IndexOf(str);
60 if NGFile.Count = 0 then
61 DeleteFile(FNGFileName)
63 NGFile.SaveToFile(FNGFileName);
73 function TIndividualAbonForm.SetThreadLogFileName(AFileName: String): boolean;
79 FThreadLogFileName := AFileName;
80 FNGFileName := ChangeFileExt(AFileName, '.NG');
82 if FileExists(FNGFileName) then begin
83 NGFile := TStringList.Create;
86 NGFile.LoadFromFile(FNGFileName);
87 ComboBox1.Items.Clear;
88 for i := 0 to NGFile.Count - 1do begin
89 str := Copy(NGFile.Strings[i], 1, AnsiPos('-', NGFile.Strings[i]) - 1);
91 ComboBox1.Items.Add(str);
93 if ComboBox1.Items.Count > 0 then
103 function TIndividualAbonForm.DeleteNG(AResNum: Integer): boolean;
111 if (FileExists(FNGFileName)) and (AResNum > 0) then begin
112 NGFile := TStringList.Create;
115 NGFile.LoadFromFile(FNGFileName);
116 str := IntToStr(AResNum) + '-';
118 for j := 0 to NGFile.Count - 1 do begin
119 if AnsiPos(str, NGFile[j]) = 1 then begin
127 if NGFile.Count = 0 then
128 DeleteFile(FNGFileName)
130 NGFile.SaveToFile(FNGFileName);