Develop and Download Open Source Software

Browse CVS Repository

Contents of /gikonavigoeson/gikonavi/Setting.pas

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


Revision 1.1 - (show annotations) (download) (as text)
Sat Aug 9 13:51:11 2003 UTC (20 years, 8 months ago) by hi_
Branch: MAIN
Branch point for: hi
File MIME type: text/x-pascal
Initial revision

1 unit Setting;
2
3 interface
4
5 uses
6 SysUtils, Classes, Graphics, Forms, Math, IniFiles, UCryptAuto, UBase64,
7 ComCtrls;
8
9 const
10 MAIN_COOLBAND_COUNT = 4; //メインCoolBandの数
11 LIST_COOLBAND_COUNT = 2; //板CoolBandの数
12 BROWSER_COOLBAND_COUNT = 3; //ブラウザCoolBandの数
13
14 type
15 TGikoTabPosition = (gtpTop, gtpBottom); // タブ位置
16 TGikoTabAppend = (gtaFirst, gtpLast); // タブ追加位置
17 TGikoTabStyle = (gtsTab, gtsButton, gtsFlat); // タブスタイル
18 TGikoListOrientation = (gloHorizontal, gloVertical); // リスト垂直・水平
19 TGikoListState = (glsMax, glsNormal, glsMin); // リストサイズ状態
20 // ポップアップ表示位置
21 TGikoPopupPosition = (gppRightTop, gppTop, gppLeftTop,
22 gppRight, gppCenter, gppLeft,
23 gppRightBottom, gppBottom, gppLeftBottom);
24 //プレビューサイズ
25 TGikoPreviewSize = (gpsXLarge, gpsLarge, gpsMedium, gpsSmall, gpsXSmall);
26
27 //CoolBar設定レコード
28 TCoolSet = record
29 FCoolID: Integer;
30 FCoolWidth: Integer;
31 FCoolBreak: Boolean;
32 end;
33
34 TSetting = class(TObject)
35 private
36 //受信バッファサイズ
37 FRecvBufferSize: Integer;
38 //HTTP1.1使用
39 FProtocol: Boolean;
40 //プロキシ接続HTTP1.1使用
41 FProxyProtocol: Boolean;
42
43 //プロキシ(読込用)
44 FReadProxy: Boolean;
45 FReadProxyAddress: string;
46 FReadProxyPort: Integer;
47 FReadProxyUserID: string;
48 FReadProxyPassword: string;
49
50 //プロキシ(書込用)
51 FWriteProxy: Boolean;
52 FWriteProxyAddress: string;
53 FWriteProxyPort: Integer;
54 FWriteProxyUserID: string;
55 FWriteProxyPassword: string;
56
57 //キャビネット
58 FCabinetFontName: string;
59 FCabinetFontSize: Integer;
60 FCabinetFontBold: Boolean;
61 FCabinetFontItalic: Boolean;
62 FCabinetFontColor: TColor;
63 FCabinetBackColor: TColor;
64
65 //リスト
66 FListFontName: string;
67 FListFontSize: Integer;
68 FListFontBold: Boolean;
69 FListFontItalic: Boolean;
70 FListFontColor: TColor;
71 FListBackColor: TColor;
72
73 //ブラウザ
74 //FBrowserFontColor: TColor;
75 //FBrowserBackColor: TColor;
76 //FBrowserFontSize: Integer;
77
78 //エディタ
79 FEditorFontName: string;
80 FEditorFontSize: Integer;
81 FEditorFontBold: Boolean;
82 FEditorFontItalic: Boolean;
83 FEditorFontColor: TColor;
84 FEditorBackColor: TColor;
85
86 //タブフォント
87 FBrowserTabFontName: string;
88 FBrowserTabFontSize: Integer;
89 FBrowserTabFontBold: Boolean;
90 FBrowserTabFontItalic: Boolean;
91
92 //ヒントウィンドウ
93 FHintFontName: string;
94 FHintFontSize: Integer;
95 //FHintFontBold: Boolean;
96 //FHintFontItalic: Boolean;
97 FHintFontColor: TColor;
98 FHintBackColor: TColor;
99
100 //ウィンドウサイズ
101 FWindowTop: Integer;
102 FWindowLeft: Integer;
103 FWindowHeight: Integer;
104 FWindowWidth: Integer;
105 FWindowMax: Boolean;
106 //リストビュースタイル
107 FListStyle: TViewStyle;
108
109 //ツールバー表示
110 FStdToolBarVisible: Boolean;
111 FAddressBarVisible: Boolean;
112 FLinkBarVisible: Boolean;
113 FListToolBarVisible: Boolean;
114 FListNameBarVisible: Boolean;
115 FBrowserToolBarVisible: Boolean;
116 FBrowserNameBarVisible: Boolean;
117
118 //ブラウザタブ
119 FBrowserTabVisible: Boolean;
120 FBrowserTabPosition: TGikoTabPosition;
121 FBrowserTabAppend: TGikoTabAppend;
122 FBrowserTabStyle: TGikoTabStyle;
123
124 //メッセージバー
125 FMessageBarVisible: Boolean;
126 FMessegeBarHeight: Integer;
127
128 //ステータスバー
129 FStatusBarVisible: Boolean;
130
131 //キャビネット可視・サイズ
132 FCabinetVisible: Boolean;
133 FCabinetWidth: Integer;
134
135 //リスト・ブラウザサイズ
136 FListOrientation: TGikoListOrientation;
137 FListHeight: Integer;
138 FListHeightState: TGikoListState;
139 FListWidth: Integer;
140 FListWidthState: TGikoListState;
141 // FListHeightMax: Boolean;
142 // FListWidthMax: Boolean;
143
144 //送信用名前・メール
145 FNameList: TStringList;
146 FMailList: TStringList;
147
148 //エディターウィンドウサイズ
149 FEditWindowTop: Integer;
150 FEditWindowLeft: Integer;
151 FEditWindowHeight: Integer;
152 FEditWindowWidth: Integer;
153 FEditWindowMax: Boolean;
154
155 //リスト番号表示
156 FListViewNo: Boolean;
157 //CSS表示
158 FUseCSS: Boolean;
159 //CSSファイル名
160 FCSSFileName: string;
161 //mail欄表示
162 FShowMail: Boolean;
163 //非アクティブ時ポップアップ表示
164 FUnActivePopup: Boolean;
165
166 //ログフォルダ
167 FLogFolder: string;
168 FNewLogFolder: string;
169
170 //リストカラムヘッダーサイズ
171 FBBSColumnWidth: array[0..0] of Integer;
172 FCategoryColumnWidth: array[0..3] of Integer;
173 FBoardColumnWidth: array[0..6] of Integer;
174
175 //絞込み文字列
176 FSelectTextList: TStringList;
177
178 //板一覧URL
179 FBoardURL2ch: string;
180
181 //ユーザID・パスワード
182 FUserID: string;
183 FPassword: string;
184 FAutoLogin: Boolean;
185
186 //URLクリック時起動アプリ
187 FURLApp: Boolean;
188 FURLAppFile: string;
189
190 //mailtoクリック時動作
191 FOpenMailer: Boolean;
192
193 //削除確認
194 FDeleteMsg: Boolean;
195
196 //CoolBar(メイン・板・ブラウザ)
197 FMainCoolBar: array[0..MAIN_COOLBAND_COUNT - 1] of TCoolSet;
198 FListCoolBar: array[0..LIST_COOLBAND_COUNT] of TCoolSet;
199 FBrowserCoolBar: array[0..BROWSER_COOLBAND_COUNT - 1] of TCoolSet;
200
201 //ToolBar Wrapable
202 FListToolBarWrapable: Boolean;
203 FBrowserToolBarWrapable: Boolean;
204
205 //ポップアップ位置
206 FPopupPosition: TGikoPopupPosition;
207
208 //アドレスバー
209 FURLDisplay: Boolean;
210 FAddressBarTabStop: Boolean;
211 FLinkAddAddressBar: Boolean;
212 FAddressHistoryCount: Integer;
213
214 //画像プレビュー
215 FPreviewVisible: Boolean;
216 FPreviewSize: TGikoPreviewSize;
217 FPreviewWait: Integer;
218
219 //スレッド一覧更新アイコン表示
220 FListIconVisible: Boolean;
221
222 //書き込み時マシン時間使用設定
223 FUseMachineTime: Boolean;
224 FTimeAdjustSec: Integer;
225 FTimeAdjust: Boolean;
226
227 function GetMainCoolSet(Index: Integer): TCoolSet;
228 function GetBoardCoolSet(Index: Integer): TCoolSet;
229 function GetBrowserCoolSet(Index: Integer): TCoolSet;
230 procedure SetMainCoolSet(Index: Integer; CoolSet: TCoolSet);
231 procedure SetBoardCoolSet(Index: Integer; CoolSet: TCoolSet);
232 procedure SetBrowserCoolSet(Index: Integer; CoolSet: TCoolSet);
233
234 function GetBBSColumnWidth(index: Integer): Integer;
235 function GetCategoryColumnWidth(index: Integer): Integer;
236 function GetBoardColumnWidth(index: Integer): Integer;
237 procedure SetBBSColumnWidth(index: Integer; value: Integer);
238 procedure SetCategoryColumnWidth(index: Integer; value: Integer);
239 procedure SetBoardColumnWidth(index: Integer; value: Integer);
240
241 function GetSoundName(Index: Integer): string;
242 function GetSoundViewName(Index: Integer): string;
243 function GetSoundFileName(Index: Integer): string;
244 procedure SetSoundFileName(Index: Integer; value: string);
245 function Encrypt(s: string): string;
246 function Decrypt(s: string): string;
247 protected
248
249 public
250 constructor Create;
251 destructor Destroy; override;
252 function GetFileName: string;
253 procedure ReadSettingFile;
254 procedure WriteSystemSettingFile;
255 procedure WriteWindowSettingFile;
256 procedure WriteNameMailSettingFile;
257 procedure WriteFolderSettingFile();
258 function GetSoundCount: Integer;
259 function FindSoundFileName(Name: string): string;
260
261 //受信バッファサイズ
262 property RecvBufferSize: Integer read FRecvBufferSize write FRecvBufferSize;
263 //HTTP1.1使用
264 property Protocol: Boolean read FProtocol write FProtocol;
265 //プロキシ接続HTTP1.1使用
266 property ProxyProtocol: Boolean read FProxyProtocol write FProxyProtocol;
267
268 property ReadProxy: Boolean read FReadProxy write FReadProxy;
269 property ReadProxyAddress: string read FReadProxyAddress write FReadProxyAddress;
270 property ReadProxyPort: Integer read FReadProxyPort write FReadProxyPort;
271 property ReadProxyUserID: string read FReadProxyUserID write FReadProxyUserID;
272 property ReadProxyPassword: string read FReadProxyPassword write FReadProxyPassword;
273
274 property WriteProxy: Boolean read FWriteProxy write FWriteProxy;
275 property WriteProxyAddress: string read FWriteProxyAddress write FWriteProxyAddress;
276 property WriteProxyPort: Integer read FWriteProxyPort write FWriteProxyPort;
277 property WriteProxyUserID: string read FWriteProxyUserID write FWriteProxyUserID;
278 property WriteProxyPassword: string read FWriteProxyPassword write FWriteProxyPassword;
279
280 property CabinetFontName: string read FCabinetFontName write FCabinetFontName;
281 property CabinetFontSize: Integer read FCabinetFontSize write FCabinetFontSize;
282 property CabinetFontBold: Boolean read FCabinetFontBold write FCabinetFontBold;
283 property CabinetFontItalic: Boolean read FCabinetFontItalic write FCabinetFontItalic;
284 property CabinetFontColor: TColor read FCabinetFontColor write FCabinetFontColor;
285 property CabinetBackColor: TColor read FCabinetBackColor write FCabinetBackColor;
286
287 property ListFontName: string read FListFontName write FListFontName;
288 property ListFontSize: Integer read FListFontSize write FListFontSize;
289 property ListFontBold: Boolean read FListFontBold write FListFontBold;
290 property ListFontItalic: Boolean read FListFontItalic write FListFontItalic;
291 property ListFontColor: TColor read FListFontColor write FListFontColor;
292 property ListBackColor: TColor read FListBackColor write FListBackColor;
293
294 // property BrowserFontColor: TColor read FBrowserFontColor write FBrowserFontColor;
295 // property BrowserBackColor: TColor read FBrowserBackColor write FBrowserBackColor;
296 // property BrowserFontSize: Integer read FBrowserFontSize write FBrowserFontSize;
297
298 property EditorFontName: string read FEditorFontName write FEditorFontName;
299 property EditorFontSize: Integer read FEditorFontSize write FEditorFontSize;
300 property EditorFontBold: Boolean read FEditorFontBold write FEditorFontBold;
301 property EditorFontItalic: Boolean read FEditorFontItalic write FEditorFontItalic;
302 property EditorFontColor: TColor read FEditorFontColor write FEditorFontColor;
303 property EditorBackColor: TColor read FEditorBackColor write FEditorBackColor;
304
305 property BrowserTabFontName: string read FBrowserTabFontName write FBrowserTabFontName;
306 property BrowserTabFontSize: Integer read FBrowserTabFontSize write FBrowserTabFontSize;
307 property BrowserTabFontBold: Boolean read FBrowserTabFontBold write FBrowserTabFontBold;
308 property BrowserTabFontItalic: Boolean read FBrowserTabFontItalic write FBrowserTabFontItalic;
309
310 property HintFontName: string read FHintFontName write FHintFontName;
311 property HintFontSize: Integer read FHintFontSize write FHintFontSize;
312 //property HintFontBold: Boolean read FHintFontBold write FHintFontBold;
313 //property HintFontItalic: Boolean read FHintFontItalic write FHintFontItalic;
314 property HintFontColor: TColor read FHintFontColor write FHintFontColor;
315 property HintBackColor: TColor read FHintBackColor write FHintBackColor;
316
317 property WindowTop: Integer read FWindowTop write FWindowTop;
318 property WindowLeft: Integer read FWindowLeft write FWindowLeft;
319 property WindowHeight: Integer read FWindowHeight write FWindowHeight;
320 property WindowWidth: Integer read FWindowWidth write FWindowWidth;
321 property WindowMax: Boolean read FWindowMax write FWindowMax;
322 property ListStyle: TViewStyle read FListStyle write FListStyle;
323
324 property StdToolBarVisible: Boolean read FStdToolBarVisible write FStdToolBarVisible;
325 property AddressBarVisible: Boolean read FAddressBarVisible write FAddressBarVisible;
326 property LinkBarVisible: Boolean read FLinkBarVisible write FLinkBarVisible;
327 property ListToolBarVisible: Boolean read FListToolBarVisible write FListToolBarVisible;
328 property ListNameBarVisible: Boolean read FListNameBarVisible write FListNameBarVisible;
329 property BrowserToolBarVisible: Boolean read FBrowserToolBarVisible write FBrowserToolBarVisible;
330 property BrowserNameBarVisible: Boolean read FBrowserNameBarVisible write FBrowserNameBarVisible;
331
332 property BrowserTabVisible: Boolean read FBrowserTabVisible write FBrowserTabVisible;
333 property BrowserTabPosition: TGikoTabPosition read FBrowserTabPosition write FBrowserTabPosition;
334 property BrowserTabAppend: TGikoTabAppend read FBrowserTabAppend write FBrowserTabAppend;
335 property BrowserTabStyle: TGikoTabStyle read FBrowserTabStyle write FBrowserTabStyle;
336
337 property MessageBarVisible: Boolean read FMessageBarVisible write FMessageBarVisible;
338 property MessegeBarHeight: Integer read FMessegeBarHeight write FMessegeBarHeight;
339
340 property StatusBarVisible: Boolean read FStatusBarVisible write FStatusBarVisible;
341
342 property CabinetVisible: Boolean read FCabinetVisible write FCabinetVisible;
343 property CabinetWidth: Integer read FCabinetWidth write FCabinetWidth;
344
345 property ListOrientation: TGikoListOrientation read FListOrientation write FListOrientation;
346 property ListHeight: Integer read FListHeight write FListHeight;
347 property ListHeightState: TGikoListState read FListHeightState write FListHeightState;
348 property ListWidth: Integer read FListWidth write FListWidth;
349 property ListWidthState: TGikoListState read FListWidthState write FListWidthState;
350 // property ListHeightMax: Boolean read FListHeightMax write FListHeightMax;
351 // property ListWidthMax: Boolean read FListWidthMax write FListWidthMax;
352
353 property NameList: TStringList read FNameList write FNameList;
354 property MailList: TStringList read FMailList write FMailList;
355 property SelectTextList: TStringList read FSelectTextList write FSelectTextList;
356
357 property EditWindowTop: Integer read FEditWindowTop write FEditWindowTop;
358 property EditWindowLeft: Integer read FEditWindowLeft write FEditWindowLeft;
359 property EditWindowHeight: Integer read FEditWindowHeight write FEditWindowHeight;
360 property EditWindowWidth: Integer read FEditWindowWidth write FEditWindowWidth;
361 property EditWindowMax: Boolean read FEditWindowMax write FEditWindowMax;
362
363 property ListViewNo: Boolean read FListViewNo write FListViewNo;
364 property UseCSS: Boolean read FUseCSS write FUseCSS;
365 property CSSFileName: string read FCSSFileName write FCSSFileName;
366
367 property ShowMail: Boolean read FShowMail write FShowMail;
368 property UnActivePopup: Boolean read FUnActivePopup write FUnActivePopup;
369
370 property LogFolder: string read FLogFolder write FLogFolder;
371 property NewLogFolder: string read FNewLogFolder write FNewLogFolder;
372
373 property BBSColumnWidth[index: Integer]: Integer read GetBBSColumnWidth write SetBBSColumnWidth;
374 property CategoryColumnWidth[index: Integer]: Integer read GetCategoryColumnWidth write SetCategoryColumnWidth;
375 property BoardColumnWidth[index: Integer]: Integer read GetBoardColumnWidth write SetBoardColumnWidth;
376
377 property SoundName[index: Integer]: string read GetSoundName;
378 property SoundViewName[index: Integer]: string read GetSoundViewName;
379 property SoundFileName[index: Integer]: string read GetSoundFileName write SetSoundFileName;
380
381 property BoardURL2ch: string read FBoardURL2ch write FBoardURL2ch;
382
383 property UserID: string read FUserID write FUserID;
384 property Password: string read FPassword write FPassword;
385 property AutoLogin: Boolean read FAutoLogin write FAutoLogin;
386
387 property URLApp: Boolean read FURLApp write FURLApp;
388 property URLAppFile: string read FURLAppFile write FURLAppFile;
389
390 property OpenMailer: Boolean read FOpenMailer write FOpenMailer;
391
392 property DeleteMsg: Boolean read FDeleteMsg write FDeleteMsg;
393
394 property MainCoolSet[Index: Integer]: TCoolSet read GetMainCoolSet write SetMainCoolSet;
395 property ListCoolSet[Index: Integer]: TCoolSet read GetBoardCoolSet write SetBoardCoolSet;
396 property BrowserCoolSet[Index: Integer]: TCoolSet read GetBrowserCoolSet write SetBrowserCoolSet;
397
398 property ListToolBarWrapable: Boolean read FListToolBarWrapable write FListToolBarWrapable;
399 property BrowserToolBarWrapable: Boolean read FBrowserToolBarWrapable write FBrowserToolBarWrapable;
400
401 property PopupPosition: TGikoPopupPosition read FPopupPosition write FPopupPosition;
402
403 property URLDisplay: Boolean read FURLDisplay write FURLDisplay;
404 property AddressBarTabStop: Boolean read FAddressBarTabStop write FAddressBarTabStop;
405 property LinkAddAddressBar: Boolean read FLinkAddAddressBar write FLinkAddAddressBar;
406 property AddressHistoryCount: Integer read FAddressHistoryCount write FAddressHistoryCount;
407
408 property PreviewVisible: Boolean read FPreviewVisible write FPreviewVisible;
409 property PreviewSize: TGikoPreviewSize read FPreviewSize write FPreviewSize;
410 property PreviewWait: Integer read FPreviewWait write FPreviewWait;
411
412 property ListIconVisible: Boolean read FListIconVisible write FListIconVisible;
413
414 property UseMachineTime: Boolean read FUseMachineTime write FUseMachineTime;
415 property TimeAdjustSec: Integer read FTimeAdjustSec write FTimeAdjustSec;
416 property TimeAdjust: Boolean read FTimeAdjust write FTimeAdjust;
417 end;
418
419
420 implementation
421
422 type
423 TSoundName = record
424 Name: string;
425 ViewName: string;
426 FileName: string;
427 end;
428
429 const
430 INI_FILE_NAME: string = 'gikoNavi.ini';
431 DEFAULT_FONT_NAME: string = 'MS Pゴシック';
432 DEFAULT_FONT_SIZE: Integer = 9;
433 DEFAULT_FONT_COLOR: string = 'clWindowText';
434 DEFAULT_WINDOW_COLOR: string = 'clWindow';
435 DEFAULT_TAB_FONT_NAME: string = 'MS Pゴシック';
436 DEFAULT_TAB_FONT_SIZE: Integer = 9;
437 DEFAULT_2CH_BOARD_URL: string = 'http://www6.ocn.ne.jp/~mirv/2chmenu.html';
438 //'http://www.2ch.net/newbbsmenu.html';
439 GIKO_ENCRYPT_TEXT: string = 'gikoNaviEncryptText';
440
441 var
442 SOUND_NAME: array[0..4] of TSoundName = (
443 (Name: 'New'; ViewName: '取得成功'; FileName: ''),
444 (Name: 'NewDiff'; ViewName: '取得成功(差分)'; FileName: ''),
445 (Name: 'NoChange'; ViewName: '未更新'; FileName: ''),
446 // (Name: 'RoundEnd'; ViewName: '巡回終了(取得あり)'; FileName: ''),
447 // (Name: 'RoundNone'; ViewName: '巡回終了(取得なし)'; FileName: ''),
448 (Name: 'ResEnd'; ViewName: 'レス送信完了'; FileName: ''),
449 (Name: 'Error'; ViewName: 'エラー'; FileName: ''));
450
451 //コンストラクタ
452 constructor TSetting.Create();
453 begin
454 FNameList := TStringList.Create;
455 FMailList := TStringList.Create;
456 FSelectTextList := TStringList.Create;
457
458 FNameList.Duplicates := dupIgnore;
459 FMailList.Duplicates := dupIgnore;
460 FSelectTextList.Duplicates := dupIgnore;
461 ReadSettingFile();
462 end;
463
464 //デストラクタ
465 destructor TSetting.Destroy();
466 begin
467 inherited;
468 FSelectTextList.Free;
469 FMailList.Free;
470 FNameList.Free;
471 end;
472
473 //初期化ファイル名取得(パス+ファイル名)
474 function TSetting.GetFileName(): string;
475 begin
476 Result := ExtractFilePath(Application.ExeName) + INI_FILE_NAME;
477 end;
478
479 //設定ファイル読込
480 procedure TSetting.ReadSettingFile();
481 const
482 DEFAULT_BBS_WIDTH: array[0..0] of Integer = (140);
483 DEFAULT_CATEGORY_WIDTH: array[0..2] of Integer = (150, 80, 130);
484 DEFAULT_BOARD_WIDTH: array[0..6] of Integer = (350, 60, 60, 60, 60, 80, 130);
485 var
486 ini: TMemIniFile;
487 i: Integer;
488 wkList: TStringList;
489 wkStr: string;
490 Exists: Boolean;
491 s: string;
492 // id: Integer;
493 CoolSet: TCoolSet;
494 begin
495 Exists := FileExists(GetFileName);
496 ini := TMemIniFile.Create(GetFileName);
497 try
498 //受信バッファサイズ
499 FRecvBufferSize := ini.ReadInteger('HTTP', 'RecvBufferSize', 4096);
500 //HTTP1.1使用
501 FProtocol := ini.ReadBool('HTTP', 'Protocol', True);
502 //プロキシ接続HTTP1.1使用
503 FProxyProtocol := ini.ReadBool('HTTP', 'ProxyProtocol', False);
504
505 FReadProxy := ini.ReadBool('ReadProxy', 'Proxy', false);
506 FReadProxyAddress := ini.ReadString('ReadProxy', 'Address', '');
507 FReadProxyPort := ini.ReadInteger('ReadProxy', 'Port', 0);
508 FReadProxyUserID := ini.ReadString('ReadProxy', 'UserID', '');
509 FReadProxyPassword := ini.ReadString('ReadProxy', 'Password', '');
510
511 FWriteProxy := ini.ReadBool('WriteProxy', 'Proxy', false);
512 FWriteProxyAddress := ini.ReadString('WriteProxy', 'Address', '');
513 FWriteProxyPort := ini.ReadInteger('WriteProxy', 'Port', 0);
514 FWriteProxyUserID := ini.ReadString('WriteProxy', 'UserID', '');
515 FWriteProxyPassword := ini.ReadString('WriteProxy', 'Password', '');
516
517 FCabinetFontName := ini.ReadString('Window', 'CabinetFontName', DEFAULT_FONT_NAME);
518 FCabinetFontSize := ini.ReadInteger('Window', 'CabinetFontSize', DEFAULT_FONT_SIZE);
519 FCabinetFontBold := ini.ReadBool('Window', 'CabinetFontBold', False);
520 FCabinetFontItalic := ini.ReadBool('Window', 'CabinetFontItalic', False);
521 FCabinetFontColor := StringToColor(ini.ReadString('Window', 'CabinetFontColor', DEFAULT_FONT_COLOR));
522 FCabinetBackColor := StringToColor(ini.ReadString('Window', 'CabinetBackColor', DEFAULT_WINDOW_COLOR));
523
524 FListFontName := ini.ReadString('Window', 'ListFontName', DEFAULT_FONT_NAME);
525 FListFontSize := ini.ReadInteger('Window', 'ListFontSize', DEFAULT_FONT_SIZE);
526 FListFontBold := ini.ReadBool('Window', 'ListFontBold', False);
527 FListFontItalic := ini.ReadBool('Window', 'ListFontItalic', False);
528 FListFontColor := StringToColor(ini.ReadString('Window', 'ListFontColor', DEFAULT_FONT_COLOR));
529 FListBackColor := StringToColor(ini.ReadString('Window', 'ListBackColor', DEFAULT_WINDOW_COLOR));
530
531 FEditorFontName := ini.ReadString('Window', 'EditorFontName', DEFAULT_FONT_NAME);
532 FEditorFontSize := ini.ReadInteger('Window', 'EditorFontSize', DEFAULT_FONT_SIZE);
533 FEditorFontBold := ini.ReadBool('Window', 'EditorFontBold', False);
534 FEditorFontItalic := ini.ReadBool('Window', 'EditorFontItalic', False);
535 FEditorFontColor := StringToColor(ini.ReadString('Window', 'EditorFontColor', DEFAULT_FONT_COLOR));
536 FEditorBackColor := StringToColor(ini.ReadString('Window', 'EditorBackColor', DEFAULT_WINDOW_COLOR));
537
538 FBrowserTabFontName := ini.ReadString('Window', 'BrowserTabFontName', DEFAULT_TAB_FONT_NAME);
539 FBrowserTabFontSize := ini.ReadInteger('Window', 'BrowserTabFontSize', DEFAULT_TAB_FONT_SIZE);
540 FBrowserTabFontBold := ini.ReadBool('Window', 'BrowserTabFontBold', False);
541 FBrowserTabFontItalic := ini.ReadBool('Window', 'BrowserTabFontItalic', False);
542
543 FHintFontName := ini.ReadString('Window', 'HintFontName', Screen.HintFont.Name);
544 FHintFontSize := ini.ReadInteger('Window', 'HintFontSize', Screen.HintFont.Size);
545 //FHintFontBold := ini.ReadBool('Window', 'HintFontBold', False);
546 //FHintFontItalic := ini.ReadBool('Window', 'HintFontItalic', False);
547 FHintFontColor := StringToColor(ini.ReadString('Window', 'HintFontColor', DEFAULT_FONT_COLOR));
548 FHintBackColor := StringToColor(ini.ReadString('Window', 'HintBackColor', 'clInfoBk'));
549
550 FWindowTop := ini.ReadInteger('WindowSize', 'Top', -1);
551 FWindowLeft := ini.ReadInteger('WindowSize', 'Left', -1);
552 FWindowHeight := ini.ReadInteger('WindowSize', 'Height', -1);
553 FWindowWidth := ini.ReadInteger('WindowSize', 'Width', -1);
554 FWindowMax := ini.ReadBool('WindowSize', 'Max', false);
555
556 if FWindowHeight <= 0 then FWindowHeight := 400;
557 if FWindowWidth <= 0 then FWindowWidth := 600;
558
559 FListStyle := TViewStyle(ini.ReadInteger('ViewStyle', 'ListView', Ord(vsReport)));
560
561 FEditWindowTop := ini.ReadInteger('EditorWindowSize', 'Top', -1);
562 FEditWindowLeft := ini.ReadInteger('EditorWindowSize', 'Left', -1);
563 FEditWindowHeight := ini.ReadInteger('EditorWindowSize', 'Height', -1);
564 FEditWindowWidth := ini.ReadInteger('EditorWindowSize', 'Width', -1);
565 FEditWindowMax := ini.ReadBool('EditorWindowSize', 'Max', False);
566
567 //ツールバー
568 FStdToolBarVisible := ini.ReadBool('ToolBar', 'StdVisible', True);
569 FAddressBarVisible := ini.ReadBool('ToolBar', 'AddressVisible', True);
570 FLinkBarVisible := ini.ReadBool('ToolBar', 'LinkVisible', True);
571 FListToolBarVisible := ini.ReadBool('ToolBar', 'ListVisible', True);
572 FListNameBarVisible := ini.ReadBool('ToolBar', 'ListNameVisible', True);
573 FBrowserToolBarVisible := ini.ReadBool('ToolBar', 'BrowserVisible', True);
574 FBrowserNameBarVisible := ini.ReadBool('ToolBar', 'BrowserNameVisible', True);
575 //ツールバーWrapable
576 FListToolBarWrapable := ini.ReadBool('ToolBar', 'ListWrapable', False);
577 FBrowserToolBarWrapable := ini.ReadBool('ToolBar', 'BrowserWrapable', False);
578
579 FBrowserTabVisible := ini.ReadBool('Tab', 'BrowserTabVisible', True);
580 FBrowserTabPosition := TGikoTabPosition(ini.ReadInteger('Tab', 'BrowserTabPosition', Ord(gtpTop)));
581 FBrowserTabAppend := TGikoTabAppend(ini.ReadInteger('Tab', 'BrowserTabAppend', Ord(gtaFirst)));
582 FBrowserTabStyle := TGikoTabStyle(ini.ReadInteger('Tab', 'BrowserTabStyle', Ord(gtsFlat)));
583
584 FMessageBarVisible := ini.ReadBool('MessageBar', 'Visible', True);
585 FMessegeBarHeight := ini.ReadInteger('MessageBar', 'Height', 30);
586
587 FStatusBarVisible := ini.ReadBool('StatusBar', 'Visible', True);
588
589 FCabinetVisible := ini.ReadBool('Cabinet', 'Visible', True);
590 FCabinetWidth := ini.ReadInteger('Cabinet', 'Width', 200);
591
592 FListOrientation := TGikoListOrientation(ini.ReadInteger('List', 'Orientation', Ord(gloHorizontal)));
593 FListHeight := ini.ReadInteger('List', 'Height', 180);
594 FListHeightState := TGikoListState(ini.ReadInteger('List', 'HeightState', Ord(glsNormal)));
595 FListWidth := ini.ReadInteger('List', 'Width', 180);
596 FListWidthState := TGikoListState(ini.ReadInteger('List', 'WidthState', Ord(glsNormal)));
597 // FListHeightMax := ini.ReadBool('List', 'HeightMax', False);
598 // FListWidthMax := ini.ReadBool('List', 'WidthMax', False);
599
600 wkList := TStringList.Create;
601 try
602 ini.ReadSection('Name', wkList);
603 for i := 0 to wkList.Count - 1 do begin
604 wkStr := ini.ReadString('Name', wkList[i], '');
605 if (wkStr <> '') and (FNameList.IndexOf(wkStr) = -1) then
606 FNameList.Add(wkStr);
607 end;
608 ini.ReadSection('Mail', wkList);
609 for i := 0 to wkList.Count - 1 do begin
610 wkStr := ini.ReadString('Mail', wkList[i], '');
611 if (wkStr <> '') and (FMailList.IndexOf(wkStr) = -1) then
612 FMailList.Add(wkStr);
613 end;
614 ini.ReadSection('SelectText', wkList);
615 for i := 0 to wkList.Count - 1 do begin
616 wkStr := ini.ReadString('SelectText', wkList[i], '');
617 if (wkStr <> '') and (FSelectTextList.IndexOf(wkStr) = -1) then
618 FSelectTextList.Add(wkStr);
619 end;
620 finally
621 wkList.Free;
622 end;
623
624 //リストカラム
625 wkList := TStringList.Create;
626 try
627 ini.ReadSection('BBSColumnWidth', wkList);
628 if Length(FBBSColumnWidth) <> wkList.Count then begin
629 ini.EraseSection('BBSColumnWidth');
630 end;
631 for i := 0 to Length(FBBSColumnWidth) - 1 do begin
632 BBSColumnWidth[i] := ini.ReadInteger('BBSColumnWidth', 'ID' + IntToStr(i), DEFAULT_BBS_WIDTH[i]);
633 end;
634 ini.ReadSection('CategoryColumnWidth', wkList);
635 if Length(FCategoryColumnWidth) <> wkList.Count then begin
636 ini.EraseSection('CategoryColumnWidth');
637 end;
638 for i := 0 to Length(FCategoryColumnWidth) - 1 do begin
639 CategoryColumnWidth[i] := ini.ReadInteger('CategoryColumnWidth', 'ID' + IntToStr(i), DEFAULT_CATEGORY_WIDTH[i]);
640 end;
641 ini.ReadSection('BoardColumnWidth', wkList);
642 if Length(FBoardColumnWidth) <> wkList.Count then begin
643 ini.EraseSection('BoardColumnWidth');
644 end;
645 for i := 0 to Length(FBoardColumnWidth) - 1 do begin
646 BoardColumnWidth[i] := ini.ReadInteger('BoardColumnWidth', 'ID' + IntToStr(i), DEFAULT_BOARD_WIDTH[i]);
647 end;
648 finally
649 wkList.Free;
650 end;
651
652
653 //リスト番号
654 FListViewNo := ini.ReadBool('Function', 'ListViewNo', True);
655 //CSS
656 FUseCSS := ini.ReadBool('CSS', 'UseCSS', True);
657 //CSSファイル名
658 FCSSFileName := ini.ReadString('CSS', 'FileName', 'default.css');
659
660 //Mail欄表示
661 FShowMail := ini.ReadBool('Thread', 'ShowMail', True);
662 //非アクティブ時ポップアップ表示
663 FUnActivePopup := ini.ReadBool('Thread', 'UnActivePopup', False);
664
665 //削除確認
666 FDeleteMsg := ini.ReadBool('Function', 'LogDeleteMessage', True);
667
668 //ログフォルダ
669 FLogFolder := ini.ReadString('Folder', 'LogFolder', ExtractFilePath(Application.ExeName) + 'Log');
670 NewLogFolder := '';
671
672 //板URL
673 FBoardURL2ch := ini.ReadString('BoardURL', '2ch', DEFAULT_2CH_BOARD_URL);
674
675 //認証用ユーザID・パスワード
676 FUserID := ini.ReadString('Attestation', 'UserID', '');
677 FPassword := Decrypt(ini.ReadString('Attestation', 'Password', ''));
678 FAutoLogin := ini.ReadBool('Attestation', 'AutoLogin', False);
679
680 //URLクリック時起動アプリ
681 FURLApp := ini.ReadBool('URLApp', 'Select', False);
682 FURLAppFile := ini.ReadString('URLApp', 'File', '');
683
684 //mailtoクリック時動作
685 FOpenMailer := ini.ReadBool('Mailto', 'Open', True);
686
687 //ポップアップ位置
688 FPopupPosition := TGikoPopupPosition(ini.ReadInteger('Browser', 'PopupPosition', Ord(gppLeftBottom)));
689
690 //アドレスバー
691 FURLDisplay := ini.ReadBool('AddressBar', 'URLDisplay', False);
692 FAddressBarTabStop := ini.ReadBool('AddressBar', 'TabStop', True);
693 FLinkAddAddressBar := ini.ReadBool('AddressBar', 'LinkAdd', False);
694 FAddressHistoryCount := ini.ReadInteger('AddressBar', 'HistoryCount', 100);
695
696 //画像プレビュー
697 FPreviewVisible := ini.ReadBool('Browser', 'PreviewVisible', True);
698 FPreviewSize := TGikoPreviewSize(ini.ReadInteger('Browser', 'PreviewSize', Ord(gpsMedium)));
699 FPreviewWait := ini.ReadInteger('Browser', 'PreviewWait', 500);
700
701 //スレッド一覧更新アイコン
702 FListIconVisible := ini.ReadBool('ThreadList', 'StateIconVisible', True);
703
704 //書き込み時マシン時刻使用設定
705 FUseMachineTime := ini.ReadBool('PostTime', 'UseMachineTime', False);
706 FTimeAdjustSec := ini.ReadInteger('PostTime', 'TimeAdjustSec', 0);
707 FTimeAdjust := ini.ReadBool('PostTime', 'TimeAdjust', True);
708
709 //サウンド
710 if Exists then begin
711 for i := 0 to GetSoundCount - 1 do begin
712 SoundFileName[i] := ini.ReadString('Sound', SoundName[i], '');
713 if not FileExists(SoundFileName[i]) then
714 SoundFileName[i] := '';
715 end;
716 end else begin
717 s := ExtractFileDir(Application.ExeName) + '\sound\';
718 SoundFileName[0] := s + '取得成功.wav';
719 SoundFileName[1] := s + '取得成功(差分).wav';
720 SoundFileName[2] := s + '未更新.wav';
721 SoundFileName[3] := '';
722 SoundFileName[4] := s + 'エラー.wav';
723 end;
724
725 //クールバー
726 for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
727 CoolSet.FCoolID := ini.ReadInteger('MainCoolBar', 'ID' + IntToStr(i), -1);
728 CoolSet.FCoolWidth := ini.ReadInteger('MainCoolBar', 'Width' + IntToStr(i), -1);
729 CoolSet.FCoolBreak := ini.ReadBool('MainCoolBar', 'Break' + IntToStr(i), False);
730 MainCoolSet[i] := CoolSet;
731 end;
732 for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
733 CoolSet.FCoolID := ini.ReadInteger('ListCoolBar', 'ID' + IntToStr(i), -1);
734 CoolSet.FCoolWidth := ini.ReadInteger('ListCoolBar', 'Width' + IntToStr(i), -1);
735 CoolSet.FCoolBreak := ini.ReadBool('ListCoolBar', 'Break' + IntToStr(i), False);
736 LIstCoolSet[i] := CoolSet;
737 end;
738 for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
739 CoolSet.FCoolID := ini.ReadInteger('BrowserCoolBar', 'ID' + IntToStr(i), -1);
740 CoolSet.FCoolWidth := ini.ReadInteger('BrowserCoolBar', 'Width' + IntToStr(i), -1);
741 CoolSet.FCoolBreak := ini.ReadBool('BrowserCoolBar', 'Break' + IntToStr(i), False);
742 BrowserCoolSet[i] := CoolSet;
743 end;
744 finally
745 ini.Free;
746 end;
747 end;
748
749 //設定ファイル保存(system)
750 procedure TSetting.WriteSystemSettingFile();
751 var
752 ini: TMemIniFile;
753 begin
754 ini := TMemIniFile.Create(GetFileName());
755 try
756 //受信バッファサイズ
757 ini.WriteInteger('HTTP', 'RecvBufferSize', FRecvBufferSize);
758 //HTTP1.1使用
759 ini.WriteBool('HTTP', 'Protocol', FProtocol);
760 //プロキシ接続HTTP1.1使用
761 ini.WriteBool('HTTP', 'ProxyProtocol', FProxyProtocol);
762
763 ini.WriteBool('ReadProxy', 'Proxy', FReadProxy);
764 ini.WriteString('ReadProxy', 'Address', FReadProxyAddress);
765 ini.WriteInteger('ReadProxy', 'Port', FReadProxyPort);
766 ini.WriteString('ReadProxy', 'UserID', FReadProxyUserID);
767 ini.WriteString('ReadProxy', 'Password', FReadProxyPassword);
768
769 ini.WriteBool('WriteProxy', 'Proxy', FWriteProxy);
770 ini.WriteString('WriteProxy', 'Address', FWriteProxyAddress);
771 ini.WriteInteger('WriteProxy', 'Port', FWriteProxyPort);
772 ini.WriteString('WriteProxy', 'UserID', FWriteProxyUserID);
773 ini.WriteString('WriteProxy', 'Password', FWriteProxyPassword);
774
775 ini.WriteString('Window', 'CabinetFontName', FCabinetFontName);
776 ini.WriteInteger('Window', 'CabinetFontSize', FCabinetFontSize);
777 ini.WriteString('Window', 'CabinetFontColor', ColorToString(FCabinetFontColor));
778 ini.WriteString('Window', 'CabinetBackColor', ColorToString(FCabinetBackColor));
779
780 ini.WriteString('Window', 'ListFontName', FListFontName);
781 ini.WriteInteger('Window', 'ListFontSize', FListFontSize);
782 ini.WriteString('Window', 'ListFontColor', ColorToString(FListFontColor));
783 ini.WriteString('Window', 'ListBackColor', ColorToString(FListBackColor));
784
785 ini.WriteString('Window', 'EditorFontName', FEditorFontName);
786 ini.WriteInteger('Window', 'EditorFontSize', FEditorFontSize);
787 ini.WriteString('Window', 'EditorFontColor', ColorToString(FEditorFontColor));
788 ini.WriteString('Window', 'EditorBackColor', ColorToString(FEditorBackColor));
789
790 ini.WriteString('Window', 'BrowserTabFontName', FBrowserTabFontName);
791 ini.WriteInteger('Window', 'BrowserTabFontSize', FBrowserTabFontSize);
792 ini.WriteBool('Window', 'BrowserTabFontBold', FBrowserTabFontBold);
793 ini.WriteBool('Window', 'BrowserTabFontItalic', FBrowserTabFontItalic);
794
795 ini.WriteString('Window', 'HintFontName', FHintFontName);
796 ini.WriteInteger('Window', 'HintFontSize', FHintFontSize);
797 ini.WriteString('Window', 'HintFontColor', ColorToString(FHintFontColor));
798 ini.WriteString('Window', 'HintBackColor', ColorToString(FHintBackColor));
799
800 ini.UpdateFile;
801 finally
802 ini.Free;
803 end;
804 end;
805
806 //設定ファイル保存(window)
807 procedure TSetting.WriteWindowSettingFile();
808 var
809 i: Integer;
810 ini: TMemIniFile;
811 CoolSet: TCoolSet;
812 begin
813 ini := TMemIniFile.Create(GetFileName());
814 try
815 ini.WriteInteger('WindowSize', 'Top', WindowTop);
816 ini.WriteInteger('WindowSize', 'Left', WindowLeft);
817 ini.WriteInteger('WindowSize', 'Height', WindowHeight);
818 ini.WriteInteger('WindowSize', 'Width', WindowWidth);
819 ini.WriteBool('WindowSize', 'Max', WindowMax);
820
821 ini.WriteInteger('ViewStyle', 'ListView', Ord(ListStyle));
822
823 ini.WriteInteger('EditorWindowSize', 'Top', EditWindowTop);
824 ini.WriteInteger('EditorWindowSize', 'Left', EditWindowLeft);
825 ini.WriteInteger('EditorWindowSize', 'Height', EditWindowHeight);
826 ini.WriteInteger('EditorWindowSize', 'Width', EditWindowWidth);
827 ini.WriteBool('EditorWindowSize', 'Max', EditWindowMax);
828
829 //ツールバー
830 ini.WriteBool('ToolBar', 'StdVisible', FStdToolBarVisible);
831 ini.WriteBool('ToolBar', 'AddressVisible', FAddressBarVisible);
832 ini.WriteBool('ToolBar', 'LinkVisible', FLinkBarVisible);
833 ini.WriteBool('ToolBar', 'ListVisible', FListToolBarVisible);
834 ini.WriteBool('ToolBar', 'ListNameVisible', FListNameBarVisible);
835 ini.WriteBool('ToolBar', 'BrowserVisible', FBrowserToolBarVisible);
836 ini.WriteBool('ToolBar', 'BrowserNameVisible', FBrowserNameBarVisible);
837 //ツールバーWrapable
838 ini.WriteBool('ToolBar', 'ListWrapable', FListToolBarWrapable);
839 ini.WriteBool('ToolBar', 'BrowserWrapable', FBrowserToolBarWrapable);
840
841 //タブ
842 ini.WriteBool('Tab', 'BrowserTabVisible', FBrowserTabVisible);
843 ini.WriteInteger('Tab', 'BrowserTabPosition', Ord(FBrowserTabPosition));
844 ini.WriteInteger('Tab', 'BrowserTabAppend', Ord(FBrowserTabAppend));
845 ini.WriteInteger('Tab', 'BrowserTabStyle', Ord(FBrowserTabStyle));
846
847 //メッセージバー
848 ini.WriteBool('MessageBar', 'Visible', FMessageBarVisible);
849 ini.WriteInteger('MessageBar', 'Height', FMessegeBarHeight);
850
851 //ステータスバー
852 ini.WriteBool('StatusBar', 'Visible', FStatusBarVisible);
853
854 //キャビネット
855 ini.WriteBool('Cabinet', 'Visible', FCabinetVisible);
856 ini.WriteInteger('Cabinet', 'Width', FCabinetWidth);
857
858 //リストのサイズと垂直水平
859 ini.WriteInteger('List', 'Orientation', Ord(FListOrientation));
860 ini.WriteInteger('List', 'Height', FListHeight);
861 ini.WriteInteger('List', 'HeightState', Ord(FListHeightState));
862 ini.WriteInteger('List', 'Width', FListWidth);
863 ini.WriteInteger('List', 'WidthState', Ord(FListWidthState));
864 // ini.WriteBool('List', 'HeightMax', FListHeightMax);
865 // ini.WriteBool('List', 'WidthMax', FListWidthMax);
866
867
868 // ini.WriteInteger('Window', 'BrowserFontSize', BrowserFontSize);
869
870 //リスト番号表示
871 ini.WriteBool('Function', 'ListViewNo', FListViewNo);
872 //CSS使用
873 ini.WriteBool('CSS', 'UseCSS', FUseCSS);
874 //CSSファイル名
875 ini.WriteString('CSS', 'FileName', FCSSFileName);
876 //Mail欄表示
877 ini.WriteBool('Thread', 'ShowMail', FShowMail);
878 //ログ削除確認
879 ini.WriteBool('Function', 'LogDeleteMessage', FDeleteMsg);
880 //非アクティブ時ポップアップ表示
881 ini.WriteBool('Thread', 'UnActivePopup', FUnActivePopup);
882
883 ini.WriteString('BoardURL', '2ch', FBoardURL2ch);
884
885 //認証用ユーザID・パスワード
886 ini.WriteString('Attestation', 'UserID', FUserID);
887 ini.WriteString('Attestation', 'Password', Encrypt(FPassword));
888 ini.WriteBool('Attestation', 'AutoLogin', FAutoLogin);
889
890 //URLクリック時起動アプリ
891 ini.WriteBool('URLApp', 'Select', FURLApp);
892 ini.WriteString('URLApp', 'File', FURLAppFile);
893
894 //mailtoクリック時動作
895 ini.WriteBool('Mailto', 'Open', FOpenMailer);
896
897 //ポップアップ位置
898 ini.WriteInteger('Browser', 'PopupPosition', Ord(FPopupPosition));
899
900 //アドレスバー
901 ini.WriteBool('AddressBar', 'URLDisplay', FURLDisplay);
902 ini.WriteBool('AddressBar', 'TabStop', FAddressBarTabStop);
903 ini.WriteBool('AddressBar', 'LinkAdd', FLinkAddAddressBar);
904 ini.WriteInteger('AddressBar', 'HistoryCount', FAddressHistoryCount);
905
906 //画像プレビュー
907 ini.WriteBool('Browser', 'PreviewVisible', FPreviewVisible);
908 ini.WriteInteger('Browser', 'PreviewSize', Ord(FPreviewSize));
909 ini.WriteInteger('Browser', 'PreviewWait', FPreviewWait);
910
911 //スレッド一覧更新アイコン
912 ini.WriteBool('ThreadList', 'StateIconVisible', FListIconVisible);
913
914 //書き込み時マシン時刻使用設定
915 ini.WriteBool('PostTime', 'UseMachineTime', FUseMachineTime);
916 ini.WriteInteger('PostTime', 'TimeAdjustSec', FTimeAdjustSec);
917 ini.WriteBool('PostTime', 'TimeAdjust', FTimeAdjust);
918
919 //リストカラム
920 for i := 0 to Length(FBBSColumnWidth) - 1 do begin
921 ini.WriteInteger('BBSColumnWidth', 'ID' + IntToStr(i), FBBSColumnWidth[i]);
922 end;
923 for i := 0 to Length(FCategoryColumnWidth) - 1 do begin
924 ini.WriteInteger('CategoryColumnWidth', 'ID' + IntToStr(i), FCategoryColumnWidth[i]);
925 end;
926 for i := 0 to Length(FBoardColumnWidth) - 1 do begin
927 ini.WriteInteger('BoardColumnWidth', 'ID' + IntToStr(i), FBoardColumnWidth[i]);
928 end;
929
930 //サウンド
931 for i := 0 to GetSoundCount - 1 do begin
932 if not FileExists(SoundFileName[i]) then
933 SoundFileName[i] := '';
934 ini.WriteString('Sound', SoundName[i], SoundFileName[i]);
935 end;
936
937 //CoolBar
938 ini.EraseSection('MainCoolBar');
939 for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
940 CoolSet := MainCoolSet[i];
941 ini.WriteInteger('MainCoolBar', 'ID' + IntToStr(i), CoolSet.FCoolID);
942 ini.WriteInteger('MainCoolBar', 'Width' + IntToStr(i), CoolSet.FCoolWidth);
943 ini.WriteBool('MainCoolBar', 'Break' + IntToStr(i), CoolSet.FCoolBreak);
944 end;
945 ini.EraseSection('BoardCoolBar');
946 for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
947 CoolSet := ListCoolSet[i];
948 ini.WriteInteger('ListCoolBar', 'ID' + IntToStr(i), CoolSet.FCoolID);
949 ini.WriteInteger('ListCoolBar', 'Width' + IntToStr(i), CoolSet.FCoolWidth);
950 ini.WriteBool('ListCoolBar', 'Break' + IntToStr(i), CoolSet.FCoolBreak);
951 end;
952 ini.EraseSection('BrowserCoolBar');
953 for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
954 CoolSet := BrowserCoolSet[i];
955 ini.WriteInteger('BrowserCoolBar', 'ID' + IntToStr(i), CoolSet.FCoolID);
956 ini.WriteInteger('BrowserCoolBar', 'Width' + IntToStr(i), CoolSet.FCoolWidth);
957 ini.WriteBool('BrowserCoolBar', 'Break' + IntToStr(i), CoolSet.FCoolBreak);
958 end;
959
960 ini.UpdateFile;
961 finally
962 ini.Free;
963 end;
964 end;
965
966 //設定ファイル保存(name & mail)
967 procedure TSetting.WriteNameMailSettingFile();
968 var
969 i: Integer;
970 ini: TMemIniFile;
971 begin
972 ini := TMemIniFile.Create(GetFileName());
973 try
974 ini.EraseSection('Name');
975 ini.EraseSection('Mail');
976 ini.EraseSection('SelectText');
977 for i := 0 to FNameList.Count - 1 do begin
978 ini.WriteString('Name', Format('%.2d', [i + 1]), FNameList[i]);
979 if i >= 39 then
980 Break;
981 end;
982 for i := 0 to FMailList.Count - 1 do begin
983 ini.WriteString('Mail', Format('%.2d', [i + 1]), FMailList[i]);
984 if i >= 39 then
985 Break;
986 end;
987 for i := 0 to FSelectTextList.Count - 1 do begin
988 ini.WriteString('SelectText', Format('%.2d', [i + 1]), FSelectTextList[i]);
989 if i >= 39 then
990 Break;
991 end;
992 ini.UpdateFile;
993 finally
994 ini.Free;
995 end;
996 end;
997
998 procedure TSetting.WriteFolderSettingFile();
999 var
1000 ini: TMemIniFile;
1001 begin
1002 ini := TMemIniFile.Create(GetFileName());
1003 try
1004 if ExtractFilePath(Application.ExeName) + 'Log' = NewLogFolder then
1005 ini.DeleteKey('Folder', 'LogFolder')
1006 else
1007 ini.WriteString('Folder', 'LogFolder', NewLogFolder);
1008 ini.UpdateFile;
1009 finally
1010 ini.Free;
1011 end;
1012 end;
1013
1014 //リストカラムヘッダー
1015 function TSetting.GetBBSColumnWidth(index: Integer): Integer;
1016 begin
1017 Result := IfThen(index in [0..Length(FBBSColumnWidth) - 1], FBBSColumnWidth[index], 0);
1018 end;
1019
1020 function TSetting.GetCategoryColumnWidth(index: Integer): Integer;
1021 begin
1022 Result := IfThen(index in [0..Length(FCategoryColumnWidth) - 1], FCategoryColumnWidth[index], 0);
1023 end;
1024
1025 function TSetting.GetBoardColumnWidth(index: Integer): Integer;
1026 begin
1027 Result := IfThen(index in [0..Length(FBoardColumnWidth) - 1], FBoardColumnWidth[index], 0);
1028 end;
1029
1030 procedure TSetting.SetBBSColumnWidth(index: Integer; value: Integer);
1031 begin
1032 if index in [0..Length(FBBSColumnWidth) - 1] then
1033 FBBSColumnWidth[index] := value;
1034 end;
1035
1036 procedure TSetting.SetCategoryColumnWidth(index: Integer; value: Integer);
1037 begin
1038 if index in [0..Length(FCategoryColumnWidth) - 1] then
1039 FCategoryColumnWidth[index] := value;
1040 end;
1041
1042 procedure TSetting.SetBoardColumnWidth(index: Integer; value: Integer);
1043 begin
1044 if index in [0..Length(FBoardColumnWidth) - 1] then
1045 FBoardColumnWidth[index] := value;
1046 end;
1047
1048 function TSetting.GetSoundCount: Integer;
1049 begin
1050 Result := Length(SOUND_NAME);
1051 end;
1052
1053 function TSetting.GetSoundName(Index: Integer): string;
1054 begin
1055 if (Index < GetSoundCount) and (Index >= 0) then
1056 Result := SOUND_NAME[Index].Name
1057 else
1058 Result := '';
1059 end;
1060
1061 function TSetting.GetSoundViewName(Index: Integer): string;
1062 begin
1063 if (Index < GetSoundCount) and (Index >= 0) then
1064 Result := SOUND_NAME[Index].ViewName
1065 else
1066 Result := '';
1067 end;
1068
1069 function TSetting.GetSoundFileName(Index: Integer): string;
1070 begin
1071 if (Index < GetSoundCount) and (Index >= 0) then
1072 Result := SOUND_NAME[Index].FileName
1073 else
1074 Result := '';
1075 end;
1076
1077 procedure TSetting.SetSoundFileName(Index: Integer; value: string);
1078 begin
1079 if (Index < GetSoundCount) and (Index >= 0) then
1080 SOUND_NAME[Index].FileName := value;
1081 end;
1082
1083 function TSetting.FindSoundFileName(Name: string): string;
1084 var
1085 i: Integer;
1086 begin
1087 for i := 0 to GetSoundCount - 1 do begin
1088 if SoundName[i] = Name then begin
1089 Result := SoundFileName[i];
1090 Exit;
1091 end;
1092 end;
1093 Result := '';
1094 end;
1095
1096 function TSetting.Encrypt(s: string): string;
1097 var
1098 cryptObj: THogeCryptAuto;
1099 inputStream, outputStream: TStringStream;
1100 begin
1101 inputStream := TStringStream.Create(s);
1102 outputStream := TStringStream.Create('');
1103 cryptObj := THogeCryptAuto.Create;
1104 try
1105 // 暗号化
1106 cryptObj.Encrypt(inputStream, GIKO_ENCRYPT_TEXT, outputStream);
1107
1108 // バイナリなので必要に応じてテキストに変換
1109 Result := HogeBase64Encode(outputStream.DataString);
1110 finally
1111 cryptObj.Free;
1112 outputStream.Free;
1113 inputStream.Free;
1114 end;
1115 end;
1116
1117 function TSetting.Decrypt(s: string): string;
1118 var
1119 cryptObj: THogeCryptAuto;
1120 inputStream, outputStream: TStringStream;
1121 begin
1122 try
1123 inputStream := TStringStream.Create(HogeBase64Decode(s));
1124 except
1125 Result := '';
1126 Exit;
1127 end;
1128 outputStream := TStringStream.Create('');
1129 cryptObj := THogeCryptAuto.Create;
1130 try
1131 // 復号
1132 cryptObj.Decrypt(inputStream, GIKO_ENCRYPT_TEXT, outputStream);
1133 Result := outputStream.DataString;
1134 finally
1135 cryptObj.Free;
1136 outputStream.Free;
1137 inputStream.Free;
1138 end;
1139 end;
1140
1141 function TSetting.GetMainCoolSet(Index: Integer): TCoolSet;
1142 begin
1143 if Index in [0..MAIN_COOLBAND_COUNT - 1] then
1144 Result := FMainCoolBar[Index]
1145 else begin
1146 Result.FCoolID := -1;
1147 Result.FCoolWidth := -1;
1148 Result.FCoolBreak := False;
1149 end;
1150 end;
1151
1152 function TSetting.GetBoardCoolSet(Index: Integer): TCoolSet;
1153 begin
1154 if Index in [0..LIST_COOLBAND_COUNT - 1] then
1155 Result := FListCoolBar[Index]
1156 else begin
1157 Result.FCoolID := -1;
1158 Result.FCoolWidth := -1;
1159 Result.FCoolBreak := False;
1160 end;
1161 end;
1162
1163 function TSetting.GetBrowserCoolSet(Index: Integer): TCoolSet;
1164 begin
1165 if Index in [0..BROWSER_COOLBAND_COUNT - 1] then
1166 Result := FBrowserCoolBar[Index]
1167 else begin
1168 Result.FCoolID := -1;
1169 Result.FCoolWidth := -1;
1170 Result.FCoolBreak := False;
1171 end;
1172 end;
1173
1174 procedure TSetting.SetMainCoolSet(Index: Integer; CoolSet: TCoolSet);
1175 begin
1176 if Index in [0..MAIN_COOLBAND_COUNT - 1] then
1177 FMainCoolBar[Index] := CoolSet;
1178 end;
1179
1180 procedure TSetting.SetBoardCoolSet(Index: Integer; CoolSet: TCoolSet);
1181 begin
1182 if Index in [0..LIST_COOLBAND_COUNT - 1] then
1183 FListCoolBar[Index] := CoolSet;
1184 end;
1185
1186 procedure TSetting.SetBrowserCoolSet(Index: Integer; CoolSet: TCoolSet);
1187 begin
1188 if Index in [0..BROWSER_COOLBAND_COUNT - 1] then
1189 FBrowserCoolBar[Index] := CoolSet;
1190 end;
1191
1192
1193 end.
1194

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