6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
7 ComCtrls, IniFiles, ShellAPI, ActnList, Math,
15 {HttpApp,} YofUtils, URLMon, IdGlobal, IdURI, {Masks,}
16 Setting, BoardGroup, gzip, Dolib, bmRegExp, AbonUnit,
17 MojuUtils, ExternalBoardManager, ExternalBoardPlugInMain,
22 TGikoBBSType = (gbt2ch);
23 //
\83\8d\83O
\83^
\83C
\83v
24 TGikoLogType = (glt2chNew, glt2chOld);
25 //
\83\81\83b
\83Z
\81[
\83W
\83A
\83C
\83R
\83\93
26 TGikoMessageIcon = (gmiOK, gmiSAD, gmiNG, gmiWhat, gmiNone);
27 //URL
\83I
\81[
\83v
\83\93\83u
\83\89\83E
\83U
\83^
\83C
\83v
28 TGikoBrowserType = (gbtIE, gbtUserApp, gbtAuto);
31 TStrTokSeparator = set of Char;
37 //
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b\83\8c\83R
\81[
\83h
45 FRoundDate: TDateTime;
46 FLastModified: TDateTime;
49 FMishiyou: Boolean; //
\96¢
\8eg
\97p
53 FAllResCount: Integer;
54 FNewResCount: Integer;
55 FAgeSage: TGikoAgeSage;
58 //
\83T
\83u
\83W
\83F
\83N
\83g
\83\8c\83R
\81[
\83h
65 //
\83\8c\83X
\83\8c\83R
\81[
\83h
75 //URLPath
\83\8c\83R
\81[
\83h
78 FKey: string; //ThreadID
79 FSt: Int64; //
\8aJ
\8en
\83\8c\83X
\94Ô
80 FTo: Int64; //
\8fI
\97¹
\83\8c\83X
\94Ô
81 FFirst: Boolean; //>>1
\82Ì
\95\
\8e¦
82 FStBegin: Boolean; //1
\81`
\95\
\8e¦
83 FToEnd: Boolean; //
\81`
\8dÅ
\8cã
\82Ü
\82Å
\95\
\8e¦
84 FDone: Boolean; //
\90¬
\8c÷
85 FNoParam: Boolean; //
\83\8c\83X
\94Ô
\83p
\83\89\83\81\81[
\83^
\82È
\82µ
88 TGikoSys = class(TObject)
96 // FExitWrite: TStringList;
97 // function StrToFloatDef(s: string; Default: Double): Double;
101 FSelectResFilter : TAbon;
104 destructor Destroy; override;
105 property ResRange : Longint read FResRange write FResRange;
106 // function MsgBox(Msg: string; Title: string; Flags: Longint): integer; overload;
107 // function MsgBox(Handle: THandle; Msg: string; Title: string; Flags: Longint): integer; overload;
108 function IsNumeric(s: string): boolean;
109 function IsFloat(s: string): boolean;
110 function DirectoryExistsEx(const Name: string): Boolean;
111 function ForceDirectoriesEx(Dir: string): Boolean;
112 // function GetVersion: string;
114 function GetBoardFileName: string;
115 function GetCustomBoardFileName: string;
116 function GetHtmlTempFileName: string;
117 function GetAppDir: string;
118 function GetTempFolder: string;
119 function GetSentFileName: string;
120 function GetConfigDir: string;
121 function GetSkinDir: string;
122 function GetSkinHeaderFileName: string;
123 function GetSkinFooterFileName: string;
124 function GetSkinResFileName: string;
125 function GetSkinNewResFileName: string;
126 function GetSkinBookmarkFileName: string;
127 function GetSkinNewmarkFileName: string;
128 function GetStyleSheetDir: string;
129 function GetOutBoxFileName: string;
130 function GetUserAgent: string;
131 function GetSambaFileName : string;
133 procedure ReadSubjectFile(Board: TBoard);
134 procedure CreateThreadDat(Board: TBoard);
135 procedure WriteThreadDat(Board: TBoard);
136 function ParseIndexLine(Line: string): TIndexRec;
137 procedure GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean); overload;
138 procedure GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean); overload;//
\83T
\83u
\83t
\83H
\83\8b\83_
\82Í
\8c\9f\8dõ
\82µ
\82È
\82¢
139 procedure GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
141 procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
142 procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
143 function AddAnchorTag(s: string): string;
145 function DivideSubject(Line: string): TSubjectRec;
146 function DivideStrLine(Line: string): TResRec;
148 property Setting: TSetting read FSetting write FSetting;
149 property Dolib: TDolib read FDolib write FDolib;
151 function UrlToID(url: string): string;
152 function UrlToServer(url: string): string;
154 function StrTokFirst(const s:string; const sep:TStrTokSeparator; var Rec:TStrTokRec):string;
155 function StrTokNext(const sep:TStrTokSeparator; var Rec:TStrTokRec): string;
157 function GetFileSize(FileName : string) : longint;
158 function GetFileLineCount(FileName : string): longint;
159 function Get2chDate(aDate: TDateTime): string;
160 function IntToDateTime(val: Int64): TDateTime;
161 function DateTimeToInt(ADate: TDateTime): Int64;
163 function ReadThreadFile(FileName: string; Line: Integer): string;
165 procedure MenuFont(Font: TFont);
167 function RemoveToken(var s:string; const delimiter:string):string;
168 function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
169 function DeleteLink(const s: string): string;
171 function GetShortName(const LongName: string; ALength: integer): string;
172 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;
173 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
174 function ConvertResAnchor(res: string): string;
175 function BoolToInt(b: Boolean): Integer;
176 function IntToBool(i: Integer): Boolean;
177 function GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
178 procedure LoadKeySetting(ActionList: TActionList);
179 procedure SaveKeySetting(ActionList: TActionList);
180 procedure LoadEditorKeySetting(ActionList: TActionList);
181 procedure SaveEditorKeySetting(ActionList: TActionList);
183 procedure CreateProcess(const AppPath: string; const Param: string);
184 procedure OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
185 function HTMLDecode(const AStr: String): String;
186 function GetHRefText(s: string): string;
187 function Is2chHost(Host: string): Boolean;
188 function Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
189 function Parse2chURL2(URL: string): TPathRec;
190 procedure ParseURI(var URL, Protocol, Host, Path, Document, Port, Bookmark: string);
191 function GetVersionBuild: Integer;
192 function GetBrowsableThreadURL( inURL : string ) : string;
193 function GetThreadURL2BoardURL( inURL : string ) : string;
194 function Get2chThreadURL2BoardURL( inURL : string ) : string;
195 function Get2chBrowsableThreadURL( inURL : string ) : string;
196 function Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string;
197 procedure ListBoardFile;
198 procedure ReadBoardFile( bbs : TBBS );
200 function GetUnknownCategory : TCategory;
201 function GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
203 procedure GetPopupResNumber(URL : string; var stRes, endRes : Int64);
205 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
206 function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string;
207 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
208 function SkinedRes( skin: string; Res: TResRec; No: string ): string;
210 //Samba24
\82Ì
\83t
\83@
\83C
\83\8b\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\81B
\91¶
\8dÝ
\82µ
\82È
\82¢
\8fê
\8d\87\81Adefault
\83t
\83@
\83C
\83\8b\82ðrename
\82·
\82é
211 procedure SambaFileExists();
217 //LENGTH_RESTITLE = 40;
218 ZERO_DATE: Integer = 25569;
219 BETA_VERSION_NAME_E = 'beta';
220 BETA_VERSION_NAME_J = 'ÊÞÀ';
222 BETA_VERSION_BUILD = ''; //debug
\94Å
\82È
\82Ç
223 APP_NAME = 'gikoNavi';
228 Giko, RoundData, Favorite;
231 FOLDER_INDEX_VERSION = '1.01';
232 USER_AGENT = 'Monazilla';
233 DEFAULT_NGWORD_FILE_NAME : String = 'NGword.txt';
234 NGWORDs_DIR_NAME : String = 'NGwords';
236 READ_PATH: string = '/test/read.cgi/';
237 OLD_READ_PATH: string = '/test/read.cgi?';
238 KAKO_PATH: string = '/kako/';
240 (*************************************************************************
241 *GikoSys
\83R
\83\93\83X
\83g
\83\89\83N
\83^
242 *************************************************************************)
243 constructor TGikoSys.Create;
245 FSetting := TSetting.Create;
246 FDolib := TDolib.Create;
247 FAWKStr := TAWKStr.Create(nil);
248 if DirectoryExists(GetConfigDir) = false then begin
249 CreateDir(GetConfigDir);
251 FAbon := TAbon.Create;
252 FAbon.Setroot(GetConfigDir+NGWORDs_DIR_NAME);
254 FAbon.ReturnNGwordLineNum := FSetting.ShowNGLinesNum;
255 FAbon.SetNGResAnchor := FSetting.AddResAnchor;
256 FAbon.DeleteSyria := FSetting.DeleteSyria;
257 FAbon.Deleterlo := FSetting.AbonDeleterlo;
258 FAbon.Replaceul := FSetting.AbonReplaceul;
259 FAbon.AbonPopupRes := FSetting.PopUpAbon;
261 FSelectResFilter := TAbon.Create;
262 //
\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
263 FSelectResFilter.AbonString := '';
265 ResRange := FSetting.ResRange;
268 (*************************************************************************
269 *GikoSys
\83f
\83X
\83g
\83\89\83N
\83^
270 *************************************************************************)
271 destructor TGikoSys.Destroy;
274 FileList: TStringList;
276 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
284 FSelectResFilter.Free;
285 //
\83e
\83\93\83|
\83\89\83\8aHTML
\82ð
\8dí
\8f\9c
286 FileList := TStringList.Create;
288 GetFileList(GetTempFolder, '*.html', FileList, False, True);
289 for i := 0 to FileList.Count - 1 do begin
290 DeleteFile(FileList[i]);
298 (*************************************************************************
299 *
\95¶
\8e\9a\97ñ
\90\94\8e\9a\83`
\83F
\83b
\83N
300 *************************************************************************)
302 function TGikoSys.IsNumeric(s: string): boolean;
312 (*************************************************************************
313 *
\95¶
\8e\9a\97ñ
\95\82\93®
\8f¬
\90\94\93_
\90\94\8e\9a\83`
\83F
\83b
\83N
314 *************************************************************************)
315 function TGikoSys.IsFloat(s: string): boolean;
319 Result := TextToFloat(PChar(s), v, fvExtended);
322 (*************************************************************************
323 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
324 *************************************************************************)
325 function TGikoSys.GetBoardFileName: string;
327 Result := Setting.GetBoardFileName;
330 (*************************************************************************
331 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
332 *************************************************************************)
333 function TGikoSys.GetCustomBoardFileName: string;
335 Result := Setting.GetCustomBoardFileName;
338 (*************************************************************************
339 *
\83e
\83\93\83|
\83\89\83\8a\83t
\83H
\83\8b\83_
\81[
\96¼
\8eæ
\93¾
340 *************************************************************************)
341 function TGikoSys.GetHtmlTempFileName: string;
343 Result := Setting.GetHtmlTempFileName;
347 (*************************************************************************
348 *
\8eÀ
\8ds
\83t
\83@
\83C
\83\8b\83t
\83H
\83\8b\83_
\8eæ
\93¾
349 *************************************************************************)
350 function TGikoSys.GetAppDir: string;
352 Result := Setting.GetAppDir;
355 (*************************************************************************
356 *TempHtml
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
357 *************************************************************************)
358 function TGikoSys.GetTempFolder: string;
360 Result := Setting.GetTempFolder;
363 (*************************************************************************
364 *sent.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
365 *************************************************************************)
366 function TGikoSys.GetSentFileName: string;
368 Result := Setting.GetSentFileName;
371 (*************************************************************************
372 *outbox.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
373 *************************************************************************)
374 function TGikoSys.GetOutBoxFileName: string;
376 Result := Setting.GetOutBoxFileName;
379 (*************************************************************************
380 *Config
\83t
\83H
\83\8b\83_
\8eæ
\93¾
381 *************************************************************************)
382 function TGikoSys.GetConfigDir: string;
384 Result := Setting.GetConfigDir;
387 function TGikoSys.GetStyleSheetDir: string;
389 Result := Setting.GetStyleSheetDir;
392 function TGikoSys.GetSkinDir: string;
394 Result := Setting.GetSkinDir;
397 function TGikoSys.GetSkinHeaderFileName: string;
399 Result := Setting.GetSkinHeaderFileName;
402 function TGikoSys.GetSkinFooterFileName: string;
404 Result := Setting.GetSkinFooterFileName;
407 function TGikoSys.GetSkinNewResFileName: string;
409 Result := Setting.GetSkinNewResFileName;
412 function TGikoSys.GetSkinResFileName: string;
414 Result := Setting.GetSkinResFileName;
417 function TGikoSys.GetSkinBookmarkFileName: string;
419 Result := Setting.GetSkinBookmarkFileName;
422 function TGikoSys.GetSkinNewmarkFileName: string;
424 Result := Setting.GetSkinNewmarkFileName;
428 function TGikoSys.GetUserAgent: string;
430 if Dolib.Connected then begin
431 Result := Format('%s %s/%s%d%s', [
438 BETA_VERSION_BUILD]);
440 Result := Format('%s/%s %s/%s%d%s', [
448 BETA_VERSION_BUILD]);
452 (*************************************************************************
453 *
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é
\95û
\8e®
\8e\9e\8d\8f\8eæ
\93¾
454 *************************************************************************)
455 function TGikoSys.Get2chDate(aDate: TDateTime): string;
460 d1 := EncodeDate(1970, 1, 1);
461 d2 := aDate - EncodeTime(9, 0, 0, 0);
462 //Result := FloatToStr(Trunc((d2 - d1) * 24 * 60 * 60));
463 Result := FloatToStr(Trunc((d2 - d1) * 86400));
467 function TGikoSys.IntToDateTime(val: Int64): TDateTime;
472 d1 := EncodeDate(1970, 1, 1);
473 d2 := val / 86400.0;//(val * 1000) / (24 * 60 * 60 * 1000);
477 function TGikoSys.DateTimeToInt(ADate: TDateTime): Int64;
482 d := EncodeDate(1970, 1, 1);
483 c := (ADate - d) * 86400; //(ADate - d) * 24 * 60 * 60;
488 (*************************************************************************
489 *Subject
\83t
\83@
\83C
\83\8bRead
490 *************************************************************************)
491 procedure TGikoSys.ReadSubjectFile(Board: TBoard);
493 ThreadItem: TThreadItem;
495 FileList: TStringList;
496 TmpFileList: TStringList;
504 RoundItem: TRoundItem;
509 FavoThreadItem : TFavoriteThreadItem;
513 if Board.IsThreadDatRead then
518 usePlugIn := Board.IsBoardPlugInAvailable;
520 FileName := Board.GetFolderIndexFileName;
522 FileList := TStringList.Create;
523 FileList.Sorted := True;
524 TmpFileList := TStringList.Create;
525 TmpFileList.Sorted := True;
527 //IsLogFile
\97pDAT
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
528 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False);
529 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\97pTmp
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
530 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False);
532 //
\8fd
\95¡
\82ð
\96h
\82®
534 Board.Sorted := True;
536 sl := TStringList.Create;
538 if FileExists(FileName) then begin
539 sl.LoadFromFile(FileName);
541 //
\82Q
\8ds
\96Ú
\82©
\82ç
\81i
\82P
\8ds
\96Ú
\82Í
\83o
\81[
\83W
\83\87\83\93\81j
542 for i := sl.Count - 1 downto 1 do begin
543 Rec := ParseIndexLine(sl[i]);
545 ThreadItem := TThreadItem.Create(
547 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
549 ThreadItem := TThreadItem.Create(
551 Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' ) ) );
553 if FileList.Count <> 0 then
554 if FileList.Find( ThreadItem.FileName, Index ) then
555 FileList.Delete( Index );
557 ThreadItem.BeginUpdate;
558 ThreadItem.No := Rec.FNo;
559 ThreadItem.FileName := Rec.FFileName;
560 ThreadItem.Title := Rec.FTitle;
561 ThreadItem.Count := Rec.FCount;
562 ThreadItem.Size := Rec.FSize;
563 // ThreadItem.RoundNo := Rec.FRoundNo;
564 ThreadItem.RoundDate := Rec.FRoundDate;
565 ThreadItem.LastModified := Rec.FLastModified;
566 ThreadItem.Kokomade := Rec.FKokomade;
567 ThreadItem.NewReceive := Rec.FNewReceive;
568 // ThreadItem.Round := Rec.FRound;
569 ThreadItem.UnRead := Rec.FUnRead;
570 ThreadItem.ScrollTop := Rec.FScrollTop;
571 ThreadItem.AllResCount := Rec.FAllResCount;
572 ThreadItem.NewResCount := Rec.FNewResCount;
573 ThreadItem.AgeSage := Rec.FAgeSage;
574 ThreadItem.ParentBoard := Board;
575 {*
\82¨
\8bC
\82É
\93ü
\82è
\91å
\97Ê
\90¶
\90¬
\83R
\81[
\83h *}
577 FavoThreadItem := TFavoriteThreadItem.Create( ThreadItem.URL, ThreadItem.Title, ThreadItem );
578 Node := FavoriteDM.TreeView.Items.AddChildObject( FavoriteDM.TreeView.Items.Item[0], ThreadItem.Title, FavoThreadItem);
581 //
\8f\84\89ñ
\83\8a\83X
\83g
\82É
\91¶
\8dÝ
\82µ
\82½
\82ç
\8f\84\89ñ
\83t
\83\89\83O
\83Z
\83b
\83g
582 if ThreadItem.IsLogFile then begin
583 idx := RoundList.Find(ThreadItem);
584 if idx <> -1 then begin
585 RoundItem := RoundList.Items[idx, grtItem];
586 ThreadItem.RoundName := RoundItem.RoundName;
587 ThreadItem.Round := True;
591 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\83`
\83F
\83b
\83N
592 if TmpFileList.Count <> 0 then begin
593 if TmpFileList.Find(ChangeFileExt(ThreadItem.FileName, '.tmp'), Index) then begin
594 ini := TMemIniFile.Create(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
596 tmpStr := ini.ReadString('Setting', 'RoundDate', DateTimeToStr(ZERO_DATE));
597 ThreadItem.RoundDate := ConvertDateTimeString(tmpStr);
599 tmpStr := ini.ReadString('Setting', 'LastModified', DateTimeToStr(ZERO_DATE));
600 ThreadItem.LastModified := ConvertDateTimeString(tmpStr);
601 ThreadItem.Count := ini.ReadInteger('Setting', 'Count', 0);
602 ThreadItem.NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
604 ThreadItem.Size := ini.ReadInteger('Setting', 'Size', 0);
605 if(ThreadItem.Size = 0) and (FileExists(ThreadItem.GetThreadFileName)) then begin
607 ThreadItem.Size := GetFileSize(ThreadItem.GetThreadFileName) - ThreadItem.Count;
613 ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
614 ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
615 ThreadItem.ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
616 ThreadItem.AllResCount := ini.ReadInteger('Setting', 'AllResCount', ThreadItem.Count);
617 ThreadItem.NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
618 ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
622 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
623 TmpFileList.Delete(Index);
627 ThreadItem.EndUpdate;
628 Board.Add(ThreadItem);
630 if (ThreadItem.IsLogFile) and (ThreadItem.UnRead) then
635 if UnRead <> Board.UnRead then
636 Board.UnRead := UnRead;
638 //
\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
639 for i := 0 to FileList.Count - 1 do begin
640 FileName := ExtractFileDir(Board.GetFolderIndexFileName) + '\' + FileList[i];
642 //ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
643 if usePlugIn then begin
644 ThreadItem := TThreadItem.Create(
646 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), FileList[i] ) );
647 ResRec := DivideStrLine(Board.BoardPlugIn.GetDat( DWORD( ThreadItem ), 1 ));
649 ThreadItem := TThreadItem.Create(
650 nil, Get2chBoard2ThreadURL( Board, ChangeFileExt( FileList[i], '' ) ) );
651 ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
654 ThreadItem.BeginUpdate;
655 ThreadItem.FilePath := FileName;
656 ThreadItem.No := Board.Count + 1;
657 ThreadItem.FileName := FileList[i];
658 ThreadItem.Title := ResRec.FTitle;
659 ThreadItem.Count := GetFileLineCount(FileName);
660 ThreadItem.AllResCount := ThreadItem.Count;
661 ThreadItem.NewResCount := ThreadItem.Count;
662 ThreadItem.Size := GetFileSize(FileName) - ThreadItem.Count;//1byte
\82¸
\82ê
\82é
\82Æ
\82«
\82ª
\82 \82é
\82¯
\82Ç
\82»
\82ê
\82Í
\82 \82«
\82ç
\82ß
\82é
663 ThreadItem.RoundDate := ZERO_DATE;
664 ThreadItem.LastModified := ZERO_DATE;
665 ThreadItem.Kokomade := -1;
666 ThreadItem.NewReceive := ThreadItem.Count;
667 ThreadItem.ParentBoard := Board;
668 ThreadItem.IsLogFile := True;
669 ThreadItem.Round := False;
670 ThreadItem.UnRead := False;
671 ThreadItem.ScrollTop := 0;
672 ThreadItem.AgeSage := gasNone;
673 ThreadItem.EndUpdate;
674 Board.Add(ThreadItem);
681 Board.Sorted := False;
683 Board.IsThreadDatRead := True;
686 (*************************************************************************
687 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b(Folder.idx)
\8dì
\90¬
688 *************************************************************************)
689 procedure TGikoSys.CreateThreadDat(Board: TBoard);
693 SubjectList: TStringList;
699 if not FileExists(Board.GetSubjectFileName) then Exit;
700 FileName := Board.GetFolderIndexFileName;
702 SubjectList := TStringList.Create;
704 SubjectList.LoadFromFile(Board.GetSubjectFileName);
705 sl := TStringList.Create;
708 sl.Add(FOLDER_INDEX_VERSION);
709 for i := 0 to SubjectList.Count - 1 do begin
710 Rec := DivideSubject(SubjectList[i]);
712 if (Trim(Rec.FFileName) = '') or (Trim(Rec.FTitle) = '') then
715 s := Format('%x', [cnt]) + #1 //
\94Ô
\8d\86
716 + Rec.FFileName + #1 //
\83t
\83@
\83C
\83\8b\96¼
717 + Rec.FTitle + #1 //
\83^
\83C
\83g
\83\8b
718 + Format('%x', [Rec.FCount]) + #1 //
\83J
\83E
\83\93\83g
719 + Format('%x', [0]) + #1 //size
720 + Format('%x', [0]) + #1 //RoundDate
721 + Format('%x', [0]) + #1 //LastModified
722 + Format('%x', [0]) + #1 //Kokomade
723 + Format('%x', [0]) + #1 //NewReceive
724 + '0' + #1 //
\96¢
\8eg
\97p
725 + Format('%x', [0]) + #1 //UnRead
726 + Format('%x', [0]) + #1 //ScrollTop
727 + Format('%x', [Rec.FCount]) + #1 //AllResCount
728 + Format('%x', [0]) + #1 //NewResCount
729 + Format('%x', [0]); //AgeSage
734 sl.SaveToFile(FileName);
743 (*************************************************************************
744 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X(Thread.dat)
\8f\91\82«
\8d\9e\82Ý
746 *************************************************************************)
747 procedure TGikoSys.WriteThreadDat(Board: TBoard);
749 // Values: array[Boolean] of string = ('0', '1');
755 TmpFileList: TStringList;
757 if not Board.IsThreadDatRead then
759 FileName := Board.GetFolderIndexFileName;
760 ForceDirectoriesEx( ExtractFilePath( FileName ) );
762 sl := TStringList.Create;
763 TmpFileList := TStringList.Create;
764 TmpFileList.Sorted := true;
766 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, false);
768 sl.Add(FOLDER_INDEX_VERSION);
770 //
\83X
\83\8c\94Ô
\8d\86\95Û
\91¶
\82Ì
\82½
\82ß
\83\
\81[
\83g
771 Sort.SortNoFlag := true;
772 Sort.SortOrder := true;
774 //Sort.SortNonAcquiredCountFlag := GikoSys.Setting.NonAcquiredCount;
775 Board.CustomSort(ThreadItemSortProc);
777 for i := 0 to Board.Count - 1 do begin
778 Board.Items[i].No := i + 1;
779 s := Format('%x', [Board.Items[i].No]) + #1
780 + Board.Items[i].FileName + #1
781 + Board.Items[i].Title + #1
782 + Format('%x', [Board.Items[i].Count]) + #1
783 + Format('%x', [Board.Items[i].Size]) + #1
784 + Format('%x', [DateTimeToInt(Board.Items[i].RoundDate)]) + #1
785 + Format('%x', [DateTimeToInt(Board.Items[i].LastModified)]) + #1
786 + Format('%x', [Board.Items[i].Kokomade]) + #1
787 + Format('%x', [Board.Items[i].NewReceive]) + #1
788 + '0' + #1 //
\96¢
\8eg
\97p
789 + Format('%x', [BoolToInt(Board.Items[i].UnRead)]) + #1
790 + Format('%x', [Board.Items[i].ScrollTop]) + #1
791 + Format('%x', [Board.Items[i].AllResCount]) + #1
792 + Format('%x', [Board.Items[i].NewResCount]) + #1
793 + Format('%x', [Ord(Board.Items[i].AgeSage)]);
798 sl.SaveToFile(FileName);
800 for i := 0 to TmpFileList.Count - 1 do begin
801 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[i]);
810 function TGikoSys.ParseIndexLine(Line: string): TIndexRec;
812 Result.FNo := StrToIntDef('$' + RemoveToken(Line, #1), 0);
813 Result.FFileName := RemoveToken(Line, #1);
814 Result.FTitle := RemoveToken(Line, #1);
815 Result.FCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
816 Result.FSize := StrToIntDef('$' + RemoveToken(Line, #1), 0);
817 Result.FRoundDate := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
818 Result.FLastModified := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
819 Result.FKokomade := StrToIntDef('$' + RemoveToken(Line, #1), -1);
820 Result.FNewReceive := StrToIntDef('$' + RemoveToken(Line, #1), 0);
821 RemoveToken(Line, #1);//9: ; //
\96¢
\8eg
\97p
822 Result.FUnRead := IntToBool(StrToIntDef('$' + RemoveToken(Line, #1), 0));
823 Result.FScrollTop := StrToIntDef('$' + RemoveToken(Line, #1), 0);
824 Result.FAllResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
825 Result.FNewResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
826 Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + RemoveToken(Line, #1), 0));
830 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
831 // ListFiles('c:\', '*.txt', list, True);
832 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
835 SearchRec : TSearchRec;
839 maskExt := Copy(Mask, 1, Length(Mask) - 1);
841 Path := IncludeTrailingPathDelimiter(Path);
842 rc := FindFirst(Path + '*.*', faAnyfile, SearchRec);
844 while rc = 0 do begin
845 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
846 s := Path + SearchRec.Name;
847 //if (SearchRec.Attr and faDirectory > 0) then
848 // s := IncludeTrailingPathDelimiter(s)
850 if (SearchRec.Attr and faDirectory = 0) and (MatchesMask(s, Mask)) then
854 List.Add(SearchRec.Name);
855 if SubDir and (SearchRec.Attr and faDirectory > 0) then
856 GetFileList(s, Mask, List, True, IsPathAdd);
858 rc := FindNext(SearchRec);
861 SysUtils.FindClose(SearchRec);
865 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
866 //
\83T
\83u
\83t
\83H
\83\8b\83_
\82Í
\8c\9f\8dõ
\82µ
\82È
\82¢
867 // ListFiles('c:\', '*.txt', list, True);
868 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean);
871 SearchRec : TSearchRec;
874 Path := IncludeTrailingPathDelimiter(Path);
875 rc := FindFirst(Path + Mask, faAnyfile, SearchRec);
877 while rc = 0 do begin
878 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
879 s := Path + SearchRec.Name;
881 if (SearchRec.Attr and faDirectory = 0) then
885 List.Add(SearchRec.Name);
887 rc := FindNext(SearchRec);
890 SysUtils.FindClose(SearchRec);
894 //
\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é
895 procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
898 SearchRec : TSearchRec;
901 Path := IncludeTrailingPathDelimiter(Path);
902 rc := FindFirst(Path + '*.*', faDirectory, SearchRec);
904 while rc = 0 do begin
905 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
906 s := Path + SearchRec.Name;
907 //if (SearchRec.Attr and faDirectory > 0) then
908 // s := IncludeTrailingPathDelimiter(s)
910 if (SearchRec.Attr and faDirectory > 0) and (MatchesMask(s, Mask)) then
911 List.Add( IncludeTrailingPathDelimiter( s ) );
912 if SubDir and (SearchRec.Attr and faDirectory > 0) then
913 GetDirectoryList(s, Mask, List, True);
915 rc := FindNext(SearchRec);
918 SysUtils.FindClose(SearchRec);
922 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
923 function TGikoSys.LoadFromSkin(
925 ThreadItem: TThreadItem;
932 Skin := TStringList.Create;
934 if FileExists( fileName ) then begin
935 Skin.LoadFromFile( fileName );
937 //
\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
939 if ThreadItem.ParentBoard <> nil then
940 if ThreadItem.ParentBoard.ParentCategory <> nil then
941 CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
942 CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
944 CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
945 CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
946 CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
947 CustomStringReplace( Skin, '<SKINPATH/>', Setting.CSSFileName);
948 CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.Count - ThreadItem.NewResCount ));
949 CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
950 CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.Count ));
952 CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
953 CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
954 CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
956 //-----
\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µ
957 //
\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
959 if ThreadItem.ParentBoard <> nil then
960 if ThreadItem.ParentBoard.ParentCategory <> nil then
961 CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
962 CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
964 CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
965 CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
966 CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
967 CustomStringReplace( Skin, '&SKINPATH', Setting.CSSFileName);
968 CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
969 CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
970 CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
972 CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
973 CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
974 CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
975 //-----
\82±
\82±
\82Ü
\82Å
983 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
984 function TGikoSys.SkinedRes(
992 Skin := CustomStringReplace( Skin, '<NUMBER/>',
993 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
994 Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
995 Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
996 Skin := CustomStringReplace( Skin, '<MAILNAME/>',
997 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
998 Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
999 Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
1000 Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
1002 //-----
\82©
\82¿
\82ã
\81`
\82µ
\82á
\8cÝ
\8a·
\97p
\81B
\83R
\83\81\83\93\83g
\83A
\83E
\83g
\82µ
\82Ä
\82à
\82æ
\82µ
1003 Skin := CustomStringReplace( Skin, '&NUMBER',
1004 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1005 Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
1006 Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
1007 Skin := CustomStringReplace( Skin, '&MAILNAME',
1008 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1009 Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
1010 Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
1011 Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
1012 //-----
\82±
\82±
\82Ü
\82Å
1020 procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
1024 //bufList : TStringList;
1025 ReadList: TStringList;
1026 SaveList: TStringList;
1027 CSSFileName: string;
1030 NewReceiveNo: Integer;
1032 boardPlugIn : TBoardPlugIn;
1034 UserOptionalStyle: string;
1039 function LoadSkin( fileName: string ): string;
1041 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1043 function ReplaceRes( skin: string ): string;
1045 Result := SkinedRes( skin, Res, No );
1048 if ThreadItem <> nil then begin
1049 if ThreadItem.IsBoardPlugInAvailable then begin
1050 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1051 boardPlugIn := ThreadItem.BoardPlugIn;
1052 NewReceiveNo := ThreadItem.NewReceive;
1053 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1054 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1055 UserOptionalStyle := UserOptionalStyle +
1056 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1057 if GikoSys.Setting.BrowserFontSize <> 0 then
1058 UserOptionalStyle := UserOptionalStyle +
1059 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1060 if GikoSys.Setting.BrowserFontColor <> -1 then
1061 UserOptionalStyle := UserOptionalStyle +
1062 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1063 if GikoSys.Setting.BrowserBackColor <> -1 then
1064 UserOptionalStyle := UserOptionalStyle +
1065 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1066 case GikoSys.Setting.BrowserFontBold of
1067 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1068 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1070 case GikoSys.Setting.BrowserFontItalic of
1071 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1072 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1075 SaveList := TStringList.Create;
1078 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1079 // doc.charset := 'Shift_JIS';
1082 SaveList.Add( boardPlugIn.GetHeader( DWORD( threadItem ),
1083 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) );
1085 for i := 0 to threadItem.Count - 1 do begin
1086 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1087 if i <> 0 then begin
1088 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1091 if ThreadItem.Kokomade > (i + 1) then
1094 if NewReceiveNo > (i + 1) then
1097 if (threadItem.Count - i) > ResRange then
1102 //
\90V
\92\85\83}
\81[
\83N
1103 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1105 if GikoSys.Setting.UseSkin then begin
1106 if FileExists( GetSkinNewmarkFileName ) then
1107 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1109 SaveList.Add( '<a name="new"></a>' );
1110 end else if GikoSys.Setting.UseCSS then begin
1111 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>');
1113 SaveList.Add('</dl>');
1114 SaveList.Add('<a name="new"></a>');
1115 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>');
1116 SaveList.Add('<dl>');
1119 SaveList.Add( '<a name="new"></a>' );
1124 SaveList.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
1126 if ThreadItem.Kokomade = (i + 1) then begin
1127 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1129 if GikoSys.Setting.UseSkin then begin
1130 if FileExists( GetSkinBookmarkFileName ) then
1131 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1133 SaveList.Add( '<a name="koko"></a>' );
1134 end else if GikoSys.Setting.UseCSS then begin
1135 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1137 SaveList.Add('</dl>');
1138 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>');
1139 SaveList.Add('<dl>');
1142 SaveList.Add( '<a name="koko"></a>' );
1146 doc.Write(SaveList.Text);
1151 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1152 SaveList.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1154 doc.Write(SaveList.Text);
1163 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1164 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1165 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1166 ShortDayNames[7] := '
\93y';
1167 BBSID := ThreadItem.ParentBoard.BBSID;
1168 NewReceiveNo := ThreadItem.NewReceive;
1169 ReadList := TStringList.Create;
1171 if ThreadItem.IsLogFile then begin
1172 FileName := ThreadItem.GetThreadFileName;
1173 ReadList.LoadFromFile(FileName);
1174 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1175 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1176 FSelectResFilter.ExecuteEx(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1177 Res := DivideStrLine(ReadList[0]);
1178 Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1179 sTitle := Res.FTitle;
1181 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1183 SaveList := TStringList.Create;
1186 doc.charset := 'Shift_JIS';
1188 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1189 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1190 UserOptionalStyle := UserOptionalStyle +
1191 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1192 if GikoSys.Setting.BrowserFontSize <> 0 then
1193 UserOptionalStyle := UserOptionalStyle +
1194 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1195 if GikoSys.Setting.BrowserFontColor <> -1 then
1196 UserOptionalStyle := UserOptionalStyle +
1197 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1198 if GikoSys.Setting.BrowserBackColor <> -1 then
1199 UserOptionalStyle := UserOptionalStyle +
1200 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1201 case GikoSys.Setting.BrowserFontBold of
1202 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1203 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1205 case GikoSys.Setting.BrowserFontItalic of
1206 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1207 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1210 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1211 if GikoSys.Setting.UseSkin then begin
1212 //
\83X
\83L
\83\93\8eg
\97p
1213 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1215 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1216 if Length( UserOptionalStyle ) > 0 then
1217 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1218 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1219 SaveList.Add( SkinHeader );
1223 SkinNewRes := LoadSkin( GetSkinNewResFileName );
1227 SkinRes := LoadSkin( GetSkinResFileName );
1231 SaveList.Add('<a name="top"></a>');
1233 for i := 0 to ReadList.Count - 1 do begin
1234 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1235 if i <> 0 then begin
1236 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1239 if ThreadItem.Kokomade > (i + 1) then
1242 if NewReceiveNo > (i + 1) then
1245 if (threadItem.Count - i) > ResRange then
1250 //
\90V
\92\85\83}
\81[
\83N
1251 if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
1253 if FileExists( GetSkinNewmarkFileName ) then
1254 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1256 SaveList.Add( '<a name="new"></a>' );
1258 SaveList.Add( '<a name="new"></a>' );
1261 if (Trim(ReadList[i]) <> '') then begin
1262 No := IntToStr(i + 1);
1264 Res := DivideStrLine(ReadList[i]);
1265 if Res.FType = glt2chOld then begin
1266 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1267 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1268 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1271 Res.FBody := AddAnchorTag(Res.FBody);
1272 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1275 if NewReceiveNo <= (i + 1) then
1276 //
\90V
\92\85\83\8c\83X
1277 SaveList.Add( ReplaceRes( SkinNewRes ) )
1279 //
\92Ê
\8fí
\82Ì
\83\8c\83X
1280 SaveList.Add( ReplaceRes( SkinRes ) );
1285 if ThreadItem.Kokomade = (i + 1) then begin
1286 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1288 if FileExists( GetSkinBookmarkFileName ) then
1289 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1291 SaveList.Add( '<a name="koko"></a>' );
1293 SaveList.Add( '<a name="koko"></a>' );
1296 doc.Write(SaveList.Text);
1299 SaveList.Add('<a name="bottom"></a>');
1300 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1302 SaveList.Add( LoadSkin( GetSkinFooterFileName ) );
1305 doc.Write(SaveList.Text);
1307 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1309 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1310 // SaveList.Add('<html lang="ja"><head>');
1311 SaveList.Add('<html><head>');
1312 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1313 SaveList.Add('<title>' + sTitle + '</title>');
1314 SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
1315 if Length( UserOptionalStyle ) > 0 then
1316 SaveList.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1317 SaveList.Add('</head>');
1318 SaveList.Add('<body>');
1319 SaveList.Add('<a name="top"></a>');
1320 SaveList.Add('<div class="title">' + sTitle + '</div>');
1321 doc.Write(SaveList.Text);
1323 //Application.ProcessMessages;
1324 for i := 0 to ReadList.Count - 1 do begin
1325 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1326 if i <> 0 then begin
1327 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1330 if ThreadItem.Kokomade > (i + 1) then
1333 if NewReceiveNo > (i + 1) then
1336 if (threadItem.Count - i) > ResRange then
1341 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1342 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>');
1344 if (Trim(ReadList[i]) <> '') then begin
1345 No := IntToStr(i + 1);
1346 Res := DivideStrLine(ReadList[i]);
1347 Res.FBody := AddAnchorTag(Res.FBody);
1348 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1349 if Res.FMailTo = '' then
1350 SaveList.Add('<a name="' + No + '"></a>'
1351 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1352 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1353 + '<span class="name"><b>' + Res.FName + '</b></span> '
1354 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1355 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1356 + '<div class="mes">' + Res.FBody + ' </div>')
1357 else if GikoSys.Setting.ShowMail then
1358 SaveList.Add('<a name="' + No + '"></a>'
1359 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1360 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1361 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1362 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1363 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1364 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1365 + '<div class="mes">' + Res.FBody + ' </div>')
1367 SaveList.Add('<a name="' + No + '"></a>'
1368 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1369 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1370 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1371 + '<b>' + Res.FName + '</b></a>'
1372 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1373 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1374 + '<div class="mes">' + Res.FBody + ' </div>');
1376 if ThreadItem.Kokomade = (i + 1) then begin
1377 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1380 doc.Write(SaveList.Text);
1383 SaveList.Add('<a name="bottom"></a>');
1384 SaveList.Add('</body></html>');
1385 SaveList.Add('<a name="last"></a>');
1386 SaveList.Add('</body></html>');
1388 doc.Write(SaveList.Text);
1391 // SaveList.Add('<html lang="ja"><head>');
1392 SaveList.Add('<html><head>');
1393 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1394 SaveList.Add('<title>' + sTitle + '</title></head>');
1395 SaveList.Add('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1396 SaveList.Add('<a name="top"></a>');
1397 SaveList.Add('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1398 SaveList.Add('<dl>');
1399 doc.Write(SaveList.Text);
1401 //Application.ProcessMessages;
1402 for i := 0 to ReadList.Count - 1 do begin
1403 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1404 if i <> 0 then begin
1405 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1408 if ThreadItem.Kokomade > (i + 1) then
1411 if NewReceiveNo > (i + 1) then
1414 if (threadItem.Count - i) > ResRange then
1419 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1420 SaveList.Add('</dl>');
1421 SaveList.Add('<a name="new"></a>');
1422 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>');
1423 SaveList.Add('<dl>');
1425 if (Trim(ReadList[i]) <> '') then begin
1426 No := IntToStr(i + 1);
1427 Res := DivideStrLine(ReadList[i]);
1428 if Res.FType = glt2chOld then begin
1429 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1430 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1431 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1433 Res.FBody := AddAnchorTag(Res.FBody);
1434 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1435 if Res.FMailTo = '' then
1436 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>')
1437 else if GikoSys.Setting.ShowMail then
1438 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>')
1440 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>');
1442 if ThreadItem.Kokomade = (i + 1) then begin
1443 SaveList.Add('</dl>');
1444 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>');
1445 SaveList.Add('<dl>');
1447 doc.Write(SaveList.Text);
1450 SaveList.Add('</dl>');
1451 SaveList.Add('<a name="bottom"></a>');
1452 SaveList.Add('</body></html>');
1453 doc.Write(SaveList.Text);
1463 procedure TGikoSys.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
1467 //bufList : TStringList;
1468 ReadList: TStringList;
1469 // SaveList: TStringList;
1470 CSSFileName: string;
1474 boardPlugIn : TBoardPlugIn;
1476 UserOptionalStyle: string;
1480 function LoadSkin( fileName: string ): string;
1482 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1484 function ReplaceRes( skin: string ): string;
1486 Result := SkinedRes( skin, Res, No );
1490 if ThreadItem <> nil then begin
1491 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1494 if ThreadItem.IsBoardPlugInAvailable then begin
1495 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1496 boardPlugIn := ThreadItem.BoardPlugIn;
1497 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1498 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1499 UserOptionalStyle := UserOptionalStyle +
1500 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1501 if GikoSys.Setting.BrowserFontSize <> 0 then
1502 UserOptionalStyle := UserOptionalStyle +
1503 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1504 if GikoSys.Setting.BrowserFontColor <> -1 then
1505 UserOptionalStyle := UserOptionalStyle +
1506 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1507 if GikoSys.Setting.BrowserBackColor <> -1 then
1508 UserOptionalStyle := UserOptionalStyle +
1509 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1510 case GikoSys.Setting.BrowserFontBold of
1511 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1512 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1514 case GikoSys.Setting.BrowserFontItalic of
1515 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1516 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1520 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1522 tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
1523 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
1524 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1525 if Setting.UseSkin then begin
1526 tmp1 := './' +Setting.CSSFileName;
1527 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1528 tmp1 := CustomStringReplace(tmp1, '\', '/');
1529 tmp := CustomStringReplace(tmp, ExtractFilePath(Setting.CSSFileName), tmp1);
1530 end else if Setting.UseCSS then begin
1531 tmp1 := './' + CSSFileName;
1532 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1533 tmp1 := CustomStringReplace(tmp1, '\', '/');
1534 tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
1538 for i := 0 to threadItem.Count - 1 do begin
1541 html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
1544 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1545 html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1552 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1553 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1554 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1555 ShortDayNames[7] := '
\93y';
1556 BBSID := ThreadItem.ParentBoard.BBSID;
1557 ReadList := TStringList.Create;
1559 if ThreadItem.IsLogFile then begin
1560 FileName := ThreadItem.GetThreadFileName;
1561 ReadList.LoadFromFile(FileName);
1562 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1563 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1564 FSelectResFilter.ExecuteEx(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1565 Res := DivideStrLine(ReadList[0]);
1566 Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1567 sTitle := Res.FTitle;
1569 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1572 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1573 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1574 UserOptionalStyle := UserOptionalStyle +
1575 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1576 if GikoSys.Setting.BrowserFontSize <> 0 then
1577 UserOptionalStyle := UserOptionalStyle +
1578 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1579 if GikoSys.Setting.BrowserFontColor <> -1 then
1580 UserOptionalStyle := UserOptionalStyle +
1581 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1582 if GikoSys.Setting.BrowserBackColor <> -1 then
1583 UserOptionalStyle := UserOptionalStyle +
1584 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1585 case GikoSys.Setting.BrowserFontBold of
1586 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1587 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1589 case GikoSys.Setting.BrowserFontItalic of
1590 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1591 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1595 if GikoSys.Setting.UseSkin then begin
1596 //
\83X
\83L
\83\93\8eg
\97p
1597 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1599 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1600 if Length( UserOptionalStyle ) > 0 then
1601 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1602 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1603 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1604 tmp1 := './' +Setting.CSSFileName;
1605 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1606 tmp1 := CustomStringReplace(tmp1, '\', '/');
1607 SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(Setting.CSSFileName), tmp1);
1608 html.Append( SkinHeader );
1612 SkinRes := LoadSkin( GetSkinResFileName );
1615 html.Append('<a name="top"></a>');
1616 for i := 0 to ReadList.Count - 1 do begin
1617 if (Trim(ReadList[i]) <> '') then begin
1618 No := IntToStr(i + 1);
1620 Res := DivideStrLine(ReadList[i]);
1621 if Res.FType = glt2chOld then begin
1622 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1623 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1624 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1627 Res.FBody := AddAnchorTag(Res.FBody);
1628 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1631 html.Append( ReplaceRes( SkinRes ) );
1637 html.Append('<a name="bottom"></a>');
1638 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1640 html.Append( LoadSkin( GetSkinFooterFileName ) );
1643 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1645 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1646 html.Append('<html><head>');
1647 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1648 html.Append('<title>' + sTitle + '</title>');
1649 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1650 tmp1 := './' + CSSFileName;
1651 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1652 tmp1 := CustomStringReplace(tmp1, '\', '/');
1654 html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
1655 if Length( UserOptionalStyle ) > 0 then
1656 html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1657 html.Append('</head>');
1658 html.Append('<body>');
1659 html.Append('<a name="top"></a>');
1660 html.Append('<div class="title">' + sTitle + '</div>');
1661 for i := 0 to ReadList.Count - 1 do begin
1662 if (Trim(ReadList[i]) <> '') then begin
1663 No := IntToStr(i + 1);
1664 Res := DivideStrLine(ReadList[i]);
1665 Res.FBody := AddAnchorTag(Res.FBody);
1666 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1667 if Res.FMailTo = '' then
1668 html.Append('<a name="' + No + '"></a>'
1669 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1670 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1671 + '<span class="name"><b>' + Res.FName + '</b></span> '
1672 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1673 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1674 + '<div class="mes">' + Res.FBody + ' </div>')
1675 else if GikoSys.Setting.ShowMail then
1676 html.Append('<a name="' + No + '"></a>'
1677 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1678 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1679 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1680 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1681 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1682 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1683 + '<div class="mes">' + Res.FBody + ' </div>')
1685 html.Append('<a name="' + No + '"></a>'
1686 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1687 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1688 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1689 + '<b>' + Res.FName + '</b></a>'
1690 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1691 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1692 + '<div class="mes">' + Res.FBody + ' </div>');
1695 html.Append('<a name="bottom"></a>');
1696 html.Append('</body></html>');
1697 html.Append('<a name="last"></a>');
1698 html.Append('</body></html>');
1701 html.Append('<html><head>');
1702 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1703 html.Append('<title>' + sTitle + '</title></head>');
1704 html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1705 html.Append('<a name="top"></a>');
1706 html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1707 html.Append('<dl>');
1708 for i := 0 to ReadList.Count - 1 do begin
1709 if (Trim(ReadList[i]) <> '') then begin
1710 No := IntToStr(i + 1);
1711 Res := DivideStrLine(ReadList[i]);
1712 if Res.FType = glt2chOld then begin
1713 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1714 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1715 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1717 Res.FBody := AddAnchorTag(Res.FBody);
1718 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1719 if Res.FMailTo = '' then
1720 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<font color="forestgreen"><b> ' + Res.FName + ' </b></font>
\93\8a\8de
\93ú
\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1721 else if GikoSys.Setting.ShowMail then
1722 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + ']
\93\8a\8de
\93ú
\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1724 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a>
\93\8a\8de
\93ú
\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>');
1727 html.Append('</dl>');
1728 html.Append('<a name="bottom"></a>');
1729 html.Append('</body></html>');
1738 function TGikoSys.ConvertResAnchor(res: string): string;
1740 _HEAD : string = '<a href="../';
1741 _TAIL : string = ' target="_blank">';
1742 _ST: string = '&st=';
1743 _TO: string = '&to=';
1744 _STA: string = '&START=';
1745 _END: string = '&END=';
1751 i := AnsiPos(_HEAD, res);
1752 while i <> 0 do begin
1753 Result := Result + Copy(res, 1, i -1);
1754 Delete(res, 1, i - 1);
1755 j := AnsiPos(_TAIL, res);
1757 Result := Result + res;
1760 tmp := Copy(res, 1, j - 1);
1761 Delete(res, 1, j + 16);
1762 if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
1763 Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
1764 Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
1765 Result := Result + '<a href="#' + tmp + '">';
1766 end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
1767 Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
1768 Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
1769 Result := Result + '<a href="#' + tmp + '">';
1771 k := LastDelimiter('/', tmp);
1773 if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
1774 Delete(tmp, AnsiPos('-', tmp), Length(tmp))
1776 Delete(tmp, AnsiPos('"', tmp), Length(tmp));
1778 Result := Result + '<a href="#' + tmp + '">';
1780 i := AnsiPos(_HEAD, res);
1782 Result := Result + res;
1786 (*************************************************************************
1787 *http://
\82Ì
\95¶
\8e\9a\97ñ
\82ðanchor
\83^
\83O
\95t
\82«
\82É
\82·
\82é
\81B
1788 *************************************************************************)
1789 function TGikoSys.AddAnchorTag(s: string): string;
1791 URL_CHAR: string = '0123456789'
1792 + 'abcdefghijklmnopqrstuvwxyz'
1793 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1794 + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
1795 ANCHOR_REF = 'href=';
1796 RES_REF = '>>';
1798 wkIdx: array[0..9] of Integer;
1803 anchorLen : Integer;
1806 // + 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ß
1807 anchorLen := Length( ANCHOR_REF ) + 3;
1810 wkIdx[0] := AnsiPos('http://', s);
1811 wkIdx[1] := AnsiPos('ttp://', s);
1812 wkIdx[2] := AnsiPos('tp://', s);
1813 wkIdx[3] := AnsiPos('ms-help://', s);
1814 wkIdx[4] := AnsiPos('p://', s);
1815 wkIdx[5] := AnsiPos('https://', s);
1816 wkIdx[6] := AnsiPos('www.', s);
1817 wkIdx[7] := AnsiPos('ftp://', s);
1818 wkIdx[8] := AnsiPos('news://', s);
1819 wkIdx[9] := AnsiPos('rtsp://', s);
1823 if wkIdx[i] <> 0 then idx := Min(wkIdx[i], idx);
1825 if idx = MaxInt then begin
1826 //
\83\8a\83\93\83N
\82ª
\96³
\82¢
\82æ
\81B
1827 Result := Result + s;
1832 (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
1833 //
\8aù
\82É
\83\8a\83\93\83N
\83^
\83O
\82ª
\82Â
\82¢
\82Ä
\82¢
\82é
\82Á
\82Û
\82¢
\82Æ
\82«
\82Í
\83\80\83V
1834 href := Copy( s, idx, Length( s ) );
1835 Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
1837 s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
1842 Result := Result + Copy(s, 0, idx - 1);
1844 s := Copy(s, idx, length(s));
1846 b := Length( s ) + 1;
1847 for i := 1 to b do begin
1851 idx := AnsiPos(s[i], URL_CHAR);
1852 if idx = 0 then begin
1853 //URL
\82¶
\82á
\82È
\82¢
\95¶
\8e\9a\94
\8c©
\81I
\82Æ
\82©
\81A
\95¶
\8e\9a\82ª
\82È
\82
\82È
\82Á
\82½
\81B
1854 url := Copy(s, 0, i - 1);
1856 if AnsiPos('ttp://', url) = 1 then
1858 else if AnsiPos('tp://', url) = 1 then
1860 else if AnsiPos('p://', url) = 1 then
1862 else if AnsiPos('www.', url) = 1 then
1863 href := 'http://' + url
1866 Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
1867 s := Copy(s, i, MaxInt);
1874 (*************************************************************************
1875 *
\83T
\83u
\83W
\83F
\83N
\83g
\88ê
\8ds
\82ð
\95ª
\8a\84
1876 *************************************************************************)
1877 function TGikoSys.DivideSubject(Line: string): TSubjectRec;
1887 if AnsiPos('<>', Line) = 0 then
1891 Result.FFileName := RemoveToken(Line, Delim);
1892 Result.FTitle := RemoveToken(Line, Delim);
1894 ws := Trim(Result.FTitle);
1896 if Copy(ws, Length(ws), 1) = ')' then begin
1899 end else if Copy(ws, Length(ws), 1) = '
\81j' then begin
1902 end else if Copy(ws, Length(ws), 1) = '<' then begin
1907 for i := Length(ws) - 1 downto 1 do begin
1908 if ws[i] = LeftK then begin
1909 ws := Copy(ws, i + 1, Length(ws) - i - 1);
1910 if IsNumeric(ws) then
1911 Result.FCount := StrToInt(ws);
1912 Result.FTitle := Trim(CustomStringReplace(Result.FTitle, LeftK + ws + RightK, ''));
1918 (*************************************************************************
1919 * dat
\83t
\83@
\83C
\83\8b\82Ì
\88ê
\83\89\83C
\83\93\82ð
\95ª
\89ð
1920 *************************************************************************)
1921 function TGikoSys.DivideStrLine(Line: string): TResRec;
1926 if AnsiPos('<>', Line) = 0 then begin
1928 Result.FType := glt2chOld;
1931 Result.FType := glt2chNew;
1933 Result.FName := Trim(RemoveToken(Line, Delim));
1934 Result.FMailTo := Trim(RemoveToken(Line, Delim));
1935 Result.FDateTime := Trim(RemoveToken(Line, Delim));
1936 bufBody := Trim(RemoveToken(Line, Delim));
1938 if bufbody = '' then begin
1939 Insert(' ',bufbody, 1);
1941 Result.FBody := bufBody;
1942 Result.FTitle := Trim(RemoveToken(Line, Delim));
1946 (*************************************************************************
1947 * URL
\82©
\82çBBSID
\82ð
\8eæ
\93¾
1948 *************************************************************************)
1949 function TGikoSys.UrlToID(url: string): string;
1956 if url = '' then Exit;
1958 url := Copy(url, 0, Length(url) - 1);
1959 for i := Length(url) downto 0 do begin
1960 if url[i] = '/' then begin
1961 Result := Copy(url, i + 1, Length(url));
1967 (*************************************************************************
1968 *URL
\82©
\82çBBSID
\88È
\8aO
\82Ì
\95\94\95ª(http://teri.2ch.net/)
\82ð
\8eæ
\93¾
1969 *************************************************************************)
1970 function TGikoSys.UrlToServer(url: string): string;
1977 wsURL := Trim(wsURL);
1979 if wsURL = '' then exit;
1981 if Copy(wsURL, Length(wsURL), 1) = '/' then
1982 wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
1984 for i := Length(wsURL) downto 0 do begin
1985 if wsURL[i] = '/' then begin
1986 Result := Copy(wsURL, 0, i);
1992 (*************************************************************************
1993 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\83`
\83F
\83b
\83N
1994 *************************************************************************)
1995 function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
1999 Code := GetFileAttributes(PChar(Name));
2000 Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
2003 (*************************************************************************
2004 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\8dì
\90¬
\81i
\95¡
\90\94\8aK
\91w
\91Î
\89\9e\81j
2005 *************************************************************************)
2006 function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
2009 if Length(Dir) = 0 then
2010 raise Exception.Create('
\83t
\83H
\83\8b\83_
\82ª
\8dì
\90¬
\8fo
\97\88\82Ü
\82¹
\82ñ');
2011 Dir := ExcludeTrailingPathDelimiter(Dir);
2012 if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
2013 or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
2014 Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
2017 (*************************************************************************
2018 *
\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
2019 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2020 *************************************************************************)
2021 function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2025 Result := StrTokNext(sep, Rec);
2028 (*************************************************************************
2029 *
\95¶
\8e\9a\97ñ
\82©
\82ç
\83g
\81[
\83N
\83\93\82Ì
\90Ø
\82è
\8fo
\82µ
2030 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2031 *************************************************************************)
2032 function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2039 if Len >= Pos then begin
2040 while (Pos <= Len) and (Str[Pos] in sep) do begin
2044 while (Pos<= Len) and not (Str[Pos] in sep) do begin
2045 if IsDBCSLeadByte(Byte(Str[Pos])) then begin
2050 Result := Copy(Str, I, Pos - I);
2051 while (Pos <= Len) and (Str[Pos] in sep) do begin//
\82±
\82ê
\82Í
\82¨
\8dD
\82Ý
2058 (*************************************************************************
2059 *
\83t
\83@
\83C
\83\8b\83T
\83C
\83Y
\8eæ
\93¾
2060 *************************************************************************)
2061 function TGikoSys.GetFileSize(FileName : string): longint;
2066 if not FileExists(FileName) then begin
2070 Assign(F, FileName);
2072 Result := FileSize(F);
2079 (*************************************************************************
2080 *
\83t
\83@
\83C
\83\8b\8ds
\90\94\8eæ
\93¾
2081 *************************************************************************)
2082 function TGikoSys.GetFileLineCount(FileName : string): longint;
2086 sl := TStringList.Create;
2089 sl.LoadFromFile(FileName);
2100 (*************************************************************************
2101 *
\83X
\83\8c\83b
\83h
\83t
\83@
\83C
\83\8b\82©
\82ç
\8ew
\92è
\8ds
\82ð
\8eæ
\93¾
2102 *************************************************************************)
2103 function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
2105 fileTmp : TStringList;
2108 if FileExists(FileName) then begin
2109 fileTmp := TStringList.Create;
2112 fileTmp.LoadFromFile( FileName );
2113 if ( Line >= 1 ) and ( Line < fileTmp.Count + 1 ) then begin
2114 Result := fileTmp.Strings[ Line-1 ];
2117 //on EFOpenError do Result := '';
2125 (*************************************************************************
2126 *
\83V
\83X
\83e
\83\80\83\81\83j
\83\85\81[
\83t
\83H
\83\93\83g
\82Ì
\91®
\90«
\82ð
\8eæ
\93¾
2127 *************************************************************************)
2128 procedure TGikoSys.MenuFont(Font: TFont);
2131 nm: NONCLIENTMETRICS;
2133 nm.cbSize := sizeof(NONCLIENTMETRICS);
2135 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
2136 lf := nm.lfMenuFont;
2138 Font.Name := lf.lfFaceName;
2139 Font.Height := lf.lfHeight;
2141 if lf.lfWeight >= 700 then
2142 Font.Style := Font.Style + [fsBold];
2143 if lf.lfItalic = 1 then
2144 Font.Style := Font.Style + [fsItalic];
2147 (*************************************************************************
2149 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2150 *************************************************************************)
2151 function TGikoSys.RemoveToken(var s: string;const delimiter: string): string;
2155 p := AnsiPos(delimiter, s);
2159 Result := Copy(s, 1, p - 1);
2160 s := Copy(s, Length(Result) + Length(delimiter) + 1, Length(s));
2163 (*************************************************************************
2165 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2166 *************************************************************************)
2167 function TGikoSys.GetTokenIndex(s: string; delimiter: string; index: Integer): string;
2172 for i := 0 to index do
2173 Result := RemoveToken(s, delimiter);
2176 (*************************************************************************
2178 *************************************************************************)
2179 function TGikoSys.DeleteLink(const s: string): string;
2189 s1 := GetTokenIndex(s, '<a href="', i);
2190 s2 := GetTokenIndex(s, '<a href="', i + 1);
2192 idx := Pos('">', s1);
2194 Delete(s1, 1, idx + 1);
2195 idx := Pos('">', s2);
2197 Delete(s2, 1, idx + 1);
2199 Result := Result + s1 + s2;
2208 //
\83C
\83\93\83f
\83b
\83N
\83X
\96¢
\8dX
\90V
\83o
\83b
\83t
\83@
\82ð
\83t
\83\89\83b
\83V
\83\85\81I
2209 {procedure TGikoSys.FlashExitWrite;
2213 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
2214 for i := 0 to FExitWrite.Count - 1 do
2215 WriteThreadDat(FExitWrite[i]);
2219 (*************************************************************************
2220 *
\83X
\83\8c\96¼
\82È
\82Ç
\82ð
\92Z
\82¢
\96¼
\91O
\82É
\95Ï
\8a·
\82·
\82é
2222 *************************************************************************)
2223 function TGikoSys.GetShortName(const LongName: string; ALength: integer): string;
2225 ERASECHAR : array [1..39] of string =
2226 ('
\81\99','
\81\9a','
\81¡','
\81 ','
\81\9f','
\81\9e','
\81Q','
\81\94','
\81£','
\81¥',
2227 '
\81¢','
\81¤','
\81\9c','
\81\9b','
\81\9d','
\81y','
\81z','
\81ô','
\81s','
\81t',
2228 '
\81g','
\81h','
\81k','
\81l','
\81e','
\81f','
\81\83','
\81\84','
\81á','
\81â',
2229 '
\81o','
\81p','
\81q','
\81r','
\81w','
\81x','
\81¬','
\81c', '
\81@');
2231 Chr : array [0..255] of char;
2235 s := Trim(LongName);
2236 if (Length(s) <= ALength) then begin
2240 for i := Low(ERASECHAR) to High(ERASECHAR) do begin
2241 S := CustomStringReplace(S, ERASECHAR[i], '');
2243 if (Length(S) <= ALength) then begin
2246 Windows.LCMapString(
2247 GetUserDefaultLCID(),
2255 S := Copy(S,1,ALength);
2257 if (ByteType(S, Length(S)) = mbLeadByte ) then begin
2258 S := Copy(S, 1, Length(S) - 1);
2268 (*************************************************************************
2271 *************************************************************************)
2272 function TGikoSys.ConvRes(const Body, Bbs, Key,
2273 ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
2274 DatToHTML: boolean = false): string;
2278 FIndexFrom : integer;
2285 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2299 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2304 FIndex.FIndexFrom := IndexFrom;
2305 FIndex.FIndexTo := IndexTo;
2309 function ChooseString(const Text, Separator: string; Index: integer): string;
2315 for i := 0 to Index - 1 do begin
2316 if (AnsiPos(Separator, S) = 0) then S := ''
2317 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2319 p := AnsiPos(Separator, S);
2320 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2329 List:= TList.Create;
2335 b := ByteType(s, i);
2337 mbSingleByte : begin
2338 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2339 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2347 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2348 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2354 if (not sw) and (Copy(s,i,4) = GT) then begin
2355 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2363 if ((not sw) and (Copy(s,i,1) = ',')) or
2364 ((not sw) and (Copy(s,i,1) = '=')) then begin
2365 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2366 ((Chk) and (oc = '')) or
2367 ((not Chk) and (al)) then
2377 if (AnsiPos(sx, SN) > 0) then begin
2380 if (No <> '') and (No <> '-') then begin
2393 if Copy(s,i,1) = '<' then oc := '';
2394 oc := oc + Copy(s,i,1);
2400 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2406 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2414 if (AnsiPos(sx, ZN) > 0) then begin
2415 No := No + ZenToHan(sx);
2417 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2432 if (i > Length(Body)) then begin
2434 if (No <> '') then Add(sp, i, No);
2439 for i := List.Count - 1 downto 0 do begin
2440 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2441 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2442 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2444 st := PIndex(List[i]).FNo;
2445 et := PIndex(List[i]).FNo;
2447 if not DatToHTML then
2448 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2449 Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2450 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2451 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2452 Copy(r,PIndex(List[i]).FIndexTo,Length(r))
2454 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2455 Format('<a href="#%s">', [st]) +
2456 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2457 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2459 Dispose(PIndex(List[i]));
2465 function TGikoSys.ConvRes(
2466 const Body, Bbs, Key, ParamBBS, ParamKey,
2467 ParamStart, ParamTo, ParamNoFirst,
2468 ParamTrue, FullURL : string
2473 FIndexFrom : integer;
2480 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2494 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2499 FIndex.FIndexFrom := IndexFrom;
2500 FIndex.FIndexTo := IndexTo;
2504 function ChooseString(const Text, Separator: string; Index: integer): string;
2510 for i := 0 to Index - 1 do begin
2511 if (AnsiPos(Separator, S) = 0) then S := ''
2512 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2514 p := AnsiPos(Separator, S);
2515 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2524 List:= TList.Create;
2530 b := ByteType(s, i);
2532 mbSingleByte : begin
2533 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2534 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2542 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2543 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2549 if (not sw) and (Copy(s,i,4) = GT) then begin
2550 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2558 if ((not sw) and (Copy(s,i,1) = ',')) or
2559 ((not sw) and (Copy(s,i,1) = '=')) then begin
2560 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2561 ((Chk) and (oc = '')) or
2562 ((not Chk) and (al)) then
2572 if (AnsiPos(sx, SN) > 0) then begin
2575 if (No <> '') and (No <> '-') then begin
2588 if Copy(s,i,1) = '<' then oc := '';
2589 oc := oc + Copy(s,i,1);
2595 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2601 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2609 if (AnsiPos(sx, ZN) > 0) then begin
2610 No := No + ZenToHan(sx);
2612 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2627 if (i > Length(Body)) then begin
2629 if (No <> '') then Add(sp, i, No);
2634 for i := List.Count - 1 downto 0 do begin
2635 //plName := Copy(PluginName, LastDelimiter('\',PluginName) + 1, Length(PluginName) - LastDelimiter('/',PluginName) -1 );
2636 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2637 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2638 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2640 st := PIndex(List[i]).FNo;
2641 et := PIndex(List[i]).FNo;
2643 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2644 Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2645 [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2646 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2647 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2648 Dispose(PIndex(List[i]));
2655 function TGikoSys.BoolToInt(b: Boolean): Integer;
2657 Result := IfThen(b, 1, 0);
2660 function TGikoSys.IntToBool(i: Integer): Boolean;
2665 //gzip
\82Å
\88³
\8fk
\82³
\82ê
\82½
\82Ì
\82ð
\96ß
\82·
2666 function TGikoSys.GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
2670 GZipStream: TGzipDecompressStream;
2671 TextStream: TStringStream;
2672 buf: array[0..BUF_SIZE - 1] of Byte;
2678 TextStream := TStringStream.Create('');
2680 //
\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¢)
2681 // if LowerCase(Trim(ContentEncoding)) = 'gzip' then begin
2682 if AnsiPos('gzip', LowerCase(Trim(ContentEncoding))) > 0 then begin
2683 ResStream.Position := 0;
2684 GZipStream := TGzipDecompressStream.Create(TextStream);
2687 FillChar(buf, BUF_SIZE, 0);
2688 cnt := ResStream.Read(buf, BUF_SIZE);
2690 GZipStream.Write(buf, BUF_SIZE);
2696 ResStream.Position := 0;
2698 FillChar(buf, BUF_SIZE, 0);
2699 cnt := ResStream.Read(buf, BUF_SIZE);
2701 TextStream.Write(buf, BUF_SIZE);
2705 //NULL
\95¶
\8e\9a\82ð"*"
\82É
\82·
\82é
2706 s := TextStream.DataString;
2708 while (i > 0) and (s[i] = #0) do
2713 while i <> 0 do begin
2723 procedure TGikoSys.LoadKeySetting(ActionList: TActionList);
2725 STD_SEC = 'KeySetting';
2731 SecList: TStringList;
2732 Component: TComponent;
2734 if not FileExists(GetConfigDir + KEY_SETTING_FILE_NAME) then
2736 SecList := TStringList.Create;
2737 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2739 ini.ReadSection(STD_SEC, SecList);
2740 for i := 0 to SecList.Count - 1 do begin
2741 ActionName := SecList[i];
2742 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2743 if ActionKey <> -1 then begin
2744 Component := ActionList.Owner.FindComponent(ActionName);
2745 if TObject(Component) is TAction then begin
2746 TAction(Component).ShortCut := ActionKey;
2756 procedure TGikoSys.SaveKeySetting(ActionList: TActionList);
2758 STD_SEC = 'KeySetting';
2763 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2765 for i := 0 to ActionList.ActionCount - 1 do begin
2766 if ActionList.Actions[i].Tag = -1 then
2768 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2776 procedure TGikoSys.LoadEditorKeySetting(ActionList: TActionList);
2778 STD_SEC = 'KeySetting';
2784 SecList: TStringList;
2785 Component: TComponent;
2787 if not FileExists(GetConfigDir + EKEY_SETTING_FILE_NAME) then
2789 SecList := TStringList.Create;
2790 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2792 ini.ReadSection(STD_SEC, SecList);
2793 for i := 0 to SecList.Count - 1 do begin
2794 ActionName := SecList[i];
2795 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2796 if ActionKey <> -1 then begin
2797 Component := ActionList.Owner.FindComponent(ActionName);
2798 if TObject(Component) is TAction then begin
2799 TAction(Component).ShortCut := ActionKey;
2809 procedure TGikoSys.SaveEditorKeySetting(ActionList: TActionList);
2811 STD_SEC = 'KeySetting';
2816 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2818 for i := 0 to ActionList.ActionCount - 1 do begin
2819 if ActionList.Actions[i].Tag = -1 then
2821 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2830 procedure TGikoSys.CreateProcess(const AppPath: string; const Param: string);
2832 PI: TProcessInformation;
2836 Path := '"' + AppPath + '"';
2838 Path := Path + ' ' + Param;
2840 SI.Cb := SizeOf(Si);
2841 SI.lpReserved := nil;
2842 SI.lpDesktop := nil;
2845 SI.cbReserved2 := 0;
2846 SI.lpReserved2 := nil;
2848 Windows.CreateProcess(nil,
2860 procedure TGikoSys.OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
2864 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2865 gbtUserApp, gbtAuto:
2866 if (Setting.URLApp) and (FileExists(Setting.URLAppFile)) then
2867 GikoSys.CreateProcess(Setting.URLAppFile, URL)
2869 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2873 function TGikoSys.HTMLDecode(const AStr: String): String;
2875 Sp, Rp, Cp, Tp: PChar;
2880 SetLength(Result, Length(AStr));
2882 Rp := PChar(Result);
2885 while Sp^ <> #0 do begin
2891 'a': if AnsiStrPos(Sp, 'amp;') = Sp then
2897 'g': if (AnsiStrPos(Sp, 'lt;') = Sp) or (AnsiStrPos(Sp, 'gt;') = Sp) then
2901 while (Sp^ <> ';') and (Sp^ <> #0) do
2908 'q': if AnsiStrPos(Sp, 'quot;') = Sp then
2916 Num := IsNumeric(Copy(Tp, 1, 1));
2917 while (Sp^ <> ';') and (Sp^ <> #0) do begin
2918 if (Num) and (not IsNumeric(Copy(Sp, 1, 1))) then
2922 SetString(S, Tp, Sp - Tp);
2927 //raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2928 //[Cp^ + Sp^, Cp - PChar(AStr)])
2938 // on E:EConvertError do
2939 // raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2940 // [Cp^ + Sp^, Cp - PChar(AStr)])
2942 SetLength(Result, Rp - PChar(Result));
2945 function TGikoSys.GetHRefText(s: string): string;
2955 Index := AnsiPos('href', LowerCase(s));
2958 s := Trim(Copy(s, Index + 4, Length(s)));
2959 s := Trim(Copy(s, 2, Length(s)));
2961 //
\8en
\82ß
\82Ì
\95¶
\8e\9a\82ª'"'
\82È
\82ç
\8eæ
\82è
\8f\9c\82
2962 //if Copy(s, 1, 1) = '"' then begin
2963 if s[1] = '"' then begin
2964 s := Trim(Copy(s, 2, Length(s)));
2967 Index := AnsiPos('"', s);
2968 if Index <> 0 then begin
2969 //'"'
\82Ü
\82ÅURL
\82Æ
\82·
\82é
2970 s := Copy(s, 1, Index - 1);
2972 //'"'
\82ª
\96³
\82¯
\82ê
\82Î
\83X
\83y
\81[
\83X
\82©">"
\82Ì
\91\81\82¢
\95û
\82Ü
\82Å
\82ðURL
\82Æ
\82·
\82é
2973 Index := AnsiPos(' ', s);
2974 Index2 := AnsiPos('>', s);
2977 if Index > Index2 then
2980 s := Copy(s, 1, Index - 1)
2982 //
\82±
\82ê
\88È
\8fã
\82à
\82¤
\92m
\82ç
\82ñ
\82Ê
2988 //
\83z
\83X
\83g
\96¼
\82ª
\82Q
\82\83\82\88\82©
\82Ç
\82¤
\82©
\83`
\83F
\83b
\83N
\82·
\82é
2989 function TGikoSys.Is2chHost(Host: string): Boolean;
2991 HOST_NAME: array[0..1] of string = ('2ch.net', 'bbspink.com');
2997 if RightStr( Host, 1 ) = '/' then
2998 Host := Copy( Host, 1, Length( Host ) - 1 );
2999 OutputDebugString(pchar(HOST_NAME[0]));
3000 for i := 0 to Length(HOST_NAME) - 1 do begin
3001 // Len := Length(HOST_NAME[i]);
3002 if AnsiPos(HOST_NAME[i], Host) = (Length(Host) - Length(HOST_NAME[i]) + 1) then begin
3009 function TGikoSys.Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
3019 Index := AnsiPos(READ_PATH, path);
3020 if Index <> 0 then begin
3021 s := Copy(path, Index + Length(READ_PATH), Length(path));
3024 BBSID := GetTokenIndex(s, '/', 0);
3025 BBSKey := GetTokenIndex(s, '/', 1);
3028 Result := (BBSID <> '') or (BBSKey <> '');
3031 Index := AnsiPos(KAKO_PATH, path);
3032 if Index <> 0 then begin
3033 s := Copy(path, 2, Length(path));
3034 BBSID := GetTokenIndex(s, '/', 0);
3035 if (BBSID = 'log') and (GetTokenIndex(s, '/', 2) = 'kako') then
3036 BBSID := GetTokenIndex(s, '/', 1);
3037 BBSKey := ChangeFileExt(Document, '');
3038 Result := (BBSID <> '') or (BBSKey <> '');
3041 Index := AnsiPos('read.cgi?', URL);
3042 if Index <> 0 then begin
3043 SList := TStringList.Create;
3046 // s := HTMLDecode(Document);
3047 ExtractHTTPFields(['?', '&'], [], PChar(URL), SList, False);
3048 BBSID := SList.Values['bbs'];
3049 BBSKey := SList.Values['key'];
3050 Result := (BBSID <> '') or (BBSKey <> '');
3060 procedure TGikoSys.GetPopupResNumber(URL : string; var stRes, endRes : Int64);
3067 URL := Trim(LowerCase(URL));
3068 if (AnsiPos('&st=', URL ) <> 0) and ( AnsiPos( '&to=',URL) <> 0 ) then begin
3072 buf := Copy( URL, AnsiPos('&st=', URL ) + 4, AnsiPos( '&to=',URL) - AnsiPos('&st=', URL ) - 4 );
3074 stRes := StrToInt64( buf );
3075 if AnsiPos( '&nofirst=',URL) <> 0 then begin
3076 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, AnsiPos( '&nofirst=',URL) - AnsiPos('&to=', URL ) - 4);
3078 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, Length( URL ) - AnsiPos('&to=', URL ) - 4 + 1 );
3081 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3082 buf := Copy( buf, 1, ps );
3086 endRes := StrToInt64(buf)
3093 if (stRes <> 0) and (endRes = 0) then
3094 endRes := stRes + MAX_POPUP_RES
3095 else if (stRes = 0) and (endRes <> 0) then begin
3096 stRes := endRes - MAX_POPUP_RES;
3100 GikoSys.GetBrowsableThreadURL( URL );
3101 end else if( AnsiPos('&res=', URL ) <> 0 ) then begin
3103 buf := Copy( URL, AnsiPos('&res=', URL ) + 5, Length( URL ) - AnsiPos('&res=', URL ) - 5 + 1 );
3106 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3107 buf := Copy( buf, 1, ps );
3110 stRes := StrToInt(buf)
3117 end else if (AnsiPos('&start=', URL ) <> 0) and ( AnsiPos( '&end=',URL) <> 0 ) then begin
3119 stRes := StrToInt64( Copy( URL, AnsiPos('&start=', URL ) + 7, AnsiPos( '&end=',URL) - AnsiPos('&start=', URL ) - 7 ) );
3120 if AnsiPos( '&nofirst=',URL) <> 0 then begin
3121 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, AnsiPos( '&nofirst=',URL) - AnsiPos('&end=', URL ) - 5);
3123 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, Length( URL ) - AnsiPos('&to=', URL ) - 5 + 1 );
3126 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3127 buf := Copy( buf, 1, ps );
3131 endRes := StrToInt64(buf);
3138 end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
3139 buf := Copy(URL, LastDelimiter('/',URL)+1,Length(URL)-LastDelimiter('/',URL)+1);
3140 if Length(buf) > 0 then begin
3141 if AnsiPos('-', buf) = 1 then begin
3146 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3148 convBuf := Copy( buf, 1, ps );
3149 if convBuf <> '' then
3150 endRes := StrToInt64(convBuf)
3156 if endRes <> 0 then begin
3157 stRes := endRes - MAX_POPUP_RES;
3164 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3166 convBuf := Copy( buf, 1, ps );
3167 if convBuf <> '' then begin
3168 stRes := StrToInt64(convBuf);
3172 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3174 convBuf := Copy( buf, 1, ps );
3175 if convBuf <> '' then
3176 endRes := StrToInt64(convBuf)
3197 function TGikoSys.Parse2chURL2(URL: string): TPathRec;
3202 // convBuf : String;
3213 URL := Trim(LowerCase(URL));
3218 Result.FFirst := False;
3219 Result.FStBegin := False;
3220 Result.FToEnd := False;
3221 Result.FDone := False;
3222 Result.FNoParam := False;
3226 if URL[length(URL)] = '\' then
3228 FAWKStr.RegExp := 'http://.+\.(2ch\.net|bbspink\.com)/';
3229 if FAWKStr.Match(FAWKStr.ProcessEscSeq(URL), RStart, RLength) <> 0 then begin
3230 s := Copy(URL, RStart + RLength - 1, Length(URL));
3232 //
\95W
\8f\80\8f\91\8e®
3233 //
\8dÅ
\8cã
\82Íl50, 10, 10-20, 10n, 10-20n, -10, 10-, 10n-
\82È
\82Ç
3234 //http://xxx.2ch.net/test/read.cgi/bbsid/1000000000/
3235 FAWKStr.RegExp := '/test/read.cgi/.+/[0-9]+/?.*';
3236 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3237 s := Copy(s, 15, Length(s));
3239 SList := TStringList.Create;
3242 FAWKStr.RegExp := '/';
3243 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 3 then begin
3244 Result.FBBS := SList[1];
3245 Result.FKey := SList[2];
3246 if SList.Count >= 4 then
3250 Result.FNoParam := true;
3256 FAWKStr.LineSeparator := mcls_CRLF;
3257 FAWKStr.RegExp := '-';
3258 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) = 0 then begin
3259 Result.FFirst := True;
3261 FAWKStr.RegExp := 'l[0-9]+';
3262 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3263 Result.FFirst := True;
3265 for i := 0 to SList.Count - 1 do begin
3266 if Trim(SList[i]) = '' then begin
3268 Result.FStBegin := True;
3269 if i = (SList.Count - 1) then
3270 Result.FToEnd := True;
3271 end else if IsNumeric(SList[i]) then begin
3272 wkInt := StrToInt(SList[i]);
3273 wkMax := Max(wkMax, wkInt);
3277 wkMin := Min(wkMin, wkInt);
3278 end else if Trim(SList[i]) = 'n' then begin
3279 Result.FFirst := True;
3281 FAWKStr.RegExp := '^n[0-9]+$|^[0-9]+n$';
3282 if FAWKStr.Match(FAWKStr.ProcessEscSeq(SList[i]), RStart, RLength) > 0 then begin
3283 if Copy(SList[i], 1, 1) = 'n' then
3284 wkInt := StrToInt(Copy(SList[i], 2, Length(SList[i])))
3286 wkInt := StrToInt(Copy(SList[i], 1, Length(SList[i]) - 1));
3287 Result.FFirst := True;
3288 wkMax := Max(wkMax, wkInt);
3292 wkMin := Min(wkMin, wkInt);
3296 if Result.FStBegin and (not Result.FToEnd) then
3298 else if (not Result.FStBegin) and Result.FToEnd then
3300 else if (not Result.FStBegin) and (not Result.FToEnd) then begin
3301 Result.FSt := wkMin;
3302 Result.FTo := wkMax;
3304 //Result.FSt := wkMin;
3305 //Result.FTo := wkMax;
3311 Result.FDone := True;
3315 //
\90Vkako
\8f\91\8e®
3316 //http://server.2ch.net/ITA_NAME/kako/1000/10000/1000000000.html
3317 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+/[0-9]+\.html';
3318 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3319 SList := TStringList.Create;
3322 FAWKStr.RegExp := '/';
3323 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3324 Result.FBBS := SList[1];
3325 Result.FKey := ChangeFileExt(SList[5], '');
3326 Result.FFirst := True;
3332 Result.FDone := True;
3336 //
\8b\8ckako
\8f\91\8e®
3337 //http://server.2ch.net/ITA_NAME/kako/999/999999999.html
3338 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+\.html';
3339 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3340 SList := TStringList.Create;
3343 FAWKStr.RegExp := '/';
3344 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 5 then begin
3345 Result.FBBS := SList[1];
3346 Result.FKey := ChangeFileExt(SList[4], '');
3347 Result.FFirst := True;
3353 Result.FDone := True;
3357 //log
\8by
\82Ñlog2
\8f\91\8e®
3358 //http://server.2ch.net/log/ITA_NAME/kako/999/999999999.html
3359 //http://server.2ch.net/log2/ITA_NAME/kako/999/999999999.html
3360 FAWKStr.RegExp := '/log2?/.+/kako/[0-9]+/[0-9]+\.html';
3361 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3362 SList := TStringList.Create;
3365 FAWKStr.RegExp := '/';
3366 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3367 Result.FBBS := SList[2];
3368 Result.FKey := ChangeFileExt(SList[5], '');
3369 Result.FFirst := True;
3375 Result.FDone := True;
3380 //
\8b\8cURL
\8f\91\8e®
3381 //http://server.2ch.net/test/read.cgi?bbs=ITA_NAME&key=1000000000&st=1&to=5&nofirst=true
3382 FAWKStr.RegExp := '/test/read\.cgi\?';
3383 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3384 s := Copy(s, 16, Length(s));
3385 SList := TStringList.Create;
3388 FAWKStr.RegExp := '&';
3389 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
3390 Result.FFirst := True;
3391 for i := 0 to SList.Count - 1 do begin
3392 if Pos('bbs=', SList[i]) = 1 then begin
3393 Result.FBBS := Copy(SList[i], 5, Length(SList[i]));
3394 end else if Pos('key=', SList[i]) = 1 then begin
3395 Result.FKey := Copy(SList[i], 5, Length(SList[i]));
3396 end else if Pos('st=', SList[i]) = 1 then begin
3397 wk := Copy(SList[i], 4, Length(SList[i]));
3398 if IsNumeric(wk) then
3399 Result.FSt := StrToInt(wk)
3400 else if wk = '' then
3401 Result.FStBegin := True;
3402 end else if Pos('to=', SList[i]) = 1 then begin
3403 wk := Copy(SList[i], 4, Length(SList[i]));
3404 if IsNumeric(wk) then
3405 Result.FTo := StrToInt(wk)
3406 else if wk = '' then
3407 Result.FToEnd := True;
3408 end else if Pos('nofirst=', SList[i]) = 1 then begin
3409 Result.FFirst := False;
3418 if (Result.FBBS <> '') and (Result.FKey <> '') then begin
3419 Result.FDone := True;
3426 procedure TGikoSys.ParseURI(var URL, Protocol, Host, Path, Document, Port, Bookmark: string);
3436 URI := TIdURI.Create(URL);
3438 Protocol := URI.Protocol;
3441 Document := URI.Document;
3443 Bookmark := URI.Bookmark;
3449 function TGikoSys.GetVersionBuild: Integer;
3451 FixedFileInfo: PVSFixedFileInfo;
3452 VersionHandle, VersionSize: DWORD;
3453 pVersionInfo: Pointer;
3458 AppFile := Application.ExeName;
3459 VersionSize := GetFileVersionInfoSize(pChar(AppFile), VersionHandle);
3460 if VersionSize = 0 then
3462 GetMem(pVersionInfo, VersionSize);
3464 if GetFileVersionInfo(PChar(AppFile),VersionHandle,VersionSize, pVersionInfo) then
3465 if VerQueryValue(pVersionInfo, '\', Pointer(FixedFileInfo), ItemLen) then
3466 Result := LOWORD(FixedFileInfo^.dwFileVersionLS);
3468 FreeMem(pVersionInfo, VersionSize);
3472 function TGikoSys.GetBrowsableThreadURL(
3476 threadItem : TThreadItem;
3477 boardPlugIn : TBoardPlugIn;
3481 //=====
\83v
\83\89\83O
\83C
\83\93
3483 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
3484 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
3485 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
3486 boardPlugIn := BoardPlugIns[ i ];
3487 threadItem := TThreadItem.Create( boardPlugIn, inURL );
3488 Result := threadItem.URL;
3496 // 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¢
3499 if Length( Result ) = 0 then
3500 Result := GikoSys.Get2chBrowsableThreadURL( inURL );
3504 function TGikoSys.GetThreadURL2BoardURL(
3508 threadItem : TThreadItem;
3509 boardPlugIn : TBoardPlugIn;
3513 //=====
\83v
\83\89\83O
\83C
\83\93
3515 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
3516 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
3517 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
3518 boardPlugIn := BoardPlugIns[ i ];
3519 threadItem := TThreadItem.Create( boardPlugIn, inURL );
3520 Result := BoardPlugIns[ i ].GetBoardURL( Longword( threadItem ) );
3528 // 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¢
3531 if Length( Result ) = 0 then
3532 Result := GikoSys.Get2chThreadURL2BoardURL( inURL );
3536 function TGikoSys.Get2chThreadURL2BoardURL(
3540 Protocol, Host, Path, Document, Port, Bookmark : string;
3541 BBSID, BBSKey : string;
3545 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3546 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3548 foundPos := Pos( '/test/read.cgi', inURL );
3549 if {(Is2chHost(Host)) and} (foundPos > 0) then
3550 Result := Copy( inURL, 1, foundPos ) + BBSID + '/'
3552 Result := Protocol + '://' + Host + '/' + BBSID + '/';
3556 function TGikoSys.Get2chBrowsableThreadURL(
3560 Protocol, Host, Path, Document, Port, Bookmark : string;
3561 BBSID, BBSKey : string;
3565 // if Pos( KAKO_PATH, inURL ) > 0 then begin
3568 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3569 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3570 foundPos := Pos( '/test/read.cgi', inURL ) - 1;
3572 if Is2chHost( Host ) then begin
3573 Result := Protocol + '://' + Host +
3574 READ_PATH + BBSID + '/' + BBSKey + '/l50';
3576 if foundPos > 0 then
3577 Result := Copy( inURL, 1, foundPos ) +
3578 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50'
3580 Result := Protocol + '://' + Host +
3581 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50';
3587 function TGikoSys.Get2chBoard2ThreadURL(
3595 server := UrlToServer( inBoard.URL );
3596 if Is2chHost( server ) then
3597 Result := server + 'test/read.cgi/' + inBoard.BBSID + '/' + inKey + '/l50'
3599 Result := server + 'test/read.cgi?bbs=' + inBoard.BBSID + '&key=' + inKey + '&ls=50';
3603 (*************************************************************************
3604 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\97ñ
\8b\93
3605 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3606 *************************************************************************)
3607 procedure TGikoSys.ListBoardFile;
3609 boardFileList : TStringList;
3615 for i := 0 to Length( BBSs ) - 1 do
3619 SetLength( BBSs, 0 );
3622 //
\94Â
\83\8a\83X
\83g
\82Ì
\97ñ
\8b\93
3623 if FileExists( GikoSys.GetBoardFileName ) then begin
3624 SetLength( BBSs, l + 1 );
3625 BBSs[ l ] := TBBS.Create( GikoSys.GetBoardFileName );
3626 BBSs[ l ].Title := '
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é';
3630 if FileExists( GikoSys.GetCustomBoardFileName ) then begin
3631 SetLength( BBSs, l + 1 );
3632 BBSs[ l ] := TBBS.Create( GikoSys.GetCustomBoardFileName );
3633 BBSs[ l ].Title := '
\82»
\82Ì
\91¼';
3637 // Board
\83t
\83H
\83\8b\83_
3638 if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
3639 BoardFileList := TStringList.Create;
3641 GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
3642 for k := BoardFileList.Count - 1 downto 0 do begin
3643 if AnsiCompareText(ExtractFileExt(BoardFileList[ k ]), '.bak') = 0 then
3644 BoardFileList.Delete(k);
3646 SetLength( BBSs, l + BoardFileList.Count );
3647 for i := BoardFileList.Count - 1 downto 0 do begin
3648 BBSs[ l ] := TBBS.Create( BoardFileList[ i ] );
3649 BBSs[ l ].Title := ChangeFileExt( ExtractFileName( BoardFileList[ i ] ), '' );
3660 (*************************************************************************
3661 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
3662 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3663 *************************************************************************)
3664 procedure TGikoSys.ReadBoardFile( bbs : TBBS );
3669 boardFile : TStringList;
3670 CategoryList : TStringList;
3671 BoardList : TStringList;
3672 Category : TCategory;
3675 RoundItem : TRoundItem;
3677 i, iBound : Integer;
3678 j, jBound : Integer;
3679 k, kBound : Integer;
3682 if not FileExists( bbs.FilePath ) then
3686 ini := TMemIniFile.Create('');
3687 boardFile := TStringList.Create;
3689 boardFile.LoadFromFile( bbs.FilePath );
3691 ini.SetStrings( boardFile );
3692 CategoryList := TStringList.Create;
3693 BoardList := TStringList.Create;
3695 ini.ReadSections( CategoryList );
3697 iBound := CategoryList.Count - 1;
3698 for i := 0 to iBound do begin
3699 ini.ReadSection( CategoryList[i], BoardList );
3700 Category := TCategory.Create;
3701 Category.No := i + 1;
3702 Category.Title := CategoryList[i];
3704 jBound := BoardList.Count - 1;
3705 for j := 0 to jBound do begin
3707 inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
3709 //=====
\83v
\83\89\83O
\83C
\83\93
3711 kBound := Length( BoardPlugIns ) - 1;
3712 for k := 0 to kBound do begin
3713 if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin
3714 if BoardPlugIns[ k ].AcceptURL( inistr ) = atBoard then begin
3715 Board := TBoard.Create( BoardPlugIns[ k ], inistr );
3722 // 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¢
3726 Board := TBoard.Create( nil, inistr );
3729 Board.Title := BoardList[j];
3730 Board.RoundDate := ZERO_DATE;
3732 idx := RoundList.Find(Board);
3733 if idx <> -1 then begin
3734 RoundItem := RoundList.Items[idx, grtBoard];
3735 Board.Round := True;
3736 Board.RoundName := RoundItem.RoundName;
3739 Category.Add(Board);
3744 bbs.Add( Category );
3746 bbs.IsBoardFileRead := True;
3758 function TGikoSys.GetUnknownCategory : TCategory;
3760 UNKNOWN_CATEGORY = '(
\96¼
\8fÌ
\95s
\96¾)';
3763 if Length( BBSs ) < 2 then begin
3768 Result := BBSs[ 1 ].FindCategoryFromTitle( UNKNOWN_CATEGORY );
3769 if Result = nil then begin
3770 Result := TCategory.Create;
3771 Result.Title := UNKNOWN_CATEGORY;
3772 BBSs[ 1 ].Add( Result );
3777 function TGikoSys.GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
3779 category : TCategory;
3781 UNKNOWN_BOARD = '(
\96¼
\8fÌ
\95s
\96¾)';
3784 category := GetUnknownCategory;
3785 if category = nil then begin
3788 Result := category.FindBoardFromTitle( UNKNOWN_BOARD );
3789 if Result = nil then begin
3790 Result := TBoard.Create( inPlugIn, inURL );
3791 Result.Title := UNKNOWN_BOARD;
3792 category.Add( Result );
3797 function TGikoSys.GetSambaFileName : string;
3799 Result := Setting.GetSambaFileName;
3801 procedure TGikoSys.SambaFileExists();
3804 sambaStrList: TStringList;
3806 if not FileExists(GikoSys.GetSambaFileName) then begin
3807 sambaTmp := ChangeFileExt(GikoSys.GetSambaFileName, '.default');
3808 sambaStrList := TStringList.Create;
3810 if FileExists(sambaTmp) then begin
3811 sambaStrList.LoadFromFile(sambaTmp);
3812 sambaStrList.SaveToFile(GikoSys.GetSambaFileName);
3821 GikoSys := TGikoSys.Create;
3824 if GikoSys <> nil then begin