• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javaandroidc++linuxc#objective-ccocoa誰得qtrubypythongamewindowsbathyscaphephpguic翻訳omegattwitterframeworktestbtronarduinovb.net計画中(planning stage)directxpreviewerゲームエンジンdom

ギコナビ


Commit MetaInfo

Revisionfb633bb71a0891b559879bb6eeed34f8ac8b30f7 (tree)
Time2007-02-26 01:20:45
Authorh677 <h677>
Commiterh677

Log Message

書き込み保存のsent.iniファイルのサイズを制限する機能を追加

Change Summary

Incremental Difference

--- a/Editor.pas
+++ b/Editor.pas
@@ -266,6 +266,8 @@ type
266266 const PON : string; Board : TBoard) : string;
267267 //! fusianaŒxƒ_ƒCƒAƒƒO
268268 function FusianaMsgBox: Integer;
269+ //! sent.iniƒtƒ@ƒCƒ‹‚̐¶¬
270+ function CreateSentIniFile: TMemIniFile;
269271 protected
270272 procedure CreateParams(var Params: TCreateParams); override;
271273 public
@@ -1021,33 +1023,60 @@ var
10211023 sDate: string;
10221024 ini: TMemIniFile;
10231025 begin
1024- ini := TMemIniFile.Create(GikoSys.GetSentFileName);
1025- try
1026- sDate := IntToStr(GikoSys.DateTimeToInt(Now));
1027-
1028- ini.WriteString(sDate, 'Name', NameComboBox.Text);
1029- ini.WriteString(sDate, 'EMail', MailComboBox.Text);
1030- ini.WriteString(sDate, 'Body', HttpEncode(BodyEdit.Text));
1031- ini.WriteInteger(sDate, 'Status', FStatusCode);
1032- ini.WriteDateTime(sDate, 'Date', Now);
1033- if FThreadItem = nil then begin
1034- ini.WriteString(sDate, 'Title', MojuUtils.Sanitize(TitleEdit.Text));
1035- //ini.WriteString(sDate, 'BBS', FBoard.BBSID);
1036- ini.WriteString(sDate, 'URL', FBoard.URL);
1037- ini.WriteInteger(sDate, 'NewThread', 1);
1038- end else begin
1039- ini.WriteString(sDate, 'Title', FThreadItem.Title);
1040- //ini.WriteString(sDate, 'BBS', FThreadItem.ParentBoard.BBSID);
1041- ini.WriteString(sDate, 'URL', FThreadItem.URL);
1042- ini.WriteString(sDate, 'Key', ChangeFileExt(FThreadItem.FileName, ''));
1043- end;
1026+ ini := CreateSentIniFile;
1027+ if (ini <> nil) then begin
1028+ try
1029+ sDate := IntToStr(GikoSys.DateTimeToInt(Now));
1030+
1031+ ini.WriteString(sDate, 'Name', NameComboBox.Text);
1032+ ini.WriteString(sDate, 'EMail', MailComboBox.Text);
1033+ ini.WriteString(sDate, 'Body', HttpEncode(BodyEdit.Text));
1034+ ini.WriteInteger(sDate, 'Status', FStatusCode);
1035+ ini.WriteDateTime(sDate, 'Date', Now);
1036+ if FThreadItem = nil then begin
1037+ ini.WriteString(sDate, 'Title', MojuUtils.Sanitize(TitleEdit.Text));
1038+ //ini.WriteString(sDate, 'BBS', FBoard.BBSID);
1039+ ini.WriteString(sDate, 'URL', FBoard.URL);
1040+ ini.WriteInteger(sDate, 'NewThread', 1);
1041+ end else begin
1042+ ini.WriteString(sDate, 'Title', FThreadItem.Title);
1043+ //ini.WriteString(sDate, 'BBS', FThreadItem.ParentBoard.BBSID);
1044+ ini.WriteString(sDate, 'URL', FThreadItem.URL);
1045+ ini.WriteString(sDate, 'Key', ChangeFileExt(FThreadItem.FileName, ''));
1046+ end;
10441047
1045- ini.UpdateFile;
1046- finally
1047- ini.Free;
1048- end;
1048+ ini.UpdateFile;
1049+ finally
1050+ ini.Free;
1051+ end;
1052+ end;
1053+end;
1054+function TEditorForm.CreateSentIniFile: TMemIniFile;
1055+var
1056+ maxSize, fileSize, i: Integer;
1057+ newName: String;
1058+begin
1059+ Result := nil;
1060+ // MB -> bytes
1061+ maxSize := GikoSys.Setting.SentIniFileSize * 1024 * 1024;
1062+ // ƒtƒ@ƒCƒ‹ƒTƒCƒY‚ª0‚̏ꍇ‚́Asent.ini‚ɏ‘‚«ž‚Ü‚È‚¢‚Ì‚Ånil‚ð•Ô‚·
1063+ if (maxSize > 0) then begin
1064+ fileSize := GikoSys.GetFileSize(GikoSys.Setting.GetSentFileName);
1065+ // Å‘åƒTƒCƒY‚ð’´‚¦‚Ä‚¢‚½ê‡‚̓Šƒl[ƒ€‚·‚é
1066+ if (fileSize >= maxSize) then begin
1067+ i := 0;
1068+ // ¡‚ÌŽž‚ðƒtƒ@ƒCƒ‹–¼‚ÌŒã‚ë‚ɂ‚¯‚é
1069+ repeat
1070+ // 10‰ñˆÈãŽ¸”s‚µ‚½‚ç‚ ‚«‚ç‚ß‚é
1071+ if (i > 10) then break;
1072+ DateTimeToString(newName, 'yyhhnnsszzz', Now());
1073+ Inc(i);
1074+ until RenameFile(GikoSys.Setting.GetSentFileName,
1075+ GikoSys.Setting.GetSentFileName + '.' + newName);
1076+ end;
1077+ Result := TMemIniFile.Create(GikoSys.Setting.GetSentFileName);
1078+ end;
10491079 end;
1050-
10511080 procedure TEditorForm.SendActionExecute(Sender: TObject);
10521081 const
10531082 TITLE_SAMBA : string = 'Samba24Œx';
--- a/KuroutSetting.dfm
+++ b/KuroutSetting.dfm
@@ -21,8 +21,8 @@ object KuroutOption: TKuroutOption
2121 Top = 0
2222 Width = 517
2323 Height = 393
24- ActivePage = TabSheet2
25- TabIndex = 3
24+ ActivePage = TabSheet1
25+ TabIndex = 0
2626 TabOrder = 0
2727 object TabSheet1: TTabSheet
2828 Caption = #35443#32048#35373#23450#65297
@@ -186,6 +186,47 @@ object KuroutOption: TKuroutOption
186186 TabOrder = 0
187187 end
188188 end
189+ object GroupBox4: TGroupBox
190+ Left = 14
191+ Top = 293
192+ Width = 473
193+ Height = 57
194+ Caption = #26360#12365#36796#12415'Ini'#12501#12449#12452#12523
195+ TabOrder = 3
196+ object Label13: TLabel
197+ Left = 13
198+ Top = 24
199+ Width = 58
200+ Height = 12
201+ Caption = #26368#22823#12469#12452#12474
202+ end
203+ object Label14: TLabel
204+ Left = 160
205+ Top = 24
206+ Width = 282
207+ Height = 12
208+ Caption = 'MB ('#26368#22823#12469#12452#12474#12434#36229#12360#12427#12392#12501#12449#12452#12523#12399#12522#12493#12540#12512#12373#12428#12414#12377#65289
209+ end
210+ object SentIniFileSizeEdit: TEdit
211+ Left = 83
212+ Top = 20
213+ Width = 54
214+ Height = 20
215+ TabOrder = 0
216+ Text = '100'
217+ end
218+ object SentIniFileSizeUpDown: TUpDown
219+ Left = 137
220+ Top = 20
221+ Width = 15
222+ Height = 20
223+ Associate = SentIniFileSizeEdit
224+ Min = 0
225+ Position = 100
226+ TabOrder = 1
227+ Wrap = False
228+ end
229+ end
189230 end
190231 object ColumnTabSheet: TTabSheet
191232 Caption = #35443#32048#35373#23450'2'
--- a/KuroutSetting.pas
+++ b/KuroutSetting.pas
@@ -74,6 +74,11 @@ type
7474 RemoteTrapAtt: TCheckBox;
7575 ReplaceDatCheckBox: TCheckBox;
7676 Label12: TLabel;
77+ GroupBox4: TGroupBox;
78+ SentIniFileSizeEdit: TEdit;
79+ SentIniFileSizeUpDown: TUpDown;
80+ Label13: TLabel;
81+ Label14: TLabel;
7782 procedure OkBottonClick(Sender: TObject);
7883 procedure FormCreate(Sender: TObject);
7984 procedure CDeleteButtonClick(Sender: TObject);
@@ -146,6 +151,7 @@ begin
146151 AddKeywordCheckBox.Checked := GikoSys.Setting.AddKeywordLink;
147152 // Œë”½‰ž‘΍ô
148153 ReplaceDatCheckBox.Checked := GikoSys.Setting.ReplaceDat;
154+ SentIniFileSizeUpDown.Position := GikoSys.Setting.SentIniFileSize;
149155 end;
150156
151157 procedure TKuroutOption.SaveSetting;
@@ -186,6 +192,7 @@ begin
186192 GikoSys.Setting.AddKeywordLink := AddKeywordCheckBox.Checked;
187193 // Œë”½‰ž‘΍ô
188194 GikoSys.Setting.ReplaceDat := ReplaceDatCheckBox.Checked;
195+ GikoSys.Setting.SentIniFileSize := SentIniFileSizeUpDown.Position;
189196 end;
190197
191198 procedure TKuroutOption.RecvBufferSizeExit(Sender: TObject);
--- a/Setting.pas
+++ b/Setting.pas
@@ -445,6 +445,8 @@ type
445445 FAddKeywordLink: Boolean;
446446 //! dat’uŠ·‚ð—LŒø‚É‚·‚é
447447 FReplaceDat: Boolean;
448+ //! sent.iniƒtƒ@ƒCƒ‹‚̃TƒCƒYi’PˆÊMBj
449+ FSentIniFileSize: Integer;
448450
449451 function GetMainCoolSet(Index: Integer): TCoolSet;
450452 function GetBoardCoolSet(Index: Integer): TCoolSet;
@@ -800,6 +802,9 @@ type
800802 property AddKeywordLink: Boolean read FAddKeywordLink write FAddKeywordLink;
801803 //! dat‚Ì’uŠ·‚ð—LŒø‚É‚·‚é‚©
802804 property ReplaceDat: Boolean read FReplaceDat write FReplaceDat;
805+ //! sent.iniƒtƒ@ƒCƒ‹‚̃TƒCƒYi’PˆÊMBj
806+ property SentIniFileSize: Integer read FSentIniFileSize write FSentIniFileSize;
807+
803808 end;
804809
805810
@@ -1284,6 +1289,9 @@ begin
12841289 end else begin
12851290 FReplaceDat := ini.ReadBool('Thread', 'ReplaceDat', False);
12861291 end;
1292+
1293+ FSentIniFileSize := ini.ReadInteger('Function', 'SentIniFileSize', 3);
1294+
12871295 ini.UpdateFile;
12881296 finally
12891297 ini.Free;
@@ -1663,6 +1671,7 @@ begin
16631671 ini.WriteBool('Function', 'LoopBrowserTabs', FLoopBrowserTabs);
16641672 ini.WriteBool('Thread', 'AddKeywordLink', FAddKeywordLink);
16651673 ini.WriteBool('Thread', 'ReplaceDat', FReplaceDat);
1674+ ini.WriteInteger('Function', 'SentIniFileSize', FSentIniFileSize);
16661675 ini.UpdateFile;
16671676 finally
16681677 ini.Free;
Binary files a/gikoNavi.res and b/gikoNavi.res differ