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;
21 TGikoBBSType = (gbt2ch);
22 //
\83\8d\83O
\83^
\83C
\83v
23 TGikoLogType = (glt2chNew, glt2chOld);
24 //
\83\81\83b
\83Z
\81[
\83W
\83A
\83C
\83R
\83\93
25 TGikoMessageIcon = (gmiOK, gmiSAD, gmiNG, gmiWhat, gmiNone);
26 //URL
\83I
\81[
\83v
\83\93\83u
\83\89\83E
\83U
\83^
\83C
\83v
27 TGikoBrowserType = (gbtIE, gbtUserApp, gbtAuto);
30 TStrTokSeparator = set of Char;
36 //
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b\83\8c\83R
\81[
\83h
44 FRoundDate: TDateTime;
45 FLastModified: TDateTime;
48 FMishiyou: Boolean; //
\96¢
\8eg
\97p
52 FAllResCount: Integer;
53 FNewResCount: Integer;
54 FAgeSage: TGikoAgeSage;
57 //
\83T
\83u
\83W
\83F
\83N
\83g
\83\8c\83R
\81[
\83h
64 //
\83\8c\83X
\83\8c\83R
\81[
\83h
74 //URLPath
\83\8c\83R
\81[
\83h
77 FKey: string; //ThreadID
78 FSt: Integer; //
\8aJ
\8en
\83\8c\83X
\94Ô
79 FTo: Integer; //
\8fI
\97¹
\83\8c\83X
\94Ô
80 FFirst: Boolean; //>>1
\82Ì
\95\
\8e¦
81 FStBegin: Boolean; //1
\81`
\95\
\8e¦
82 FToEnd: Boolean; //
\81`
\8dÅ
\8cã
\82Ü
\82Å
\95\
\8e¦
83 FDone: Boolean; //
\90¬
\8c÷
86 TGikoSys = class(TObject)
92 FOnlyAHundredRes : Boolean;
93 // FExitWrite: TStringList;
94 // function StrToFloatDef(s: string; Default: Double): Double;
98 FSelectResFilter : TAbon;
101 destructor Destroy; override;
102 property OnlyAHundredRes : Boolean read FOnlyAHundredRes write FOnlyAHundredRes;
104 // function MsgBox(Msg: string; Title: string; Flags: Longint): integer; overload;
105 // function MsgBox(Handle: THandle; Msg: string; Title: string; Flags: Longint): integer; overload;
106 function IsNumeric(s: string): boolean;
107 function IsFloat(s: string): boolean;
108 function DirectoryExistsEx(const Name: string): Boolean;
109 function ForceDirectoriesEx(Dir: string): Boolean;
110 // function GetVersion: string;
112 function GetBoardFileName: string;
113 function GetCustomBoardFileName: string;
114 function GetHtmlTempFileName: string;
115 function GetAppDir: string;
116 function GetTempFolder: string;
117 function GetSentFileName: string;
118 function GetConfigDir: string;
119 function GetSkinDir: string;
120 function GetSkinHeaderFileName: string;
121 function GetSkinFooterFileName: string;
122 function GetSkinResFileName: string;
123 function GetSkinNewResFileName: string;
124 function GetSkinBookmarkFileName: string;
125 function GetSkinNewmarkFileName: string;
126 function GetStyleSheetDir: string;
127 function GetOutBoxFileName: string;
128 function GetUserAgent: string;
130 procedure ReadSubjectFile(Board: TBoard);
131 procedure CreateThreadDat(Board: TBoard);
132 procedure WriteThreadDat(Board: TBoard);
133 function ParseIndexLine(Line: string): TIndexRec;
134 procedure GetFileList(Path: string; Mask: string; List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
135 procedure GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
137 procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
138 function AddAnchorTag(s: string): string;
140 function DivideSubject(Line: string): TSubjectRec;
141 function DivideStrLine(Line: string): TResRec;
143 property Setting: TSetting read FSetting write FSetting;
144 property Dolib: TDolib read FDolib write FDolib;
146 function UrlToID(url: string): string;
147 function UrlToServer(url: string): string;
149 function StrTokFirst(const s:string; const sep:TStrTokSeparator; var Rec:TStrTokRec):string;
150 function StrTokNext(const sep:TStrTokSeparator; var Rec:TStrTokRec): string;
152 function GetFileSize(FileName : string) : longint;
153 function GetFileLineCount(FileName : string): longint;
154 function Get2chDate(aDate: TDateTime): string;
155 function IntToDateTime(val: Int64): TDateTime;
156 function DateTimeToInt(ADate: TDateTime): Integer;
158 function ReadThreadFile(FileName: string; Line: Integer): string;
160 procedure MenuFont(Font: TFont);
162 function RemoveToken(var s:string;delimiter:string):string;
163 function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
165 function DeleteLink(const s: string): string;
167 function GetShortName(const LongName: string; ALength: integer): string;
168 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string): string;
170 function ZenToHan(const s: string): string;
171 function VaguePos(const Substr, S: string): Integer;
172 function BoolToInt(b: Boolean): Integer;
173 function IntToBool(i: Integer): Boolean;
174 function GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
175 procedure LoadKeySetting(ActionList: TActionList);
176 procedure SaveKeySetting(ActionList: TActionList);
177 procedure CreateProcess(const AppPath: string; const Param: string);
178 procedure OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
179 function HTMLDecode(const AStr: String): String;
180 function GetHRefText(s: string): string;
181 function Is2chHost(Host: string): Boolean;
182 function Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
183 function Parse2chURL2(URL: string): TPathRec;
184 procedure ParseURI(var URL, Protocol, Host, Path, Document, Port, Bookmark: string);
185 function GetVersionBuild: Integer;
186 function GetThreadURL2BoardURL( inURL : string ) : string;
187 function Get2chThreadURL2BoardURL( inURL : string ) : string;
188 function Get2chBrowsableThreadURL( inURL : string ) : string;
189 function Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string;
190 procedure ReadBoardFile;
192 function GetUnknownCategory : TCategory;
193 function GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
195 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
196 function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string;
197 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
198 function SkinedRes( skin: string; Res: TResRec; No: string ): string;
205 LENGTH_RESTITLE = 40;
206 ZERO_DATE: Integer = 25569;
207 BETA_VERSION_NAME_E = 'beta';
208 BETA_VERSION_NAME_J = 'ÊÞÀ';
210 BETA_VERSION_BUILD = ''; //debug
\94Å
\82È
\82Ç
211 APP_NAME = 'gikoNavi';
219 FOLDER_INDEX_VERSION = '1.01';
220 USER_AGENT = 'Monazilla';
221 DEFAULT_NGWORD_FILE_NAME : String = 'NGword.txt';
222 NGWORDs_DIR_NAME : String = 'NGwords';
224 READ_PATH: string = '/test/read.cgi/';
225 OLD_READ_PATH: string = '/test/read.cgi?';
226 KAKO_PATH: string = '/kako/';
228 (*************************************************************************
229 *GikoSys
\83R
\83\93\83X
\83g
\83\89\83N
\83^
230 *************************************************************************)
231 constructor TGikoSys.Create;
233 FSetting := TSetting.Create;
234 FDolib := TDolib.Create;
235 FAWKStr := TAWKStr.Create(nil);
236 if DirectoryExists(GetConfigDir) = false then begin
237 CreateDir(GetConfigDir);
239 FAbon := TAbon.Create;
240 FAbon.Setroot(GetConfigDir+NGWORDs_DIR_NAME);
242 FAbon.ReturnNGwordLineNum := FSetting.ShowNGLinesNum;
243 FAbon.SetNGResAnchor := FSetting.AddResAnchor;
244 FAbon.Deleterlo := FSetting.AbonDeleterlo;
245 FAbon.Replaceul := FSetting.AbonReplaceul;
246 FAbon.AbonPopupRes := FSetting.PopUpAbon;
248 FSelectResFilter := TAbon.Create;
249 //
\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
250 FSelectResFilter.AbonString := '';
252 OnlyAHundredRes := FSetting.OnlyAHundredRes;
255 (*************************************************************************
256 *GikoSys
\83f
\83X
\83g
\83\89\83N
\83^
257 *************************************************************************)
258 destructor TGikoSys.Destroy;
261 FileList: TStringList;
263 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
271 FSelectResFilter.Free;
272 //
\83e
\83\93\83|
\83\89\83\8aHTML
\82ð
\8dí
\8f\9c
273 FileList := TStringList.Create;
275 GetFileList(GetTempFolder, '*.html', FileList, False, True);
276 for i := 0 to FileList.Count - 1 do begin
277 DeleteFile(FileList[i]);
285 (*************************************************************************
286 *
\95¶
\8e\9a\97ñ
\90\94\8e\9a\83`
\83F
\83b
\83N
287 *************************************************************************)
289 function TGikoSys.IsNumeric(s: string): boolean;
299 (*************************************************************************
300 *
\95¶
\8e\9a\97ñ
\95\82\93®
\8f¬
\90\94\93_
\90\94\8e\9a\83`
\83F
\83b
\83N
301 *************************************************************************)
302 function TGikoSys.IsFloat(s: string): boolean;
306 Result := TextToFloat(PChar(s), v, fvExtended);
309 (*************************************************************************
310 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
311 *************************************************************************)
312 function TGikoSys.GetBoardFileName: string;
314 Result := Setting.GetBoardFileName;
317 (*************************************************************************
318 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
319 *************************************************************************)
320 function TGikoSys.GetCustomBoardFileName: string;
322 Result := Setting.GetCustomBoardFileName;
325 (*************************************************************************
326 *
\83e
\83\93\83|
\83\89\83\8a\83t
\83H
\83\8b\83_
\81[
\96¼
\8eæ
\93¾
327 *************************************************************************)
328 function TGikoSys.GetHtmlTempFileName: string;
330 Result := Setting.GetHtmlTempFileName;
334 (*************************************************************************
335 *
\8eÀ
\8ds
\83t
\83@
\83C
\83\8b\83t
\83H
\83\8b\83_
\8eæ
\93¾
336 *************************************************************************)
337 function TGikoSys.GetAppDir: string;
339 Result := Setting.GetAppDir;
342 (*************************************************************************
343 *TempHtml
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
344 *************************************************************************)
345 function TGikoSys.GetTempFolder: string;
347 Result := Setting.GetTempFolder;
350 (*************************************************************************
351 *sent.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
352 *************************************************************************)
353 function TGikoSys.GetSentFileName: string;
355 Result := Setting.GetSentFileName;
358 (*************************************************************************
359 *outbox.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
360 *************************************************************************)
361 function TGikoSys.GetOutBoxFileName: string;
363 Result := Setting.GetOutBoxFileName;
366 (*************************************************************************
367 *Config
\83t
\83H
\83\8b\83_
\8eæ
\93¾
368 *************************************************************************)
369 function TGikoSys.GetConfigDir: string;
371 Result := Setting.GetConfigDir;
374 function TGikoSys.GetStyleSheetDir: string;
376 Result := Setting.GetStyleSheetDir;
379 function TGikoSys.GetSkinDir: string;
381 Result := Setting.GetSkinDir;
384 function TGikoSys.GetSkinHeaderFileName: string;
386 Result := Setting.GetSkinHeaderFileName;
389 function TGikoSys.GetSkinFooterFileName: string;
391 Result := Setting.GetSkinFooterFileName;
394 function TGikoSys.GetSkinNewResFileName: string;
396 Result := Setting.GetSkinNewResFileName;
399 function TGikoSys.GetSkinResFileName: string;
401 Result := Setting.GetSkinResFileName;
404 function TGikoSys.GetSkinBookmarkFileName: string;
406 Result := Setting.GetSkinBookmarkFileName;
409 function TGikoSys.GetSkinNewmarkFileName: string;
411 Result := Setting.GetSkinNewmarkFileName;
415 function TGikoSys.GetUserAgent: string;
417 if Dolib.Connected then begin
418 Result := Format('%s %s/%s%d%s', [
425 BETA_VERSION_BUILD]);
427 Result := Format('%s/%s %s/%s%d%s', [
435 BETA_VERSION_BUILD]);
439 (*************************************************************************
440 *
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é
\95û
\8e®
\8e\9e\8d\8f\8eæ
\93¾
441 *************************************************************************)
442 function TGikoSys.Get2chDate(aDate: TDateTime): string;
447 d1 := EncodeDate(1970, 1, 1);
448 d2 := aDate - EncodeTime(9, 0, 0, 0);
449 Result := FloatToStr(Trunc((d2 - d1) * 24 * 60 * 60));
453 function TGikoSys.IntToDateTime(val: Int64): TDateTime;
458 d1 := EncodeDate(1970, 1, 1);
459 d2 := (val * 1000) / (24 * 60 * 60 * 1000);
463 function TGikoSys.DateTimeToInt(ADate: TDateTime): Integer;
468 d := EncodeDate(1970, 1, 1);
469 c := (ADate - d) * 24 * 60 * 60;
474 (*************************************************************************
475 *Subject
\83t
\83@
\83C
\83\8bRead
476 *************************************************************************)
477 procedure TGikoSys.ReadSubjectFile(Board: TBoard);
479 ThreadItem: TThreadItem;
481 FileList: TStringList;
482 TmpFileList: TStringList;
483 // SrchRec: TSearchRec;
490 // TmpUpdate: Boolean;
493 RoundItem: TRoundItem;
499 // TmpUpdate := False;
501 usePlugIn := Board.IsBoardPlugInAvailable;
503 FileName := Board.GetFolderIndexFileName;
504 if not FileExists(FileName) then CreateThreadDat(Board);
505 // if not FileExists(FileName) then Exit;
507 { R := FindFirst(ExtractFileDir(Board.GetFolderIndexFileName) + '\*.dat', 0, SrchRec);
509 FileList.Add(SrchRec.Name);
510 R := FindNext(SrchRec);
514 FileList := TStringList.Create;
515 FileList.Sorted := True;
516 TmpFileList := TStringList.Create;
517 TmpFileList.Sorted := True;
519 //IsLogFile
\97pDAT
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
520 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False, False);
522 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\97pTmp
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
523 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False, False);
525 sl := TStringList.Create;
527 if FileExists(FileName) then
528 sl.LoadFromFile(FileName);
530 //
\82Q
\8ds
\96Ú
\82©
\82ç
\81i
\82P
\8ds
\96Ú
\82Í
\83o
\81[
\83W
\83\87\83\93\81j
531 for i := sl.Count - 1 downto 1 do begin
532 Rec := ParseIndexLine(sl[i]);
535 ThreadItem := TThreadItem.Create(
537 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
539 ThreadItem := TThreadItem.Create(
541 Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' ) ) );
543 if FileList.Count <> 0 then
544 if FileList.Find( ThreadItem.FileName, Index ) then
545 //ThreadItem.IsLogFile := True;
546 FileList.Delete( Index );
548 ThreadItem.BeginUpdate;
549 ThreadItem.No := Rec.FNo;
550 ThreadItem.FileName := Rec.FFileName;
551 ThreadItem.Title := Rec.FTitle;
552 ThreadItem.Count := Rec.FCount;
553 ThreadItem.Size := Rec.FSize;
554 // ThreadItem.RoundNo := Rec.FRoundNo;
555 ThreadItem.RoundDate := Rec.FRoundDate;
556 ThreadItem.LastModified := Rec.FLastModified;
557 ThreadItem.Kokomade := Rec.FKokomade;
558 ThreadItem.NewReceive := Rec.FNewReceive;
559 // ThreadItem.Round := Rec.FRound;
560 ThreadItem.UnRead := Rec.FUnRead;
561 ThreadItem.ScrollTop := Rec.FScrollTop;
562 ThreadItem.AllResCount := Rec.FAllResCount;
563 ThreadItem.NewResCount := Rec.FNewResCount;
564 ThreadItem.AgeSage := Rec.FAgeSage;
565 ThreadItem.ParentBoard := Board;
567 //
\8f\84\89ñ
\83\8a\83X
\83g
\82É
\91¶
\8dÝ
\82µ
\82½
\82ç
\8f\84\89ñ
\83t
\83\89\83O
\83Z
\83b
\83g
568 if ThreadItem.IsLogFile then begin
569 idx := RoundList.Find(ThreadItem);
570 if idx <> -1 then begin
571 RoundItem := RoundList.Items[idx, grtItem];
572 ThreadItem.RoundName := RoundItem.RoundName;
573 ThreadItem.Round := True;
577 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\83`
\83F
\83b
\83N
578 if TmpFileList.Count <> 0 then begin
579 if TmpFileList.Find(ChangeFileExt(ThreadItem.FileName, '.tmp'), Index) then begin
580 ini := TMemIniFile.Create(ChangeFileExt(ThreadItem.GetThreadFileName, '.tmp'));
582 ThreadItem.RoundDate := ini.ReadDateTime('Setting', 'RoundDate', ZERO_DATE);
583 ThreadItem.LastModified := ini.ReadDateTime('Setting', 'LastModified', ZERO_DATE);
584 ThreadItem.Size := ini.ReadInteger('Setting', 'Size', 0);
585 ThreadItem.Count := ini.ReadInteger('Setting', 'Count', 0);
586 ThreadItem.NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
587 ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
588 ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
589 ThreadItem.ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
590 ThreadItem.AllResCount := ini.ReadInteger('Setting', 'AllResCount', 0);
591 ThreadItem.NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
592 ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
596 TmpFileList.Delete(Index);
600 ThreadItem.EndUpdate;
601 Board.Add(ThreadItem);
603 // if (ThreadItem.IsLogFile) and (ThreadItem.Count > ThreadItem.Kokomade) then
604 if (ThreadItem.IsLogFile) and (ThreadItem.UnRead) then
608 if UnRead <> Board.UnRead then
609 Board.UnRead := UnRead;
611 //
\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
612 for i := 0 to FileList.Count - 1 do begin
613 FileName := ExtractFileDir(Board.GetFolderIndexFileName) + '\' + FileList[i];
615 ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
617 ThreadItem := TThreadItem.Create(
619 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
621 ThreadItem := TThreadItem.Create(
622 nil, Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' ) ) );
623 ThreadItem.No := Board.Count + 1;
624 ThreadItem.FileName := FileList[i];
625 ThreadItem.Title := ResRec.FTitle;
626 ThreadItem.Count := GetFileLineCount(FileName);
627 ThreadItem.AllResCount := ThreadItem.Count;
628 ThreadItem.NewResCount := 0;
629 ThreadItem.Size := 0;
630 ThreadItem.RoundDate := ZERO_DATE;
631 ThreadItem.LastModified := ZERO_DATE;
632 ThreadItem.Kokomade := -1;
633 ThreadItem.NewReceive := 0;
634 ThreadItem.ParentBoard := Board;
635 ThreadItem.IsLogFile := True;
636 ThreadItem.Round := False;
637 ThreadItem.UnRead := False;
638 ThreadItem.ScrollTop := 0;
639 ThreadItem.AgeSage := gasNone;
640 Board.Add(ThreadItem);
647 Board.IsThreadDatRead := True;
650 (*************************************************************************
651 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b(Folder.idx)
\8dì
\90¬
652 *************************************************************************)
653 procedure TGikoSys.CreateThreadDat(Board: TBoard);
657 SubjectList: TStringList;
663 if not FileExists(Board.GetSubjectFileName) then Exit;
664 FileName := Board.GetFolderIndexFileName;
666 SubjectList := TStringList.Create;
668 SubjectList.LoadFromFile(Board.GetSubjectFileName);
669 sl := TStringList.Create;
672 sl.Add(FOLDER_INDEX_VERSION);
673 for i := 0 to SubjectList.Count - 1 do begin
674 Rec := DivideSubject(SubjectList[i]);
676 if (Trim(Rec.FFileName) = '') or (Trim(Rec.FTitle) = '') then
679 s := Format('%x', [cnt]) + #1 //
\94Ô
\8d\86
680 + Rec.FFileName + #1 //
\83t
\83@
\83C
\83\8b\96¼
681 + Rec.FTitle + #1 //
\83^
\83C
\83g
\83\8b
682 + Format('%x', [Rec.FCount]) + #1 //
\83J
\83E
\83\93\83g
683 + Format('%x', [0]) + #1 //size
684 + Format('%x', [0]) + #1 //RoundDate
685 + Format('%x', [0]) + #1 //LastModified
686 + Format('%x', [0]) + #1 //Kokomade
687 + Format('%x', [0]) + #1 //NewReceive
688 + '0' + #1 //
\96¢
\8eg
\97p
689 + Format('%x', [0]) + #1 //UnRead
690 + Format('%x', [0]) + #1 //ScrollTop
691 + Format('%x', [Rec.FCount]) + #1 //AllResCount
692 + Format('%x', [0]) + #1 //NewResCount
693 + Format('%x', [0]); //AgeSage
698 sl.SaveToFile(FileName);
707 (*************************************************************************
708 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X(Thread.dat)
\8f\91\82«
\8d\9e\82Ý
710 *************************************************************************)
711 procedure TGikoSys.WriteThreadDat(Board: TBoard);
713 // Values: array[Boolean] of string = ('0', '1');
719 FileList: TStringList;
721 if not Board.IsThreadDatRead then
723 FileName := Board.GetFolderIndexFileName;
724 ForceDirectoriesEx( ExtractFilePath( FileName ) );
726 sl := TStringList.Create;
728 sl.Add(FOLDER_INDEX_VERSION);
729 for i := 0 to Board.Count - 1 do begin
730 if Board.Items[i].No = 0 then
731 Board.Items[i].No := i + 1;
733 s := Format('%x', [Board.Items[i].No]) + #1
734 + Board.Items[i].FileName + #1
735 + Board.Items[i].Title + #1
736 + Format('%x', [Board.Items[i].Count]) + #1
737 + Format('%x', [Board.Items[i].Size]) + #1
738 + Format('%x', [DateTimeToInt(Board.Items[i].RoundDate)]) + #1
739 + Format('%x', [DateTimeToInt(Board.Items[i].LastModified)]) + #1
740 + Format('%x', [Board.Items[i].Kokomade]) + #1
741 + Format('%x', [Board.Items[i].NewReceive]) + #1
742 + '0' + #1 //
\96¢
\8eg
\97p
743 + Format('%x', [BoolToInt(Board.Items[i].UnRead)]) + #1
744 + Format('%x', [Board.Items[i].ScrollTop]) + #1
745 + Format('%x', [Board.Items[i].AllResCount]) + #1
746 + Format('%x', [Board.Items[i].NewResCount]) + #1
747 + Format('%x', [Ord(Board.Items[i].AgeSage)]);
752 sl.SaveToFile(FileName);
754 FileList := TStringList.Create;
756 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', FileList, False, True);
757 for i := 0 to FileList.Count - 1 do begin
758 DeleteFile(FileList[i]);
768 function TGikoSys.ParseIndexLine(Line: string): TIndexRec;
773 for i := 0 to 14 do begin
774 s := GetTokenIndex(Line, #1, i);
776 0: Result.FNo := StrToIntDef('$' + s, 0);
777 1: Result.FFileName := s;
778 2: Result.FTitle := s;
779 3: Result.FCount := StrToIntDef('$' + s, 0);
780 4: Result.FSize := StrToIntDef('$' + s, 0);
781 5: Result.FRoundDate := IntToDateTime(StrToIntDef('$' + s, ZERO_DATE));
782 6: Result.FLastModified := IntToDateTime(StrToIntDef('$' + s, ZERO_DATE));
783 7: Result.FKokomade := StrToIntDef('$' + s, -1);
784 8: Result.FNewReceive := StrToIntDef('$' + s, 0);
786 10: Result.FUnRead := IntToBool(StrToIntDef('$' + s, 0));
787 11: Result.FScrollTop := StrToIntDef('$' + s, 0);
788 12: Result.FAllResCount := StrToIntDef('$' + s, 0);
789 13: Result.FNewResCount := StrToIntDef('$' + s, 0);
790 14: Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + s, 0));
795 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
796 // ListFiles('c:\', '*.txt', list, True);
797 procedure TGikoSys.GetFileList(Path: string; Mask: string; List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
800 SearchRec : TSearchRec;
803 Path := IncludeTrailingPathDelimiter(Path);
804 rc := FindFirst(Path + '*.*', faAnyfile, SearchRec);
806 while rc = 0 do begin
807 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
808 s := Path + SearchRec.Name;
809 //if (SearchRec.Attr and faDirectory > 0) then
810 // s := IncludeTrailingPathDelimiter(s)
812 if (SearchRec.Attr and faDirectory = 0) and (MatchesMask(s, Mask)) then
816 List.Add(SearchRec.Name);
817 if SubDir and (SearchRec.Attr and faDirectory > 0) then
818 GetFileList(s, Mask, List, True, IsPathAdd);
820 rc := FindNext(SearchRec);
823 SysUtils.FindClose(SearchRec);
827 //
\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é
828 procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
831 SearchRec : TSearchRec;
834 Path := IncludeTrailingPathDelimiter(Path);
835 rc := FindFirst(Path + '*.*', faDirectory, SearchRec);
837 while rc = 0 do begin
838 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
839 s := Path + SearchRec.Name;
840 //if (SearchRec.Attr and faDirectory > 0) then
841 // s := IncludeTrailingPathDelimiter(s)
843 if (SearchRec.Attr and faDirectory > 0) and (MatchesMask(s, Mask)) then
844 List.Add( IncludeTrailingPathDelimiter( s ) );
845 if SubDir and (SearchRec.Attr and faDirectory > 0) then
846 GetDirectoryList(s, Mask, List, True);
848 rc := FindNext(SearchRec);
851 SysUtils.FindClose(SearchRec);
855 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
856 function TGikoSys.LoadFromSkin(
858 ThreadItem: TThreadItem;
865 Skin := TStringList.Create;
867 if FileExists( fileName ) then begin
868 Skin.LoadFromFile( fileName );
870 //
\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
872 if ThreadItem.ParentBoard <> nil then
873 if ThreadItem.ParentBoard.ParentCategory <> nil then
874 CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
875 //Skin.Text := CustomStringReplace( Skin.Text, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
876 //Skin.Text := CustomStringReplace( Skin.Text, '<THREADURL/>', ThreadItem.URL);
877 CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
879 //Skin.Text := CustomStringReplace( Skin.Text, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
880 CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
881 //Skin.Text := CustomStringReplace( Skin.Text, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
882 CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
883 //Skin.Text := CustomStringReplace( Skin.Text, '<THREADNAME/>', ThreadItem.Title);
884 CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
885 //Skin.Text := CustomStringReplace( Skin.Text, '<SKINPATH/>', Setting.CSSFileName);
886 CustomStringReplace( Skin, '<SKINPATH/>', Setting.CSSFileName);
887 //Skin.Text := CustomStringReplace( Skin.Text, '<GETRESCOUNT/>', IntToStr( ThreadItem.NewReceive - 1 ));
888 CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.NewReceive - 1 ));
889 //Skin.Text := CustomStringReplace( Skin.Text, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
890 CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
891 //Skin.Text := CustomStringReplace( Skin.Text, '<ALLRESCOUNT/>', IntToStr( ThreadItem.AllResCount ));
892 CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.AllResCount ));
894 //Skin.Text := CustomStringReplace( Skin.Text, '<NEWDATE/>',
895 //FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
896 CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
897 //Skin.Text := CustomStringReplace( Skin.Text, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
898 CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
899 //Skin.Text := CustomStringReplace( Skin.Text, '<SIZE/>', IntToStr( SizeByte ));
900 CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
902 //-----
\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µ
903 //
\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
905 if ThreadItem.ParentBoard <> nil then
906 if ThreadItem.ParentBoard.ParentCategory <> nil then
907 CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
908 //Skin.Text := CustomStringReplace( Skin.Text, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
909 //Skin.Text := CustomStringReplace( Skin.Text, '&THREADURL', ThreadItem.URL);
910 CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
912 //Skin.Text := CustomStringReplace( Skin.Text, '&BOARDNAME', ThreadItem.ParentBoard.Title);
913 CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
914 //Skin.Text := CustomStringReplace( Skin.Text, '&BOARDURL', ThreadItem.ParentBoard.URL);
915 CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
916 //Skin.Text := CustomStringReplace( Skin.Text, '&THREADNAME', ThreadItem.Title);
917 CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
918 //Skin.Text := CustomStringReplace( Skin.Text, '&SKINPATH', Setting.CSSFileName);
919 CustomStringReplace( Skin, '&SKINPATH', Setting.CSSFileName);
920 //Skin.Text := CustomStringReplace( Skin.Text, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
921 CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
922 //Skin.Text := CustomStringReplace( Skin.Text, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
923 CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
924 //Skin.Text := CustomStringReplace( Skin.Text, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
925 CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
927 //Skin.Text := CustomStringReplace( Skin.Text, '&NEWDATE',
928 // FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
929 CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
930 //Skin.Text := CustomStringReplace( Skin.Text, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
931 CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
932 //Skin.Text := CustomStringReplace( Skin.Text, '&SIZE', IntToStr( SizeByte ));
933 CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
934 //-----
\82±
\82±
\82Ü
\82Å
942 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
943 function TGikoSys.SkinedRes(
951 Skin := CustomStringReplace( Skin, '<NUMBER/>',
952 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
953 Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
954 Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
955 Skin := CustomStringReplace( Skin, '<MAILNAME/>',
956 '<a href="mailo:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
957 Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
958 Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
959 Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
961 //-----
\82©
\82¿
\82ã
\81`
\82µ
\82á
\8cÝ
\8a·
\97p
\81B
\83R
\83\81\83\93\83g
\83A
\83E
\83g
\82µ
\82Ä
\82à
\82æ
\82µ
962 Skin := CustomStringReplace( Skin, '&NUMBER',
963 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
964 Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
965 Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
966 Skin := CustomStringReplace( Skin, '&MAILNAME',
967 '<a href="mailo:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
968 Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
969 Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
970 Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
971 //-----
\82±
\82±
\82Ü
\82Å
979 procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
983 //bufList : TStringList;
984 ReadList: TStringList;
985 SaveList: TStringList;
989 NewReceiveNo: Integer;
991 boardPlugIn : TBoardPlugIn;
993 UserOptionalStyle: string;
999 function LoadSkin( fileName: string ): string;
1001 Result := LoadFromSkin( fileName, ThreadItem, SizeByte );
1003 function ReplaceRes( skin: string ): string;
1005 Result := SkinedRes( skin, Res, No );
1008 if ThreadItem <> nil then begin
1009 if ThreadItem.IsBoardPlugInAvailable then begin
1010 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1011 boardPlugIn := ThreadItem.BoardPlugIn;
1012 NewReceiveNo := ThreadItem.NewReceive;
1014 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1015 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1016 UserOptionalStyle := UserOptionalStyle +
1017 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1018 if GikoSys.Setting.BrowserFontSize <> 0 then
1019 UserOptionalStyle := UserOptionalStyle +
1020 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1021 if GikoSys.Setting.BrowserFontColor <> -1 then
1022 UserOptionalStyle := UserOptionalStyle +
1023 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1024 if GikoSys.Setting.BrowserBackColor <> -1 then
1025 UserOptionalStyle := UserOptionalStyle +
1026 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1027 case GikoSys.Setting.BrowserFontBold of
1028 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1029 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1031 case GikoSys.Setting.BrowserFontItalic of
1032 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1033 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1036 SaveList := TStringList.Create;
1039 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1040 // doc.charset := 'Shift_JIS';
1041 threadItem.SizeByte := 0;
1044 SaveList.Add( boardPlugIn.GetHeader( DWORD( threadItem ),
1045 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) );
1047 for i := 0 to threadItem.Count - 1 do begin
1048 if (OnlyAHundredRes = true) and ( i <> 0 ) and ( (threadItem.Count-i) > 101 ) then begin
1052 //
\90V
\92\85\83}
\81[
\83N
1053 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1055 if GikoSys.Setting.UseSkin then begin
1056 if FileExists( GetSkinNewmarkFileName ) then
1057 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1059 SaveList.Add( '<a name="new"></a>' );
1060 end else if GikoSys.Setting.UseCSS then begin
1061 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>');
1063 SaveList.Add('</dl>');
1064 SaveList.Add('<a name="new"></a>');
1065 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>');
1066 SaveList.Add('<dl>');
1069 SaveList.Add( '<a name="new"></a>' );
1074 SaveList.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
1076 if ThreadItem.Kokomade = (i + 1) then begin
1077 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1079 if GikoSys.Setting.UseSkin then begin
1080 if FileExists( GetSkinBookmarkFileName ) then
1081 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1083 SaveList.Add( '<a name="koko"></a>' );
1084 end else if GikoSys.Setting.UseCSS then begin
1085 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1087 SaveList.Add('</dl>');
1088 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>');
1089 SaveList.Add('<dl>');
1092 SaveList.Add( '<a name="koko"></a>' );
1096 threadItem.SizeByte := threadItem.SizeByte + Length( SaveList.Text );
1097 doc.Write(SaveList.Text);
1101 threadItem.SizeByte := threadItem.SizeByte + Length( SaveList.Text );
1103 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1104 SaveList.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1106 doc.Write(SaveList.Text);
1115 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1116 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1117 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1118 ShortDayNames[7] := '
\93y';
1120 BBSID := ThreadItem.ParentBoard.BBSID;
1121 NewReceiveNo := ThreadItem.NewReceive;
1122 ReadList := TStringList.Create;
1124 if ThreadItem.IsLogFile then begin
1125 FileName := ThreadItem.GetThreadFileName;
1126 ReadList.LoadFromFile(FileName);
1127 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1128 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1129 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1130 Res := DivideStrLine(ReadList[0]);
1131 Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1132 sTitle := Res.FTitle;
1134 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1136 SaveList := TStringList.Create;
1139 doc.charset := 'Shift_JIS';
1141 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1142 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1143 UserOptionalStyle := UserOptionalStyle +
1144 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1145 if GikoSys.Setting.BrowserFontSize <> 0 then
1146 UserOptionalStyle := UserOptionalStyle +
1147 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1148 if GikoSys.Setting.BrowserFontColor <> -1 then
1149 UserOptionalStyle := UserOptionalStyle +
1150 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1151 if GikoSys.Setting.BrowserBackColor <> -1 then
1152 UserOptionalStyle := UserOptionalStyle +
1153 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1154 case GikoSys.Setting.BrowserFontBold of
1155 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1156 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1158 case GikoSys.Setting.BrowserFontItalic of
1159 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1160 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1163 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1164 if GikoSys.Setting.UseSkin then begin
1165 //
\83X
\83L
\83\93\8eg
\97p
1166 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1168 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1169 if Length( UserOptionalStyle ) > 0 then
1170 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1171 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1172 SaveList.Add( SkinHeader );
1176 SkinNewRes := LoadSkin( GetSkinNewResFileName );
1180 SkinRes := LoadSkin( GetSkinResFileName );
1184 SaveList.Add('<a name="top"></a>');
1186 for i := 0 to ReadList.Count - 1 do begin
1187 if (OnlyAHundredRes = true) and ( i <> 0 ) and ( (ReadList.Count-i) > 101 ) then begin
1190 if (Trim(ReadList[i]) <> '') then begin
1191 No := IntToStr(i + 1);
1193 Res := DivideStrLine(ReadList[i]);
1194 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1196 if Res.FType = glt2chOld then begin
1197 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1198 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1199 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1202 Res.FBody := AddAnchorTag(Res.FBody);
1203 if Res.FName = '' then
1204 Res.FName := ' ';
1206 //
\90V
\92\85\83}
\81[
\83N
1207 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1209 if FileExists( GetSkinNewmarkFileName ) then
1210 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1212 SaveList.Add( '<a name="new"></a>' );
1214 SaveList.Add( '<a name="new"></a>' );
1218 if NewReceiveNo <= (i + 1) then
1219 //
\90V
\92\85\83\8c\83X
1220 SaveList.Add( ReplaceRes( SkinNewRes ) )
1222 //
\92Ê
\8fí
\82Ì
\83\8c\83X
1223 SaveList.Add( ReplaceRes( SkinRes ) );
1226 if ThreadItem.Kokomade = (i + 1) then begin
1227 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1229 if FileExists( GetSkinBookmarkFileName ) then
1230 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1232 SaveList.Add( '<a name="koko"></a>' );
1234 SaveList.Add( '<a name="koko"></a>' );
1238 SizeByte := SizeByte + Length( SaveList.Text );
1239 doc.Write(SaveList.Text);
1242 SaveList.Add('<a name="bottom"></a>');
1243 SizeByte := SizeByte + Length( SaveList.Text );
1244 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1246 SaveList.Add( LoadSkin( GetSkinFooterFileName ) );
1249 doc.Write(SaveList.Text);
1251 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1253 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1254 // SaveList.Add('<html lang="ja"><head>');
1255 SaveList.Add('<html><head>');
1256 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1257 SaveList.Add('<title>' + sTitle + '</title>');
1258 SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
1259 if Length( UserOptionalStyle ) > 0 then
1260 SaveList.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1261 SaveList.Add('</head>');
1262 SaveList.Add('<body>');
1263 SaveList.Add('<a name="top"></a>');
1264 SaveList.Add('<div class="title">' + sTitle + '</div>');
1265 doc.Write(SaveList.Text);
1267 //Application.ProcessMessages;
1268 for i := 0 to ReadList.Count - 1 do begin
1269 if (OnlyAHundredRes = true) and ( i <> 0 ) and ( (ReadList.Count-i) > 101 ) then begin
1272 if (Trim(ReadList[i]) <> '') then begin
1273 No := IntToStr(i + 1);
1274 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1275 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>');
1277 Res := DivideStrLine(ReadList[i]);
1278 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1279 Res.FBody := AddAnchorTag(Res.FBody);
1280 if Res.FName = '' then
1281 Res.FName := ' ';
1282 if Res.FMailTo = '' then
1283 SaveList.Add('<a name="' + No + '"></a>'
1284 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1285 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1286 + '<span class="name"><b>' + Res.FName + '</b></span> '
1287 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1288 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1289 + '<div class="mes">' + Res.FBody + ' </div>')
1290 else if GikoSys.Setting.ShowMail then
1291 SaveList.Add('<a name="' + No + '"></a>'
1292 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1293 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1294 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1295 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1296 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1297 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1298 + '<div class="mes">' + Res.FBody + ' </div>')
1300 SaveList.Add('<a name="' + No + '"></a>'
1301 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1302 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1303 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1304 + '<b>' + Res.FName + '</b></a>'
1305 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1306 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1307 + '<div class="mes">' + Res.FBody + ' </div>');
1308 if ThreadItem.Kokomade = (i + 1) then begin
1309 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1313 doc.Write(SaveList.Text);
1317 SaveList.Add('<a name="bottom"></a>');
1318 SaveList.Add('</body></html>');
1319 SaveList.Add('<a name="last"></a>');
1320 SaveList.Add('</body></html>');
1322 doc.Write(SaveList.Text);
1325 // SaveList.Add('<html lang="ja"><head>');
1326 SaveList.Add('<html><head>');
1327 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1328 SaveList.Add('<title>' + sTitle + '</title></head>');
1329 SaveList.Add('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1330 SaveList.Add('<a name="top"></a>');
1331 SaveList.Add('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1332 SaveList.Add('<dl>');
1333 doc.Write(SaveList.Text);
1335 //Application.ProcessMessages;
1336 for i := 0 to ReadList.Count - 1 do begin
1337 if (OnlyAHundredRes = true) and ( i <> 0 ) and ( (ReadList.Count-i) > 101 ) then begin
1340 if (Trim(ReadList[i]) <> '') then begin
1341 No := IntToStr(i + 1);
1343 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1344 SaveList.Add('</dl>');
1345 SaveList.Add('<a name="new"></a>');
1346 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>');
1347 SaveList.Add('<dl>');
1349 Res := DivideStrLine(ReadList[i]);
1350 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1351 if Res.FType = glt2chOld then begin
1352 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1353 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1354 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1356 Res.FBody := AddAnchorTag(Res.FBody);
1357 if Res.FMailTo = '' then
1358 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 ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1359 else if GikoSys.Setting.ShowMail then
1360 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 ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1362 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 ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>');
1363 if ThreadItem.Kokomade = (i + 1) then begin
1364 SaveList.Add('</dl>');
1365 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>');
1366 SaveList.Add('<dl>');
1369 //if SaveList.Count > 50 then begin
1370 doc.Write(SaveList.Text);
1372 //Application.ProcessMessages;
1375 SaveList.Add('</dl>');
1376 SaveList.Add('<a name="bottom"></a>');
1377 SaveList.Add('</body></html>');
1378 doc.Write(SaveList.Text);
1388 (*************************************************************************
1389 *http://
\82Ì
\95¶
\8e\9a\97ñ
\82ðanchor
\83^
\83O
\95t
\82«
\82É
\82·
\82é
\81B
1390 *************************************************************************)
1391 function TGikoSys.AddAnchorTag(s: string): string;
1393 URL_CHAR: string = '0123456789'
1394 + 'abcdefghijklmnopqrstuvwxyz'
1395 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1396 + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
1397 ANCHOR_REF = 'href=';
1398 RES_REF = '>>';
1400 wkIdx: array[0..9] of Integer;
1405 anchorLen : Integer;
1408 // + 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ß
1409 anchorLen := Length( ANCHOR_REF ) + 3;
1412 wkIdx[0] := AnsiPos('http://', s);
1413 wkIdx[1] := AnsiPos('ttp://', s);
1414 wkIdx[2] := AnsiPos('tp://', s);
1415 wkIdx[3] := AnsiPos('ms-help://', s);
1416 wkIdx[4] := AnsiPos('p://', s);
1417 wkIdx[5] := AnsiPos('https://', s);
1418 wkIdx[6] := AnsiPos('www.', s);
1419 wkIdx[7] := AnsiPos('ftp://', s);
1420 wkIdx[8] := AnsiPos('news://', s);
1421 wkIdx[9] := AnsiPos('rtsp://', s);
1425 if wkIdx[i] <> 0 then idx := Min(wkIdx[i], idx);
1427 if idx = MaxInt then begin
1428 //
\83\8a\83\93\83N
\82ª
\96³
\82¢
\82æ
\81B
1429 Result := Result + s;
1434 (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
1435 //
\8aù
\82É
\83\8a\83\93\83N
\83^
\83O
\82ª
\82Â
\82¢
\82Ä
\82¢
\82é
\82Á
\82Û
\82¢
\82Æ
\82«
\82Í
\83\80\83V
1436 href := Copy( s, idx, Length( s ) );
1437 Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
1439 s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
1444 Result := Result + Copy(s, 0, idx - 1);
1446 s := Copy(s, idx, length(s));
1448 for i := 0 to Length(s) do begin
1449 idx := AnsiPos(s[i + 1], URL_CHAR);
1450 if (idx = 0) or (i = (Length(s))) then begin
1451 //URL
\82¶
\82á
\82È
\82¢
\95¶
\8e\9a\94
\8c©
\81I
\82Æ
\82©
\81A
\95¶
\8e\9a\82ª
\82È
\82
\82È
\82Á
\82½
\81B
1452 url := Copy(s, 0, i);
1454 if AnsiPos('ttp://', url) = 1 then
1456 else if AnsiPos('tp://', url) = 1 then
1458 else if AnsiPos('p://', url) = 1 then
1460 else if AnsiPos('www.', url) = 1 then
1461 href := 'http://' + url
1464 Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
1465 s := Copy(s, i + 1, Length(s));
1472 (*************************************************************************
1473 *
\83T
\83u
\83W
\83F
\83N
\83g
\88ê
\8ds
\82ð
\95ª
\8a\84
1474 *************************************************************************)
1475 function TGikoSys.DivideSubject(Line: string): TSubjectRec;
1485 if Pos('<>', Line) = 0 then
1490 Result.FFileName := GetTokenIndex(Line, Delim, 0);
1491 Result.FTitle := GetTokenIndex(Line, Delim, 1);
1493 ws := Trim(Result.FTitle);
1495 if Copy(ws, Length(ws), 1) = ')' then begin
1498 end else if Copy(ws, Length(ws), 1) = '
\81j' then begin
1501 end else if Copy(ws, Length(ws), 1) = '<' then begin
1506 for i := Length(ws) - 1 downto 1 do begin
1507 if ws[i] = LeftK then begin
1508 ws := Copy(ws, i + 1, Length(ws) - i - 1);
1509 if IsNumeric(ws) then
1510 Result.FCount := StrToInt(ws);
1511 Result.FTitle := Trim(CustomStringReplace(Result.FTitle, LeftK + ws + RightK, ''));
1517 (*************************************************************************
1518 * dat
\83t
\83@
\83C
\83\8b\82Ì
\88ê
\83\89\83C
\83\93\82ð
\95ª
\89ð
1519 *************************************************************************)
1520 function TGikoSys.DivideStrLine(Line: string): TResRec;
1525 if Pos('<>', Line) = 0 then begin
1527 Result.FType := glt2chOld;
1530 Result.FType := glt2chNew;
1532 Result.FName := Trim(GetTokenIndex(Line, Delim, 0));
1533 Result.FMailTo := Trim(GetTokenIndex(Line, Delim, 1));
1534 Result.FDateTime := Trim(GetTokenIndex(Line, Delim, 2));
1535 bufBody := Trim(GetTokenIndex(Line, Delim, 3));
1536 if bufbody = '' then begin
1537 Insert(' ',bufbody, 1);
1539 Result.FBody := bufBody;
1540 Result.FTitle := Trim(GetTokenIndex(Line, Delim, 4));
1544 (*************************************************************************
1545 * URL
\82©
\82çBBSID
\82ð
\8eæ
\93¾
1546 *************************************************************************)
1547 function TGikoSys.UrlToID(url: string): string;
1554 if url = '' then Exit;
1556 url := Copy(url, 0, Length(url) - 1);
1557 for i := Length(url) downto 0 do begin
1558 if url[i] = '/' then begin
1559 Result := Copy(url, i + 1, Length(url));
1565 (*************************************************************************
1566 *URL
\82©
\82çBBSID
\88È
\8aO
\82Ì
\95\94\95ª(http://teri.2ch.net/)
\82ð
\8eæ
\93¾
1567 *************************************************************************)
1568 function TGikoSys.UrlToServer(url: string): string;
1575 wsURL := Trim(wsURL);
1577 if wsURL = '' then exit;
1579 if Copy(wsURL, Length(wsURL), 1) = '/' then
1580 wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
1582 for i := Length(wsURL) downto 0 do begin
1583 if wsURL[i] = '/' then begin
1584 Result := Copy(wsURL, 0, i);
1590 (*************************************************************************
1591 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\83`
\83F
\83b
\83N
1592 *************************************************************************)
1593 function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
1597 Code := GetFileAttributes(PChar(Name));
1598 Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
1601 (*************************************************************************
1602 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\8dì
\90¬
\81i
\95¡
\90\94\8aK
\91w
\91Î
\89\9e\81j
1603 *************************************************************************)
1604 function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
1607 if Length(Dir) = 0 then
1608 raise Exception.Create('
\83t
\83H
\83\8b\83_
\82ª
\8dì
\90¬
\8fo
\97\88\82Ü
\82¹
\82ñ');
1609 Dir := ExcludeTrailingPathDelimiter(Dir);
1610 if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
1611 or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
1612 Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
1615 (*************************************************************************
1616 *
\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
1617 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1618 *************************************************************************)
1619 function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
1623 Result := StrTokNext(sep, Rec);
1626 (*************************************************************************
1627 *
\95¶
\8e\9a\97ñ
\82©
\82ç
\83g
\81[
\83N
\83\93\82Ì
\90Ø
\82è
\8fo
\82µ
1628 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1629 *************************************************************************)
1630 function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
1637 if Len >= Pos then begin
1638 while (Pos <= Len) and (Str[Pos] in sep) do begin
1642 while (Pos<= Len) and not (Str[Pos] in sep) do begin
1643 if IsDBCSLeadByte(Byte(Str[Pos])) then begin
1648 Result := Copy(Str, I, Pos - I);
1649 while (Pos <= Len) and (Str[Pos] in sep) do begin//
\82±
\82ê
\82Í
\82¨
\8dD
\82Ý
1656 (*************************************************************************
1657 *
\83t
\83@
\83C
\83\8b\83T
\83C
\83Y
\8eæ
\93¾
1658 *************************************************************************)
1659 function TGikoSys.GetFileSize(FileName : string): longint;
1664 if not FileExists(FileName) then begin
1668 Assign(F, FileName);
1670 Result := FileSize(F);
1677 (*************************************************************************
1678 *
\83t
\83@
\83C
\83\8b\8ds
\90\94\8eæ
\93¾
1679 *************************************************************************)
1680 function TGikoSys.GetFileLineCount(FileName : string): longint;
1684 sl := TStringList.Create;
1687 sl.LoadFromFile(FileName);
1698 (*************************************************************************
1699 *
\83X
\83\8c\83b
\83h
\83t
\83@
\83C
\83\8b\82©
\82ç
\8ew
\92è
\8ds
\82ð
\8eæ
\93¾
1700 *************************************************************************)
1701 function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
1703 fileTmp : TStringList;
1706 if FileExists(FileName) then begin
1707 fileTmp := TStringList.Create;
1710 fileTmp.LoadFromFile( FileName );
1711 if ( Line >= 1 ) and ( Line < fileTmp.Count + 1 ) then begin
1712 Result := fileTmp.Strings[ Line-1 ];
1715 //on EFOpenError do Result := '';
1723 (*************************************************************************
1724 *
\83V
\83X
\83e
\83\80\83\81\83j
\83\85\81[
\83t
\83H
\83\93\83g
\82Ì
\91®
\90«
\82ð
\8eæ
\93¾
1725 *************************************************************************)
1726 procedure TGikoSys.MenuFont(Font: TFont);
1729 nm: NONCLIENTMETRICS;
1731 nm.cbSize := sizeof(NONCLIENTMETRICS);
1733 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
1734 lf := nm.lfMenuFont;
1736 Font.Name := lf.lfFaceName;
1737 Font.Height := lf.lfHeight;
1739 if lf.lfWeight >= 700 then
1740 Font.Style := Font.Style + [fsBold];
1741 if lf.lfItalic = 1 then
1742 Font.Style := Font.Style + [fsItalic];
1745 (*************************************************************************
1747 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1748 *************************************************************************)
1749 function TGikoSys.RemoveToken(var s: string; delimiter: string): string;
1753 p := AnsiPos(delimiter, s);
1757 Result := Copy(s, 1, p - 1);
1758 s := Copy(s, Length(Result) + Length(delimiter) + 1, Length(s));
1761 (*************************************************************************
1763 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1764 *************************************************************************)
1765 function TGikoSys.GetTokenIndex(s: string; delimiter: string; index: Integer): string;
1770 for i := 0 to index do
1771 Result := RemoveToken(s, delimiter);
1774 (*************************************************************************
1776 *************************************************************************)
1777 function TGikoSys.DeleteLink(const s: string): string;
1787 s1 := GetTokenIndex(s, '<a href="', i);
1788 s2 := GetTokenIndex(s, '<a href="', i + 1);
1790 idx := Pos('">', s1);
1792 Delete(s1, 1, idx + 1);
1793 idx := Pos('">', s2);
1795 Delete(s2, 1, idx + 1);
1797 Result := Result + s1 + s2;
1806 //
\83C
\83\93\83f
\83b
\83N
\83X
\96¢
\8dX
\90V
\83o
\83b
\83t
\83@
\82ð
\83t
\83\89\83b
\83V
\83\85\81I
1807 {procedure TGikoSys.FlashExitWrite;
1811 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
1812 for i := 0 to FExitWrite.Count - 1 do
1813 WriteThreadDat(FExitWrite[i]);
1817 (*************************************************************************
1818 *
\83X
\83\8c\96¼
\82È
\82Ç
\82ð
\92Z
\82¢
\96¼
\91O
\82É
\95Ï
\8a·
\82·
\82é
1820 *************************************************************************)
1821 function TGikoSys.GetShortName(const LongName: string; ALength: integer): string;
1823 ERASECHAR : array [1..39] of string =
1824 ('
\81\99','
\81\9a','
\81¡','
\81 ','
\81\9f','
\81\9e','
\81Q','
\81\94','
\81£','
\81¥',
1825 '
\81¢','
\81¤','
\81\9c','
\81\9b','
\81\9d','
\81y','
\81z','
\81ô','
\81s','
\81t',
1826 '
\81g','
\81h','
\81k','
\81l','
\81e','
\81f','
\81\83','
\81\84','
\81á','
\81â',
1827 '
\81o','
\81p','
\81q','
\81r','
\81w','
\81x','
\81¬','
\81c', '
\81@');
1829 Chr : array [0..255] of char;
1833 s := Trim(LongName);
1834 if (Length(s) <= ALength) then begin
1838 for i := Low(ERASECHAR) to High(ERASECHAR) do begin
1839 S := CustomStringReplace(S, ERASECHAR[i], '');
1841 if (Length(S) <= ALength) then begin
1844 Windows.LCMapString(
1845 GetUserDefaultLCID(),
1853 S := Copy(S,1,ALength);
1855 if (ByteType(S, Length(S)) = mbLeadByte ) then begin
1856 S := Copy(S, 1, Length(S) - 1);
1866 (*************************************************************************
1869 *************************************************************************)
1870 function TGikoSys.ConvRes(const Body, Bbs, Key,
1871 ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string): string;
1875 FIndexFrom : integer;
1882 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
1896 procedure Add(IndexFrom, IndexTo: integer; const No: string);
1901 FIndex.FIndexFrom := IndexFrom;
1902 FIndex.FIndexTo := IndexTo;
1906 function ChooseString(const Text, Separator: string; Index: integer): string;
1912 for i := 0 to Index - 1 do begin
1913 if (AnsiPos(Separator, S) = 0) then S := ''
1914 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
1916 p := AnsiPos(Separator, S);
1917 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
1926 List:= TList.Create;
1932 b := ByteType(s, i);
1934 mbSingleByte : begin
1935 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
1936 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
1944 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
1945 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
1951 if (not sw) and (Copy(s,i,4) = GT) then begin
1952 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
1960 if ((not sw) and (Copy(s,i,1) = ',')) or
1961 ((not sw) and (Copy(s,i,1) = '=')) then begin
1962 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
1963 ((Chk) and (oc = '')) or
1964 ((not Chk) and (al)) then
1974 if (AnsiPos(sx, SN) > 0) then begin
1977 if (No <> '') and (No <> '-') then begin
1990 if Copy(s,i,1) = '<' then oc := '';
1991 oc := oc + Copy(s,i,1);
1997 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2003 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2011 if (AnsiPos(sx, ZN) > 0) then begin
2012 No := No + ZenToHan(sx);
2014 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2029 if (i > Length(Body)) then begin
2031 if (No <> '') then Add(sp, i, No);
2036 for i := List.Count - 1 downto 0 do begin
2037 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2038 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2039 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2041 st := PIndex(List[i]).FNo;
2042 et := PIndex(List[i]).FNo;
2044 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2045 Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2046 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2047 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2048 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2049 Dispose(PIndex(List[i]));
2055 (*************************************************************************
2056 *
\91S
\8ap
\81¨
\94¼
\8ap
2058 *************************************************************************)
2059 function TGikoSys.ZenToHan(const s: string): string;
2061 Chr: array [0..255] of char;
2063 Windows.LCMapString(
2064 GetUserDefaultLCID(),
2066 LCMAP_HALFWIDTH or LCMAP_KATAKANA or LCMAP_LOWERCASE,
2075 (*************************************************************************
2076 *
\91S
\8ap
\94¼
\8ap
\82Ð
\82ç
\82ª
\82È
\82©
\82½
\82©
\82È
\82ð
\8bæ
\95Ê
\82µ
\82È
\82¢
\90¦
\82¢Pos
2077 *************************************************************************)
2078 function TGikoSys.VaguePos(const Substr, S: string): Integer;
2080 Result := Pos(ZenToHan(Substr), ZenToHan(S));
2083 function TGikoSys.BoolToInt(b: Boolean): Integer;
2085 Result := IfThen(b, 1, 0);
2088 function TGikoSys.IntToBool(i: Integer): Boolean;
2093 //gzip
\82Å
\88³
\8fk
\82³
\82ê
\82½
\82Ì
\82ð
\96ß
\82·
2094 function TGikoSys.GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
2098 GZipStream: TGzipDecompressStream;
2099 TextStream: TStringStream;
2100 buf: array[0..BUF_SIZE - 1] of Byte;
2106 TextStream := TStringStream.Create('');
2108 //
\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¢)
2109 // if LowerCase(Trim(ContentEncoding)) = 'gzip' then begin
2110 if AnsiPos('gzip', LowerCase(Trim(ContentEncoding))) > 0 then begin
2111 ResStream.Position := 0;
2112 GZipStream := TGzipDecompressStream.Create(TextStream);
2115 FillChar(buf, BUF_SIZE, 0);
2116 cnt := ResStream.Read(buf, BUF_SIZE);
2118 GZipStream.Write(buf, BUF_SIZE);
2124 ResStream.Position := 0;
2126 FillChar(buf, BUF_SIZE, 0);
2127 cnt := ResStream.Read(buf, BUF_SIZE);
2129 TextStream.Write(buf, BUF_SIZE);
2133 //NULL
\95¶
\8e\9a\82ð"*"
\82É
\82·
\82é
2134 s := TextStream.DataString;
2136 while (i > 0) and (s[i] = #0) do
2141 while i <> 0 do begin
2151 procedure TGikoSys.LoadKeySetting(ActionList: TActionList);
2153 STD_SEC = 'KeySetting';
2159 SecList: TStringList;
2160 Component: TComponent;
2162 if not FileExists(GetConfigDir + KEY_SETTING_FILE_NAME) then
2164 SecList := TStringList.Create;
2165 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2167 ini.ReadSection(STD_SEC, SecList);
2168 for i := 0 to SecList.Count - 1 do begin
2169 ActionName := SecList[i];
2170 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2171 if ActionKey <> -1 then begin
2172 Component := ActionList.Owner.FindComponent(ActionName);
2173 if TObject(Component) is TAction then begin
2174 TAction(Component).ShortCut := ActionKey;
2184 procedure TGikoSys.SaveKeySetting(ActionList: TActionList);
2186 STD_SEC = 'KeySetting';
2191 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2193 for i := 0 to ActionList.ActionCount - 1 do begin
2194 if ActionList.Actions[i].Tag = -1 then
2196 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2205 procedure TGikoSys.CreateProcess(const AppPath: string; const Param: string);
2207 PI: TProcessInformation;
2211 Path := '"' + AppPath + '"';
2213 Path := Path + ' ' + Param;
2215 SI.Cb := SizeOf(Si);
2216 SI.lpReserved := nil;
2217 SI.lpDesktop := nil;
2220 SI.cbReserved2 := 0;
2221 SI.lpReserved2 := nil;
2223 Windows.CreateProcess(nil,
2235 procedure TGikoSys.OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
2239 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2240 gbtUserApp, gbtAuto:
2241 if (Setting.URLApp) and (FileExists(Setting.URLAppFile)) then
2242 GikoSys.CreateProcess(Setting.URLAppFile, URL)
2244 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2248 function TGikoSys.HTMLDecode(const AStr: String): String;
2250 Sp, Rp, Cp, Tp: PChar;
2255 SetLength(Result, Length(AStr));
2257 Rp := PChar(Result);
2260 while Sp^ <> #0 do begin
2266 'a': if AnsiStrPos(Sp, 'amp;') = Sp then
2272 'g': if (AnsiStrPos(Sp, 'lt;') = Sp) or (AnsiStrPos(Sp, 'gt;') = Sp) then
2276 while (Sp^ <> ';') and (Sp^ <> #0) do
2283 'q': if AnsiStrPos(Sp, 'quot;') = Sp then
2291 Num := IsNumeric(Copy(Tp, 1, 1));
2292 while (Sp^ <> ';') and (Sp^ <> #0) do begin
2293 if (Num) and (not IsNumeric(Copy(Sp, 1, 1))) then
2297 SetString(S, Tp, Sp - Tp);
2302 //raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2303 //[Cp^ + Sp^, Cp - PChar(AStr)])
2313 // on E:EConvertError do
2314 // raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2315 // [Cp^ + Sp^, Cp - PChar(AStr)])
2317 SetLength(Result, Rp - PChar(Result));
2320 function TGikoSys.GetHRefText(s: string): string;
2330 Index := AnsiPos('href', LowerCase(s));
2333 s := Trim(Copy(s, Index + 4, Length(s)));
2334 s := Trim(Copy(s, 2, Length(s)));
2336 //
\8en
\82ß
\82Ì
\95¶
\8e\9a\82ª'"'
\82È
\82ç
\8eæ
\82è
\8f\9c\82
2337 if Copy(s, 1, 1) = '"' then begin
2338 s := Trim(Copy(s, 2, Length(s)));
2341 Index := AnsiPos('"', s);
2342 if Index <> 0 then begin
2343 //'"'
\82Ü
\82ÅURL
\82Æ
\82·
\82é
2344 s := Copy(s, 1, Index - 1);
2346 //'"'
\82ª
\96³
\82¯
\82ê
\82Î
\83X
\83y
\81[
\83X
\82©">"
\82Ì
\91\81\82¢
\95û
\82Ü
\82Å
\82ðURL
\82Æ
\82·
\82é
2347 Index := AnsiPos(' ', s);
2348 Index2 := AnsiPos('>', s);
2351 if Index > Index2 then
2354 s := Copy(s, 1, Index - 1)
2356 //
\82±
\82ê
\88È
\8fã
\82à
\82¤
\92m
\82ç
\82ñ
\82Ê
2362 //
\83z
\83X
\83g
\96¼
\82ª
\82Q
\82\83\82\88\82©
\82Ç
\82¤
\82©
\83`
\83F
\83b
\83N
\82·
\82é
2363 function TGikoSys.Is2chHost(Host: string): Boolean;
2365 HOST_NAME: array[0..1] of string = ('2ch.net', 'bbspink.com');
2371 if RightStr( Host, 1 ) = '/' then
2372 Host := Copy( Host, 1, Length( Host ) - 1 );
2373 OutputDebugString(pchar(HOST_NAME[0]));
2374 for i := 0 to Length(HOST_NAME) - 1 do begin
2375 // Len := Length(HOST_NAME[i]);
2376 if AnsiPos(HOST_NAME[i], Host) = (Length(Host) - Length(HOST_NAME[i]) + 1) then begin
2383 function TGikoSys.Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
2393 Index := AnsiPos(READ_PATH, path);
2394 if Index <> 0 then begin
2395 s := Copy(path, Length(READ_PATH) + 1, Length(path));
2396 BBSID := GetTokenIndex(s, '/', 0);
2397 BBSKey := GetTokenIndex(s, '/', 1);
2400 Result := (BBSID <> '') or (BBSKey <> '');
2403 Index := AnsiPos(KAKO_PATH, path);
2404 if Index <> 0 then begin
2405 s := Copy(path, 2, Length(path));
2406 BBSID := GetTokenIndex(s, '/', 0);
2407 if (BBSID = 'log') and (GetTokenIndex(s, '/', 2) = 'kako') then
2408 BBSID := GetTokenIndex(s, '/', 1);
2409 BBSKey := ChangeFileExt(Document, '');
2410 Result := (BBSID <> '') or (BBSKey <> '');
2413 Index := AnsiPos('read.cgi?', URL);
2414 if Index <> 0 then begin
2415 SList := TStringList.Create;
2418 // s := HTMLDecode(Document);
2419 ExtractHTTPFields(['?', '&'], [], PChar(URL), SList, False);
2420 BBSID := SList.Values['bbs'];
2421 BBSKey := SList.Values['key'];
2422 Result := (BBSID <> '') or (BBSKey <> '');
2433 function TGikoSys.Parse2chURL2(URL: string): TPathRec;
2445 URL := Trim(LowerCase(URL));
2450 Result.FFirst := False;
2451 Result.FStBegin := False;
2452 Result.FToEnd := False;
2453 Result.FDone := False;
2458 FAWKStr.RegExp := 'http://.+\.(2ch\.net|bbspink\.com)/';
2459 if FAWKStr.Match(FAWKStr.ProcessEscSeq(URL), RStart, RLength) = 0 then
2461 s := Copy(URL, RStart + RLength - 1, Length(URL));
2463 //
\95W
\8f\80\8f\91\8e®
2464 //
\8dÅ
\8cã
\82Íl50, 10, 10-20, 10n, 10-20n, -10, 10-, 10n-
\82È
\82Ç
2465 //http://xxx.2ch.net/test/read.cgi/bbsid/1000000000/
2466 FAWKStr.RegExp := '/test/read.cgi/.+/[0-9]+/.*';
2467 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2468 s := Copy(s, 15, Length(s));
2470 SList := TStringList.Create;
2473 FAWKStr.RegExp := '/';
2474 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
2475 Result.FBBS := SList[1];
2476 Result.FKey := SList[2];
2477 if SList.Count >= 3 then
2485 FAWKStr.LineSeparator := mcls_CRLF;
2486 FAWKStr.RegExp := '-';
2487 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) = 0 then begin
2488 Result.FFirst := True;
2490 FAWKStr.RegExp := 'l[0-9]+';
2491 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2492 Result.FFirst := True;
2494 for i := 0 to SList.Count - 1 do begin
2495 if Trim(SList[i]) = '' then begin
2497 Result.FStBegin := True;
2498 if i = (SList.Count - 1) then
2499 Result.FToEnd := True;
2500 end else if IsNumeric(SList[i]) then begin
2501 wkInt := StrToInt(SList[i]);
2502 wkMax := Max(wkMax, wkInt);
2506 wkMin := Min(wkMin, wkInt);
2507 end else if Trim(SList[i]) = 'n' then begin
2508 Result.FFirst := True;
2510 FAWKStr.RegExp := '^n[0-9]+$|^[0-9]+n$';
2511 if FAWKStr.Match(FAWKStr.ProcessEscSeq(SList[i]), RStart, RLength) > 0 then begin
2512 if Copy(SList[i], 1, 1) = 'n' then
2513 wkInt := StrToInt(Copy(SList[i], 2, Length(SList[i])))
2515 wkInt := StrToInt(Copy(SList[i], 1, Length(SList[i]) - 1));
2516 Result.FFirst := True;
2517 wkMax := Max(wkMax, wkInt);
2521 wkMin := Min(wkMin, wkInt);
2525 if Result.FStBegin and (not Result.FToEnd) then
2527 else if (not Result.FStBegin) and Result.FToEnd then
2529 else if (not Result.FStBegin) and (not Result.FToEnd) then begin
2530 Result.FSt := wkMin;
2531 Result.FTo := wkMax;
2533 //Result.FSt := wkMin;
2534 //Result.FTo := wkMax;
2540 Result.FDone := True;
2544 //
\90Vkako
\8f\91\8e®
2545 //http://server.2ch.net/ITA_NAME/kako/1000/10000/1000000000.html
2546 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+/[0-9]+\.html';
2547 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2548 SList := TStringList.Create;
2551 FAWKStr.RegExp := '/';
2552 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
2553 Result.FBBS := SList[1];
2554 Result.FKey := ChangeFileExt(SList[5], '');
2555 Result.FFirst := True;
2561 Result.FDone := True;
2565 //
\8b\8ckako
\8f\91\8e®
2566 //http://server.2ch.net/ITA_NAME/kako/999/999999999.html
2567 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+\.html';
2568 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2569 SList := TStringList.Create;
2572 FAWKStr.RegExp := '/';
2573 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 5 then begin
2574 Result.FBBS := SList[1];
2575 Result.FKey := ChangeFileExt(SList[4], '');
2576 Result.FFirst := True;
2582 Result.FDone := True;
2586 //log
\8by
\82Ñlog2
\8f\91\8e®
2587 //http://server.2ch.net/log/ITA_NAME/kako/999/999999999.html
2588 //http://server.2ch.net/log2/ITA_NAME/kako/999/999999999.html
2589 FAWKStr.RegExp := '/log2?/.+/kako/[0-9]+/[0-9]+\.html';
2590 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2591 SList := TStringList.Create;
2594 FAWKStr.RegExp := '/';
2595 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
2596 Result.FBBS := SList[2];
2597 Result.FKey := ChangeFileExt(SList[5], '');
2598 Result.FFirst := True;
2604 Result.FDone := True;
2609 //
\8b\8cURL
\8f\91\8e®
2610 //http://server.2ch.net/test/read.cgi?bbs=ITA_NAME&key=1000000000&st=1&to=5&nofirst=true
2611 FAWKStr.RegExp := '/test/read\.cgi\?';
2612 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2613 s := Copy(s, 16, Length(s));
2614 SList := TStringList.Create;
2617 FAWKStr.RegExp := '&';
2618 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
2619 Result.FFirst := True;
2620 for i := 0 to SList.Count - 1 do begin
2621 if Pos('bbs=', SList[i]) = 1 then begin
2622 Result.FBBS := Copy(SList[i], 5, Length(SList[i]));
2623 end else if Pos('key=', SList[i]) = 1 then begin
2624 Result.FKey := Copy(SList[i], 5, Length(SList[i]));
2625 end else if Pos('st=', SList[i]) = 1 then begin
2626 wk := Copy(SList[i], 4, Length(SList[i]));
2627 if IsNumeric(wk) then
2628 Result.FSt := StrToInt(wk)
2629 else if wk = '' then
2630 Result.FStBegin := True;
2631 end else if Pos('to=', SList[i]) = 1 then begin
2632 wk := Copy(SList[i], 4, Length(SList[i]));
2633 if IsNumeric(wk) then
2634 Result.FTo := StrToInt(wk)
2635 else if wk = '' then
2636 Result.FToEnd := True;
2637 end else if Pos('nofirst=', SList[i]) = 1 then begin
2638 Result.FFirst := False;
2647 if (Result.FBBS <> '') and (Result.FKey <> '') then begin
2648 Result.FDone := True;
2654 procedure TGikoSys.ParseURI(var URL, Protocol, Host, Path, Document, Port, Bookmark: string);
2664 URI := TIdURI.Create(URL);
2666 Protocol := URI.Protocol;
2669 Document := URI.Document;
2671 Bookmark := URI.Bookmark;
2677 function TGikoSys.GetVersionBuild: Integer;
2679 FixedFileInfo: PVSFixedFileInfo;
2680 VersionHandle, VersionSize: DWORD;
2681 pVersionInfo: Pointer;
2686 AppFile := Application.ExeName;
2687 VersionSize := GetFileVersionInfoSize(pChar(AppFile), VersionHandle);
2688 if VersionSize = 0 then
2690 GetMem(pVersionInfo, VersionSize);
2692 if GetFileVersionInfo(PChar(AppFile),VersionHandle,VersionSize, pVersionInfo) then
2693 if VerQueryValue(pVersionInfo, '\', Pointer(FixedFileInfo), ItemLen) then
2694 Result := LOWORD(FixedFileInfo^.dwFileVersionLS);
2696 FreeMem(pVersionInfo, VersionSize);
2700 function TGikoSys.GetThreadURL2BoardURL(
2704 threadItem : TThreadItem;
2705 boardPlugIn : TBoardPlugIn;
2709 //=====
\83v
\83\89\83O
\83C
\83\93
2711 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
2712 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
2713 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
2714 boardPlugIn := BoardPlugIns[ i ];
2715 threadItem := TThreadItem.Create( boardPlugIn, inURL );
2716 Result := BoardPlugIns[ i ].GetBoardURL( Longword( threadItem ) );
2724 // 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¢
2727 if Length( Result ) = 0 then
2728 Result := GikoSys.Get2chThreadURL2BoardURL( inURL );
2732 function TGikoSys.Get2chThreadURL2BoardURL(
2736 Protocol, Host, Path, Document, Port, Bookmark : string;
2737 BBSID, BBSKey : string;
2740 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
2741 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
2743 Result := Copy( inURL, 1, Pos( '/test/read.cgi', inURL ) ) + BBSID + '/';
2747 function TGikoSys.Get2chBrowsableThreadURL(
2751 Protocol, Host, Path, Document, Port, Bookmark : string;
2752 BBSID, BBSKey : string;
2756 if Pos( KAKO_PATH, inURL ) > 0 then begin
2759 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
2760 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
2761 foundPos := Pos( '/test/read.cgi', inURL ) - 1;
2763 if Is2chHost( Host ) then begin
2764 Result := Copy( inURL, 1, foundPos ) +
2765 READ_PATH + BBSID + '/' + BBSKey + '/l50';
2767 Result := Copy( inURL, 1, foundPos ) +
2768 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50';
2774 function TGikoSys.Get2chBoard2ThreadURL(
2782 server := UrlToServer( inBoard.URL );
2783 if Is2chHost( server ) then
2784 Result := server + 'test/read.cgi/' + inBoard.BBSID + '/' + inKey + '/l50'
2786 Result := server + 'test/read.cgi?bbs=' + inBoard.BBSID + '&key=' + inKey + '&ls=50';
2790 (*************************************************************************
2791 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
2792 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
2793 *
\97\9a\97ð
\82P
\81@
\81@
\81F
\90V
\8bK
\8dì
\90¬
2794 *************************************************************************)
2795 procedure TGikoSys.ReadBoardFile;
2799 CategoryList: TStringList;
2800 BoardList: TStringList;
2801 Category: TCategory;
2804 RoundItem: TRoundItem;
2806 // BBS
\94z
\97ñ(1
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\82É
\82Â
\82« 1
\8d\80\96Ú)
2807 bbsList : array of TStringList;
2808 boardFileList : TStringList;
2810 i, iBound : Integer;
2811 j, jBound : Integer;
2812 k, kBound : Integer;
2813 l, lBound : Integer;
2815 ini := TMemIniFile.Create('');
2819 for i := 0 to Length( BBSs ) - 1 do
2823 SetLength( BBSs, 0 );
2825 //
\94Â
\83\8a\83X
\83g
\82Ì
\97ñ
\8b\93
2826 if FileExists( GikoSys.GetBoardFileName ) then begin
2827 l := Length( bbsList );
2828 SetLength( bbsList, l + 1 );
2829 bbsList[ l ] := TStringList.Create;
2830 bbsList[ l ].LoadFromFile( GikoSys.GetBoardFileName );
2832 SetLength( BBSs, l + 1 );
2833 BBSs[ l ] := TBBS.Create( GikoSys.Setting.LogFolder );
2834 BBSs[ l ].Title := '
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é';
2837 if FileExists( GikoSys.GetCustomBoardFileName ) then begin
2838 l := Length( bbsList );
2839 SetLength( bbsList, l + 1 );
2840 bbsList[ l ] := TStringList.Create;
2841 bbsList[ l ].LoadFromFile( GikoSys.GetCustomBoardFileName );
2843 SetLength( BBSs, l + 1 );
2844 BBSs[ l ] := TBBS.Create( GikoSys.Setting.LogFolder );
2845 BBSs[ l ].Title := '
\82»
\82Ì
\91¼';
2848 // Board
\83t
\83H
\83\8b\83_
2849 if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
2850 BoardFileList := TStringList.Create;
2852 GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
2853 l := Length( bbsList );
2854 for i := BoardFileList.Count - 1 downto 0 do begin
2855 SetLength( bbsList, l + 1 );
2856 bbsList[ l ] := TStringList.Create;
2857 bbsList[ l ].LoadFromFile( BoardFileList[ i ] );
2859 SetLength( BBSs, l + 1 );
2860 BBSs[ l ] := TBBS.Create( GikoSys.Setting.LogFolder );
2861 BBSs[ l ].Title := ChangeFileExt( ExtractFileName( BoardFileList[ i ] ), '' );
2870 lBound := Length( bbsList ) - 1;
2871 for l := 0 to lBound do begin
2872 ini.SetStrings( bbsList[ l ] );
2873 CategoryList := TStringList.Create;
2874 BoardList := TStringList.Create;
2876 ini.ReadSections( CategoryList );
2878 iBound := CategoryList.Count - 1;
2879 for i := 0 to iBound do begin
2880 ini.ReadSection( CategoryList[i], BoardList );
2881 Category := TCategory.Create;
2882 Category.No := i + 1;
2883 Category.Title := CategoryList[i];
2885 jBound := BoardList.Count - 1;
2886 for j := 0 to jBound do begin
2888 inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
2890 //=====
\83v
\83\89\83O
\83C
\83\93
2892 kBound := Length( BoardPlugIns ) - 1;
2893 for k := 0 to kBound do begin
2894 if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin
2895 if BoardPlugIns[ k ].AcceptURL( inistr ) = atBoard then begin
2896 Board := TBoard.Create( BoardPlugIns[ k ], inistr );
2903 // 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¢
2907 Board := TBoard.Create( nil, inistr );
2910 Board.Title := BoardList[j];
2911 Board.RoundDate := ZERO_DATE;
2913 idx := RoundList.Find(Board);
2914 if idx <> -1 then begin
2915 RoundItem := RoundList.Items[idx, grtBoard];
2916 Board.Round := True;
2917 Board.RoundName := RoundItem.RoundName;
2919 Category.Add(Board);
2924 BBSs[ l ].Add( Category );
2933 lBound := Length( bbsList ) - 1;
2934 for l := 0 to lBound do
2939 function TGikoSys.GetUnknownCategory : TCategory;
2941 UNKNOWN_CATEGORY = '(
\96¼
\8fÌ
\95s
\96¾)';
2944 if Length( BBSs ) < 2 then begin
2949 Result := BBSs[ 1 ].FindCategoryFromTitle( UNKNOWN_CATEGORY );
2950 if Result = nil then begin
2951 Result := TCategory.Create;
2952 Result.Title := UNKNOWN_CATEGORY;
2953 BBSs[ 1 ].Add( Result );
2958 function TGikoSys.GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
2960 category : TCategory;
2962 UNKNOWN_BOARD = '(
\96¼
\8fÌ
\95s
\96¾)';
2965 category := GetUnknownCategory;
2966 if category = nil then begin
2969 Result := category.FindBoardFromTitle( UNKNOWN_BOARD );
2970 if Result = nil then begin
2971 Result := TBoard.Create( inPlugIn, inURL );
2972 Result.Title := UNKNOWN_BOARD;
2973 category.Add( Result );
2980 GikoSys := TGikoSys.Create;
2983 if GikoSys <> nil then begin