Develop and Download Open Source Software

Browse CVS Repository

Annotation of /gikonavigoeson/gikonavi/IndividualAbon.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5.2.1 - (hide annotations) (download) (as text)
Tue May 17 14:32:51 2005 UTC (18 years, 11 months ago) by h677
Branch: remodeling
CVS Tags: v1_50_0_581, v1_50_0_580, v1_50_0_587, v1_50_0_586, v1_50_0_585, v1_50_0_582, v1_50_0_577, v1_50_0_588, v1_50_0_584, v_step1, v1_50_0_576, v1_50_0_578, v1_50_0_579
Changes since 1.5: +1 -1 lines
File MIME type: text/x-pascal
未使用変数の整理

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.5 BitBtn2: TBitBtn;
15 h677 1.2 BitBtn1: TBitBtn;
16 h677 1.1 procedure Button1Click(Sender: TObject);
17 h677 1.5 procedure FormCreate(Sender: TObject);
18     procedure FormDestroy(Sender: TObject);
19     procedure BitBtn2Click(Sender: TObject);
20 h677 1.1 private
21 h677 1.3 { Private ?辿?転 }
22     FThreadLogFileName: String;
23     FNGFileName: String;
24 h677 1.5 FDeleteList: TStringList;
25 h677 1.1 public
26 h677 1.3 { Public ?辿?転 }
27     FRepaint : boolean;
28     ResNumber : Integer;
29     function SetThreadLogFileName(AFileName: String): boolean;
30     function DeleteNG(AResNum: Integer): boolean;
31 h677 1.5 property DeleteList : TStringList read FDeleteList write FDeleteList;
32 h677 1.1 end;
33    
34     var
35     IndividualAbonForm: TIndividualAbonForm;
36    
37     implementation
38    
39     {$R *.dfm}
40    
41     procedure TIndividualAbonForm.Button1Click(Sender: TObject);
42 h677 1.3 var
43     NGFile: TStringList;
44     i, j: Integer;
45    
46     str: String;
47     begin
48     if (FileExists(FNGFileName)) and (ComboBox1.ItemIndex >= 0) then begin
49     NGFile := TStringList.Create;
50     try
51     try
52     NGFile.LoadFromFile(FNGFileName);
53     str := ComboBox1.Items[ComboBox1.ItemIndex] + '-';
54     i := -1;
55     for j := 0 to NGFile.Count - 1 do begin
56     if AnsiPos(str, NGFile[j]) = 1 then begin
57     i := j;
58     break;
59     end;
60     end;
61    
62     if i >= 0 then begin
63     FRepaint := true;
64 h677 1.5 DeleteList.Add(Copy(str, 1, Length(str) - 1));
65 h677 1.3 NGFile.Delete(i);
66     if NGFile.Count = 0 then
67     DeleteFile(FNGFileName)
68     else
69     NGFile.SaveToFile(FNGFileName);
70     end else
71     FRepaint := false;
72     except
73     end;
74     finally
75     NGFile.Free;
76     end;
77     end;
78     end;
79     function TIndividualAbonForm.SetThreadLogFileName(AFileName: String): boolean;
80     var
81     NGFile: TStringList;
82     i: Integer;
83     str: String;
84     begin
85     FThreadLogFileName := AFileName;
86     FNGFileName := ChangeFileExt(AFileName, '.NG');
87     Result := false;
88     if FileExists(FNGFileName) then begin
89     NGFile := TStringList.Create;
90     try
91     try
92     NGFile.LoadFromFile(FNGFileName);
93     ComboBox1.Items.Clear;
94 h677 1.5 ComboBox1.Sorted := true;
95 h677 1.3 for i := 0 to NGFile.Count - 1do begin
96     str := Copy(NGFile.Strings[i], 1, AnsiPos('-', NGFile.Strings[i]) - 1);
97 h677 1.4 if str <> '' then
98     ComboBox1.Items.Add(str);
99 h677 1.3 end;
100 h677 1.4 if ComboBox1.Items.Count > 0 then
101 h677 1.3 Result := true;
102 h677 1.5
103 h677 1.3 except
104     Result := false;
105     end;
106     finally
107     NGFile.Free;
108     end;
109     end;
110     end;
111     function TIndividualAbonForm.DeleteNG(AResNum: Integer): boolean;
112     var
113     NGFile: TStringList;
114     i, j: Integer;
115    
116     str: String;
117 h677 1.1 begin
118 h677 1.3 Result := false;
119     if (FileExists(FNGFileName)) and (AResNum > 0) then begin
120     NGFile := TStringList.Create;
121     try
122     try
123     NGFile.LoadFromFile(FNGFileName);
124     str := IntToStr(AResNum) + '-';
125 h677 1.5 i := -1;
126 h677 1.3 for j := 0 to NGFile.Count - 1 do begin
127     if AnsiPos(str, NGFile[j]) = 1 then begin
128     i := j;
129     break;
130     end;
131     end;
132     if i >= 0 then begin
133     Result := true;
134     NGFile.Delete(i);
135     if NGFile.Count = 0 then
136     DeleteFile(FNGFileName)
137     else
138     NGFile.SaveToFile(FNGFileName);
139     end;
140     except
141     end;
142     finally
143     NGFile.Free;
144     end;
145     end;
146 h677 1.1 end;
147    
148 h677 1.5 procedure TIndividualAbonForm.FormCreate(Sender: TObject);
149     begin
150     FDeleteList := TStringList.Create;
151     end;
152    
153     procedure TIndividualAbonForm.FormDestroy(Sender: TObject);
154     begin
155     FDeleteList.Free;
156     end;
157    
158     procedure TIndividualAbonForm.BitBtn2Click(Sender: TObject);
159     var
160     NGFile: TStringList;
161 h677 1.5.2.1 i{, j}: Integer;
162 h677 1.5
163     str: String;
164     begin
165     if (FileExists(FNGFileName)) then begin
166     NGFile := TStringList.Create;
167     try
168     try
169     FRepaint := false;
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
174     FRepaint := true;
175     DeleteList.Add(str);
176     NGFile.Delete(i);
177     end;
178     end;
179     DeleteFile(FNGFileName);
180     except
181     end;
182     finally
183     NGFile.Free;
184     end;
185     end;
186     end;
187    
188 h677 1.1 end.

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