6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
7 ComCtrls, IniFiles, ShellAPI, ActnList, Math,
15 {HttpApp,} YofUtils, URLMon, IdGlobal, IdURI, {Masks,}
16 Setting, BoardGroup, gzip, Dolib, bmRegExp, AbonUnit,
17 MojuUtils, ExternalBoardManager, ExternalBoardPlugInMain,
22 TGikoBBSType = (gbt2ch);
23 //
\83\8d\83O
\83^
\83C
\83v
24 TGikoLogType = (glt2chNew, glt2chOld);
25 //
\83\81\83b
\83Z
\81[
\83W
\83A
\83C
\83R
\83\93
26 TGikoMessageIcon = (gmiOK, gmiSAD, gmiNG, gmiWhat, gmiNone);
27 //URL
\83I
\81[
\83v
\83\93\83u
\83\89\83E
\83U
\83^
\83C
\83v
28 TGikoBrowserType = (gbtIE, gbtUserApp, gbtAuto);
31 TStrTokSeparator = set of Char;
37 //
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b\83\8c\83R
\81[
\83h
45 FRoundDate: TDateTime;
46 FLastModified: TDateTime;
49 FMishiyou: Boolean; //
\96¢
\8eg
\97p
53 FAllResCount: Integer;
54 FNewResCount: Integer;
55 FAgeSage: TGikoAgeSage;
58 //
\83T
\83u
\83W
\83F
\83N
\83g
\83\8c\83R
\81[
\83h
65 //
\83\8c\83X
\83\8c\83R
\81[
\83h
75 //URLPath
\83\8c\83R
\81[
\83h
78 FKey: string; //ThreadID
79 FSt: Int64; //
\8aJ
\8en
\83\8c\83X
\94Ô
80 FTo: Int64; //
\8fI
\97¹
\83\8c\83X
\94Ô
81 FFirst: Boolean; //>>1
\82Ì
\95\
\8e¦
82 FStBegin: Boolean; //1
\81`
\95\
\8e¦
83 FToEnd: Boolean; //
\81`
\8dÅ
\8cã
\82Ü
\82Å
\95\
\8e¦
84 FDone: Boolean; //
\90¬
\8c÷
85 FNoParam: Boolean; //
\83\8c\83X
\94Ô
\83p
\83\89\83\81\81[
\83^
\82È
\82µ
88 TGikoSys = class(TObject)
95 FBayesian : TGikoBayesian; //!<
\83x
\83C
\83W
\83A
\83\93\83t
\83B
\83\8b\83^
97 // FExitWrite: TStringList;
98 // function StrToFloatDef(s: string; Default: Double): Double;
102 FSelectResFilter : TAbon;
105 destructor Destroy; override;
106 property ResRange : Longint read FResRange write FResRange;
107 // function MsgBox(Msg: string; Title: string; Flags: Longint): integer; overload;
108 // function MsgBox(Handle: THandle; Msg: string; Title: string; Flags: Longint): integer; overload;
109 function IsNumeric(s: string): boolean;
110 function IsFloat(s: string): boolean;
111 function DirectoryExistsEx(const Name: string): Boolean;
112 function ForceDirectoriesEx(Dir: string): Boolean;
113 // function GetVersion: string;
115 function GetBoardFileName: string;
116 function GetCustomBoardFileName: string;
117 function GetHtmlTempFileName: string;
118 function GetAppDir: string;
119 function GetTempFolder: string;
120 function GetSentFileName: string;
121 function GetConfigDir: string;
122 function GetSkinDir: string;
123 function GetSkinHeaderFileName: string;
124 function GetSkinFooterFileName: string;
125 function GetSkinResFileName: string;
126 function GetSkinNewResFileName: string;
127 function GetSkinBookmarkFileName: string;
128 function GetSkinNewmarkFileName: string;
129 function GetStyleSheetDir: string;
130 function GetOutBoxFileName: string;
131 function GetUserAgent: string;
132 function GetSambaFileName : string;
134 procedure ReadSubjectFile(Board: TBoard);
135 procedure CreateThreadDat(Board: TBoard);
136 procedure WriteThreadDat(Board: TBoard);
137 function ParseIndexLine(Line: string): TIndexRec;
138 procedure GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean); overload;
139 procedure GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean); overload;//
\83T
\83u
\83t
\83H
\83\8b\83_
\82Í
\8c\9f\8dõ
\82µ
\82È
\82¢
140 procedure GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
142 procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
143 procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
144 function AddAnchorTag(s: string): string;
146 function DivideSubject(Line: string): TSubjectRec;
147 function DivideStrLine(Line: string): TResRec;
149 property Setting: TSetting read FSetting write FSetting;
150 property Dolib: TDolib read FDolib write FDolib;
152 function UrlToID(url: string): string;
153 function UrlToServer(url: string): string;
155 function StrTokFirst(const s:string; const sep:TStrTokSeparator; var Rec:TStrTokRec):string;
156 function StrTokNext(const sep:TStrTokSeparator; var Rec:TStrTokRec): string;
158 function GetFileSize(FileName : string) : longint;
159 function GetFileLineCount(FileName : string): longint;
160 function Get2chDate(aDate: TDateTime): string;
161 function IntToDateTime(val: Int64): TDateTime;
162 function DateTimeToInt(ADate: TDateTime): Int64;
164 function ReadThreadFile(FileName: string; Line: Integer): string;
166 procedure MenuFont(Font: TFont);
168 function RemoveToken(var s:string; const delimiter:string):string;
169 function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
170 function DeleteLink(const s: string): string;
172 function GetShortName(const LongName: string; ALength: integer): string;
173 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;
174 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
175 function ConvertResAnchor(res: string): string;
176 function BoolToInt(b: Boolean): Integer;
177 function IntToBool(i: Integer): Boolean;
178 function GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
179 procedure LoadKeySetting(ActionList: TActionList);
180 procedure SaveKeySetting(ActionList: TActionList);
181 procedure LoadEditorKeySetting(ActionList: TActionList);
182 procedure SaveEditorKeySetting(ActionList: TActionList);
184 procedure CreateProcess(const AppPath: string; const Param: string);
185 procedure OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
186 function HTMLDecode(const AStr: String): String;
187 function GetHRefText(s: string): string;
188 function Is2chHost(Host: string): Boolean;
189 function Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
190 function Parse2chURL2(URL: string): TPathRec;
191 procedure ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
192 function GetVersionBuild: Integer;
193 function GetBrowsableThreadURL( inURL : string ) : string;
194 function GetThreadURL2BoardURL( inURL : string ) : string;
195 function Get2chThreadURL2BoardURL( inURL : string ) : string;
196 function Get2chBrowsableThreadURL( inURL : string ) : string;
197 function Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string;
198 procedure ListBoardFile;
199 procedure ReadBoardFile( bbs : TBBS );
201 function GetUnknownCategory : TCategory;
202 function GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
204 procedure GetPopupResNumber(URL : string; var stRes, endRes : Int64);
206 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
207 function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string;
208 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
209 function SkinedRes( skin: string; Res: TResRec; No: string ): string;
211 //Samba24
\82Ì
\83t
\83@
\83C
\83\8b\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\81B
\91¶
\8dÝ
\82µ
\82È
\82¢
\8fê
\8d\87\81Adefault
\83t
\83@
\83C
\83\8b\82ðrename
\82·
\82é
212 procedure SambaFileExists();
214 property Bayesian : TGikoBayesian read FBayesian write FBayesian;
215 function GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem):string;
217 procedure SpamCountWord( const text : string; wordCount : TWordCount );
218 //!
\8aw
\8fK
\83N
\83\8a\83A
219 procedure SpamForget( wordCount : TWordCount; isSpam : Boolean );
220 //!
\83X
\83p
\83\80\8aw
\8fK
221 procedure SpamLearn( wordCount : TWordCount; isSpam : Boolean );
222 //!
\83X
\83p
\83\80\93x
\90\94
223 function SpamParse( const text : string; wordCount : TWordCount ) : Extended;
229 //LENGTH_RESTITLE = 40;
230 ZERO_DATE: Integer = 25569;
231 BETA_VERSION_NAME_E = 'beta';
232 BETA_VERSION_NAME_J = 'ÊÞÀ';
234 BETA_VERSION_BUILD = ''; //debug
\94Å
\82È
\82Ç
235 APP_NAME = 'gikoNavi';
240 Giko, RoundData, Favorite;
243 FOLDER_INDEX_VERSION = '1.01';
244 USER_AGENT = 'Monazilla';
245 DEFAULT_NGWORD_FILE_NAME : String = 'NGword.txt';
246 NGWORDs_DIR_NAME : String = 'NGwords';
248 READ_PATH: string = '/test/read.cgi/';
249 OLD_READ_PATH: string = '/test/read.cgi?';
250 KAKO_PATH: string = '/kako/';
252 (*************************************************************************
253 *GikoSys
\83R
\83\93\83X
\83g
\83\89\83N
\83^
254 *************************************************************************)
255 constructor TGikoSys.Create;
257 FSetting := TSetting.Create;
258 FDolib := TDolib.Create;
259 FAWKStr := TAWKStr.Create(nil);
260 if DirectoryExists(GetConfigDir) = false then begin
261 CreateDir(GetConfigDir);
263 FAbon := TAbon.Create;
264 FAbon.Setroot(GetConfigDir+NGWORDs_DIR_NAME);
266 FAbon.ReturnNGwordLineNum := FSetting.ShowNGLinesNum;
267 FAbon.SetNGResAnchor := FSetting.AddResAnchor;
268 FAbon.DeleteSyria := FSetting.DeleteSyria;
269 FAbon.Deleterlo := FSetting.AbonDeleterlo;
270 FAbon.Replaceul := FSetting.AbonReplaceul;
271 FAbon.AbonPopupRes := FSetting.PopUpAbon;
273 FSelectResFilter := TAbon.Create;
274 //
\8di
\82è
\8d\9e\82Þ
\82Æ
\82«
\82Í
\8bÉ
\97Í
\88ê
\97\97\82ª
\8c©
\82ç
\82ê
\82é
\82Ù
\82¤
\82ª
\82¢
\82¢
\82Ì
\82Å
\91¼
\82Í
\8a®
\91S
\82É
\8dí
\8f\9c
275 FSelectResFilter.AbonString := '';
277 ResRange := FSetting.ResRange;
278 FBayesian := TGikoBayesian.Create;
281 (*************************************************************************
282 *GikoSys
\83f
\83X
\83g
\83\89\83N
\83^
283 *************************************************************************)
284 destructor TGikoSys.Destroy;
287 FileList: TStringList;
289 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
298 FSelectResFilter.Free;
299 //
\83e
\83\93\83|
\83\89\83\8aHTML
\82ð
\8dí
\8f\9c
300 FileList := TStringList.Create;
302 GetFileList(GetTempFolder, '*.html', FileList, False, True);
303 for i := 0 to FileList.Count - 1 do begin
304 DeleteFile(FileList[i]);
312 (*************************************************************************
313 *
\95¶
\8e\9a\97ñ
\90\94\8e\9a\83`
\83F
\83b
\83N
314 *************************************************************************)
316 function TGikoSys.IsNumeric(s: string): boolean;
326 (*************************************************************************
327 *
\95¶
\8e\9a\97ñ
\95\82\93®
\8f¬
\90\94\93_
\90\94\8e\9a\83`
\83F
\83b
\83N
328 *************************************************************************)
329 function TGikoSys.IsFloat(s: string): boolean;
333 Result := TextToFloat(PChar(s), v, fvExtended);
336 (*************************************************************************
337 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
338 *************************************************************************)
339 function TGikoSys.GetBoardFileName: string;
341 Result := Setting.GetBoardFileName;
344 (*************************************************************************
345 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
346 *************************************************************************)
347 function TGikoSys.GetCustomBoardFileName: string;
349 Result := Setting.GetCustomBoardFileName;
352 (*************************************************************************
353 *
\83e
\83\93\83|
\83\89\83\8a\83t
\83H
\83\8b\83_
\81[
\96¼
\8eæ
\93¾
354 *************************************************************************)
355 function TGikoSys.GetHtmlTempFileName: string;
357 Result := Setting.GetHtmlTempFileName;
361 (*************************************************************************
362 *
\8eÀ
\8ds
\83t
\83@
\83C
\83\8b\83t
\83H
\83\8b\83_
\8eæ
\93¾
363 *************************************************************************)
364 function TGikoSys.GetAppDir: string;
366 Result := Setting.GetAppDir;
369 (*************************************************************************
370 *TempHtml
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
371 *************************************************************************)
372 function TGikoSys.GetTempFolder: string;
374 Result := Setting.GetTempFolder;
377 (*************************************************************************
378 *sent.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
379 *************************************************************************)
380 function TGikoSys.GetSentFileName: string;
382 Result := Setting.GetSentFileName;
385 (*************************************************************************
386 *outbox.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
387 *************************************************************************)
388 function TGikoSys.GetOutBoxFileName: string;
390 Result := Setting.GetOutBoxFileName;
393 (*************************************************************************
394 *Config
\83t
\83H
\83\8b\83_
\8eæ
\93¾
395 *************************************************************************)
396 function TGikoSys.GetConfigDir: string;
398 Result := Setting.GetConfigDir;
401 function TGikoSys.GetStyleSheetDir: string;
403 Result := Setting.GetStyleSheetDir;
406 function TGikoSys.GetSkinDir: string;
408 Result := Setting.GetSkinDir;
411 function TGikoSys.GetSkinHeaderFileName: string;
413 Result := Setting.GetSkinHeaderFileName;
416 function TGikoSys.GetSkinFooterFileName: string;
418 Result := Setting.GetSkinFooterFileName;
421 function TGikoSys.GetSkinNewResFileName: string;
423 Result := Setting.GetSkinNewResFileName;
426 function TGikoSys.GetSkinResFileName: string;
428 Result := Setting.GetSkinResFileName;
431 function TGikoSys.GetSkinBookmarkFileName: string;
433 Result := Setting.GetSkinBookmarkFileName;
436 function TGikoSys.GetSkinNewmarkFileName: string;
438 Result := Setting.GetSkinNewmarkFileName;
442 function TGikoSys.GetUserAgent: string;
444 if Dolib.Connected then begin
445 Result := Format('%s %s/%s%d%s', [
452 BETA_VERSION_BUILD]);
454 Result := Format('%s/%s %s/%s%d%s', [
462 BETA_VERSION_BUILD]);
466 (*************************************************************************
467 *
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é
\95û
\8e®
\8e\9e\8d\8f\8eæ
\93¾
468 *************************************************************************)
469 function TGikoSys.Get2chDate(aDate: TDateTime): string;
474 d1 := EncodeDate(1970, 1, 1);
475 d2 := aDate - EncodeTime(9, 0, 0, 0);
476 //Result := FloatToStr(Trunc((d2 - d1) * 24 * 60 * 60));
477 Result := FloatToStr(Trunc((d2 - d1) * 86400));
481 function TGikoSys.IntToDateTime(val: Int64): TDateTime;
486 d1 := EncodeDate(1970, 1, 1);
487 d2 := val / 86400.0;//(val * 1000) / (24 * 60 * 60 * 1000);
491 function TGikoSys.DateTimeToInt(ADate: TDateTime): Int64;
496 d := EncodeDate(1970, 1, 1);
497 c := (ADate - d) * 86400; //(ADate - d) * 24 * 60 * 60;
502 (*************************************************************************
503 *Subject
\83t
\83@
\83C
\83\8bRead
504 *************************************************************************)
505 procedure TGikoSys.ReadSubjectFile(Board: TBoard);
507 ThreadItem: TThreadItem;
509 FileList: TStringList;
510 TmpFileList: TStringList;
518 RoundItem: TRoundItem;
523 FavoThreadItem : TFavoriteThreadItem;
527 if Board.IsThreadDatRead then
532 usePlugIn := Board.IsBoardPlugInAvailable;
534 FileName := Board.GetFolderIndexFileName;
536 FileList := TStringList.Create;
537 FileList.Sorted := True;
538 TmpFileList := TStringList.Create;
539 TmpFileList.Sorted := True;
541 //IsLogFile
\97pDAT
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
542 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False);
543 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\97pTmp
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
544 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False);
546 //
\8fd
\95¡
\82ð
\96h
\82®
548 Board.Sorted := True;
550 sl := TStringList.Create;
552 if FileExists(FileName) then begin
553 sl.LoadFromFile(FileName);
555 //
\82Q
\8ds
\96Ú
\82©
\82ç
\81i
\82P
\8ds
\96Ú
\82Í
\83o
\81[
\83W
\83\87\83\93\81j
556 for i := sl.Count - 1 downto 1 do begin
557 Rec := ParseIndexLine(sl[i]);
559 ThreadItem := TThreadItem.Create(
561 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
563 ThreadItem := TThreadItem.Create(
565 Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' ) ) );
567 if FileList.Count <> 0 then
568 if FileList.Find( ThreadItem.FileName, Index ) then
569 FileList.Delete( Index );
571 ThreadItem.BeginUpdate;
572 ThreadItem.No := Rec.FNo;
573 ThreadItem.FileName := Rec.FFileName;
574 ThreadItem.Title := Rec.FTitle;
575 ThreadItem.ShortTitle := CustomStringReplace(ZenToHan(ThreadItem.Title), ' ', '');
576 ThreadItem.Count := Rec.FCount;
577 ThreadItem.Size := Rec.FSize;
578 // ThreadItem.RoundNo := Rec.FRoundNo;
579 ThreadItem.RoundDate := Rec.FRoundDate;
580 ThreadItem.LastModified := Rec.FLastModified;
581 ThreadItem.Kokomade := Rec.FKokomade;
582 ThreadItem.NewReceive := Rec.FNewReceive;
583 // ThreadItem.Round := Rec.FRound;
584 ThreadItem.UnRead := Rec.FUnRead;
585 ThreadItem.ScrollTop := Rec.FScrollTop;
586 ThreadItem.AllResCount := Rec.FAllResCount;
587 ThreadItem.NewResCount := Rec.FNewResCount;
588 ThreadItem.AgeSage := Rec.FAgeSage;
589 ThreadItem.ParentBoard := Board;
590 {*
\82¨
\8bC
\82É
\93ü
\82è
\91å
\97Ê
\90¶
\90¬
\83R
\81[
\83h *}
592 FavoThreadItem := TFavoriteThreadItem.Create( ThreadItem.URL, ThreadItem.Title, ThreadItem );
593 Node := FavoriteDM.TreeView.Items.AddChildObject( FavoriteDM.TreeView.Items.Item[0], ThreadItem.Title, FavoThreadItem);
596 //
\8f\84\89ñ
\83\8a\83X
\83g
\82É
\91¶
\8dÝ
\82µ
\82½
\82ç
\8f\84\89ñ
\83t
\83\89\83O
\83Z
\83b
\83g
597 if ThreadItem.IsLogFile then begin
598 idx := RoundList.Find(ThreadItem);
599 if idx <> -1 then begin
600 RoundItem := RoundList.Items[idx, grtItem];
601 ThreadItem.RoundName := RoundItem.RoundName;
602 ThreadItem.Round := True;
606 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\83`
\83F
\83b
\83N
607 if TmpFileList.Count <> 0 then begin
608 if TmpFileList.Find(ChangeFileExt(ThreadItem.FileName, '.tmp'), Index) then begin
609 ini := TMemIniFile.Create(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
611 tmpStr := ini.ReadString('Setting', 'RoundDate', DateTimeToStr(ZERO_DATE));
612 ThreadItem.RoundDate := ConvertDateTimeString(tmpStr);
614 tmpStr := ini.ReadString('Setting', 'LastModified', DateTimeToStr(ZERO_DATE));
615 ThreadItem.LastModified := ConvertDateTimeString(tmpStr);
616 ThreadItem.Count := ini.ReadInteger('Setting', 'Count', 0);
617 ThreadItem.NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
619 ThreadItem.Size := ini.ReadInteger('Setting', 'Size', 0);
620 if(ThreadItem.Size = 0) and (FileExists(ThreadItem.GetThreadFileName)) then begin
622 ThreadItem.Size := GetFileSize(ThreadItem.GetThreadFileName) - ThreadItem.Count;
628 ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
629 ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
630 ThreadItem.ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
631 ThreadItem.AllResCount := ini.ReadInteger('Setting', 'AllResCount', ThreadItem.Count);
632 ThreadItem.NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
633 ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
637 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
638 TmpFileList.Delete(Index);
642 ThreadItem.EndUpdate;
643 Board.Add(ThreadItem);
645 if (ThreadItem.IsLogFile) and (ThreadItem.UnRead) then
650 if UnRead <> Board.UnRead then
651 Board.UnRead := UnRead;
653 //
\83C
\83\93\83f
\83b
\83N
\83X
\82É
\96³
\82©
\82Á
\82½
\83\8d\83O
\82ð
\92Ç
\89Á
\81i
\95\85\82ê
\83C
\83\93\83f
\83b
\83N
\83X
\91Î
\89\9e\81j
654 for i := 0 to FileList.Count - 1 do begin
655 FileName := ExtractFileDir(Board.GetFolderIndexFileName) + '\' + FileList[i];
657 //ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
658 if usePlugIn then begin
659 ThreadItem := TThreadItem.Create(
661 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), FileList[i] ) );
662 ResRec := DivideStrLine(Board.BoardPlugIn.GetDat( DWORD( ThreadItem ), 1 ));
664 ThreadItem := TThreadItem.Create(
665 nil, Get2chBoard2ThreadURL( Board, ChangeFileExt( FileList[i], '' ) ) );
666 ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
669 ThreadItem.BeginUpdate;
670 ThreadItem.FilePath := FileName;
671 ThreadItem.No := Board.Count + 1;
672 ThreadItem.FileName := FileList[i];
673 ThreadItem.Title := ResRec.FTitle;
674 ThreadItem.Count := GetFileLineCount(FileName);
675 ThreadItem.AllResCount := ThreadItem.Count;
676 ThreadItem.NewResCount := ThreadItem.Count;
677 ThreadItem.Size := GetFileSize(FileName) - ThreadItem.Count;//1byte
\82¸
\82ê
\82é
\82Æ
\82«
\82ª
\82 \82é
\82¯
\82Ç
\82»
\82ê
\82Í
\82 \82«
\82ç
\82ß
\82é
678 ThreadItem.RoundDate := ZERO_DATE;
679 ThreadItem.LastModified := ZERO_DATE;
680 ThreadItem.Kokomade := -1;
681 ThreadItem.NewReceive := ThreadItem.Count;
682 ThreadItem.ParentBoard := Board;
683 ThreadItem.IsLogFile := True;
684 ThreadItem.Round := False;
685 ThreadItem.UnRead := False;
686 ThreadItem.ScrollTop := 0;
687 ThreadItem.AgeSage := gasNone;
688 ThreadItem.EndUpdate;
689 Board.Add(ThreadItem);
696 Board.Sorted := False;
698 Board.IsThreadDatRead := True;
701 (*************************************************************************
702 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b(Folder.idx)
\8dì
\90¬
703 *************************************************************************)
704 procedure TGikoSys.CreateThreadDat(Board: TBoard);
708 SubjectList: TStringList;
714 if not FileExists(Board.GetSubjectFileName) then Exit;
715 FileName := Board.GetFolderIndexFileName;
717 SubjectList := TStringList.Create;
719 SubjectList.LoadFromFile(Board.GetSubjectFileName);
720 sl := TStringList.Create;
723 sl.Add(FOLDER_INDEX_VERSION);
724 for i := 0 to SubjectList.Count - 1 do begin
725 Rec := DivideSubject(SubjectList[i]);
727 if (Trim(Rec.FFileName) = '') or (Trim(Rec.FTitle) = '') then
730 s := Format('%x', [cnt]) + #1 //
\94Ô
\8d\86
731 + Rec.FFileName + #1 //
\83t
\83@
\83C
\83\8b\96¼
732 + Rec.FTitle + #1 //
\83^
\83C
\83g
\83\8b
733 + Format('%x', [Rec.FCount]) + #1 //
\83J
\83E
\83\93\83g
734 + Format('%x', [0]) + #1 //size
735 + Format('%x', [0]) + #1 //RoundDate
736 + Format('%x', [0]) + #1 //LastModified
737 + Format('%x', [0]) + #1 //Kokomade
738 + Format('%x', [0]) + #1 //NewReceive
739 + '0' + #1 //
\96¢
\8eg
\97p
740 + Format('%x', [0]) + #1 //UnRead
741 + Format('%x', [0]) + #1 //ScrollTop
742 + Format('%x', [Rec.FCount]) + #1 //AllResCount
743 + Format('%x', [0]) + #1 //NewResCount
744 + Format('%x', [0]); //AgeSage
749 sl.SaveToFile(FileName);
758 (*************************************************************************
759 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X(Thread.dat)
\8f\91\82«
\8d\9e\82Ý
761 *************************************************************************)
762 procedure TGikoSys.WriteThreadDat(Board: TBoard);
764 // Values: array[Boolean] of string = ('0', '1');
770 TmpFileList: TStringList;
772 if not Board.IsThreadDatRead then
774 FileName := Board.GetFolderIndexFileName;
775 ForceDirectoriesEx( ExtractFilePath( FileName ) );
777 sl := TStringList.Create;
778 TmpFileList := TStringList.Create;
779 TmpFileList.Sorted := true;
781 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, false);
783 sl.Add(FOLDER_INDEX_VERSION);
785 //
\83X
\83\8c\94Ô
\8d\86\95Û
\91¶
\82Ì
\82½
\82ß
\83\
\81[
\83g
786 Sort.SortNoFlag := true;
787 Sort.SortOrder := true;
789 //Sort.SortNonAcquiredCountFlag := GikoSys.Setting.NonAcquiredCount;
790 Board.CustomSort(ThreadItemSortProc);
792 for i := 0 to Board.Count - 1 do begin
793 Board.Items[i].No := i + 1;
794 s := Format('%x', [Board.Items[i].No]) + #1
795 + Board.Items[i].FileName + #1
796 + Board.Items[i].Title + #1
797 + Format('%x', [Board.Items[i].Count]) + #1
798 + Format('%x', [Board.Items[i].Size]) + #1
799 + Format('%x', [DateTimeToInt(Board.Items[i].RoundDate)]) + #1
800 + Format('%x', [DateTimeToInt(Board.Items[i].LastModified)]) + #1
801 + Format('%x', [Board.Items[i].Kokomade]) + #1
802 + Format('%x', [Board.Items[i].NewReceive]) + #1
803 + '0' + #1 //
\96¢
\8eg
\97p
804 + Format('%x', [BoolToInt(Board.Items[i].UnRead)]) + #1
805 + Format('%x', [Board.Items[i].ScrollTop]) + #1
806 + Format('%x', [Board.Items[i].AllResCount]) + #1
807 + Format('%x', [Board.Items[i].NewResCount]) + #1
808 + Format('%x', [Ord(Board.Items[i].AgeSage)]);
813 sl.SaveToFile(FileName);
815 for i := 0 to TmpFileList.Count - 1 do begin
816 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[i]);
825 function TGikoSys.ParseIndexLine(Line: string): TIndexRec;
827 Result.FNo := StrToIntDef('$' + RemoveToken(Line, #1), 0);
828 Result.FFileName := RemoveToken(Line, #1);
829 Result.FTitle := RemoveToken(Line, #1);
830 Result.FCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
831 Result.FSize := StrToIntDef('$' + RemoveToken(Line, #1), 0);
832 Result.FRoundDate := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
833 Result.FLastModified := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
834 Result.FKokomade := StrToIntDef('$' + RemoveToken(Line, #1), -1);
835 Result.FNewReceive := StrToIntDef('$' + RemoveToken(Line, #1), 0);
836 RemoveToken(Line, #1);//9: ; //
\96¢
\8eg
\97p
837 Result.FUnRead := IntToBool(StrToIntDef('$' + RemoveToken(Line, #1), 0));
838 Result.FScrollTop := StrToIntDef('$' + RemoveToken(Line, #1), 0);
839 Result.FAllResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
840 Result.FNewResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
841 Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + RemoveToken(Line, #1), 0));
845 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
846 // ListFiles('c:\', '*.txt', list, True);
847 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
850 SearchRec : TSearchRec;
854 maskExt := Copy(Mask, 1, Length(Mask) - 1);
856 Path := IncludeTrailingPathDelimiter(Path);
857 rc := FindFirst(Path + '*.*', faAnyfile, SearchRec);
859 while rc = 0 do begin
860 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
861 s := Path + SearchRec.Name;
862 //if (SearchRec.Attr and faDirectory > 0) then
863 // s := IncludeTrailingPathDelimiter(s)
865 if (SearchRec.Attr and faDirectory = 0) and (MatchesMask(s, Mask)) then
869 List.Add(SearchRec.Name);
870 if SubDir and (SearchRec.Attr and faDirectory > 0) then
871 GetFileList(s, Mask, List, True, IsPathAdd);
873 rc := FindNext(SearchRec);
876 SysUtils.FindClose(SearchRec);
880 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
881 //
\83T
\83u
\83t
\83H
\83\8b\83_
\82Í
\8c\9f\8dõ
\82µ
\82È
\82¢
882 // ListFiles('c:\', '*.txt', list, True);
883 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean);
886 SearchRec : TSearchRec;
889 Path := IncludeTrailingPathDelimiter(Path);
890 rc := FindFirst(Path + Mask, faAnyfile, SearchRec);
892 while rc = 0 do begin
893 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
894 s := Path + SearchRec.Name;
896 if (SearchRec.Attr and faDirectory = 0) then
900 List.Add(SearchRec.Name);
902 rc := FindNext(SearchRec);
905 SysUtils.FindClose(SearchRec);
909 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\83f
\83B
\83\8c\83N
\83g
\83\8a\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
910 procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
913 SearchRec : TSearchRec;
916 Path := IncludeTrailingPathDelimiter(Path);
917 rc := FindFirst(Path + '*.*', faDirectory, SearchRec);
919 while rc = 0 do begin
920 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
921 s := Path + SearchRec.Name;
922 //if (SearchRec.Attr and faDirectory > 0) then
923 // s := IncludeTrailingPathDelimiter(s)
925 if (SearchRec.Attr and faDirectory > 0) and (MatchesMask(s, Mask)) then
926 List.Add( IncludeTrailingPathDelimiter( s ) );
927 if SubDir and (SearchRec.Attr and faDirectory > 0) then
928 GetDirectoryList(s, Mask, List, True);
930 rc := FindNext(SearchRec);
933 SysUtils.FindClose(SearchRec);
937 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
938 function TGikoSys.LoadFromSkin(
940 ThreadItem: TThreadItem;
947 Skin := TStringList.Create;
949 if FileExists( fileName ) then begin
950 Skin.LoadFromFile( fileName );
952 //
\82â
\82è
\82©
\82½
\82ª
\8bê
\82µ
\82¢
\82¯
\82Ç
\81A
\83I
\83v
\83V
\83\87\83\93\83_
\83C
\83A
\83\8d\83O
\82Ì
\83v
\83\8c\83r
\83\85\81[
\97p try
954 if ThreadItem.ParentBoard <> nil then
955 if ThreadItem.ParentBoard.ParentCategory <> nil then
956 CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
957 CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
959 CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
960 CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
961 CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
962 CustomStringReplace( Skin, '<SKINPATH/>', Setting.CSSFileName);
963 CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.Count - ThreadItem.NewResCount ));
964 CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
965 CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.Count ));
967 CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
968 CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
969 CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
971 //-----
\82Æ
\82è
\82 \82¦
\82¸
\82©
\82¿
\82ã
\81`
\82µ
\82á
\8cÝ
\8a·
\97p
\81B
\83R
\83\81\83\93\83g
\83A
\83E
\83g
\82µ
\82Ä
\82à
\82æ
\82µ
972 //
\82â
\82è
\82©
\82½
\82ª
\8bê
\82µ
\82¢
\82¯
\82Ç
\81A
\83I
\83v
\83V
\83\87\83\93\83_
\83C
\83A
\83\8d\83O
\82Ì
\83v
\83\8c\83r
\83\85\81[
\97p try
974 if ThreadItem.ParentBoard <> nil then
975 if ThreadItem.ParentBoard.ParentCategory <> nil then
976 CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
977 CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
979 CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
980 CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
981 CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
982 CustomStringReplace( Skin, '&SKINPATH', Setting.CSSFileName);
983 CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
984 CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
985 CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
987 CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
988 CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
989 CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
990 //-----
\82±
\82±
\82Ü
\82Å
998 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
999 function TGikoSys.SkinedRes(
1005 spamminess : Extended;
1006 wordCount : TWordCount;
1009 wordCount := TWordCount.Create;
1011 spamminess := Floor( SpamParse(
1012 Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 );
1014 Skin := CustomStringReplace( Skin, '<NUMBER/>',
1015 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1016 Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
1017 Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
1018 Skin := CustomStringReplace( Skin, '<MAILNAME/>',
1019 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1020 Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
1021 Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
1022 Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
1023 Skin := CustomStringReplace( Skin, '<SPAMMINESS/>', FloatToStr( spamminess ) );
1025 //-----
\82©
\82¿
\82ã
\81`
\82µ
\82á
\8cÝ
\8a·
\97p
\81B
\83R
\83\81\83\93\83g
\83A
\83E
\83g
\82µ
\82Ä
\82à
\82æ
\82µ
1026 Skin := CustomStringReplace( Skin, '&NUMBER',
1027 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1028 Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
1029 Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
1030 Skin := CustomStringReplace( Skin, '&MAILNAME',
1031 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1032 Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
1033 Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
1034 Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
1035 Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );
1036 //-----
\82±
\82±
\82Ü
\82Å
1045 procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
1049 //bufList : TStringList;
1050 ReadList: TStringList;
1051 SaveList: TStringList;
1052 CSSFileName: string;
1055 NewReceiveNo: Integer;
1057 boardPlugIn : TBoardPlugIn;
1059 UserOptionalStyle: string;
1066 function LoadSkin( fileName: string ): string;
1068 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1070 function ReplaceRes( skin: string ): string;
1072 Result := SkinedRes( skin, Res, No );
1075 if ThreadItem <> nil then begin
1076 if ThreadItem.IsBoardPlugInAvailable then begin
1077 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1078 boardPlugIn := ThreadItem.BoardPlugIn;
1079 NewReceiveNo := ThreadItem.NewReceive;
1080 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1081 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1082 UserOptionalStyle := UserOptionalStyle +
1083 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1084 if GikoSys.Setting.BrowserFontSize <> 0 then
1085 UserOptionalStyle := UserOptionalStyle +
1086 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1087 if GikoSys.Setting.BrowserFontColor <> -1 then
1088 UserOptionalStyle := UserOptionalStyle +
1089 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1090 if GikoSys.Setting.BrowserBackColor <> -1 then
1091 UserOptionalStyle := UserOptionalStyle +
1092 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1093 case GikoSys.Setting.BrowserFontBold of
1094 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1095 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1097 case GikoSys.Setting.BrowserFontItalic of
1098 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1099 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1102 SaveList := TStringList.Create;
1105 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1106 // doc.charset := 'Shift_JIS';
1109 SaveList.Add( boardPlugIn.GetHeader( DWORD( threadItem ),
1110 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) );
1112 SaveList.Add('<p id="idSearch"></p>');
1113 for i := 0 to threadItem.Count - 1 do begin
1114 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1115 if i <> 0 then begin
1116 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1119 if ThreadItem.Kokomade > (i + 1) then
1122 if NewReceiveNo > (i + 1) then
1125 if (threadItem.Count - i) > ResRange then
1130 //
\90V
\92\85\83}
\81[
\83N
1131 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1133 if GikoSys.Setting.UseSkin then begin
1134 if FileExists( GetSkinNewmarkFileName ) then
1135 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1137 SaveList.Add( '<a name="new"></a>' );
1138 end else if GikoSys.Setting.UseCSS then begin
1139 SaveList.Add('<a name="new"></a><div class="new">
\90V
\92\85\83\8c\83X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
1141 SaveList.Add('</dl>');
1142 SaveList.Add('<a name="new"></a>');
1143 SaveList.Add('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>
\90V
\92\85\83\8c\83X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
1144 SaveList.Add('<dl>');
1147 SaveList.Add( '<a name="new"></a>' );
1152 SaveList.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
1154 if ThreadItem.Kokomade = (i + 1) then begin
1155 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1157 if GikoSys.Setting.UseSkin then begin
1158 if FileExists( GetSkinBookmarkFileName ) then
1159 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1161 SaveList.Add( '<a name="koko"></a>' );
1162 end else if GikoSys.Setting.UseCSS then begin
1163 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1165 SaveList.Add('</dl>');
1166 SaveList.Add('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</b></font></td></tr></table>');
1167 SaveList.Add('<dl>');
1170 SaveList.Add( '<a name="koko"></a>' );
1174 doc.Write(SaveList.Text);
1179 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1180 SaveList.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1182 doc.Write(SaveList.Text);
1191 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1192 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1193 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1194 ShortDayNames[7] := '
\93y';
1195 BBSID := ThreadItem.ParentBoard.BBSID;
1196 NewReceiveNo := ThreadItem.NewReceive;
1197 ReadList := TStringList.Create;
1199 if ThreadItem.IsLogFile then begin
1200 FileName := ThreadItem.GetThreadFileName;
1201 ReadList.LoadFromFile(FileName);
1202 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1203 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1204 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1205 Res := DivideStrLine(ReadList[0]);
1206 Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1207 sTitle := Res.FTitle;
1209 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1211 SaveList := TStringList.Create;
1214 doc.charset := 'Shift_JIS';
1216 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1217 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1218 UserOptionalStyle := UserOptionalStyle +
1219 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1220 if GikoSys.Setting.BrowserFontSize <> 0 then
1221 UserOptionalStyle := UserOptionalStyle +
1222 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1223 if GikoSys.Setting.BrowserFontColor <> -1 then
1224 UserOptionalStyle := UserOptionalStyle +
1225 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1226 if GikoSys.Setting.BrowserBackColor <> -1 then
1227 UserOptionalStyle := UserOptionalStyle +
1228 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1229 case GikoSys.Setting.BrowserFontBold of
1230 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1231 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1233 case GikoSys.Setting.BrowserFontItalic of
1234 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1235 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1238 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1239 if GikoSys.Setting.UseSkin then begin
1240 //
\83X
\83L
\83\93\8eg
\97p
1241 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1243 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1244 if Length( UserOptionalStyle ) > 0 then
1245 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1246 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1247 SaveList.Add( SkinHeader );
1251 SkinNewRes := LoadSkin( GetSkinNewResFileName );
1255 SkinRes := LoadSkin( GetSkinResFileName );
1258 SaveList.Add('<p id="idSearch"></p>');
1259 SaveList.Add('<a name="top"></a>');
1261 for i := 0 to ReadList.Count - 1 do begin
1262 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1263 if i <> 0 then begin
1264 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1267 if ThreadItem.Kokomade > (i + 1) then
1270 if NewReceiveNo > (i + 1) then
1273 if (threadItem.Count - i) > ResRange then
1278 //
\90V
\92\85\83}
\81[
\83N
1279 if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
1281 if FileExists( GetSkinNewmarkFileName ) then
1282 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1284 SaveList.Add( '<a name="new"></a>' );
1286 SaveList.Add( '<a name="new"></a>' );
1289 if (Trim(ReadList[i]) <> '') then begin
1290 No := IntToStr(i + 1);
1292 Res := DivideStrLine(ReadList[i]);
1293 if Res.FType = glt2chOld then begin
1294 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1295 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1296 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1299 Res.FBody := AddAnchorTag(Res.FBody);
1300 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1303 if NewReceiveNo <= (i + 1) then
1304 //
\90V
\92\85\83\8c\83X
1305 strTmp := ReplaceRes( SkinNewRes )
1307 //
\92Ê
\8fí
\82Ì
\83\8c\83X
1308 strTmp := ReplaceRes( SkinRes );
1310 SaveList.Add( strTmp );
1315 if ThreadItem.Kokomade = (i + 1) then begin
1316 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1318 if FileExists( GetSkinBookmarkFileName ) then
1319 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1321 SaveList.Add( '<a name="koko"></a>' );
1323 SaveList.Add( '<a name="koko"></a>' );
1326 doc.Write(SaveList.Text);
1329 SaveList.Add('<a name="bottom"></a>');
1330 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1332 SaveList.Add( LoadSkin( GetSkinFooterFileName ) );
1335 doc.Write(SaveList.Text);
1337 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1339 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1340 // SaveList.Add('<html lang="ja"><head>');
1341 SaveList.Add('<html><head>');
1342 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1343 SaveList.Add('<title>' + sTitle + '</title>');
1344 SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
1345 if Length( UserOptionalStyle ) > 0 then
1346 SaveList.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1347 SaveList.Add('</head>');
1348 SaveList.Add('<body>');
1349 SaveList.Add('<a name="top"></a>');
1350 SaveList.Add('<p id="idSearch"></p>');
1351 SaveList.Add('<div class="title">' + sTitle + '</div>');
1352 doc.Write(SaveList.Text);
1354 //Application.ProcessMessages;
1355 for i := 0 to ReadList.Count - 1 do begin
1356 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1357 if i <> 0 then begin
1358 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1361 if ThreadItem.Kokomade > (i + 1) then
1364 if NewReceiveNo > (i + 1) then
1367 if (threadItem.Count - i) > ResRange then
1372 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1373 SaveList.Add('<a name="new"></a><div class="new">
\90V
\92\85\83\8c\83X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
1375 if (Trim(ReadList[i]) <> '') then begin
1376 No := IntToStr(i + 1);
1377 Res := DivideStrLine(ReadList[i]);
1378 Res.FBody := AddAnchorTag(Res.FBody);
1379 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1380 if Res.FMailTo = '' then
1381 SaveList.Add('<a name="' + No + '"></a>'
1382 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1383 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1384 + '<span class="name"><b>' + Res.FName + '</b></span> '
1385 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1386 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1387 + '<div class="mes">' + Res.FBody + ' </div>')
1388 else if GikoSys.Setting.ShowMail then
1389 SaveList.Add('<a name="' + No + '"></a>'
1390 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1391 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1392 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1393 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1394 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1395 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1396 + '<div class="mes">' + Res.FBody + ' </div>')
1398 SaveList.Add('<a name="' + No + '"></a>'
1399 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1400 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1401 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1402 + '<b>' + Res.FName + '</b></a>'
1403 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1404 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1405 + '<div class="mes">' + Res.FBody + ' </div>');
1407 if ThreadItem.Kokomade = (i + 1) then begin
1408 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1411 doc.Write(SaveList.Text);
1414 SaveList.Add('<a name="bottom"></a>');
1415 //SaveList.Add('</body></html>');
1416 SaveList.Add('<a name="last"></a>');
1417 SaveList.Add('</body></html>');
1419 doc.Write(SaveList.Text);
1422 // SaveList.Add('<html lang="ja"><head>');
1423 SaveList.Add('<html><head>');
1424 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1425 SaveList.Add('<title>' + sTitle + '</title></head>');
1426 SaveList.Add('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1427 SaveList.Add('<a name="top"></a>');
1428 SaveList.Add('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1429 SaveList.Add('<dl>');
1430 SaveList.Add('<p id="idSearch"></p>');
1431 doc.Write(SaveList.Text);
1433 //Application.ProcessMessages;
1434 for i := 0 to ReadList.Count - 1 do begin
1435 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1436 if i <> 0 then begin
1437 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1440 if ThreadItem.Kokomade > (i + 1) then
1443 if NewReceiveNo > (i + 1) then
1446 if (threadItem.Count - i) > ResRange then
1451 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1452 SaveList.Add('</dl>');
1453 SaveList.Add('<a name="new"></a>');
1454 SaveList.Add('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>
\90V
\92\85\83\8c\83X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
1455 SaveList.Add('<dl>');
1457 if (Trim(ReadList[i]) <> '') then begin
1458 No := IntToStr(i + 1);
1459 Res := DivideStrLine(ReadList[i]);
1460 if Res.FType = glt2chOld then begin
1461 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1462 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1463 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1465 Res.FBody := AddAnchorTag(Res.FBody);
1466 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1467 if Res.FMailTo = '' then
1468 SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<font color="forestgreen"><b> ' + Res.FName + ' </b></font>
\93\8a\8de
\93ú
\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>')
1469 else if GikoSys.Setting.ShowMail then
1470 SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + ']
\93\8a\8de
\93ú
\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>')
1472 SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a>
\93\8a\8de
\93ú
\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>');
1474 if ThreadItem.Kokomade = (i + 1) then begin
1475 SaveList.Add('</dl>');
1476 SaveList.Add('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</b></font></td></tr></table>');
1477 SaveList.Add('<dl>');
1479 doc.Write(SaveList.Text);
1482 SaveList.Add('</dl>');
1483 SaveList.Add('<a name="bottom"></a>');
1484 SaveList.Add('</body></html>');
1485 doc.Write(SaveList.Text);
1495 procedure TGikoSys.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
1499 //bufList : TStringList;
1500 ReadList: TStringList;
1501 // SaveList: TStringList;
1502 CSSFileName: string;
1506 boardPlugIn : TBoardPlugIn;
1508 UserOptionalStyle: string;
1512 function LoadSkin( fileName: string ): string;
1514 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1516 function ReplaceRes( skin: string ): string;
1518 Result := SkinedRes( skin, Res, No );
1522 if ThreadItem <> nil then begin
1523 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1526 if ThreadItem.IsBoardPlugInAvailable then begin
1527 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1528 boardPlugIn := ThreadItem.BoardPlugIn;
1529 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1530 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1531 UserOptionalStyle := UserOptionalStyle +
1532 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1533 if GikoSys.Setting.BrowserFontSize <> 0 then
1534 UserOptionalStyle := UserOptionalStyle +
1535 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1536 if GikoSys.Setting.BrowserFontColor <> -1 then
1537 UserOptionalStyle := UserOptionalStyle +
1538 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1539 if GikoSys.Setting.BrowserBackColor <> -1 then
1540 UserOptionalStyle := UserOptionalStyle +
1541 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1542 case GikoSys.Setting.BrowserFontBold of
1543 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1544 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1546 case GikoSys.Setting.BrowserFontItalic of
1547 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1548 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1552 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1554 tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
1555 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
1556 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1557 if Setting.UseSkin then begin
1558 tmp1 := './' +Setting.CSSFileName;
1559 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1560 tmp1 := CustomStringReplace(tmp1, '\', '/');
1561 tmp := CustomStringReplace(tmp, ExtractFilePath(Setting.CSSFileName), tmp1);
1562 end else if Setting.UseCSS then begin
1563 tmp1 := './' + CSSFileName;
1564 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1565 tmp1 := CustomStringReplace(tmp1, '\', '/');
1566 tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
1570 for i := 0 to threadItem.Count - 1 do begin
1573 html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
1576 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1577 html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1584 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1585 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1586 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1587 ShortDayNames[7] := '
\93y';
1588 BBSID := ThreadItem.ParentBoard.BBSID;
1589 ReadList := TStringList.Create;
1591 if ThreadItem.IsLogFile then begin
1592 FileName := ThreadItem.GetThreadFileName;
1593 ReadList.LoadFromFile(FileName);
1594 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1595 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1596 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1597 Res := DivideStrLine(ReadList[0]);
1598 Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1599 sTitle := Res.FTitle;
1601 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1604 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1605 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1606 UserOptionalStyle := UserOptionalStyle +
1607 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1608 if GikoSys.Setting.BrowserFontSize <> 0 then
1609 UserOptionalStyle := UserOptionalStyle +
1610 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1611 if GikoSys.Setting.BrowserFontColor <> -1 then
1612 UserOptionalStyle := UserOptionalStyle +
1613 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1614 if GikoSys.Setting.BrowserBackColor <> -1 then
1615 UserOptionalStyle := UserOptionalStyle +
1616 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1617 case GikoSys.Setting.BrowserFontBold of
1618 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1619 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1621 case GikoSys.Setting.BrowserFontItalic of
1622 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1623 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1627 if GikoSys.Setting.UseSkin then begin
1628 //
\83X
\83L
\83\93\8eg
\97p
1629 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1631 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1632 if Length( UserOptionalStyle ) > 0 then
1633 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1634 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1635 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1636 tmp1 := './' +Setting.CSSFileName;
1637 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1638 tmp1 := CustomStringReplace(tmp1, '\', '/');
1639 SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(Setting.CSSFileName), tmp1);
1640 html.Append( SkinHeader );
1644 SkinRes := LoadSkin( GetSkinResFileName );
1647 html.Append('<a name="top"></a>');
1648 for i := 0 to ReadList.Count - 1 do begin
1649 if (Trim(ReadList[i]) <> '') then begin
1650 No := IntToStr(i + 1);
1652 Res := DivideStrLine(ReadList[i]);
1653 if Res.FType = glt2chOld then begin
1654 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1655 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1656 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1659 Res.FBody := AddAnchorTag(Res.FBody);
1660 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1663 html.Append( ReplaceRes( SkinRes ) );
1669 html.Append('<a name="bottom"></a>');
1670 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1672 html.Append( LoadSkin( GetSkinFooterFileName ) );
1675 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1677 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1678 html.Append('<html><head>');
1679 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1680 html.Append('<title>' + sTitle + '</title>');
1681 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1682 tmp1 := './' + CSSFileName;
1683 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1684 tmp1 := CustomStringReplace(tmp1, '\', '/');
1686 html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
1687 if Length( UserOptionalStyle ) > 0 then
1688 html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1689 html.Append('</head>');
1690 html.Append('<body>');
1691 html.Append('<a name="top"></a>');
1692 html.Append('<div class="title">' + sTitle + '</div>');
1693 for i := 0 to ReadList.Count - 1 do begin
1694 if (Trim(ReadList[i]) <> '') then begin
1695 No := IntToStr(i + 1);
1696 Res := DivideStrLine(ReadList[i]);
1697 Res.FBody := AddAnchorTag(Res.FBody);
1698 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1699 if Res.FMailTo = '' then
1700 html.Append('<a name="' + No + '"></a>'
1701 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1702 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1703 + '<span class="name"><b>' + Res.FName + '</b></span> '
1704 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1705 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1706 + '<div class="mes">' + Res.FBody + ' </div>')
1707 else if GikoSys.Setting.ShowMail then
1708 html.Append('<a name="' + No + '"></a>'
1709 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1710 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1711 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1712 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1713 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1714 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1715 + '<div class="mes">' + Res.FBody + ' </div>')
1717 html.Append('<a name="' + No + '"></a>'
1718 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1719 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1720 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1721 + '<b>' + Res.FName + '</b></a>'
1722 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1723 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1724 + '<div class="mes">' + Res.FBody + ' </div>');
1727 html.Append('<a name="bottom"></a>');
1728 html.Append('</body></html>');
1729 html.Append('<a name="last"></a>');
1730 html.Append('</body></html>');
1733 html.Append('<html><head>');
1734 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1735 html.Append('<title>' + sTitle + '</title></head>');
1736 html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1737 html.Append('<a name="top"></a>');
1738 html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1739 html.Append('<dl>');
1740 for i := 0 to ReadList.Count - 1 do begin
1741 if (Trim(ReadList[i]) <> '') then begin
1742 No := IntToStr(i + 1);
1743 Res := DivideStrLine(ReadList[i]);
1744 if Res.FType = glt2chOld then begin
1745 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1746 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1747 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1749 Res.FBody := AddAnchorTag(Res.FBody);
1750 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1751 if Res.FMailTo = '' then
1752 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<font color="forestgreen"><b> ' + Res.FName + ' </b></font>
\93\8a\8de
\93ú
\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1753 else if GikoSys.Setting.ShowMail then
1754 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + ']
\93\8a\8de
\93ú
\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1756 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a>
\93\8a\8de
\93ú
\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>');
1759 html.Append('</dl>');
1760 html.Append('<a name="bottom"></a>');
1761 html.Append('</body></html>');
1770 function TGikoSys.ConvertResAnchor(res: string): string;
1772 _HEAD : string = '<a href="../';
1773 _TAIL : string = ' target="_blank">';
1774 _ST: string = '&st=';
1775 _TO: string = '&to=';
1776 _STA: string = '&START=';
1777 _END: string = '&END=';
1783 i := AnsiPos(_HEAD, res);
1784 while i <> 0 do begin
1785 Result := Result + Copy(res, 1, i -1);
1786 Delete(res, 1, i - 1);
1787 j := AnsiPos(_TAIL, res);
1789 Result := Result + res;
1792 tmp := Copy(res, 1, j - 1);
1793 Delete(res, 1, j + 16);
1794 if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
1795 Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
1796 Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
1797 Result := Result + '<a href="#' + tmp + '">';
1798 end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
1799 Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
1800 Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
1801 Result := Result + '<a href="#' + tmp + '">';
1803 k := LastDelimiter('/', tmp);
1805 if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
1806 Delete(tmp, AnsiPos('-', tmp), Length(tmp))
1808 Delete(tmp, AnsiPos('"', tmp), Length(tmp));
1810 Result := Result + '<a href="#' + tmp + '">';
1812 i := AnsiPos(_HEAD, res);
1814 Result := Result + res;
1818 (*************************************************************************
1819 *http://
\82Ì
\95¶
\8e\9a\97ñ
\82ðanchor
\83^
\83O
\95t
\82«
\82É
\82·
\82é
\81B
1820 *************************************************************************)
1821 function TGikoSys.AddAnchorTag(s: string): string;
1823 URL_CHAR: string = '0123456789'
1824 + 'abcdefghijklmnopqrstuvwxyz'
1825 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1826 + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
1827 ANCHOR_REF = 'href=';
1828 RES_REF = '>>';
1830 wkIdx: array[0..9] of Integer;
1835 anchorLen : Integer;
1838 // + 3
\82Í 'href="' ('"'
\82Â
\82«)
\82È
\82Ç
\82Ì
\83o
\83\8a\83G
\81[
\83V
\83\87\83\93\82É
\97]
\97T
\82ð
\8e\9d\82½
\82¹
\82é
\82½
\82ß
1839 anchorLen := Length( ANCHOR_REF ) + 3;
1842 wkIdx[0] := AnsiPos('http://', s);
1843 wkIdx[1] := AnsiPos('ttp://', s);
1844 wkIdx[2] := AnsiPos('tp://', s);
1845 wkIdx[3] := AnsiPos('ms-help://', s);
1846 wkIdx[4] := AnsiPos('p://', s);
1847 wkIdx[5] := AnsiPos('https://', s);
1848 wkIdx[6] := AnsiPos('www.', s);
1849 wkIdx[7] := AnsiPos('ftp://', s);
1850 wkIdx[8] := AnsiPos('news://', s);
1851 wkIdx[9] := AnsiPos('rtsp://', s);
1855 if wkIdx[i] <> 0 then idx := Min(wkIdx[i], idx);
1857 if idx = MaxInt then begin
1858 //
\83\8a\83\93\83N
\82ª
\96³
\82¢
\82æ
\81B
1859 Result := Result + s;
1864 (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
1865 //
\8aù
\82É
\83\8a\83\93\83N
\83^
\83O
\82ª
\82Â
\82¢
\82Ä
\82¢
\82é
\82Á
\82Û
\82¢
\82Æ
\82«
\82Í
\83\80\83V
1866 href := Copy( s, idx, Length( s ) );
1867 Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
1869 s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
1874 Result := Result + Copy(s, 0, idx - 1);
1876 s := Copy(s, idx, length(s));
1878 b := Length( s ) + 1;
1879 for i := 1 to b do begin
1883 idx := AnsiPos(s[i], URL_CHAR);
1884 if idx = 0 then begin
1885 //URL
\82¶
\82á
\82È
\82¢
\95¶
\8e\9a\94
\8c©
\81I
\82Æ
\82©
\81A
\95¶
\8e\9a\82ª
\82È
\82
\82È
\82Á
\82½
\81B
1886 url := Copy(s, 0, i - 1);
1888 if AnsiPos('ttp://', url) = 1 then
1890 else if AnsiPos('tp://', url) = 1 then
1892 else if AnsiPos('p://', url) = 1 then
1894 else if AnsiPos('www.', url) = 1 then
1895 href := 'http://' + url
1898 Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
1899 s := Copy(s, i, MaxInt);
1906 (*************************************************************************
1907 *
\83T
\83u
\83W
\83F
\83N
\83g
\88ê
\8ds
\82ð
\95ª
\8a\84
1908 *************************************************************************)
1909 function TGikoSys.DivideSubject(Line: string): TSubjectRec;
1919 if AnsiPos('<>', Line) = 0 then
1923 Result.FFileName := RemoveToken(Line, Delim);
1924 Result.FTitle := RemoveToken(Line, Delim);
1926 ws := Trim(Result.FTitle);
1928 if Copy(ws, Length(ws), 1) = ')' then begin
1931 end else if Copy(ws, Length(ws), 1) = '
\81j' then begin
1934 end else if Copy(ws, Length(ws), 1) = '<' then begin
1939 for i := Length(ws) - 1 downto 1 do begin
1940 if ws[i] = LeftK then begin
1941 ws := Copy(ws, i + 1, Length(ws) - i - 1);
1942 if IsNumeric(ws) then
1943 Result.FCount := StrToInt(ws);
1944 Result.FTitle := Trim(CustomStringReplace(Result.FTitle, LeftK + ws + RightK, ''));
1950 (*************************************************************************
1951 * dat
\83t
\83@
\83C
\83\8b\82Ì
\88ê
\83\89\83C
\83\93\82ð
\95ª
\89ð
1952 *************************************************************************)
1953 function TGikoSys.DivideStrLine(Line: string): TResRec;
1958 if AnsiPos('<>', Line) = 0 then begin
1960 Result.FType := glt2chOld;
1963 Result.FType := glt2chNew;
1965 Result.FName := Trim(RemoveToken(Line, Delim));
1966 Result.FMailTo := Trim(RemoveToken(Line, Delim));
1967 Result.FDateTime := Trim(RemoveToken(Line, Delim));
1968 bufBody := Trim(RemoveToken(Line, Delim));
1970 if bufbody = '' then begin
1971 Insert(' ',bufbody, 1);
1973 Result.FBody := bufBody;
1974 Result.FTitle := Trim(RemoveToken(Line, Delim));
1978 (*************************************************************************
1979 * URL
\82©
\82çBBSID
\82ð
\8eæ
\93¾
1980 *************************************************************************)
1981 function TGikoSys.UrlToID(url: string): string;
1988 if url = '' then Exit;
1990 url := Copy(url, 0, Length(url) - 1);
1991 for i := Length(url) downto 0 do begin
1992 if url[i] = '/' then begin
1993 Result := Copy(url, i + 1, Length(url));
1999 (*************************************************************************
2000 *URL
\82©
\82çBBSID
\88È
\8aO
\82Ì
\95\94\95ª(http://teri.2ch.net/)
\82ð
\8eæ
\93¾
2001 *************************************************************************)
2002 function TGikoSys.UrlToServer(url: string): string;
2009 wsURL := Trim(wsURL);
2011 if wsURL = '' then exit;
2013 if Copy(wsURL, Length(wsURL), 1) = '/' then
2014 wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
2016 for i := Length(wsURL) downto 0 do begin
2017 if wsURL[i] = '/' then begin
2018 Result := Copy(wsURL, 0, i);
2024 (*************************************************************************
2025 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\83`
\83F
\83b
\83N
2026 *************************************************************************)
2027 function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
2031 Code := GetFileAttributes(PChar(Name));
2032 Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
2035 (*************************************************************************
2036 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\8dì
\90¬
\81i
\95¡
\90\94\8aK
\91w
\91Î
\89\9e\81j
2037 *************************************************************************)
2038 function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
2041 if Length(Dir) = 0 then
2042 raise Exception.Create('
\83t
\83H
\83\8b\83_
\82ª
\8dì
\90¬
\8fo
\97\88\82Ü
\82¹
\82ñ');
2043 Dir := ExcludeTrailingPathDelimiter(Dir);
2044 if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
2045 or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
2046 Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
2049 (*************************************************************************
2050 *
\95¶
\8e\9a\97ñ
\82©
\82ç
\83g
\81[
\83N
\83\93\82Ì
\90Ø
\82è
\8fo
\82µ
\81i
\8f\89\8aú
\8f\88\97\9d\81j
2051 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2052 *************************************************************************)
2053 function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2057 Result := StrTokNext(sep, Rec);
2060 (*************************************************************************
2061 *
\95¶
\8e\9a\97ñ
\82©
\82ç
\83g
\81[
\83N
\83\93\82Ì
\90Ø
\82è
\8fo
\82µ
2062 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2063 *************************************************************************)
2064 function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2071 if Len >= Pos then begin
2072 while (Pos <= Len) and (Str[Pos] in sep) do begin
2076 while (Pos<= Len) and not (Str[Pos] in sep) do begin
2077 if IsDBCSLeadByte(Byte(Str[Pos])) then begin
2082 Result := Copy(Str, I, Pos - I);
2083 while (Pos <= Len) and (Str[Pos] in sep) do begin//
\82±
\82ê
\82Í
\82¨
\8dD
\82Ý
2090 (*************************************************************************
2091 *
\83t
\83@
\83C
\83\8b\83T
\83C
\83Y
\8eæ
\93¾
2092 *************************************************************************)
2093 function TGikoSys.GetFileSize(FileName : string): longint;
2098 if not FileExists(FileName) then begin
2102 Assign(F, FileName);
2104 Result := FileSize(F);
2111 (*************************************************************************
2112 *
\83t
\83@
\83C
\83\8b\8ds
\90\94\8eæ
\93¾
2113 *************************************************************************)
2114 function TGikoSys.GetFileLineCount(FileName : string): longint;
2118 sl := TStringList.Create;
2121 sl.LoadFromFile(FileName);
2132 (*************************************************************************
2133 *
\83X
\83\8c\83b
\83h
\83t
\83@
\83C
\83\8b\82©
\82ç
\8ew
\92è
\8ds
\82ð
\8eæ
\93¾
2134 *************************************************************************)
2135 function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
2137 fileTmp : TStringList;
2140 if FileExists(FileName) then begin
2141 fileTmp := TStringList.Create;
2144 fileTmp.LoadFromFile( FileName );
2145 if ( Line >= 1 ) and ( Line < fileTmp.Count + 1 ) then begin
2146 Result := fileTmp.Strings[ Line-1 ];
2149 //on EFOpenError do Result := '';
2157 (*************************************************************************
2158 *
\83V
\83X
\83e
\83\80\83\81\83j
\83\85\81[
\83t
\83H
\83\93\83g
\82Ì
\91®
\90«
\82ð
\8eæ
\93¾
2159 *************************************************************************)
2160 procedure TGikoSys.MenuFont(Font: TFont);
2163 nm: NONCLIENTMETRICS;
2165 nm.cbSize := sizeof(NONCLIENTMETRICS);
2167 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
2168 lf := nm.lfMenuFont;
2170 Font.Name := lf.lfFaceName;
2171 Font.Height := lf.lfHeight;
2173 if lf.lfWeight >= 700 then
2174 Font.Style := Font.Style + [fsBold];
2175 if lf.lfItalic = 1 then
2176 Font.Style := Font.Style + [fsItalic];
2179 (*************************************************************************
2181 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2182 *************************************************************************)
2183 function TGikoSys.RemoveToken(var s: string;const delimiter: string): string;
2187 p := AnsiPos(delimiter, s);
2191 Result := Copy(s, 1, p - 1);
2192 s := Copy(s, Length(Result) + Length(delimiter) + 1, Length(s));
2195 (*************************************************************************
2197 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2198 *************************************************************************)
2199 function TGikoSys.GetTokenIndex(s: string; delimiter: string; index: Integer): string;
2204 for i := 0 to index do
2205 Result := RemoveToken(s, delimiter);
2208 (*************************************************************************
2210 *************************************************************************)
2211 function TGikoSys.DeleteLink(const s: string): string;
2221 s1 := GetTokenIndex(s, '<a href="', i);
2222 s2 := GetTokenIndex(s, '<a href="', i + 1);
2224 idx := Pos('">', s1);
2226 Delete(s1, 1, idx + 1);
2227 idx := Pos('">', s2);
2229 Delete(s2, 1, idx + 1);
2231 Result := Result + s1 + s2;
2240 //
\83C
\83\93\83f
\83b
\83N
\83X
\96¢
\8dX
\90V
\83o
\83b
\83t
\83@
\82ð
\83t
\83\89\83b
\83V
\83\85\81I
2241 {procedure TGikoSys.FlashExitWrite;
2245 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
2246 for i := 0 to FExitWrite.Count - 1 do
2247 WriteThreadDat(FExitWrite[i]);
2251 (*************************************************************************
2252 *
\83X
\83\8c\96¼
\82È
\82Ç
\82ð
\92Z
\82¢
\96¼
\91O
\82É
\95Ï
\8a·
\82·
\82é
2254 *************************************************************************)
2255 function TGikoSys.GetShortName(const LongName: string; ALength: integer): string;
2257 ERASECHAR : array [1..39] of string =
2258 ('
\81\99','
\81\9a','
\81¡','
\81 ','
\81\9f','
\81\9e','
\81Q','
\81\94','
\81£','
\81¥',
2259 '
\81¢','
\81¤','
\81\9c','
\81\9b','
\81\9d','
\81y','
\81z','
\81ô','
\81s','
\81t',
2260 '
\81g','
\81h','
\81k','
\81l','
\81e','
\81f','
\81\83','
\81\84','
\81á','
\81â',
2261 '
\81o','
\81p','
\81q','
\81r','
\81w','
\81x','
\81¬','
\81c', '
\81@');
2263 Chr : array [0..255] of char;
2267 s := Trim(LongName);
2268 if (Length(s) <= ALength) then begin
2272 for i := Low(ERASECHAR) to High(ERASECHAR) do begin
2273 S := CustomStringReplace(S, ERASECHAR[i], '');
2275 if (Length(S) <= ALength) then begin
2278 Windows.LCMapString(
2279 GetUserDefaultLCID(),
2287 S := Copy(S,1,ALength);
2289 if (ByteType(S, Length(S)) = mbLeadByte ) then begin
2290 S := Copy(S, 1, Length(S) - 1);
2300 (*************************************************************************
2303 *************************************************************************)
2304 function TGikoSys.ConvRes(const Body, Bbs, Key,
2305 ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
2306 DatToHTML: boolean = false): string;
2310 FIndexFrom : integer;
2317 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2331 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2336 FIndex.FIndexFrom := IndexFrom;
2337 FIndex.FIndexTo := IndexTo;
2341 function ChooseString(const Text, Separator: string; Index: integer): string;
2347 for i := 0 to Index - 1 do begin
2348 if (AnsiPos(Separator, S) = 0) then S := ''
2349 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2351 p := AnsiPos(Separator, S);
2352 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2361 List:= TList.Create;
2367 b := ByteType(s, i);
2369 mbSingleByte : begin
2370 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2371 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2379 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2380 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2386 if (not sw) and (Copy(s,i,4) = GT) then begin
2387 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2395 if ((not sw) and (Copy(s,i,1) = ',')) or
2396 ((not sw) and (Copy(s,i,1) = '=')) then begin
2397 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2398 ((Chk) and (oc = '')) or
2399 ((not Chk) and (al)) then
2409 if (AnsiPos(sx, SN) > 0) then begin
2412 if (No <> '') and (No <> '-') then begin
2425 if Copy(s,i,1) = '<' then oc := '';
2426 oc := oc + Copy(s,i,1);
2432 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2438 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2446 if (AnsiPos(sx, ZN) > 0) then begin
2447 No := No + ZenToHan(sx);
2449 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2464 if (i > Length(Body)) then begin
2466 if (No <> '') then Add(sp, i, No);
2471 for i := List.Count - 1 downto 0 do begin
2472 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2473 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2474 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2476 st := PIndex(List[i]).FNo;
2477 et := PIndex(List[i]).FNo;
2479 if not DatToHTML then
2480 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2481 Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2482 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2483 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2484 Copy(r,PIndex(List[i]).FIndexTo,Length(r))
2486 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2487 Format('<a href="#%s">', [st]) +
2488 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2489 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2491 Dispose(PIndex(List[i]));
2497 function TGikoSys.ConvRes(
2498 const Body, Bbs, Key, ParamBBS, ParamKey,
2499 ParamStart, ParamTo, ParamNoFirst,
2500 ParamTrue, FullURL : string
2505 FIndexFrom : integer;
2512 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2526 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2531 FIndex.FIndexFrom := IndexFrom;
2532 FIndex.FIndexTo := IndexTo;
2536 function ChooseString(const Text, Separator: string; Index: integer): string;
2542 for i := 0 to Index - 1 do begin
2543 if (AnsiPos(Separator, S) = 0) then S := ''
2544 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2546 p := AnsiPos(Separator, S);
2547 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2556 List:= TList.Create;
2562 b := ByteType(s, i);
2564 mbSingleByte : begin
2565 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2566 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2574 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2575 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2581 if (not sw) and (Copy(s,i,4) = GT) then begin
2582 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2590 if ((not sw) and (Copy(s,i,1) = ',')) or
2591 ((not sw) and (Copy(s,i,1) = '=')) then begin
2592 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2593 ((Chk) and (oc = '')) or
2594 ((not Chk) and (al)) then
2604 if (AnsiPos(sx, SN) > 0) then begin
2607 if (No <> '') and (No <> '-') then begin
2620 if Copy(s,i,1) = '<' then oc := '';
2621 oc := oc + Copy(s,i,1);
2627 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2633 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2641 if (AnsiPos(sx, ZN) > 0) then begin
2642 No := No + ZenToHan(sx);
2644 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2659 if (i > Length(Body)) then begin
2661 if (No <> '') then Add(sp, i, No);
2666 for i := List.Count - 1 downto 0 do begin
2667 //plName := Copy(PluginName, LastDelimiter('\',PluginName) + 1, Length(PluginName) - LastDelimiter('/',PluginName) -1 );
2668 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2669 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2670 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2672 st := PIndex(List[i]).FNo;
2673 et := PIndex(List[i]).FNo;
2675 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2676 Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2677 [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2678 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2679 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2680 Dispose(PIndex(List[i]));
2687 function TGikoSys.BoolToInt(b: Boolean): Integer;
2689 Result := IfThen(b, 1, 0);
2692 function TGikoSys.IntToBool(i: Integer): Boolean;
2697 //gzip
\82Å
\88³
\8fk
\82³
\82ê
\82½
\82Ì
\82ð
\96ß
\82·
2698 function TGikoSys.GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
2702 GZipStream: TGzipDecompressStream;
2703 TextStream: TStringStream;
2704 buf: array[0..BUF_SIZE - 1] of Byte;
2710 TextStream := TStringStream.Create('');
2712 //
\83m
\81[
\83g
\83\93\83E
\83\93\83`
\83E
\83B
\83\8b\83X2003
\91Î
\8dô(x-gzip
\82Æ
\82©
\82É
\82È
\82é
\82Ý
\82½
\82¢)
2713 // if LowerCase(Trim(ContentEncoding)) = 'gzip' then begin
2714 if AnsiPos('gzip', LowerCase(Trim(ContentEncoding))) > 0 then begin
2715 ResStream.Position := 0;
2716 GZipStream := TGzipDecompressStream.Create(TextStream);
2719 FillChar(buf, BUF_SIZE, 0);
2720 cnt := ResStream.Read(buf, BUF_SIZE);
2722 GZipStream.Write(buf, BUF_SIZE);
2728 ResStream.Position := 0;
2730 FillChar(buf, BUF_SIZE, 0);
2731 cnt := ResStream.Read(buf, BUF_SIZE);
2733 TextStream.Write(buf, BUF_SIZE);
2737 //NULL
\95¶
\8e\9a\82ð"*"
\82É
\82·
\82é
2738 s := TextStream.DataString;
2740 while (i > 0) and (s[i] = #0) do
2745 while i <> 0 do begin
2755 procedure TGikoSys.LoadKeySetting(ActionList: TActionList);
2757 STD_SEC = 'KeySetting';
2763 SecList: TStringList;
2764 Component: TComponent;
2766 if not FileExists(GetConfigDir + KEY_SETTING_FILE_NAME) then
2768 SecList := TStringList.Create;
2769 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2771 ini.ReadSection(STD_SEC, SecList);
2772 for i := 0 to SecList.Count - 1 do begin
2773 ActionName := SecList[i];
2774 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2775 if ActionKey <> -1 then begin
2776 Component := ActionList.Owner.FindComponent(ActionName);
2777 if TObject(Component) is TAction then begin
2778 TAction(Component).ShortCut := ActionKey;
2788 procedure TGikoSys.SaveKeySetting(ActionList: TActionList);
2790 STD_SEC = 'KeySetting';
2795 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2797 for i := 0 to ActionList.ActionCount - 1 do begin
2798 if ActionList.Actions[i].Tag = -1 then
2800 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2808 procedure TGikoSys.LoadEditorKeySetting(ActionList: TActionList);
2810 STD_SEC = 'KeySetting';
2816 SecList: TStringList;
2817 Component: TComponent;
2819 if not FileExists(GetConfigDir + EKEY_SETTING_FILE_NAME) then
2821 SecList := TStringList.Create;
2822 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2824 ini.ReadSection(STD_SEC, SecList);
2825 for i := 0 to SecList.Count - 1 do begin
2826 ActionName := SecList[i];
2827 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2828 if ActionKey <> -1 then begin
2829 Component := ActionList.Owner.FindComponent(ActionName);
2830 if TObject(Component) is TAction then begin
2831 TAction(Component).ShortCut := ActionKey;
2841 procedure TGikoSys.SaveEditorKeySetting(ActionList: TActionList);
2843 STD_SEC = 'KeySetting';
2848 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2850 for i := 0 to ActionList.ActionCount - 1 do begin
2851 if ActionList.Actions[i].Tag = -1 then
2853 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2862 procedure TGikoSys.CreateProcess(const AppPath: string; const Param: string);
2864 PI: TProcessInformation;
2868 Path := '"' + AppPath + '"';
2870 Path := Path + ' ' + Param;
2872 SI.Cb := SizeOf(Si);
2873 SI.lpReserved := nil;
2874 SI.lpDesktop := nil;
2877 SI.cbReserved2 := 0;
2878 SI.lpReserved2 := nil;
2880 Windows.CreateProcess(nil,
2892 procedure TGikoSys.OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
2896 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2897 gbtUserApp, gbtAuto:
2898 if (Setting.URLApp) and (FileExists(Setting.URLAppFile)) then
2899 GikoSys.CreateProcess(Setting.URLAppFile, URL)
2901 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2905 function TGikoSys.HTMLDecode(const AStr: String): String;
2907 Sp, Rp, Cp, Tp: PChar;
2912 SetLength(Result, Length(AStr));
2914 Rp := PChar(Result);
2917 while Sp^ <> #0 do begin
2923 'a': if AnsiStrPos(Sp, 'amp;') = Sp then
2929 'g': if (AnsiStrPos(Sp, 'lt;') = Sp) or (AnsiStrPos(Sp, 'gt;') = Sp) then
2933 while (Sp^ <> ';') and (Sp^ <> #0) do
2940 'q': if AnsiStrPos(Sp, 'quot;') = Sp then
2948 Num := IsNumeric(Copy(Tp, 1, 1));
2949 while (Sp^ <> ';') and (Sp^ <> #0) do begin
2950 if (Num) and (not IsNumeric(Copy(Sp, 1, 1))) then
2954 SetString(S, Tp, Sp - Tp);
2959 //raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2960 //[Cp^ + Sp^, Cp - PChar(AStr)])
2970 // on E:EConvertError do
2971 // raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2972 // [Cp^ + Sp^, Cp - PChar(AStr)])
2974 SetLength(Result, Rp - PChar(Result));
2977 function TGikoSys.GetHRefText(s: string): string;
2987 Index := AnsiPos('href', LowerCase(s));
2990 s := Trim(Copy(s, Index + 4, Length(s)));
2991 s := Trim(Copy(s, 2, Length(s)));
2993 //
\8en
\82ß
\82Ì
\95¶
\8e\9a\82ª'"'
\82È
\82ç
\8eæ
\82è
\8f\9c\82
2994 //if Copy(s, 1, 1) = '"' then begin
2995 if s[1] = '"' then begin
2996 s := Trim(Copy(s, 2, Length(s)));
2999 Index := AnsiPos('"', s);
3000 if Index <> 0 then begin
3001 //'"'
\82Ü
\82ÅURL
\82Æ
\82·
\82é
3002 s := Copy(s, 1, Index - 1);
3004 //'"'
\82ª
\96³
\82¯
\82ê
\82Î
\83X
\83y
\81[
\83X
\82©">"
\82Ì
\91\81\82¢
\95û
\82Ü
\82Å
\82ðURL
\82Æ
\82·
\82é
3005 Index := AnsiPos(' ', s);
3006 Index2 := AnsiPos('>', s);
3009 if Index > Index2 then
3012 s := Copy(s, 1, Index - 1)
3014 //
\82±
\82ê
\88È
\8fã
\82à
\82¤
\92m
\82ç
\82ñ
\82Ê
3020 //
\83z
\83X
\83g
\96¼
\82ª
\82Q
\82\83\82\88\82©
\82Ç
\82¤
\82©
\83`
\83F
\83b
\83N
\82·
\82é
3021 function TGikoSys.Is2chHost(Host: string): Boolean;
3023 HOST_NAME: array[0..1] of string = ('2ch.net', 'bbspink.com');
3029 if RightStr( Host, 1 ) = '/' then
3030 Host := Copy( Host, 1, Length( Host ) - 1 );
3031 OutputDebugString(pchar(HOST_NAME[0]));
3032 for i := 0 to Length(HOST_NAME) - 1 do begin
3033 // Len := Length(HOST_NAME[i]);
3034 if (AnsiPos(HOST_NAME[i], Host) > 0) and
3035 (AnsiPos(HOST_NAME[i], Host) = (Length(Host) - Length(HOST_NAME[i]) + 1)) then begin
3042 function TGikoSys.Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
3052 Index := AnsiPos(READ_PATH, path);
3053 if Index <> 0 then begin
3054 s := Copy(path, Index + Length(READ_PATH), Length(path));
3057 BBSID := GetTokenIndex(s, '/', 0);
3058 BBSKey := GetTokenIndex(s, '/', 1);
3061 Result := (BBSID <> '') or (BBSKey <> '');
3064 Index := AnsiPos(KAKO_PATH, path);
3065 if Index <> 0 then begin
3066 s := Copy(path, 2, Length(path));
3067 BBSID := GetTokenIndex(s, '/', 0);
3068 if (BBSID = 'log') and (GetTokenIndex(s, '/', 2) = 'kako') then
3069 BBSID := GetTokenIndex(s, '/', 1);
3070 BBSKey := ChangeFileExt(Document, '');
3071 Result := (BBSID <> '') or (BBSKey <> '');
3074 Index := AnsiPos('read.cgi?', URL);
3075 if Index <> 0 then begin
3076 SList := TStringList.Create;
3079 // s := HTMLDecode(Document);
3080 ExtractHTTPFields(['?', '&'], [], PChar(URL), SList, False);
3081 BBSID := SList.Values['bbs'];
3082 BBSKey := SList.Values['key'];
3083 Result := (BBSID <> '') or (BBSKey <> '');
3093 procedure TGikoSys.GetPopupResNumber(URL : string; var stRes, endRes : Int64);
3100 URL := Trim(LowerCase(URL));
3101 if (AnsiPos('&st=', URL ) <> 0) and ( AnsiPos( '&to=',URL) <> 0 ) then begin
3105 buf := Copy( URL, AnsiPos('&st=', URL ) + 4, AnsiPos( '&to=',URL) - AnsiPos('&st=', URL ) - 4 );
3107 stRes := StrToInt64( buf );
3108 if AnsiPos( '&nofirst=',URL) <> 0 then begin
3109 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, AnsiPos( '&nofirst=',URL) - AnsiPos('&to=', URL ) - 4);
3111 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, Length( URL ) - AnsiPos('&to=', URL ) - 4 + 1 );
3114 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3115 buf := Copy( buf, 1, ps );
3119 endRes := StrToInt64(buf)
3126 if (stRes <> 0) and (endRes = 0) then
3127 endRes := stRes + MAX_POPUP_RES
3128 else if (stRes = 0) and (endRes <> 0) then begin
3129 stRes := endRes - MAX_POPUP_RES;
3133 GikoSys.GetBrowsableThreadURL( URL );
3134 end else if( AnsiPos('&res=', URL ) <> 0 ) then begin
3136 buf := Copy( URL, AnsiPos('&res=', URL ) + 5, Length( URL ) - AnsiPos('&res=', URL ) - 5 + 1 );
3139 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3140 buf := Copy( buf, 1, ps );
3143 stRes := StrToInt(buf)
3150 end else if (AnsiPos('&start=', URL ) <> 0) and ( AnsiPos( '&end=',URL) <> 0 ) then begin
3152 stRes := StrToInt64( Copy( URL, AnsiPos('&start=', URL ) + 7, AnsiPos( '&end=',URL) - AnsiPos('&start=', URL ) - 7 ) );
3153 if AnsiPos( '&nofirst=',URL) <> 0 then begin
3154 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, AnsiPos( '&nofirst=',URL) - AnsiPos('&end=', URL ) - 5);
3156 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, Length( URL ) - AnsiPos('&to=', URL ) - 5 + 1 );
3159 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3160 buf := Copy( buf, 1, ps );
3164 endRes := StrToInt64(buf);
3171 end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
3172 buf := Copy(URL, LastDelimiter('/',URL)+1,Length(URL)-LastDelimiter('/',URL)+1);
3173 if Length(buf) > 0 then begin
3174 if AnsiPos('-', buf) = 1 then begin
3179 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3181 convBuf := Copy( buf, 1, ps );
3182 if convBuf <> '' then
3183 endRes := StrToInt64(convBuf)
3189 if endRes <> 0 then begin
3190 stRes := endRes - MAX_POPUP_RES;
3197 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3199 convBuf := Copy( buf, 1, ps );
3200 if convBuf <> '' then begin
3201 stRes := StrToInt64(convBuf);
3205 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3207 convBuf := Copy( buf, 1, ps );
3208 if convBuf <> '' then
3209 endRes := StrToInt64(convBuf)
3230 function TGikoSys.Parse2chURL2(URL: string): TPathRec;
3235 // convBuf : String;
3246 URL := Trim(LowerCase(URL));
3251 Result.FFirst := False;
3252 Result.FStBegin := False;
3253 Result.FToEnd := False;
3254 Result.FDone := False;
3255 Result.FNoParam := False;
3259 if URL[length(URL)] = '\' then
3261 FAWKStr.RegExp := 'http://.+\.(2ch\.net|bbspink\.com)/';
3262 if FAWKStr.Match(FAWKStr.ProcessEscSeq(URL), RStart, RLength) <> 0 then begin
3263 s := Copy(URL, RStart + RLength - 1, Length(URL));
3265 //
\95W
\8f\80\8f\91\8e®
3266 //
\8dÅ
\8cã
\82Íl50, 10, 10-20, 10n, 10-20n, -10, 10-, 10n-
\82È
\82Ç
3267 //http://xxx.2ch.net/test/read.cgi/bbsid/1000000000/
3268 FAWKStr.RegExp := '/test/read.cgi/.+/[0-9]+/?.*';
3269 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3270 s := Copy(s, 15, Length(s));
3272 SList := TStringList.Create;
3275 FAWKStr.RegExp := '/';
3276 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 3 then begin
3277 Result.FBBS := SList[1];
3278 Result.FKey := SList[2];
3279 if SList.Count >= 4 then
3283 Result.FNoParam := true;
3289 FAWKStr.LineSeparator := mcls_CRLF;
3290 FAWKStr.RegExp := '-';
3291 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) = 0 then begin
3292 Result.FFirst := True;
3294 FAWKStr.RegExp := 'l[0-9]+';
3295 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3296 Result.FFirst := True;
3298 for i := 0 to SList.Count - 1 do begin
3299 if Trim(SList[i]) = '' then begin
3301 Result.FStBegin := True;
3302 if i = (SList.Count - 1) then
3303 Result.FToEnd := True;
3304 end else if IsNumeric(SList[i]) then begin
3305 wkInt := StrToInt(SList[i]);
3306 wkMax := Max(wkMax, wkInt);
3310 wkMin := Min(wkMin, wkInt);
3311 end else if Trim(SList[i]) = 'n' then begin
3312 Result.FFirst := True;
3314 FAWKStr.RegExp := '^n[0-9]+$|^[0-9]+n$';
3315 if FAWKStr.Match(FAWKStr.ProcessEscSeq(SList[i]), RStart, RLength) > 0 then begin
3316 if Copy(SList[i], 1, 1) = 'n' then
3317 wkInt := StrToInt(Copy(SList[i], 2, Length(SList[i])))
3319 wkInt := StrToInt(Copy(SList[i], 1, Length(SList[i]) - 1));
3320 Result.FFirst := True;
3321 wkMax := Max(wkMax, wkInt);
3325 wkMin := Min(wkMin, wkInt);
3329 if Result.FStBegin and (not Result.FToEnd) then
3331 else if (not Result.FStBegin) and Result.FToEnd then
3333 else if (not Result.FStBegin) and (not Result.FToEnd) then begin
3334 Result.FSt := wkMin;
3335 Result.FTo := wkMax;
3337 //Result.FSt := wkMin;
3338 //Result.FTo := wkMax;
3344 Result.FDone := True;
3348 //
\90Vkako
\8f\91\8e®
3349 //http://server.2ch.net/ITA_NAME/kako/1000/10000/1000000000.html
3350 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+/[0-9]+\.html';
3351 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3352 SList := TStringList.Create;
3355 FAWKStr.RegExp := '/';
3356 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3357 Result.FBBS := SList[1];
3358 Result.FKey := ChangeFileExt(SList[5], '');
3359 Result.FFirst := True;
3365 Result.FDone := True;
3369 //
\8b\8ckako
\8f\91\8e®
3370 //http://server.2ch.net/ITA_NAME/kako/999/999999999.html
3371 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+\.html';
3372 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3373 SList := TStringList.Create;
3376 FAWKStr.RegExp := '/';
3377 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 5 then begin
3378 Result.FBBS := SList[1];
3379 Result.FKey := ChangeFileExt(SList[4], '');
3380 Result.FFirst := True;
3386 Result.FDone := True;
3390 //log
\8by
\82Ñlog2
\8f\91\8e®
3391 //http://server.2ch.net/log/ITA_NAME/kako/999/999999999.html
3392 //http://server.2ch.net/log2/ITA_NAME/kako/999/999999999.html
3393 FAWKStr.RegExp := '/log2?/.+/kako/[0-9]+/[0-9]+\.html';
3394 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3395 SList := TStringList.Create;
3398 FAWKStr.RegExp := '/';
3399 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3400 Result.FBBS := SList[2];
3401 Result.FKey := ChangeFileExt(SList[5], '');
3402 Result.FFirst := True;
3408 Result.FDone := True;
3413 //
\8b\8cURL
\8f\91\8e®
3414 //http://server.2ch.net/test/read.cgi?bbs=ITA_NAME&key=1000000000&st=1&to=5&nofirst=true
3415 FAWKStr.RegExp := '/test/read\.cgi\?';
3416 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3417 s := Copy(s, 16, Length(s));
3418 SList := TStringList.Create;
3421 FAWKStr.RegExp := '&';
3422 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
3423 Result.FFirst := True;
3424 for i := 0 to SList.Count - 1 do begin
3425 if Pos('bbs=', SList[i]) = 1 then begin
3426 Result.FBBS := Copy(SList[i], 5, Length(SList[i]));
3427 end else if Pos('key=', SList[i]) = 1 then begin
3428 Result.FKey := Copy(SList[i], 5, Length(SList[i]));
3429 end else if Pos('st=', SList[i]) = 1 then begin
3430 wk := Copy(SList[i], 4, Length(SList[i]));
3431 if IsNumeric(wk) then
3432 Result.FSt := StrToInt(wk)
3433 else if wk = '' then
3434 Result.FStBegin := True;
3435 end else if Pos('to=', SList[i]) = 1 then begin
3436 wk := Copy(SList[i], 4, Length(SList[i]));
3437 if IsNumeric(wk) then
3438 Result.FTo := StrToInt(wk)
3439 else if wk = '' then
3440 Result.FToEnd := True;
3441 end else if Pos('nofirst=', SList[i]) = 1 then begin
3442 Result.FFirst := False;
3451 if (Result.FBBS <> '') and (Result.FKey <> '') then begin
3452 Result.FDone := True;
3459 procedure TGikoSys.ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
3469 URI := TIdURI.Create(URL);
3471 Protocol := URI.Protocol;
3474 Document := URI.Document;
3476 Bookmark := URI.Bookmark;
3482 function TGikoSys.GetVersionBuild: Integer;
3484 FixedFileInfo: PVSFixedFileInfo;
3485 VersionHandle, VersionSize: DWORD;
3486 pVersionInfo: Pointer;
3491 AppFile := Application.ExeName;
3492 VersionSize := GetFileVersionInfoSize(pChar(AppFile), VersionHandle);
3493 if VersionSize = 0 then
3495 GetMem(pVersionInfo, VersionSize);
3497 if GetFileVersionInfo(PChar(AppFile),VersionHandle,VersionSize, pVersionInfo) then
3498 if VerQueryValue(pVersionInfo, '\', Pointer(FixedFileInfo), ItemLen) then
3499 Result := LOWORD(FixedFileInfo^.dwFileVersionLS);
3501 FreeMem(pVersionInfo, VersionSize);
3505 function TGikoSys.GetBrowsableThreadURL(
3509 threadItem : TThreadItem;
3510 boardPlugIn : TBoardPlugIn;
3514 //=====
\83v
\83\89\83O
\83C
\83\93
3516 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
3517 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
3518 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
3519 boardPlugIn := BoardPlugIns[ i ];
3520 threadItem := TThreadItem.Create( boardPlugIn, inURL );
3521 Result := threadItem.URL;
3529 // exception
\82ª
\94
\90¶
\82µ
\82½
\8fê
\8d\87\82Í
\93à
\95\94\8f\88\97\9d\82É
\94C
\82¹
\82½
\82¢
\82Ì
\82Å
\82±
\82±
\82Å
\82Í
\89½
\82à
\82µ
\82È
\82¢
3532 if Length( Result ) = 0 then
3533 Result := GikoSys.Get2chBrowsableThreadURL( inURL );
3537 function TGikoSys.GetThreadURL2BoardURL(
3541 threadItem : TThreadItem;
3542 boardPlugIn : TBoardPlugIn;
3546 //=====
\83v
\83\89\83O
\83C
\83\93
3548 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
3549 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
3550 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
3551 boardPlugIn := BoardPlugIns[ i ];
3552 threadItem := TThreadItem.Create( boardPlugIn, inURL );
3553 Result := BoardPlugIns[ i ].GetBoardURL( Longword( threadItem ) );
3561 // exception
\82ª
\94
\90¶
\82µ
\82½
\8fê
\8d\87\82Í
\93à
\95\94\8f\88\97\9d\82É
\94C
\82¹
\82½
\82¢
\82Ì
\82Å
\82±
\82±
\82Å
\82Í
\89½
\82à
\82µ
\82È
\82¢
3564 if Length( Result ) = 0 then
3565 Result := GikoSys.Get2chThreadURL2BoardURL( inURL );
3569 function TGikoSys.Get2chThreadURL2BoardURL(
3573 Protocol, Host, Path, Document, Port, Bookmark : string;
3574 BBSID, BBSKey : string;
3578 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3579 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3581 foundPos := Pos( '/test/read.cgi', inURL );
3582 if {(Is2chHost(Host)) and} (foundPos > 0) then
3583 Result := Copy( inURL, 1, foundPos ) + BBSID + '/'
3585 Result := Protocol + '://' + Host + '/' + BBSID + '/';
3589 function TGikoSys.Get2chBrowsableThreadURL(
3593 Protocol, Host, Path, Document, Port, Bookmark : string;
3594 BBSID, BBSKey : string;
3598 // if Pos( KAKO_PATH, inURL ) > 0 then begin
3601 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3602 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3603 foundPos := Pos( '/test/read.cgi', inURL ) - 1;
3605 if Is2chHost( Host ) then begin
3606 Result := Protocol + '://' + Host +
3607 READ_PATH + BBSID + '/' + BBSKey + '/l50';
3609 if foundPos > 0 then
3610 Result := Copy( inURL, 1, foundPos ) +
3611 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50'
3613 Result := Protocol + '://' + Host +
3614 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50';
3620 function TGikoSys.Get2chBoard2ThreadURL(
3628 server := UrlToServer( inBoard.URL );
3629 if Is2chHost( server ) then
3630 Result := server + 'test/read.cgi/' + inBoard.BBSID + '/' + inKey + '/l50'
3632 Result := server + 'test/read.cgi?bbs=' + inBoard.BBSID + '&key=' + inKey + '&ls=50';
3636 (*************************************************************************
3637 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\97ñ
\8b\93
3638 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3639 *************************************************************************)
3640 procedure TGikoSys.ListBoardFile;
3642 boardFileList : TStringList;
3648 for i := 0 to Length( BBSs ) - 1 do
3652 SetLength( BBSs, 0 );
3655 //
\94Â
\83\8a\83X
\83g
\82Ì
\97ñ
\8b\93
3656 if FileExists( GikoSys.GetBoardFileName ) then begin
3657 SetLength( BBSs, l + 1 );
3658 BBSs[ l ] := TBBS.Create( GikoSys.GetBoardFileName );
3659 BBSs[ l ].Title := '
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é';
3663 if FileExists( GikoSys.GetCustomBoardFileName ) then begin
3664 SetLength( BBSs, l + 1 );
3665 BBSs[ l ] := TBBS.Create( GikoSys.GetCustomBoardFileName );
3666 BBSs[ l ].Title := '
\82»
\82Ì
\91¼';
3670 // Board
\83t
\83H
\83\8b\83_
3671 if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
3672 BoardFileList := TStringList.Create;
3674 GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
3675 for k := BoardFileList.Count - 1 downto 0 do begin
3676 if AnsiCompareText(ExtractFileExt(BoardFileList[ k ]), '.bak') = 0 then
3677 BoardFileList.Delete(k);
3679 SetLength( BBSs, l + BoardFileList.Count );
3680 for i := BoardFileList.Count - 1 downto 0 do begin
3681 BBSs[ l ] := TBBS.Create( BoardFileList[ i ] );
3682 BBSs[ l ].Title := ChangeFileExt( ExtractFileName( BoardFileList[ i ] ), '' );
3693 (*************************************************************************
3694 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
3695 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3696 *************************************************************************)
3697 procedure TGikoSys.ReadBoardFile( bbs : TBBS );
3702 boardFile : TStringList;
3703 CategoryList : TStringList;
3704 BoardList : TStringList;
3705 Category : TCategory;
3708 RoundItem : TRoundItem;
3710 i, iBound : Integer;
3711 j, jBound : Integer;
3712 k, kBound : Integer;
3715 if not FileExists( bbs.FilePath ) then
3719 ini := TMemIniFile.Create('');
3720 boardFile := TStringList.Create;
3722 boardFile.LoadFromFile( bbs.FilePath );
3724 ini.SetStrings( boardFile );
3725 CategoryList := TStringList.Create;
3726 BoardList := TStringList.Create;
3728 ini.ReadSections( CategoryList );
3730 iBound := CategoryList.Count - 1;
3731 for i := 0 to iBound do begin
3732 ini.ReadSection( CategoryList[i], BoardList );
3733 Category := TCategory.Create;
3734 Category.No := i + 1;
3735 Category.Title := CategoryList[i];
3737 jBound := BoardList.Count - 1;
3738 for j := 0 to jBound do begin
3740 inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
3742 //=====
\83v
\83\89\83O
\83C
\83\93
3744 kBound := Length( BoardPlugIns ) - 1;
3745 for k := 0 to kBound do begin
3746 if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin
3747 if BoardPlugIns[ k ].AcceptURL( inistr ) = atBoard then begin
3748 Board := TBoard.Create( BoardPlugIns[ k ], inistr );
3755 // exception
\82ª
\94
\90¶
\82µ
\82½
\8fê
\8d\87\82Í
\93à
\95\94\8f\88\97\9d\82É
\94C
\82¹
\82½
\82¢
\82Ì
\82Å
\82±
\82±
\82Å
\82Í
\89½
\82à
\82µ
\82È
\82¢
3759 Board := TBoard.Create( nil, inistr );
3762 Board.Title := BoardList[j];
3763 Board.RoundDate := ZERO_DATE;
3765 idx := RoundList.Find(Board);
3766 if idx <> -1 then begin
3767 RoundItem := RoundList.Items[idx, grtBoard];
3768 Board.Round := True;
3769 Board.RoundName := RoundItem.RoundName;
3772 Category.Add(Board);
3777 bbs.Add( Category );
3779 bbs.IsBoardFileRead := True;
3791 function TGikoSys.GetUnknownCategory : TCategory;
3793 UNKNOWN_CATEGORY = '(
\96¼
\8fÌ
\95s
\96¾)';
3796 if Length( BBSs ) < 2 then begin
3801 Result := BBSs[ 1 ].FindCategoryFromTitle( UNKNOWN_CATEGORY );
3802 if Result = nil then begin
3803 Result := TCategory.Create;
3804 Result.Title := UNKNOWN_CATEGORY;
3805 BBSs[ 1 ].Add( Result );
3810 function TGikoSys.GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
3812 category : TCategory;
3814 UNKNOWN_BOARD = '(
\96¼
\8fÌ
\95s
\96¾)';
3817 category := GetUnknownCategory;
3818 if category = nil then begin
3821 Result := category.FindBoardFromTitle( UNKNOWN_BOARD );
3822 if Result = nil then begin
3823 Result := TBoard.Create( inPlugIn, inURL );
3824 Result.Title := UNKNOWN_BOARD;
3825 category.Add( Result );
3830 function TGikoSys.GetSambaFileName : string;
3832 Result := Setting.GetSambaFileName;
3834 procedure TGikoSys.SambaFileExists();
3837 sambaStrList: TStringList;
3839 if not FileExists(GikoSys.GetSambaFileName) then begin
3840 sambaTmp := ChangeFileExt(GikoSys.GetSambaFileName, '.default');
3841 sambaStrList := TStringList.Create;
3843 if FileExists(sambaTmp) then begin
3844 sambaStrList.LoadFromFile(sambaTmp);
3845 sambaStrList.SaveToFile(GikoSys.GetSambaFileName);
3852 function TGikoSys.GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem):string;
3855 ReadList: TStringList;
3857 boardPlugIn : TBoardPlugIn;
3860 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3861 if ThreadItem.IsBoardPlugInAvailable then begin
3862 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
3863 boardPlugIn := ThreadItem.BoardPlugIn;
3865 for i := 0 to threadItem.Count - 1 do begin
3867 Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), i + 1));
3868 if(AnsiPos(AID, Res.FDateTime) > 0) then begin
3869 Result := Result + '>' + IntToStr(i) + ' ';
3873 ReadList := TStringList.Create;
3875 ReadList.LoadFromFile(ThreadItem.GetThreadFileName);
3876 for i := 0 to ReadList.Count - 1 do begin
3877 Res := DivideStrLine(ReadList[i]);
3878 if AnsiPos(AID, Res.FDateTime) > 0 then begin
3879 Result := Result + '>' + IntToStr(i+1) + ' ';
3886 Result := ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
3891 procedure TGikoSys.SpamCountWord( const text : string; wordCount : TWordCount );
3894 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
3895 Bayesian.CountWord( text, wordCount );
3899 procedure TGikoSys.SpamForget( wordCount : TWordCount; isSpam : Boolean );
3902 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
3903 Bayesian.Forget( wordCount, isSpam );
3907 procedure TGikoSys.SpamLearn( wordCount : TWordCount; isSpam : Boolean );
3910 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
3911 Bayesian.Learn( wordCount, isSpam );
3915 function TGikoSys.SpamParse( const text : string; wordCount : TWordCount ) : Extended;
3918 case Setting.SpamFilterAlgorithm of
3919 gsfaNone: Result := 0;
3920 gsfaPaulGraham: Result := Bayesian.Parse( text, wordCount, gbaPaulGraham );
3921 gsfaGaryRobinson: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinson );
3922 gsfaGaryRobinsonFisher: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinsonFisher );
3928 GikoSys := TGikoSys.Create;
3931 if GikoSys <> nil then begin