6 Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
7 Dialogs, StdCtrls, Buttons;
10 TIndividualAbonForm = class(TForm)
16 procedure Button1Click(Sender: TObject);
17 procedure FormCreate(Sender: TObject);
18 procedure FormDestroy(Sender: TObject);
19 procedure BitBtn2Click(Sender: TObject);
22 FThreadLogFileName: String;
24 FDeleteList: TStringList;
29 function SetThreadLogFileName(AFileName: String): boolean;
30 function DeleteNG(AResNum: Integer): boolean;
31 property DeleteList : TStringList read FDeleteList write FDeleteList;
35 IndividualAbonForm: TIndividualAbonForm;
41 procedure TIndividualAbonForm.Button1Click(Sender: TObject);
48 if (FileExists(FNGFileName)) and (ComboBox1.ItemIndex >= 0) then begin
49 NGFile := TStringList.Create;
52 NGFile.LoadFromFile(FNGFileName);
53 str := ComboBox1.Items[ComboBox1.ItemIndex] + '-';
55 for j := 0 to NGFile.Count - 1 do begin
56 if AnsiPos(str, NGFile[j]) = 1 then begin
64 DeleteList.Add(Copy(str, 1, Length(str) - 1));
66 if NGFile.Count = 0 then
67 DeleteFile(FNGFileName)
69 NGFile.SaveToFile(FNGFileName);
79 function TIndividualAbonForm.SetThreadLogFileName(AFileName: String): boolean;
85 FThreadLogFileName := AFileName;
86 FNGFileName := ChangeFileExt(AFileName, '.NG');
88 if FileExists(FNGFileName) then begin
89 NGFile := TStringList.Create;
92 NGFile.LoadFromFile(FNGFileName);
93 ComboBox1.Items.Clear;
94 ComboBox1.Sorted := true;
95 for i := 0 to NGFile.Count - 1do begin
96 str := Copy(NGFile.Strings[i], 1, AnsiPos('-', NGFile.Strings[i]) - 1);
98 ComboBox1.Items.Add(str);
100 if ComboBox1.Items.Count > 0 then
111 function TIndividualAbonForm.DeleteNG(AResNum: Integer): boolean;
119 if (FileExists(FNGFileName)) and (AResNum > 0) then begin
120 NGFile := TStringList.Create;
123 NGFile.LoadFromFile(FNGFileName);
124 str := IntToStr(AResNum) + '-';
126 for j := 0 to NGFile.Count - 1 do begin
127 if AnsiPos(str, NGFile[j]) = 1 then begin
135 if NGFile.Count = 0 then
136 DeleteFile(FNGFileName)
138 NGFile.SaveToFile(FNGFileName);
148 procedure TIndividualAbonForm.FormCreate(Sender: TObject);
150 FDeleteList := TStringList.Create;
153 procedure TIndividualAbonForm.FormDestroy(Sender: TObject);
158 procedure TIndividualAbonForm.BitBtn2Click(Sender: TObject);
165 if (FileExists(FNGFileName)) then begin
166 NGFile := TStringList.Create;
170 NGFile.LoadFromFile(FNGFileName);
171 for i := ComboBox1.Items.Count - 1 downto 0 do begin
172 str := ComboBox1.Items[i];
173 if( Length(str) > 0 ) then begin
179 DeleteFile(FNGFileName);