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;
20 TGikoBBSType = (gbt2ch);
21 //
\83\8d\83O
\83^
\83C
\83v
22 TGikoLogType = (glt2chNew, glt2chOld);
23 //
\83\81\83b
\83Z
\81[
\83W
\83A
\83C
\83R
\83\93
24 TGikoMessageIcon = (gmiOK, gmiSAD, gmiNG, gmiWhat, gmiNone);
25 //URL
\83I
\81[
\83v
\83\93\83u
\83\89\83E
\83U
\83^
\83C
\83v
26 TGikoBrowserType = (gbtIE, gbtUserApp, gbtAuto);
29 TStrTokSeparator = set of Char;
35 //
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b\83\8c\83R
\81[
\83h
43 FRoundDate: TDateTime;
44 FLastModified: TDateTime;
47 FMishiyou: Boolean; //
\96¢
\8eg
\97p
51 FAllResCount: Integer;
52 FNewResCount: Integer;
53 FAgeSage: TGikoAgeSage;
56 //
\83T
\83u
\83W
\83F
\83N
\83g
\83\8c\83R
\81[
\83h
63 //
\83\8c\83X
\83\8c\83R
\81[
\83h
73 //URLPath
\83\8c\83R
\81[
\83h
76 FKey: string; //ThreadID
77 FSt: Integer; //
\8aJ
\8en
\83\8c\83X
\94Ô
78 FTo: Integer; //
\8fI
\97¹
\83\8c\83X
\94Ô
79 FFirst: Boolean; //>>1
\82Ì
\95\
\8e¦
80 FStBegin: Boolean; //1
\81`
\95\
\8e¦
81 FToEnd: Boolean; //
\81`
\8dÅ
\8cã
\82Ü
\82Å
\95\
\8e¦
82 FDone: Boolean; //
\90¬
\8c÷
85 TGikoSys = class(TObject)
91 FOnlyAHundredRes : Boolean;
92 // FExitWrite: TStringList;
93 // 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 Get2chThreadURL2BoardURL( inURL : string ) : string;
187 function Get2chBrowsableThreadURL( inURL : string ) : string;
188 function Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string;
189 procedure ReadBoardFile;
191 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
192 function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string;
193 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
194 function SkinedRes( skin: string; Res: TResRec; No: string ): string;
201 LENGTH_RESTITLE = 40;
202 ZERO_DATE: Integer = 25569;
203 BETA_VERSION_NAME_E = 'beta';
204 BETA_VERSION_NAME_J = 'ÊÞÀ';
206 BETA_VERSION_BUILD = ''; //debug
\94Å
\82È
\82Ç
207 APP_NAME = 'gikoNavi';
212 Giko, RoundData, ExternalBoardManager, ExternalBoardPlugInMain;
215 FOLDER_INDEX_VERSION = '1.01';
216 USER_AGENT = 'Monazilla';
217 DEFAULT_NGWORD_FILE_NAME : String = 'NGword.txt';
218 NGWORDs_DIR_NAME : String = 'NGwords';
220 (*************************************************************************
221 *GikoSys
\83R
\83\93\83X
\83g
\83\89\83N
\83^
222 *************************************************************************)
223 constructor TGikoSys.Create;
225 FSetting := TSetting.Create;
226 FDolib := TDolib.Create;
227 FAWKStr := TAWKStr.Create(nil);
228 if DirectoryExists(GetConfigDir) = false then begin
229 CreateDir(GetConfigDir);
231 FAbon := TAbon.Create;
232 FAbon.Setroot(GetConfigDir+NGWORDs_DIR_NAME);
234 FAbon.ReturnNGwordLineNum := FSetting.ShowNGLinesNum;
235 FAbon.SetNGResAnchor := FSetting.AddResAnchor;
236 FAbon.Deleterlo := FSetting.AbonDeleterlo;
237 FAbon.Replaceul := FSetting.AbonReplaceul;
238 FAbon.AbonPopupRes := FSetting.PopUpAbon;
240 FSelectResFilter := TAbon.Create;
241 //
\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
242 FSelectResFilter.AbonString := '';
244 OnlyAHundredRes := FSetting.OnlyAHundredRes;
247 (*************************************************************************
248 *GikoSys
\83f
\83X
\83g
\83\89\83N
\83^
249 *************************************************************************)
250 destructor TGikoSys.Destroy;
253 FileList: TStringList;
255 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
263 //
\83e
\83\93\83|
\83\89\83\8aHTML
\82ð
\8dí
\8f\9c
264 FileList := TStringList.Create;
266 GetFileList(GetTempFolder, '*.html', FileList, False, True);
267 for i := 0 to FileList.Count - 1 do begin
268 DeleteFile(FileList[i]);
276 (*************************************************************************
277 *
\95¶
\8e\9a\97ñ
\90\94\8e\9a\83`
\83F
\83b
\83N
278 *************************************************************************)
280 function TGikoSys.IsNumeric(s: string): boolean;
290 (*************************************************************************
291 *
\95¶
\8e\9a\97ñ
\95\82\93®
\8f¬
\90\94\93_
\90\94\8e\9a\83`
\83F
\83b
\83N
292 *************************************************************************)
293 function TGikoSys.IsFloat(s: string): boolean;
297 Result := TextToFloat(PChar(s), v, fvExtended);
300 (*************************************************************************
301 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
302 *************************************************************************)
303 function TGikoSys.GetBoardFileName: string;
305 Result := Setting.GetBoardFileName;
308 (*************************************************************************
309 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
310 *************************************************************************)
311 function TGikoSys.GetCustomBoardFileName: string;
313 Result := Setting.GetCustomBoardFileName;
316 (*************************************************************************
317 *
\83e
\83\93\83|
\83\89\83\8a\83t
\83H
\83\8b\83_
\81[
\96¼
\8eæ
\93¾
318 *************************************************************************)
319 function TGikoSys.GetHtmlTempFileName: string;
321 Result := Setting.GetHtmlTempFileName;
325 (*************************************************************************
326 *
\8eÀ
\8ds
\83t
\83@
\83C
\83\8b\83t
\83H
\83\8b\83_
\8eæ
\93¾
327 *************************************************************************)
328 function TGikoSys.GetAppDir: string;
330 Result := Setting.GetAppDir;
333 (*************************************************************************
334 *TempHtml
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
335 *************************************************************************)
336 function TGikoSys.GetTempFolder: string;
338 Result := Setting.GetTempFolder;
341 (*************************************************************************
342 *sent.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
343 *************************************************************************)
344 function TGikoSys.GetSentFileName: string;
346 Result := Setting.GetSentFileName;
349 (*************************************************************************
350 *outbox.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
351 *************************************************************************)
352 function TGikoSys.GetOutBoxFileName: string;
354 Result := Setting.GetOutBoxFileName;
357 (*************************************************************************
358 *Config
\83t
\83H
\83\8b\83_
\8eæ
\93¾
359 *************************************************************************)
360 function TGikoSys.GetConfigDir: string;
362 Result := Setting.GetConfigDir;
365 function TGikoSys.GetStyleSheetDir: string;
367 Result := Setting.GetStyleSheetDir;
370 function TGikoSys.GetSkinDir: string;
372 Result := Setting.GetSkinDir;
375 function TGikoSys.GetSkinHeaderFileName: string;
377 Result := Setting.GetSkinHeaderFileName;
380 function TGikoSys.GetSkinFooterFileName: string;
382 Result := Setting.GetSkinFooterFileName;
385 function TGikoSys.GetSkinNewResFileName: string;
387 Result := Setting.GetSkinNewResFileName;
390 function TGikoSys.GetSkinResFileName: string;
392 Result := Setting.GetSkinResFileName;
395 function TGikoSys.GetSkinBookmarkFileName: string;
397 Result := Setting.GetSkinBookmarkFileName;
400 function TGikoSys.GetSkinNewmarkFileName: string;
402 Result := Setting.GetSkinNewmarkFileName;
406 function TGikoSys.GetUserAgent: string;
408 if Dolib.Connected then begin
409 Result := Format('%s %s/%s%d%s', [
416 BETA_VERSION_BUILD]);
418 Result := Format('%s/%s %s/%s%d%s', [
426 BETA_VERSION_BUILD]);
430 (*************************************************************************
431 *
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é
\95û
\8e®
\8e\9e\8d\8f\8eæ
\93¾
432 *************************************************************************)
433 function TGikoSys.Get2chDate(aDate: TDateTime): string;
438 d1 := EncodeDate(1970, 1, 1);
439 d2 := aDate - EncodeTime(9, 0, 0, 0);
440 Result := FloatToStr(Trunc((d2 - d1) * 24 * 60 * 60));
444 function TGikoSys.IntToDateTime(val: Int64): TDateTime;
449 d1 := EncodeDate(1970, 1, 1);
450 d2 := (val * 1000) / (24 * 60 * 60 * 1000);
454 function TGikoSys.DateTimeToInt(ADate: TDateTime): Integer;
459 d := EncodeDate(1970, 1, 1);
460 c := (ADate - d) * 24 * 60 * 60;
465 (*************************************************************************
466 *Subject
\83t
\83@
\83C
\83\8bRead
467 *************************************************************************)
468 procedure TGikoSys.ReadSubjectFile(Board: TBoard);
470 ThreadItem: TThreadItem;
472 FileList: TStringList;
473 TmpFileList: TStringList;
474 // SrchRec: TSearchRec;
481 // TmpUpdate: Boolean;
484 RoundItem: TRoundItem;
490 // TmpUpdate := False;
492 usePlugIn := Board.IsBoardPlugInAvailable;
494 FileName := Board.GetFolderIndexFileName;
495 if not FileExists(FileName) then CreateThreadDat(Board);
496 // if not FileExists(FileName) then Exit;
498 { R := FindFirst(ExtractFileDir(Board.GetFolderIndexFileName) + '\*.dat', 0, SrchRec);
500 FileList.Add(SrchRec.Name);
501 R := FindNext(SrchRec);
505 FileList := TStringList.Create;
506 FileList.Sorted := True;
507 TmpFileList := TStringList.Create;
508 TmpFileList.Sorted := True;
510 //IsLogFile
\97pDAT
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
511 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False, False);
513 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\97pTmp
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
514 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False, False);
517 sl := TStringList.Create;
519 if FileExists(FileName) then
520 sl.LoadFromFile(FileName);
522 //
\82Q
\8ds
\96Ú
\82©
\82ç
\81i
\82P
\8ds
\96Ú
\82Í
\83o
\81[
\83W
\83\87\83\93\81j
523 for i := sl.Count - 1 downto 0 do begin
524 Rec := ParseIndexLine(sl[i]);
527 ThreadItem := TThreadItem.Create(
529 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
531 ThreadItem := TThreadItem.Create(
533 Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' ) ) );
535 //IsLogFile
\83`
\83F
\83b
\83N
536 ThreadItem.IsLogFile := False;
537 if FileList.Count <> 0 then begin
538 if FileList.Find( ThreadItem.FileName, Index ) then begin
539 ThreadItem.IsLogFile := True;
540 FileList.Delete( Index );
544 ThreadItem.BeginUpdate;
545 ThreadItem.No := Rec.FNo;
546 ThreadItem.FileName := Rec.FFileName;
547 ThreadItem.Title := Rec.FTitle;
548 ThreadItem.Count := Rec.FCount;
549 ThreadItem.Size := Rec.FSize;
550 // ThreadItem.RoundNo := Rec.FRoundNo;
551 ThreadItem.RoundDate := Rec.FRoundDate;
552 ThreadItem.LastModified := Rec.FLastModified;
553 ThreadItem.Kokomade := Rec.FKokomade;
554 ThreadItem.NewReceive := Rec.FNewReceive;
555 // ThreadItem.Round := Rec.FRound;
556 ThreadItem.UnRead := Rec.FUnRead;
557 ThreadItem.ScrollTop := Rec.FScrollTop;
558 ThreadItem.AllResCount := Rec.FAllResCount;
559 ThreadItem.NewResCount := Rec.FNewResCount;
560 ThreadItem.AgeSage := Rec.FAgeSage;
561 ThreadItem.ParentBoard := Board;
563 //
\8f\84\89ñ
\83\8a\83X
\83g
\82É
\91¶
\8dÝ
\82µ
\82½
\82ç
\8f\84\89ñ
\83t
\83\89\83O
\83Z
\83b
\83g
564 if ThreadItem.IsLogFile then begin
565 idx := RoundList.Find(ThreadItem);
566 if idx <> -1 then begin
567 RoundItem := RoundList.Items[idx, grtItem];
568 ThreadItem.RoundName := RoundItem.RoundName;
569 ThreadItem.Round := True;
573 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\83`
\83F
\83b
\83N
574 if TmpFileList.Count <> 0 then begin
575 if TmpFileList.Find(ChangeFileExt(ThreadItem.FileName, '.tmp'), Index) then begin
576 ini := TMemIniFile.Create(ChangeFileExt(ThreadItem.GetThreadFileName, '.tmp'));
578 ThreadItem.RoundDate := ini.ReadDateTime('Setting', 'RoundDate', ZERO_DATE);
579 ThreadItem.LastModified := ini.ReadDateTime('Setting', 'LastModified', ZERO_DATE);
580 ThreadItem.Size := ini.ReadInteger('Setting', 'Size', 0);
581 ThreadItem.Count := ini.ReadInteger('Setting', 'Count', 0);
582 ThreadItem.NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
583 ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
584 ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
585 ThreadItem.ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
586 ThreadItem.AllResCount := ini.ReadInteger('Setting', 'AllResCount', 0);
587 ThreadItem.NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
588 ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
592 TmpFileList.Delete(Index);
596 ThreadItem.EndUpdate;
597 Board.Add(ThreadItem);
599 // if (ThreadItem.IsLogFile) and (ThreadItem.Count > ThreadItem.Kokomade) then
600 if (ThreadItem.IsLogFile) and (ThreadItem.UnRead) then
604 if UnRead <> Board.UnRead then
605 Board.UnRead := UnRead;
607 //
\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
608 for i := 0 to FileList.Count - 1 do begin
609 FileName := ExtractFileDir(Board.GetFolderIndexFileName) + '\' + FileList[i];
611 ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
613 ThreadItem := TThreadItem.Create(
615 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
617 ThreadItem := TThreadItem.Create(
618 nil, Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' ) ) );
619 ThreadItem.No := Board.Count + 1;
620 ThreadItem.FileName := FileList[i];
621 ThreadItem.Title := ResRec.FTitle;
622 ThreadItem.Count := GetFileLineCount(FileName);
623 ThreadItem.AllResCount := ThreadItem.Count;
624 ThreadItem.NewResCount := 0;
625 ThreadItem.Size := 0;
626 ThreadItem.RoundDate := ZERO_DATE;
627 ThreadItem.LastModified := ZERO_DATE;
628 ThreadItem.Kokomade := -1;
629 ThreadItem.NewReceive := 0;
630 ThreadItem.ParentBoard := Board;
631 ThreadItem.IsLogFile := True;
632 ThreadItem.Round := False;
633 ThreadItem.UnRead := False;
634 ThreadItem.ScrollTop := 0;
635 ThreadItem.AgeSage := gasNone;
636 Board.Add(ThreadItem);
643 Board.IsThreadDatRead := True;
646 (*************************************************************************
647 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b(Folder.idx)
\8dì
\90¬
648 *************************************************************************)
649 procedure TGikoSys.CreateThreadDat(Board: TBoard);
653 SubjectList: TStringList;
659 if not FileExists(Board.GetSubjectFileName) then Exit;
660 FileName := Board.GetFolderIndexFileName;
662 SubjectList := TStringList.Create;
664 SubjectList.LoadFromFile(Board.GetSubjectFileName);
665 sl := TStringList.Create;
668 sl.Add(FOLDER_INDEX_VERSION);
669 for i := 0 to SubjectList.Count - 1 do begin
670 Rec := DivideSubject(SubjectList[i]);
672 if (Trim(Rec.FFileName) = '') or (Trim(Rec.FTitle) = '') then
675 s := Format('%x', [cnt]) + #1 //
\94Ô
\8d\86
676 + Rec.FFileName + #1 //
\83t
\83@
\83C
\83\8b\96¼
677 + Rec.FTitle + #1 //
\83^
\83C
\83g
\83\8b
678 + Format('%x', [Rec.FCount]) + #1 //
\83J
\83E
\83\93\83g
679 + Format('%x', [0]) + #1 //size
680 + Format('%x', [0]) + #1 //RoundDate
681 + Format('%x', [0]) + #1 //LastModified
682 + Format('%x', [0]) + #1 //Kokomade
683 + Format('%x', [0]) + #1 //NewReceive
684 + '0' + #1 //
\96¢
\8eg
\97p
685 + Format('%x', [0]) + #1 //UnRead
686 + Format('%x', [0]) + #1 //ScrollTop
687 + Format('%x', [Rec.FCount]) + #1 //AllResCount
688 + Format('%x', [0]) + #1 //NewResCount
689 + Format('%x', [0]); //AgeSage
694 sl.SaveToFile(FileName);
703 (*************************************************************************
704 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X(Thread.dat)
\8f\91\82«
\8d\9e\82Ý
706 *************************************************************************)
707 procedure TGikoSys.WriteThreadDat(Board: TBoard);
709 // Values: array[Boolean] of string = ('0', '1');
715 FileList: TStringList;
717 if not Board.IsThreadDatRead then
719 FileName := Board.GetFolderIndexFileName;
720 ForceDirectoriesEx( ExtractFilePath( FileName ) );
722 sl := TStringList.Create;
724 sl.Add(FOLDER_INDEX_VERSION);
725 for i := 0 to Board.Count - 1 do begin
726 if Board.Items[i].No = 0 then
727 Board.Items[i].No := i + 1;
729 s := Format('%x', [Board.Items[i].No]) + #1
730 + Board.Items[i].FileName + #1
731 + Board.Items[i].Title + #1
732 + Format('%x', [Board.Items[i].Count]) + #1
733 + Format('%x', [Board.Items[i].Size]) + #1
734 + Format('%x', [DateTimeToInt(Board.Items[i].RoundDate)]) + #1
735 + Format('%x', [DateTimeToInt(Board.Items[i].LastModified)]) + #1
736 + Format('%x', [Board.Items[i].Kokomade]) + #1
737 + Format('%x', [Board.Items[i].NewReceive]) + #1
738 + '0' + #1 //
\96¢
\8eg
\97p
739 + Format('%x', [BoolToInt(Board.Items[i].UnRead)]) + #1
740 + Format('%x', [Board.Items[i].ScrollTop]) + #1
741 + Format('%x', [Board.Items[i].AllResCount]) + #1
742 + Format('%x', [Board.Items[i].NewResCount]) + #1
743 + Format('%x', [Ord(Board.Items[i].AgeSage)]);
748 sl.SaveToFile(FileName);
750 FileList := TStringList.Create;
752 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', FileList, False, True);
753 for i := 0 to FileList.Count - 1 do begin
754 DeleteFile(FileList[i]);
764 function TGikoSys.ParseIndexLine(Line: string): TIndexRec;
769 for i := 0 to 14 do begin
770 s := GetTokenIndex(Line, #1, i);
772 0: Result.FNo := StrToIntDef('$' + s, 0);
773 1: Result.FFileName := s;
774 2: Result.FTitle := s;
775 3: Result.FCount := StrToIntDef('$' + s, 0);
776 4: Result.FSize := StrToIntDef('$' + s, 0);
777 5: Result.FRoundDate := IntToDateTime(StrToIntDef('$' + s, ZERO_DATE));
778 6: Result.FLastModified := IntToDateTime(StrToIntDef('$' + s, ZERO_DATE));
779 7: Result.FKokomade := StrToIntDef('$' + s, -1);
780 8: Result.FNewReceive := StrToIntDef('$' + s, 0);
782 10: Result.FUnRead := IntToBool(StrToIntDef('$' + s, 0));
783 11: Result.FScrollTop := StrToIntDef('$' + s, 0);
784 12: Result.FAllResCount := StrToIntDef('$' + s, 0);
785 13: Result.FNewResCount := StrToIntDef('$' + s, 0);
786 14: Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + s, 0));
791 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
792 // ListFiles('c:\', '*.txt', list, True);
793 procedure TGikoSys.GetFileList(Path: string; Mask: string; List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
796 SearchRec : TSearchRec;
799 Path := IncludeTrailingPathDelimiter(Path);
800 rc := FindFirst(Path + '*.*', faAnyfile, SearchRec);
802 while rc = 0 do begin
803 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
804 s := Path + SearchRec.Name;
805 //if (SearchRec.Attr and faDirectory > 0) then
806 // s := IncludeTrailingPathDelimiter(s)
808 if (SearchRec.Attr and faDirectory = 0) and (MatchesMask(s, Mask)) then
812 List.Add(SearchRec.Name);
813 if SubDir and (SearchRec.Attr and faDirectory > 0) then
814 GetFileList(s, Mask, List, True, IsPathAdd);
816 rc := FindNext(SearchRec);
819 SysUtils.FindClose(SearchRec);
823 //
\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é
824 procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
827 SearchRec : TSearchRec;
830 Path := IncludeTrailingPathDelimiter(Path);
831 rc := FindFirst(Path + '*.*', faDirectory, SearchRec);
833 while rc = 0 do begin
834 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
835 s := Path + SearchRec.Name;
836 //if (SearchRec.Attr and faDirectory > 0) then
837 // s := IncludeTrailingPathDelimiter(s)
839 if (SearchRec.Attr and faDirectory > 0) and (MatchesMask(s, Mask)) then
840 List.Add( IncludeTrailingPathDelimiter( s ) );
841 if SubDir and (SearchRec.Attr and faDirectory > 0) then
842 GetDirectoryList(s, Mask, List, True);
844 rc := FindNext(SearchRec);
847 SysUtils.FindClose(SearchRec);
851 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
852 function TGikoSys.LoadFromSkin(
854 ThreadItem: TThreadItem;
861 Skin := TStringList.Create;
863 if FileExists( fileName ) then begin
864 Skin.LoadFromFile( fileName );
866 //
\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
868 if ThreadItem.ParentBoard <> nil then
869 if ThreadItem.ParentBoard.ParentCategory <> nil then
870 Skin.Text := StringReplace( Skin.Text, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title, [rfReplaceAll] );
871 Skin.Text := StringReplace( Skin.Text, '<THREADURL/>', ThreadItem.URL, [rfReplaceAll] );
873 Skin.Text := StringReplace( Skin.Text, '<BOARDNAME/>', ThreadItem.ParentBoard.Title, [rfReplaceAll] );
874 Skin.Text := StringReplace( Skin.Text, '<BOARDURL/>', ThreadItem.ParentBoard.URL, [rfReplaceAll] );
875 Skin.Text := StringReplace( Skin.Text, '<THREADNAME/>', ThreadItem.Title, [rfReplaceAll] );
876 Skin.Text := StringReplace( Skin.Text, '<SKINPATH/>', Setting.CSSFileName, [rfReplaceAll] );
877 Skin.Text := StringReplace( Skin.Text, '<GETRESCOUNT/>', IntToStr( ThreadItem.NewReceive - 1 ), [rfReplaceAll] );
878 Skin.Text := StringReplace( Skin.Text, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ), [rfReplaceAll] );
879 Skin.Text := StringReplace( Skin.Text, '<ALLRESCOUNT/>', IntToStr( ThreadItem.AllResCount ), [rfReplaceAll] );
881 Skin.Text := StringReplace( Skin.Text, '<NEWDATE/>',
882 FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate), [rfReplaceAll] );
883 Skin.Text := StringReplace( Skin.Text, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ), [rfReplaceAll] );
884 Skin.Text := StringReplace( Skin.Text, '<SIZE/>', IntToStr( SizeByte ), [rfReplaceAll] );
886 //-----
\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µ
887 //
\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
889 if ThreadItem.ParentBoard <> nil then
890 if ThreadItem.ParentBoard.ParentCategory <> nil then
891 Skin.Text := StringReplace( Skin.Text, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title, [rfReplaceAll] );
892 Skin.Text := StringReplace( Skin.Text, '&THREADURL', ThreadItem.URL, [rfReplaceAll] );
894 Skin.Text := StringReplace( Skin.Text, '&BOARDNAME', ThreadItem.ParentBoard.Title, [rfReplaceAll] );
895 Skin.Text := StringReplace( Skin.Text, '&BOARDURL', ThreadItem.ParentBoard.URL, [rfReplaceAll] );
896 Skin.Text := StringReplace( Skin.Text, '&THREADNAME', ThreadItem.Title, [rfReplaceAll] );
897 Skin.Text := StringReplace( Skin.Text, '&SKINPATH', Setting.CSSFileName, [rfReplaceAll] );
898 Skin.Text := StringReplace( Skin.Text, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ), [rfReplaceAll] );
899 Skin.Text := StringReplace( Skin.Text, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ), [rfReplaceAll] );
900 Skin.Text := StringReplace( Skin.Text, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ), [rfReplaceAll] );
902 Skin.Text := StringReplace( Skin.Text, '&NEWDATE',
903 FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate), [rfReplaceAll] );
904 Skin.Text := StringReplace( Skin.Text, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ), [rfReplaceAll] );
905 Skin.Text := StringReplace( Skin.Text, '&SIZE', IntToStr( SizeByte ), [rfReplaceAll] );
906 //-----
\82±
\82±
\82Ü
\82Å
914 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
915 function TGikoSys.SkinedRes(
923 Skin := StringReplace( Skin, '<NUMBER/>',
924 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>', [rfReplaceAll] );
925 Skin := StringReplace( Skin, '<PLAINNUMBER/>', No, [rfReplaceAll] );
926 Skin := StringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>', [rfReplaceAll] );
927 Skin := StringReplace( Skin, '<MAILNAME/>',
928 '<a href="mailo:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>', [rfReplaceAll] );
929 Skin := StringReplace( Skin, '<MAIL/>', Res.FMailTo, [rfReplaceAll] );
930 Skin := StringReplace( Skin, '<DATE/>', Res.FDateTime, [rfReplaceAll] );
931 Skin := StringReplace( Skin, '<MESSAGE/>', Res.FBody, [rfReplaceAll] );
933 //-----
\82©
\82¿
\82ã
\81`
\82µ
\82á
\8cÝ
\8a·
\97p
\81B
\83R
\83\81\83\93\83g
\83A
\83E
\83g
\82µ
\82Ä
\82à
\82æ
\82µ
934 Skin := StringReplace( Skin, '&NUMBER',
935 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>', [rfReplaceAll] );
936 Skin := StringReplace( Skin, '&PLAINNUMBER', No, [rfReplaceAll] );
937 Skin := StringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>', [rfReplaceAll] );
938 Skin := StringReplace( Skin, '&MAILNAME',
939 '<a href="mailo:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>', [rfReplaceAll] );
940 Skin := StringReplace( Skin, '&MAIL', Res.FMailTo, [rfReplaceAll] );
941 Skin := StringReplace( Skin, '&DATE', Res.FDateTime, [rfReplaceAll] );
942 Skin := StringReplace( Skin, '&MESSAGE', Res.FBody, [rfReplaceAll] );
943 //-----
\82±
\82±
\82Ü
\82Å
951 procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
955 //bufList : TStringList;
956 ReadList: TStringList;
957 SaveList: TStringList;
961 NewReceiveNo: Integer;
963 boardPlugIn : TBoardPlugIn;
965 UserOptionalStyle: string;
971 function LoadSkin( fileName: string ): string;
973 Result := LoadFromSkin( fileName, ThreadItem, SizeByte );
975 function ReplaceRes( skin: string ): string;
977 Result := SkinedRes( skin, Res, No );
980 if ThreadItem <> nil then begin
981 if ThreadItem.IsBoardPlugInAvailable then begin
982 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
983 boardPlugIn := ThreadItem.BoardPlugIn;
984 NewReceiveNo := ThreadItem.NewReceive;
986 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
987 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
988 UserOptionalStyle := UserOptionalStyle +
989 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
990 if GikoSys.Setting.BrowserFontSize <> 0 then
991 UserOptionalStyle := UserOptionalStyle +
992 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
993 if GikoSys.Setting.BrowserFontColor <> -1 then
994 UserOptionalStyle := UserOptionalStyle +
995 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
996 if GikoSys.Setting.BrowserBackColor <> -1 then
997 UserOptionalStyle := UserOptionalStyle +
998 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
999 case GikoSys.Setting.BrowserFontBold of
1000 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1001 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1003 case GikoSys.Setting.BrowserFontItalic of
1004 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1005 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1008 SaveList := TStringList.Create;
1011 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1012 // doc.charset := 'Shift_JIS';
1013 threadItem.SizeByte := 0;
1016 SaveList.Add( boardPlugIn.GetHeader( DWORD( threadItem ),
1017 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) );
1019 for i := 0 to threadItem.Count - 1 do begin
1020 if (OnlyAHundredRes = true) and ( i <> 0 ) and ( (threadItem.Count-i) > 101 ) then begin
1024 //
\90V
\92\85\83}
\81[
\83N
1025 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1027 if GikoSys.Setting.UseSkin then begin
1028 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) );
1029 end else if GikoSys.Setting.UseCSS then begin
1030 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>');
1032 SaveList.Add('</dl>');
1033 SaveList.Add('<a name="new"></a>');
1034 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>');
1035 SaveList.Add('<dl>');
1038 SaveList.Add( '<a name="new"></a>' );
1043 SaveList.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
1045 if ThreadItem.Kokomade = (i + 1) then begin
1046 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1048 if GikoSys.Setting.UseSkin then begin
1049 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) );
1050 end else if GikoSys.Setting.UseCSS then begin
1051 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1053 SaveList.Add('</dl>');
1054 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>');
1055 SaveList.Add('<dl>');
1058 SaveList.Add( '<a name="koko"></a>' );
1062 threadItem.SizeByte := threadItem.SizeByte + Length( SaveList.Text );
1063 doc.Write(SaveList.Text);
1067 threadItem.SizeByte := threadItem.SizeByte + Length( SaveList.Text );
1069 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1070 SaveList.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1072 doc.Write(SaveList.Text);
1081 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1082 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1083 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1084 ShortDayNames[7] := '
\93y';
1086 BBSID := ThreadItem.ParentBoard.BBSID;
1087 NewReceiveNo := ThreadItem.NewReceive;
1088 ReadList := TStringList.Create;
1090 if ThreadItem.IsLogFile then begin
1091 FileName := ThreadItem.GetThreadFileName;
1092 ReadList.LoadFromFile(FileName);
1093 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1094 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1095 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1096 Res := DivideStrLine(ReadList[0]);
1097 Res.FTitle := StringReplace(Res.FTitle, '
\81\97\81M', ',', [rfReplaceAll]);
1098 sTitle := Res.FTitle;
1100 sTitle := StringReplace(ThreadItem.Title, '
\81\97\81M', ',', [rfReplaceAll]);
1102 SaveList := TStringList.Create;
1105 doc.charset := 'Shift_JIS';
1107 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1108 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1109 UserOptionalStyle := UserOptionalStyle +
1110 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1111 if GikoSys.Setting.BrowserFontSize <> 0 then
1112 UserOptionalStyle := UserOptionalStyle +
1113 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1114 if GikoSys.Setting.BrowserFontColor <> -1 then
1115 UserOptionalStyle := UserOptionalStyle +
1116 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1117 if GikoSys.Setting.BrowserBackColor <> -1 then
1118 UserOptionalStyle := UserOptionalStyle +
1119 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1120 case GikoSys.Setting.BrowserFontBold of
1121 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1122 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1124 case GikoSys.Setting.BrowserFontItalic of
1125 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1126 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1129 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1130 if GikoSys.Setting.UseSkin then begin
1131 //
\83X
\83L
\83\93\8eg
\97p
1132 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1134 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1135 if Length( UserOptionalStyle ) > 0 then
1136 SkinHeader := StringReplace( SkinHeader, '</head>',
1137 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>', [rfReplaceAll] );
1138 SaveList.Add( SkinHeader );
1142 SkinNewRes := LoadSkin( GetSkinNewResFileName );
1146 SkinRes := LoadSkin( GetSkinResFileName );
1150 SaveList.Add('<a name="top"></a>');
1152 for i := 0 to ReadList.Count - 1 do begin
1153 if (OnlyAHundredRes = true) and ( i <> 0 ) and ( (ReadList.Count-i) > 101 ) then begin
1156 if (Trim(ReadList[i]) <> '') then begin
1157 No := IntToStr(i + 1);
1159 Res := DivideStrLine(ReadList[i]);
1160 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1162 if Res.FType = glt2chOld then begin
1163 Res.FMailTo := StringReplace(Res.FMailTo, '
\81\97\81M', ',', [rfReplaceAll]);
1164 Res.FName := StringReplace(Res.FName, '
\81\97\81M', ',', [rfReplaceAll]);
1165 Res.FBody := StringReplace(Res.FBody, '
\81\97\81M', ',', [rfReplaceAll]);
1168 Res.FBody := AddAnchorTag(Res.FBody);
1169 if Res.FName = '' then
1170 Res.FName := ' ';
1172 //
\90V
\92\85\83}
\81[
\83N
1173 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1175 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) );
1177 SaveList.Add( '<a name="new"></a>' );
1181 if NewReceiveNo <= (i + 1) then
1182 //
\90V
\92\85\83\8c\83X
1183 SaveList.Add( ReplaceRes( SkinNewRes ) )
1185 //
\92Ê
\8fí
\82Ì
\83\8c\83X
1186 SaveList.Add( ReplaceRes( SkinRes ) );
1189 if ThreadItem.Kokomade = (i + 1) then begin
1190 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1192 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) );
1194 SaveList.Add( '<a name="koko"></a>' );
1198 SizeByte := SizeByte + Length( SaveList.Text );
1199 doc.Write(SaveList.Text);
1202 SaveList.Add('<a name="bottom"></a>');
1203 SizeByte := SizeByte + Length( SaveList.Text );
1204 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1206 SaveList.Add( LoadSkin( GetSkinFooterFileName ) );
1209 doc.Write(SaveList.Text);
1211 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1213 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1214 // SaveList.Add('<html lang="ja"><head>');
1215 SaveList.Add('<html><head>');
1216 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1217 SaveList.Add('<title>' + sTitle + '</title>');
1218 SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
1219 if Length( UserOptionalStyle ) > 0 then
1220 SaveList.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1221 SaveList.Add('</head>');
1222 SaveList.Add('<body>');
1223 SaveList.Add('<a name="top"></a>');
1224 SaveList.Add('<div class="title">' + sTitle + '</div>');
1225 doc.Write(SaveList.Text);
1227 //Application.ProcessMessages;
1228 for i := 0 to ReadList.Count - 1 do begin
1229 if (OnlyAHundredRes = true) and ( i <> 0 ) and ( (ReadList.Count-i) > 101 ) then begin
1232 if (Trim(ReadList[i]) <> '') then begin
1233 No := IntToStr(i + 1);
1234 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1235 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>');
1237 Res := DivideStrLine(ReadList[i]);
1238 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1239 Res.FBody := AddAnchorTag(Res.FBody);
1240 if Res.FName = '' then
1241 Res.FName := ' ';
1242 if Res.FMailTo = '' then
1243 SaveList.Add('<a name="' + No + '"></a>'
1244 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1245 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1246 + '<span class="name"><b>' + Res.FName + '</b></span> '
1247 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1248 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1249 + '<div class="mes">' + Res.FBody + ' </div>')
1250 else if GikoSys.Setting.ShowMail then
1251 SaveList.Add('<a name="' + No + '"></a>'
1252 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1253 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1254 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1255 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1256 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1257 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1258 + '<div class="mes">' + Res.FBody + ' </div>')
1260 SaveList.Add('<a name="' + No + '"></a>'
1261 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1262 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1263 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1264 + '<b>' + Res.FName + '</b></a>'
1265 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1266 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1267 + '<div class="mes">' + Res.FBody + ' </div>');
1268 if ThreadItem.Kokomade = (i + 1) then begin
1269 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1273 doc.Write(SaveList.Text);
1277 SaveList.Add('<a name="bottom"></a>');
1278 SaveList.Add('</body></html>');
1279 SaveList.Add('<a name="last"></a>');
1280 SaveList.Add('</body></html>');
1282 doc.Write(SaveList.Text);
1285 // SaveList.Add('<html lang="ja"><head>');
1286 SaveList.Add('<html><head>');
1287 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1288 SaveList.Add('<title>' + sTitle + '</title></head>');
1289 SaveList.Add('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1290 SaveList.Add('<a name="top"></a>');
1291 SaveList.Add('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1292 SaveList.Add('<dl>');
1293 doc.Write(SaveList.Text);
1295 //Application.ProcessMessages;
1296 for i := 0 to ReadList.Count - 1 do begin
1297 if (OnlyAHundredRes = true) and ( i <> 0 ) and ( (ReadList.Count-i) > 101 ) then begin
1300 if (Trim(ReadList[i]) <> '') then begin
1301 No := IntToStr(i + 1);
1303 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1304 SaveList.Add('</dl>');
1305 SaveList.Add('<a name="new"></a>');
1306 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>');
1307 SaveList.Add('<dl>');
1309 Res := DivideStrLine(ReadList[i]);
1310 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1311 if Res.FType = glt2chOld then begin
1312 Res.FMailTo := StringReplace(Res.FMailTo, '
\81\97\81M', ',', [rfReplaceAll]);
1313 Res.FName := StringReplace(Res.FName, '
\81\97\81M', ',', [rfReplaceAll]);
1314 Res.FBody := StringReplace(Res.FBody, '
\81\97\81M', ',', [rfReplaceAll]);
1316 Res.FBody := AddAnchorTag(Res.FBody);
1317 if Res.FMailTo = '' then
1318 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>')
1319 else if GikoSys.Setting.ShowMail then
1320 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>')
1322 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>');
1323 if ThreadItem.Kokomade = (i + 1) then begin
1324 SaveList.Add('</dl>');
1325 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>');
1326 SaveList.Add('<dl>');
1329 //if SaveList.Count > 50 then begin
1330 doc.Write(SaveList.Text);
1332 //Application.ProcessMessages;
1335 SaveList.Add('</dl>');
1336 SaveList.Add('<a name="bottom"></a>');
1337 SaveList.Add('</body></html>');
1338 doc.Write(SaveList.Text);
1348 (*************************************************************************
1349 *http://
\82Ì
\95¶
\8e\9a\97ñ
\82ðanchor
\83^
\83O
\95t
\82«
\82É
\82·
\82é
\81B
1350 *************************************************************************)
1351 function TGikoSys.AddAnchorTag(s: string): string;
1353 URL_CHAR: string = '0123456789'
1354 + 'abcdefghijklmnopqrstuvwxyz'
1355 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1356 + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
1357 ANCHOR_REF = 'href=';
1358 RES_REF = '>>';
1360 wkIdx: array[0..9] of Integer;
1365 anchorLen : Integer;
1368 // + 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ß
1369 anchorLen := Length( ANCHOR_REF ) + 3;
1372 wkIdx[0] := AnsiPos('http://', s);
1373 wkIdx[1] := AnsiPos('ttp://', s);
1374 wkIdx[2] := AnsiPos('tp://', s);
1375 wkIdx[3] := AnsiPos('ms-help://', s);
1376 wkIdx[4] := AnsiPos('p://', s);
1377 wkIdx[5] := AnsiPos('https://', s);
1378 wkIdx[6] := AnsiPos('www.', s);
1379 wkIdx[7] := AnsiPos('ftp://', s);
1380 wkIdx[8] := AnsiPos('news://', s);
1381 wkIdx[9] := AnsiPos('rtsp://', s);
1385 if wkIdx[i] <> 0 then idx := Min(wkIdx[i], idx);
1387 if idx = MaxInt then begin
1388 //
\83\8a\83\93\83N
\82ª
\96³
\82¢
\82æ
\81B
1389 Result := Result + s;
1394 (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
1395 //
\8aù
\82É
\83\8a\83\93\83N
\83^
\83O
\82ª
\82Â
\82¢
\82Ä
\82¢
\82é
\82Á
\82Û
\82¢
\82Æ
\82«
\82Í
\83\80\83V
1396 href := Copy( s, idx, Length( s ) );
1397 Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
1399 s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
1404 Result := Result + Copy(s, 0, idx - 1);
1406 s := Copy(s, idx, length(s));
1408 for i := 0 to Length(s) do begin
1409 idx := AnsiPos(s[i + 1], URL_CHAR);
1410 if (idx = 0) or (i = (Length(s))) then begin
1411 //URL
\82¶
\82á
\82È
\82¢
\95¶
\8e\9a\94
\8c©
\81I
\82Æ
\82©
\81A
\95¶
\8e\9a\82ª
\82È
\82
\82È
\82Á
\82½
\81B
1412 url := Copy(s, 0, i);
1414 if AnsiPos('ttp://', url) = 1 then
1416 else if AnsiPos('tp://', url) = 1 then
1418 else if AnsiPos('p://', url) = 1 then
1420 else if AnsiPos('www.', url) = 1 then
1421 href := 'http://' + url
1424 Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
1425 s := Copy(s, i + 1, Length(s));
1432 (*************************************************************************
1433 *
\83T
\83u
\83W
\83F
\83N
\83g
\88ê
\8ds
\82ð
\95ª
\8a\84
1434 *************************************************************************)
1435 function TGikoSys.DivideSubject(Line: string): TSubjectRec;
1445 if Pos('<>', Line) = 0 then
1450 Result.FFileName := GetTokenIndex(Line, Delim, 0);
1451 Result.FTitle := GetTokenIndex(Line, Delim, 1);
1453 ws := Trim(Result.FTitle);
1455 if Copy(ws, Length(ws), 1) = ')' then begin
1458 end else if Copy(ws, Length(ws), 1) = '
\81j' then begin
1461 end else if Copy(ws, Length(ws), 1) = '<' then begin
1466 for i := Length(ws) - 1 downto 1 do begin
1467 if ws[i] = LeftK then begin
1468 ws := Copy(ws, i + 1, Length(ws) - i - 1);
1469 if IsNumeric(ws) then
1470 Result.FCount := StrToInt(ws);
1471 Result.FTitle := Trim(StringReplace(Result.FTitle, LeftK + ws + RightK, '', [rfReplaceAll]));
1477 (*************************************************************************
1478 * dat
\83t
\83@
\83C
\83\8b\82Ì
\88ê
\83\89\83C
\83\93\82ð
\95ª
\89ð
1479 *************************************************************************)
1480 function TGikoSys.DivideStrLine(Line: string): TResRec;
1485 if Pos('<>', Line) = 0 then begin
1487 Result.FType := glt2chOld;
1490 Result.FType := glt2chNew;
1492 Result.FName := Trim(GetTokenIndex(Line, Delim, 0));
1493 Result.FMailTo := Trim(GetTokenIndex(Line, Delim, 1));
1494 Result.FDateTime := Trim(GetTokenIndex(Line, Delim, 2));
1495 bufBody := Trim(GetTokenIndex(Line, Delim, 3));
1496 if bufbody = '' then begin
1497 Insert(' ',bufbody, 1);
1499 Result.FBody := bufBody;
1500 Result.FTitle := Trim(GetTokenIndex(Line, Delim, 4));
1504 (*************************************************************************
1505 * URL
\82©
\82çBBSID
\82ð
\8eæ
\93¾
1506 *************************************************************************)
1507 function TGikoSys.UrlToID(url: string): string;
1514 if url = '' then Exit;
1516 url := Copy(url, 0, Length(url) - 1);
1517 for i := Length(url) downto 0 do begin
1518 if url[i] = '/' then begin
1519 Result := Copy(url, i + 1, Length(url));
1525 (*************************************************************************
1526 *URL
\82©
\82çBBSID
\88È
\8aO
\82Ì
\95\94\95ª(http://teri.2ch.net/)
\82ð
\8eæ
\93¾
1527 *************************************************************************)
1528 function TGikoSys.UrlToServer(url: string): string;
1535 wsURL := Trim(wsURL);
1537 if wsURL = '' then exit;
1539 if Copy(wsURL, Length(wsURL), 1) = '/' then
1540 wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
1542 for i := Length(wsURL) downto 0 do begin
1543 if wsURL[i] = '/' then begin
1544 Result := Copy(wsURL, 0, i);
1550 (*************************************************************************
1551 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\83`
\83F
\83b
\83N
1552 *************************************************************************)
1553 function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
1557 Code := GetFileAttributes(PChar(Name));
1558 Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
1561 (*************************************************************************
1562 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\8dì
\90¬
\81i
\95¡
\90\94\8aK
\91w
\91Î
\89\9e\81j
1563 *************************************************************************)
1564 function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
1567 if Length(Dir) = 0 then
1568 raise Exception.Create('
\83t
\83H
\83\8b\83_
\82ª
\8dì
\90¬
\8fo
\97\88\82Ü
\82¹
\82ñ');
1569 Dir := ExcludeTrailingPathDelimiter(Dir);
1570 if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
1571 or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
1572 Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
1575 (*************************************************************************
1576 *
\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
1577 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1578 *************************************************************************)
1579 function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
1583 Result := StrTokNext(sep, Rec);
1586 (*************************************************************************
1587 *
\95¶
\8e\9a\97ñ
\82©
\82ç
\83g
\81[
\83N
\83\93\82Ì
\90Ø
\82è
\8fo
\82µ
1588 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1589 *************************************************************************)
1590 function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
1597 if Len >= Pos then begin
1598 while (Pos <= Len) and (Str[Pos] in sep) do begin
1602 while (Pos<= Len) and not (Str[Pos] in sep) do begin
1603 if IsDBCSLeadByte(Byte(Str[Pos])) then begin
1608 Result := Copy(Str, I, Pos - I);
1609 while (Pos <= Len) and (Str[Pos] in sep) do begin//
\82±
\82ê
\82Í
\82¨
\8dD
\82Ý
1616 (*************************************************************************
1617 *
\83t
\83@
\83C
\83\8b\83T
\83C
\83Y
\8eæ
\93¾
1618 *************************************************************************)
1619 function TGikoSys.GetFileSize(FileName : string): longint;
1624 if not FileExists(FileName) then begin
1628 Assign(F, FileName);
1630 Result := FileSize(F);
1637 (*************************************************************************
1638 *
\83t
\83@
\83C
\83\8b\8ds
\90\94\8eæ
\93¾
1639 *************************************************************************)
1640 function TGikoSys.GetFileLineCount(FileName : string): longint;
1644 sl := TStringList.Create;
1647 sl.LoadFromFile(FileName);
1658 (*************************************************************************
1659 *
\83X
\83\8c\83b
\83h
\83t
\83@
\83C
\83\8b\82©
\82ç
\8ew
\92è
\8ds
\82ð
\8eæ
\93¾
1660 *************************************************************************)
1661 function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
1663 fileTmp : TStringList;
1666 if FileExists(FileName) then begin
1667 fileTmp := TStringList.Create;
1670 fileTmp.LoadFromFile( FileName );
1671 if ( Line >= 1 ) and ( Line < fileTmp.Count + 1 ) then begin
1672 Result := fileTmp.Strings[ Line-1 ];
1675 //on EFOpenError do Result := '';
1683 (*************************************************************************
1684 *
\83V
\83X
\83e
\83\80\83\81\83j
\83\85\81[
\83t
\83H
\83\93\83g
\82Ì
\91®
\90«
\82ð
\8eæ
\93¾
1685 *************************************************************************)
1686 procedure TGikoSys.MenuFont(Font: TFont);
1689 nm: NONCLIENTMETRICS;
1691 nm.cbSize := sizeof(NONCLIENTMETRICS);
1693 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
1694 lf := nm.lfMenuFont;
1696 Font.Name := lf.lfFaceName;
1697 Font.Height := lf.lfHeight;
1699 if lf.lfWeight >= 700 then
1700 Font.Style := Font.Style + [fsBold];
1701 if lf.lfItalic = 1 then
1702 Font.Style := Font.Style + [fsItalic];
1705 (*************************************************************************
1707 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1708 *************************************************************************)
1709 function TGikoSys.RemoveToken(var s: string; delimiter: string): string;
1713 p := AnsiPos(delimiter, s);
1717 Result := Copy(s, 1, p - 1);
1718 s := Copy(s, Length(Result) + Length(delimiter) + 1, Length(s));
1721 (*************************************************************************
1723 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1724 *************************************************************************)
1725 function TGikoSys.GetTokenIndex(s: string; delimiter: string; index: Integer): string;
1730 for i := 0 to index do
1731 Result := RemoveToken(s, delimiter);
1734 (*************************************************************************
1736 *************************************************************************)
1737 function TGikoSys.DeleteLink(const s: string): string;
1747 s1 := GetTokenIndex(s, '<a href="', i);
1748 s2 := GetTokenIndex(s, '<a href="', i + 1);
1750 idx := Pos('">', s1);
1752 Delete(s1, 1, idx + 1);
1753 idx := Pos('">', s2);
1755 Delete(s2, 1, idx + 1);
1757 Result := Result + s1 + s2;
1766 //
\83C
\83\93\83f
\83b
\83N
\83X
\96¢
\8dX
\90V
\83o
\83b
\83t
\83@
\82ð
\83t
\83\89\83b
\83V
\83\85\81I
1767 {procedure TGikoSys.FlashExitWrite;
1771 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
1772 for i := 0 to FExitWrite.Count - 1 do
1773 WriteThreadDat(FExitWrite[i]);
1777 (*************************************************************************
1778 *
\83X
\83\8c\96¼
\82È
\82Ç
\82ð
\92Z
\82¢
\96¼
\91O
\82É
\95Ï
\8a·
\82·
\82é
1780 *************************************************************************)
1781 function TGikoSys.GetShortName(const LongName: string; ALength: integer): string;
1783 ERASECHAR : array [1..39] of string =
1784 ('
\81\99','
\81\9a','
\81¡','
\81 ','
\81\9f','
\81\9e','
\81Q','
\81\94','
\81£','
\81¥',
1785 '
\81¢','
\81¤','
\81\9c','
\81\9b','
\81\9d','
\81y','
\81z','
\81ô','
\81s','
\81t',
1786 '
\81g','
\81h','
\81k','
\81l','
\81e','
\81f','
\81\83','
\81\84','
\81á','
\81â',
1787 '
\81o','
\81p','
\81q','
\81r','
\81w','
\81x','
\81¬','
\81c', '
\81@');
1789 Chr : array [0..255] of char;
1793 s := Trim(LongName);
1794 if (Length(s) <= ALength) then begin
1798 for i := Low(ERASECHAR) to High(ERASECHAR) do begin
1799 S := StringReplace(S, ERASECHAR[i], '', [rfReplaceAll]);
1801 if (Length(S) <= ALength) then begin
1804 Windows.LCMapString(
1805 GetUserDefaultLCID(),
1813 S := Copy(S,1,ALength);
1815 if (ByteType(S, Length(S)) = mbLeadByte ) then begin
1816 S := Copy(S, 1, Length(S) - 1);
1826 (*************************************************************************
1829 *************************************************************************)
1830 function TGikoSys.ConvRes(const Body, Bbs, Key,
1831 ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string): string;
1835 FIndexFrom : integer;
1842 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
1856 procedure Add(IndexFrom, IndexTo: integer; const No: string);
1861 FIndex.FIndexFrom := IndexFrom;
1862 FIndex.FIndexTo := IndexTo;
1866 function ChooseString(const Text, Separator: string; Index: integer): string;
1872 for i := 0 to Index - 1 do begin
1873 if (AnsiPos(Separator, S) = 0) then S := ''
1874 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
1876 p := AnsiPos(Separator, S);
1877 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
1886 List:= TList.Create;
1892 b := ByteType(s, i);
1894 mbSingleByte : begin
1895 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
1896 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
1904 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
1905 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
1911 if (not sw) and (Copy(s,i,4) = GT) then begin
1912 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
1920 if ((not sw) and (Copy(s,i,1) = ',')) or
1921 ((not sw) and (Copy(s,i,1) = '=')) then begin
1922 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
1923 ((Chk) and (oc = '')) or
1924 ((not Chk) and (al)) then
1934 if (AnsiPos(sx, SN) > 0) then begin
1937 if (No <> '') and (No <> '-') then begin
1950 if Copy(s,i,1) = '<' then oc := '';
1951 oc := oc + Copy(s,i,1);
1957 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
1963 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
1971 if (AnsiPos(sx, ZN) > 0) then begin
1972 No := No + ZenToHan(sx);
1974 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
1989 if (i > Length(Body)) then begin
1991 if (No <> '') then Add(sp, i, No);
1996 for i := List.Count - 1 downto 0 do begin
1997 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
1998 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
1999 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2001 st := PIndex(List[i]).FNo;
2002 et := PIndex(List[i]).FNo;
2004 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2005 Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2006 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2007 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2008 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2009 Dispose(PIndex(List[i]));
2015 (*************************************************************************
2016 *
\91S
\8ap
\81¨
\94¼
\8ap
2018 *************************************************************************)
2019 function TGikoSys.ZenToHan(const s: string): string;
2021 Chr: array [0..255] of char;
2023 Windows.LCMapString(
2024 GetUserDefaultLCID(),
2026 LCMAP_HALFWIDTH or LCMAP_KATAKANA or LCMAP_LOWERCASE,
2035 (*************************************************************************
2036 *
\91S
\8ap
\94¼
\8ap
\82Ð
\82ç
\82ª
\82È
\82©
\82½
\82©
\82È
\82ð
\8bæ
\95Ê
\82µ
\82È
\82¢
\90¦
\82¢Pos
2037 *************************************************************************)
2038 function TGikoSys.VaguePos(const Substr, S: string): Integer;
2040 Result := Pos(ZenToHan(Substr), ZenToHan(S));
2043 function TGikoSys.BoolToInt(b: Boolean): Integer;
2045 Result := IfThen(b, 1, 0);
2048 function TGikoSys.IntToBool(i: Integer): Boolean;
2053 //gzip
\82Å
\88³
\8fk
\82³
\82ê
\82½
\82Ì
\82ð
\96ß
\82·
2054 function TGikoSys.GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
2058 GZipStream: TGzipDecompressStream;
2059 TextStream: TStringStream;
2060 buf: array[0..BUF_SIZE - 1] of Byte;
2066 TextStream := TStringStream.Create('');
2068 //
\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¢)
2069 // if LowerCase(Trim(ContentEncoding)) = 'gzip' then begin
2070 if AnsiPos('gzip', LowerCase(Trim(ContentEncoding))) > 0 then begin
2071 ResStream.Position := 0;
2072 GZipStream := TGzipDecompressStream.Create(TextStream);
2075 FillChar(buf, BUF_SIZE, 0);
2076 cnt := ResStream.Read(buf, BUF_SIZE);
2078 GZipStream.Write(buf, BUF_SIZE);
2084 ResStream.Position := 0;
2086 FillChar(buf, BUF_SIZE, 0);
2087 cnt := ResStream.Read(buf, BUF_SIZE);
2089 TextStream.Write(buf, BUF_SIZE);
2093 //NULL
\95¶
\8e\9a\82ð"*"
\82É
\82·
\82é
2094 s := TextStream.DataString;
2096 while (i > 0) and (s[i] = #0) do
2101 while i <> 0 do begin
2111 procedure TGikoSys.LoadKeySetting(ActionList: TActionList);
2113 STD_SEC = 'KeySetting';
2119 SecList: TStringList;
2120 Component: TComponent;
2122 if not FileExists(GetConfigDir + KEY_SETTING_FILE_NAME) then
2124 SecList := TStringList.Create;
2125 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2127 ini.ReadSection(STD_SEC, SecList);
2128 for i := 0 to SecList.Count - 1 do begin
2129 ActionName := SecList[i];
2130 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2131 if ActionKey <> -1 then begin
2132 Component := ActionList.Owner.FindComponent(ActionName);
2133 if TObject(Component) is TAction then begin
2134 TAction(Component).ShortCut := ActionKey;
2144 procedure TGikoSys.SaveKeySetting(ActionList: TActionList);
2146 STD_SEC = 'KeySetting';
2151 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2153 for i := 0 to ActionList.ActionCount - 1 do begin
2154 if ActionList.Actions[i].Tag = -1 then
2156 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2165 procedure TGikoSys.CreateProcess(const AppPath: string; const Param: string);
2167 PI: TProcessInformation;
2171 Path := '"' + AppPath + '"';
2173 Path := Path + ' ' + Param;
2175 SI.Cb := SizeOf(Si);
2176 SI.lpReserved := nil;
2177 SI.lpDesktop := nil;
2180 SI.cbReserved2 := 0;
2181 SI.lpReserved2 := nil;
2183 Windows.CreateProcess(nil,
2195 procedure TGikoSys.OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
2199 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2200 gbtUserApp, gbtAuto:
2201 if (Setting.URLApp) and (FileExists(Setting.URLAppFile)) then
2202 GikoSys.CreateProcess(Setting.URLAppFile, URL)
2204 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2208 function TGikoSys.HTMLDecode(const AStr: String): String;
2210 Sp, Rp, Cp, Tp: PChar;
2215 SetLength(Result, Length(AStr));
2217 Rp := PChar(Result);
2220 while Sp^ <> #0 do begin
2226 'a': if AnsiStrPos(Sp, 'amp;') = Sp then
2232 'g': if (AnsiStrPos(Sp, 'lt;') = Sp) or (AnsiStrPos(Sp, 'gt;') = Sp) then
2236 while (Sp^ <> ';') and (Sp^ <> #0) do
2243 'q': if AnsiStrPos(Sp, 'quot;') = Sp then
2251 Num := IsNumeric(Copy(Tp, 1, 1));
2252 while (Sp^ <> ';') and (Sp^ <> #0) do begin
2253 if (Num) and (not IsNumeric(Copy(Sp, 1, 1))) then
2257 SetString(S, Tp, Sp - Tp);
2262 //raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2263 //[Cp^ + Sp^, Cp - PChar(AStr)])
2273 // on E:EConvertError do
2274 // raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2275 // [Cp^ + Sp^, Cp - PChar(AStr)])
2277 SetLength(Result, Rp - PChar(Result));
2280 function TGikoSys.GetHRefText(s: string): string;
2290 Index := AnsiPos('href', LowerCase(s));
2293 s := Trim(Copy(s, Index + 4, Length(s)));
2294 s := Trim(Copy(s, 2, Length(s)));
2296 //
\8en
\82ß
\82Ì
\95¶
\8e\9a\82ª'"'
\82È
\82ç
\8eæ
\82è
\8f\9c\82
2297 if Copy(s, 1, 1) = '"' then begin
2298 s := Trim(Copy(s, 2, Length(s)));
2301 Index := AnsiPos('"', s);
2302 if Index <> 0 then begin
2303 //'"'
\82Ü
\82ÅURL
\82Æ
\82·
\82é
2304 s := Copy(s, 1, Index - 1);
2306 //'"'
\82ª
\96³
\82¯
\82ê
\82Î
\83X
\83y
\81[
\83X
\82©">"
\82Ì
\91\81\82¢
\95û
\82Ü
\82Å
\82ðURL
\82Æ
\82·
\82é
2307 Index := AnsiPos(' ', s);
2308 Index2 := AnsiPos('>', s);
2311 if Index > Index2 then
2314 s := Copy(s, 1, Index - 1)
2316 //
\82±
\82ê
\88È
\8fã
\82à
\82¤
\92m
\82ç
\82ñ
\82Ê
2322 //
\83z
\83X
\83g
\96¼
\82ª
\82Q
\82\83\82\88\82©
\82Ç
\82¤
\82©
\83`
\83F
\83b
\83N
\82·
\82é
2323 function TGikoSys.Is2chHost(Host: string): Boolean;
2325 HOST_NAME: array[0..1] of string = ('2ch.net', 'bbspink.com');
2331 if RightStr( Host, 1 ) = '/' then
2332 Host := Copy( Host, 1, Length( Host ) - 1 );
2333 OutputDebugString(pchar(HOST_NAME[0]));
2334 for i := 0 to Length(HOST_NAME) - 1 do begin
2335 // Len := Length(HOST_NAME[i]);
2336 if AnsiPos(HOST_NAME[i], Host) = (Length(Host) - Length(HOST_NAME[i]) + 1) then begin
2343 function TGikoSys.Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
2345 READ_PATH: string = '/test/read.cgi/';
2346 OLD_READ_PATH: string = '/test/read.cgi?';
2347 KAKO_PATH: string = '/kako/';
2357 Index := AnsiPos(READ_PATH, path);
2358 if Index <> 0 then begin
2359 s := Copy(path, Length(READ_PATH) + 1, Length(path));
2360 BBSID := GetTokenIndex(s, '/', 0);
2361 BBSKey := GetTokenIndex(s, '/', 1);
2364 Result := (BBSID <> '') or (BBSKey <> '');
2367 Index := AnsiPos(KAKO_PATH, path);
2368 if Index <> 0 then begin
2369 s := Copy(path, 2, Length(path));
2370 BBSID := GetTokenIndex(s, '/', 0);
2371 if (BBSID = 'log') and (GetTokenIndex(s, '/', 2) = 'kako') then
2372 BBSID := GetTokenIndex(s, '/', 1);
2373 BBSKey := ChangeFileExt(Document, '');
2374 Result := (BBSID <> '') or (BBSKey <> '');
2377 Index := AnsiPos('read.cgi?', URL);
2378 if Index <> 0 then begin
2379 SList := TStringList.Create;
2382 // s := HTMLDecode(Document);
2383 ExtractHTTPFields(['?', '&'], [], PChar(URL), SList, False);
2384 BBSID := SList.Values['bbs'];
2385 BBSKey := SList.Values['key'];
2386 Result := (BBSID <> '') or (BBSKey <> '');
2397 function TGikoSys.Parse2chURL2(URL: string): TPathRec;
2409 URL := Trim(LowerCase(URL));
2414 Result.FFirst := False;
2415 Result.FStBegin := False;
2416 Result.FToEnd := False;
2417 Result.FDone := False;
2422 FAWKStr.RegExp := 'http://.+\.(2ch\.net|bbspink\.com)/';
2423 if FAWKStr.Match(FAWKStr.ProcessEscSeq(URL), RStart, RLength) = 0 then
2425 s := Copy(URL, RStart + RLength - 1, Length(URL));
2427 //
\95W
\8f\80\8f\91\8e®
2428 //
\8dÅ
\8cã
\82Íl50, 10, 10-20, 10n, 10-20n, -10, 10-, 10n-
\82È
\82Ç
2429 //http://xxx.2ch.net/test/read.cgi/bbsid/1000000000/
2430 FAWKStr.RegExp := '/test/read.cgi/.+/[0-9]+/.*';
2431 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2432 s := Copy(s, 15, Length(s));
2434 SList := TStringList.Create;
2437 FAWKStr.RegExp := '/';
2438 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
2439 Result.FBBS := SList[1];
2440 Result.FKey := SList[2];
2441 if SList.Count >= 3 then
2449 FAWKStr.LineSeparator := mcls_CRLF;
2450 FAWKStr.RegExp := '-';
2451 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) = 0 then begin
2452 Result.FFirst := True;
2454 FAWKStr.RegExp := 'l[0-9]+';
2455 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2456 Result.FFirst := True;
2458 for i := 0 to SList.Count - 1 do begin
2459 if Trim(SList[i]) = '' then begin
2461 Result.FStBegin := True;
2462 if i = (SList.Count - 1) then
2463 Result.FToEnd := True;
2464 end else if IsNumeric(SList[i]) then begin
2465 wkInt := StrToInt(SList[i]);
2466 wkMax := Max(wkMax, wkInt);
2470 wkMin := Min(wkMin, wkInt);
2471 end else if Trim(SList[i]) = 'n' then begin
2472 Result.FFirst := True;
2474 FAWKStr.RegExp := '^n[0-9]+$|^[0-9]+n$';
2475 if FAWKStr.Match(FAWKStr.ProcessEscSeq(SList[i]), RStart, RLength) > 0 then begin
2476 if Copy(SList[i], 1, 1) = 'n' then
2477 wkInt := StrToInt(Copy(SList[i], 2, Length(SList[i])))
2479 wkInt := StrToInt(Copy(SList[i], 1, Length(SList[i]) - 1));
2480 Result.FFirst := True;
2481 wkMax := Max(wkMax, wkInt);
2485 wkMin := Min(wkMin, wkInt);
2489 if Result.FStBegin and (not Result.FToEnd) then
2491 else if (not Result.FStBegin) and Result.FToEnd then
2493 else if (not Result.FStBegin) and (not Result.FToEnd) then begin
2494 Result.FSt := wkMin;
2495 Result.FTo := wkMax;
2497 //Result.FSt := wkMin;
2498 //Result.FTo := wkMax;
2504 Result.FDone := True;
2508 //
\90Vkako
\8f\91\8e®
2509 //http://server.2ch.net/ITA_NAME/kako/1000/10000/1000000000.html
2510 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+/[0-9]+\.html';
2511 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2512 SList := TStringList.Create;
2515 FAWKStr.RegExp := '/';
2516 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
2517 Result.FBBS := SList[1];
2518 Result.FKey := ChangeFileExt(SList[5], '');
2519 Result.FFirst := True;
2525 Result.FDone := True;
2529 //
\8b\8ckako
\8f\91\8e®
2530 //http://server.2ch.net/ITA_NAME/kako/999/999999999.html
2531 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+\.html';
2532 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2533 SList := TStringList.Create;
2536 FAWKStr.RegExp := '/';
2537 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 5 then begin
2538 Result.FBBS := SList[1];
2539 Result.FKey := ChangeFileExt(SList[4], '');
2540 Result.FFirst := True;
2546 Result.FDone := True;
2550 //log
\8by
\82Ñlog2
\8f\91\8e®
2551 //http://server.2ch.net/log/ITA_NAME/kako/999/999999999.html
2552 //http://server.2ch.net/log2/ITA_NAME/kako/999/999999999.html
2553 FAWKStr.RegExp := '/log2?/.+/kako/[0-9]+/[0-9]+\.html';
2554 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2555 SList := TStringList.Create;
2558 FAWKStr.RegExp := '/';
2559 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
2560 Result.FBBS := SList[2];
2561 Result.FKey := ChangeFileExt(SList[5], '');
2562 Result.FFirst := True;
2568 Result.FDone := True;
2573 //
\8b\8cURL
\8f\91\8e®
2574 //http://server.2ch.net/test/read.cgi?bbs=ITA_NAME&key=1000000000&st=1&to=5&nofirst=true
2575 FAWKStr.RegExp := '/test/read\.cgi\?';
2576 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2577 s := Copy(s, 16, Length(s));
2578 SList := TStringList.Create;
2581 FAWKStr.RegExp := '&';
2582 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
2583 Result.FFirst := True;
2584 for i := 0 to SList.Count - 1 do begin
2585 if Pos('bbs=', SList[i]) = 1 then begin
2586 Result.FBBS := Copy(SList[i], 5, Length(SList[i]));
2587 end else if Pos('key=', SList[i]) = 1 then begin
2588 Result.FKey := Copy(SList[i], 5, Length(SList[i]));
2589 end else if Pos('st=', SList[i]) = 1 then begin
2590 wk := Copy(SList[i], 4, Length(SList[i]));
2591 if IsNumeric(wk) then
2592 Result.FSt := StrToInt(wk)
2593 else if wk = '' then
2594 Result.FStBegin := True;
2595 end else if Pos('to=', SList[i]) = 1 then begin
2596 wk := Copy(SList[i], 4, Length(SList[i]));
2597 if IsNumeric(wk) then
2598 Result.FTo := StrToInt(wk)
2599 else if wk = '' then
2600 Result.FToEnd := True;
2601 end else if Pos('nofirst=', SList[i]) = 1 then begin
2602 Result.FFirst := False;
2611 if (Result.FBBS <> '') and (Result.FKey <> '') then begin
2612 Result.FDone := True;
2618 procedure TGikoSys.ParseURI(var URL, Protocol, Host, Path, Document, Port, Bookmark: string);
2628 URI := TIdURI.Create(URL);
2630 Protocol := URI.Protocol;
2633 Document := URI.Document;
2635 Bookmark := URI.Bookmark;
2641 function TGikoSys.GetVersionBuild: Integer;
2643 FixedFileInfo: PVSFixedFileInfo;
2644 VersionHandle, VersionSize: DWORD;
2645 pVersionInfo: Pointer;
2650 AppFile := Application.ExeName;
2651 VersionSize := GetFileVersionInfoSize(pChar(AppFile), VersionHandle);
2652 if VersionSize = 0 then
2654 GetMem(pVersionInfo, VersionSize);
2656 if GetFileVersionInfo(PChar(AppFile),VersionHandle,VersionSize, pVersionInfo) then
2657 if VerQueryValue(pVersionInfo, '\', Pointer(FixedFileInfo), ItemLen) then
2658 Result := LOWORD(FixedFileInfo^.dwFileVersionLS);
2660 FreeMem(pVersionInfo, VersionSize);
2664 function TGikoSys.Get2chThreadURL2BoardURL(
2668 Protocol, Host, Path, Document, Port, Bookmark : string;
2669 BBSID, BBSKey : string;
2672 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
2673 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
2675 Result := Protocol + '://' + Host + '/' + BBSID + '/';
2679 function TGikoSys.Get2chBrowsableThreadURL(
2683 Protocol, Host, Path, Document, Port, Bookmark : string;
2684 BBSID, BBSKey : string;
2686 KAKO_PATH = '/kako/';
2689 if Pos( KAKO_PATH, inURL ) > 0 then begin
2692 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
2693 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
2695 Result := Protocol + '://' + Host + '/test/read.cgi/' + BBSID + '/' + BBSKey + '/l50';
2700 function TGikoSys.Get2chBoard2ThreadURL(
2706 Protocol, Host, Path, Document, Port, Bookmark : string;
2710 ParseURI( url, Protocol, Host, Path, Document, Port, Bookmark );
2712 Result := Protocol + '://' + Host + '/test/read.cgi/' + inBoard.BBSID + '/' + inKey + '/l50';
2716 (*************************************************************************
2717 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
2718 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
2719 *
\97\9a\97ð
\82P
\81@
\81@
\81F
\90V
\8bK
\8dì
\90¬
2720 *************************************************************************)
2721 procedure TGikoSys.ReadBoardFile;
2725 CategoryList: TStringList;
2726 BoardList: TStringList;
2727 Category: TCategory;
2730 RoundItem: TRoundItem;
2732 // BBS
\94z
\97ñ(1
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\82É
\82Â
\82« 1
\8d\80\96Ú)
2733 bbsList : array of TStringList;
2734 boardFileList : TStringList;
2736 i, iBound : Integer;
2737 j, jBound : Integer;
2738 k, kBound : Integer;
2739 l, lBound : Integer;
2741 ini := TMemIniFile.Create('');
2745 for i := 0 to Length( BBSs ) - 1 do
2749 SetLength( BBSs, 0 );
2751 //
\94Â
\83\8a\83X
\83g
\82Ì
\97ñ
\8b\93
2752 if FileExists( GikoSys.GetBoardFileName ) then begin
2753 l := Length( bbsList );
2754 SetLength( bbsList, l + 1 );
2755 bbsList[ l ] := TStringList.Create;
2756 bbsList[ l ].LoadFromFile( GikoSys.GetBoardFileName );
2758 SetLength( BBSs, l + 1 );
2759 BBSs[ l ] := TBBS.Create( GikoSys.Setting.LogFolder );
2760 BBSs[ l ].Title := '
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é';
2763 if FileExists( GikoSys.GetCustomBoardFileName ) then begin
2764 l := Length( bbsList );
2765 SetLength( bbsList, l + 1 );
2766 bbsList[ l ] := TStringList.Create;
2767 bbsList[ l ].LoadFromFile( GikoSys.GetCustomBoardFileName );
2769 SetLength( BBSs, l + 1 );
2770 BBSs[ l ] := TBBS.Create( GikoSys.Setting.LogFolder );
2771 BBSs[ l ].Title := '
\82»
\82Ì
\91¼';
2774 // Board
\83t
\83H
\83\8b\83_
2775 if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
2776 BoardFileList := TStringList.Create;
2778 GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
2779 l := Length( bbsList );
2780 for i := BoardFileList.Count - 1 downto 0 do begin
2781 SetLength( bbsList, l + 1 );
2782 bbsList[ l ] := TStringList.Create;
2783 bbsList[ l ].LoadFromFile( BoardFileList[ i ] );
2785 SetLength( BBSs, l + 1 );
2786 BBSs[ l ] := TBBS.Create( GikoSys.Setting.LogFolder );
2787 BBSs[ l ].Title := ChangeFileExt( ExtractFileName( BoardFileList[ i ] ), '' );
2796 lBound := Length( bbsList ) - 1;
2797 for l := 0 to lBound do begin
2798 ini.SetStrings( bbsList[ l ] );
2799 CategoryList := TStringList.Create;
2800 BoardList := TStringList.Create;
2802 ini.ReadSections( CategoryList );
2804 iBound := CategoryList.Count - 1;
2805 for i := 0 to iBound do begin
2806 ini.ReadSection( CategoryList[i], BoardList );
2807 Category := TCategory.Create;
2808 Category.No := i + 1;
2809 Category.Title := CategoryList[i];
2811 jBound := BoardList.Count - 1;
2812 for j := 0 to jBound do begin
2814 inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
2816 //=====
\83v
\83\89\83O
\83C
\83\93
2818 kBound := Length( BoardPlugIns ) - 1;
2819 for k := 0 to kBound do begin
2820 if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin
2821 if BoardPlugIns[ k ].AcceptURL( inistr ) = atBoard then begin
2822 Board := TBoard.Create( BoardPlugIns[ k ], inistr );
2829 // 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¢
2833 Board := TBoard.Create( nil, inistr );
2836 Board.Title := BoardList[j];
2837 Board.BBSID := GikoSys.UrlToID(inistr);
2838 Board.RoundDate := ZERO_DATE;
2840 idx := RoundList.Find(Board);
2841 if idx <> -1 then begin
2842 RoundItem := RoundList.Items[idx, grtBoard];
2843 Board.Round := True;
2844 Board.RoundName := RoundItem.RoundName;
2846 Category.Add(Board);
2850 BBSs[ l ].Add( Category );
2859 lBound := Length( bbsList ) - 1;
2860 for l := 0 to lBound do
2866 GikoSys := TGikoSys.Create;
2869 if GikoSys <> nil then begin