| 1 |
h677 |
1.1 |
unit IndividualAbon; |
| 2 |
|
|
|
| 3 |
|
|
interface |
| 4 |
|
|
|
| 5 |
|
|
uses |
| 6 |
|
|
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, |
| 7 |
h677 |
1.2 |
Dialogs, StdCtrls, Buttons; |
| 8 |
h677 |
1.1 |
|
| 9 |
|
|
type |
| 10 |
|
|
TIndividualAbonForm = class(TForm) |
| 11 |
|
|
ComboBox1: TComboBox; |
| 12 |
|
|
Label1: TLabel; |
| 13 |
|
|
Button1: TButton; |
| 14 |
h677 |
1.2 |
BitBtn1: TBitBtn; |
| 15 |
h677 |
1.1 |
procedure Button1Click(Sender: TObject); |
| 16 |
|
|
private |
| 17 |
h677 |
1.3 |
{ Private ?辿?転 } |
| 18 |
|
|
FThreadLogFileName: String; |
| 19 |
|
|
FNGFileName: String; |
| 20 |
h677 |
1.1 |
public |
| 21 |
h677 |
1.3 |
{ Public ?辿?転 } |
| 22 |
|
|
FRepaint : boolean; |
| 23 |
|
|
ResNumber : Integer; |
| 24 |
|
|
function SetThreadLogFileName(AFileName: String): boolean; |
| 25 |
|
|
function DeleteNG(AResNum: Integer): boolean; |
| 26 |
h677 |
1.1 |
end; |
| 27 |
|
|
|
| 28 |
|
|
var |
| 29 |
|
|
IndividualAbonForm: TIndividualAbonForm; |
| 30 |
|
|
|
| 31 |
|
|
implementation |
| 32 |
|
|
|
| 33 |
|
|
{$R *.dfm} |
| 34 |
|
|
|
| 35 |
|
|
procedure TIndividualAbonForm.Button1Click(Sender: TObject); |
| 36 |
h677 |
1.3 |
var |
| 37 |
|
|
NGFile: TStringList; |
| 38 |
|
|
i, j: Integer; |
| 39 |
|
|
|
| 40 |
|
|
str: String; |
| 41 |
|
|
begin |
| 42 |
|
|
if (FileExists(FNGFileName)) and (ComboBox1.ItemIndex >= 0) then begin |
| 43 |
|
|
NGFile := TStringList.Create; |
| 44 |
|
|
try |
| 45 |
|
|
try |
| 46 |
|
|
NGFile.LoadFromFile(FNGFileName); |
| 47 |
|
|
str := ComboBox1.Items[ComboBox1.ItemIndex] + '-'; |
| 48 |
|
|
i := -1; |
| 49 |
|
|
for j := 0 to NGFile.Count - 1 do begin |
| 50 |
|
|
if AnsiPos(str, NGFile[j]) = 1 then begin |
| 51 |
|
|
i := j; |
| 52 |
|
|
break; |
| 53 |
|
|
end; |
| 54 |
|
|
end; |
| 55 |
|
|
|
| 56 |
|
|
//i := NGFile.IndexOf(str); |
| 57 |
|
|
if i >= 0 then begin |
| 58 |
|
|
FRepaint := true; |
| 59 |
|
|
NGFile.Delete(i); |
| 60 |
|
|
if NGFile.Count = 0 then |
| 61 |
|
|
DeleteFile(FNGFileName) |
| 62 |
|
|
else |
| 63 |
|
|
NGFile.SaveToFile(FNGFileName); |
| 64 |
|
|
end else |
| 65 |
|
|
FRepaint := false; |
| 66 |
|
|
except |
| 67 |
|
|
end; |
| 68 |
|
|
finally |
| 69 |
|
|
NGFile.Free; |
| 70 |
|
|
end; |
| 71 |
|
|
end; |
| 72 |
|
|
end; |
| 73 |
|
|
function TIndividualAbonForm.SetThreadLogFileName(AFileName: String): boolean; |
| 74 |
|
|
var |
| 75 |
|
|
NGFile: TStringList; |
| 76 |
|
|
i: Integer; |
| 77 |
|
|
str: String; |
| 78 |
|
|
begin |
| 79 |
|
|
FThreadLogFileName := AFileName; |
| 80 |
|
|
FNGFileName := ChangeFileExt(AFileName, '.NG'); |
| 81 |
|
|
Result := false; |
| 82 |
|
|
if FileExists(FNGFileName) then begin |
| 83 |
|
|
NGFile := TStringList.Create; |
| 84 |
|
|
try |
| 85 |
|
|
try |
| 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); |
| 90 |
|
|
ComboBox1.Items.Add(str); |
| 91 |
|
|
end; |
| 92 |
|
|
if NGFile.Count > 0 then |
| 93 |
|
|
Result := true; |
| 94 |
|
|
except |
| 95 |
|
|
Result := false; |
| 96 |
|
|
end; |
| 97 |
|
|
finally |
| 98 |
|
|
NGFile.Free; |
| 99 |
|
|
end; |
| 100 |
|
|
end; |
| 101 |
|
|
end; |
| 102 |
|
|
function TIndividualAbonForm.DeleteNG(AResNum: Integer): boolean; |
| 103 |
|
|
var |
| 104 |
|
|
NGFile: TStringList; |
| 105 |
|
|
i, j: Integer; |
| 106 |
|
|
|
| 107 |
|
|
str: String; |
| 108 |
h677 |
1.1 |
begin |
| 109 |
h677 |
1.3 |
Result := false; |
| 110 |
|
|
if (FileExists(FNGFileName)) and (AResNum > 0) then begin |
| 111 |
|
|
NGFile := TStringList.Create; |
| 112 |
|
|
try |
| 113 |
|
|
try |
| 114 |
|
|
NGFile.LoadFromFile(FNGFileName); |
| 115 |
|
|
str := IntToStr(AResNum) + '-'; |
| 116 |
|
|
i := -1; |
| 117 |
|
|
for j := 0 to NGFile.Count - 1 do begin |
| 118 |
|
|
if AnsiPos(str, NGFile[j]) = 1 then begin |
| 119 |
|
|
i := j; |
| 120 |
|
|
break; |
| 121 |
|
|
end; |
| 122 |
|
|
end; |
| 123 |
|
|
if i >= 0 then begin |
| 124 |
|
|
Result := true; |
| 125 |
|
|
NGFile.Delete(i); |
| 126 |
|
|
if NGFile.Count = 0 then |
| 127 |
|
|
DeleteFile(FNGFileName) |
| 128 |
|
|
else |
| 129 |
|
|
NGFile.SaveToFile(FNGFileName); |
| 130 |
|
|
end; |
| 131 |
|
|
except |
| 132 |
|
|
end; |
| 133 |
|
|
finally |
| 134 |
|
|
NGFile.Free; |
| 135 |
|
|
end; |
| 136 |
|
|
end; |
| 137 |
h677 |
1.1 |
end; |
| 138 |
|
|
|
| 139 |
|
|
end. |