6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls, Buttons, ExtCtrls;
10 TIndividualAbonForm = class(TForm)
18 procedure Button1Click(Sender: TObject);
19 procedure FormCreate(Sender: TObject);
20 procedure FormDestroy(Sender: TObject);
21 procedure BitBtn2Click(Sender: TObject);
24 FThreadLogFileName: String;
26 FDeleteList: TStringList;
31 function SetThreadLogFileName(AFileName: String): boolean;
32 function DeleteNG(AResNum: Integer): boolean;
33 property DeleteList : TStringList read FDeleteList write FDeleteList;
37 IndividualAbonForm: TIndividualAbonForm;
43 procedure TIndividualAbonForm.Button1Click(Sender: TObject);
50 if (FileExists(FNGFileName)) and (ComboBox1.ItemIndex >= 0) then begin
51 NGFile := TStringList.Create;
54 NGFile.LoadFromFile(FNGFileName);
55 str := ComboBox1.Items[ComboBox1.ItemIndex] + '-';
57 for j := 0 to NGFile.Count - 1 do begin
58 if AnsiPos(str, NGFile[j]) = 1 then begin
66 DeleteList.Add(Copy(str, 1, Length(str) - 1));
68 if NGFile.Count = 0 then
69 DeleteFile(FNGFileName)
71 NGFile.SaveToFile(FNGFileName);
81 function TIndividualAbonForm.SetThreadLogFileName(AFileName: String): boolean;
87 FThreadLogFileName := AFileName;
88 FNGFileName := ChangeFileExt(AFileName, '.NG');
90 if FileExists(FNGFileName) then begin
91 NGFile := TStringList.Create;
94 NGFile.LoadFromFile(FNGFileName);
95 ComboBox1.Items.Clear;
96 ComboBox1.Sorted := true;
97 for i := 0 to NGFile.Count - 1do begin
98 str := Copy(NGFile.Strings[i], 1, AnsiPos('-', NGFile.Strings[i]) - 1);
100 ComboBox1.Items.Add(str);
102 if ComboBox1.Items.Count > 0 then
113 function TIndividualAbonForm.DeleteNG(AResNum: Integer): boolean;
121 if (FileExists(FNGFileName)) and (AResNum > 0) then begin
122 NGFile := TStringList.Create;
125 NGFile.LoadFromFile(FNGFileName);
126 str := IntToStr(AResNum) + '-';
128 for j := 0 to NGFile.Count - 1 do begin
129 if AnsiPos(str, NGFile[j]) = 1 then begin
137 if NGFile.Count = 0 then
138 DeleteFile(FNGFileName)
140 NGFile.SaveToFile(FNGFileName);
150 procedure TIndividualAbonForm.FormCreate(Sender: TObject);
152 FDeleteList := TStringList.Create;
155 procedure TIndividualAbonForm.FormDestroy(Sender: TObject);
160 procedure TIndividualAbonForm.BitBtn2Click(Sender: TObject);
167 if (FileExists(FNGFileName)) then begin
168 NGFile := TStringList.Create;
172 NGFile.LoadFromFile(FNGFileName);
173 for i := ComboBox1.Items.Count - 1 downto 0 do begin
174 str := ComboBox1.Items[i];
175 if( Length(str) > 0 ) then begin
181 DeleteFile(FNGFileName);