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(const URL : string; var 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.ShortTitle := CustomStringReplace(ZenToHan(ThreadItem.Title), ' ', '');
562 ThreadItem.Count := Rec.FCount;
563 ThreadItem.Size := Rec.FSize;
564 // ThreadItem.RoundNo := Rec.FRoundNo;
565 ThreadItem.RoundDate := Rec.FRoundDate;
566 ThreadItem.LastModified := Rec.FLastModified;
567 ThreadItem.Kokomade := Rec.FKokomade;
568 ThreadItem.NewReceive := Rec.FNewReceive;
569 // ThreadItem.Round := Rec.FRound;
570 ThreadItem.UnRead := Rec.FUnRead;
571 ThreadItem.ScrollTop := Rec.FScrollTop;
572 ThreadItem.AllResCount := Rec.FAllResCount;
573 ThreadItem.NewResCount := Rec.FNewResCount;
574 ThreadItem.AgeSage := Rec.FAgeSage;
575 ThreadItem.ParentBoard := Board;
576 {*
\82¨
\8bC
\82É
\93ü
\82è
\91å
\97Ê
\90¶
\90¬
\83R
\81[
\83h *}
578 FavoThreadItem := TFavoriteThreadItem.Create( ThreadItem.URL, ThreadItem.Title, ThreadItem );
579 Node := FavoriteDM.TreeView.Items.AddChildObject( FavoriteDM.TreeView.Items.Item[0], ThreadItem.Title, FavoThreadItem);
582 //
\8f\84\89ñ
\83\8a\83X
\83g
\82É
\91¶
\8dÝ
\82µ
\82½
\82ç
\8f\84\89ñ
\83t
\83\89\83O
\83Z
\83b
\83g
583 if ThreadItem.IsLogFile then begin
584 idx := RoundList.Find(ThreadItem);
585 if idx <> -1 then begin
586 RoundItem := RoundList.Items[idx, grtItem];
587 ThreadItem.RoundName := RoundItem.RoundName;
588 ThreadItem.Round := True;
592 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\83`
\83F
\83b
\83N
593 if TmpFileList.Count <> 0 then begin
594 if TmpFileList.Find(ChangeFileExt(ThreadItem.FileName, '.tmp'), Index) then begin
595 ini := TMemIniFile.Create(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
597 tmpStr := ini.ReadString('Setting', 'RoundDate', DateTimeToStr(ZERO_DATE));
598 ThreadItem.RoundDate := ConvertDateTimeString(tmpStr);
600 tmpStr := ini.ReadString('Setting', 'LastModified', DateTimeToStr(ZERO_DATE));
601 ThreadItem.LastModified := ConvertDateTimeString(tmpStr);
602 ThreadItem.Count := ini.ReadInteger('Setting', 'Count', 0);
603 ThreadItem.NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
605 ThreadItem.Size := ini.ReadInteger('Setting', 'Size', 0);
606 if(ThreadItem.Size = 0) and (FileExists(ThreadItem.GetThreadFileName)) then begin
608 ThreadItem.Size := GetFileSize(ThreadItem.GetThreadFileName) - ThreadItem.Count;
614 ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
615 ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
616 ThreadItem.ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
617 ThreadItem.AllResCount := ini.ReadInteger('Setting', 'AllResCount', ThreadItem.Count);
618 ThreadItem.NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
619 ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
623 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
624 TmpFileList.Delete(Index);
628 ThreadItem.EndUpdate;
629 Board.Add(ThreadItem);
631 if (ThreadItem.IsLogFile) and (ThreadItem.UnRead) then
636 if UnRead <> Board.UnRead then
637 Board.UnRead := UnRead;
639 //
\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
640 for i := 0 to FileList.Count - 1 do begin
641 FileName := ExtractFileDir(Board.GetFolderIndexFileName) + '\' + FileList[i];
643 //ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
644 if usePlugIn then begin
645 ThreadItem := TThreadItem.Create(
647 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), FileList[i] ) );
648 ResRec := DivideStrLine(Board.BoardPlugIn.GetDat( DWORD( ThreadItem ), 1 ));
650 ThreadItem := TThreadItem.Create(
651 nil, Get2chBoard2ThreadURL( Board, ChangeFileExt( FileList[i], '' ) ) );
652 ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
655 ThreadItem.BeginUpdate;
656 ThreadItem.FilePath := FileName;
657 ThreadItem.No := Board.Count + 1;
658 ThreadItem.FileName := FileList[i];
659 ThreadItem.Title := ResRec.FTitle;
660 ThreadItem.Count := GetFileLineCount(FileName);
661 ThreadItem.AllResCount := ThreadItem.Count;
662 ThreadItem.NewResCount := ThreadItem.Count;
663 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é
664 ThreadItem.RoundDate := ZERO_DATE;
665 ThreadItem.LastModified := ZERO_DATE;
666 ThreadItem.Kokomade := -1;
667 ThreadItem.NewReceive := ThreadItem.Count;
668 ThreadItem.ParentBoard := Board;
669 ThreadItem.IsLogFile := True;
670 ThreadItem.Round := False;
671 ThreadItem.UnRead := False;
672 ThreadItem.ScrollTop := 0;
673 ThreadItem.AgeSage := gasNone;
674 ThreadItem.EndUpdate;
675 Board.Add(ThreadItem);
682 Board.Sorted := False;
684 Board.IsThreadDatRead := True;
687 (*************************************************************************
688 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b(Folder.idx)
\8dì
\90¬
689 *************************************************************************)
690 procedure TGikoSys.CreateThreadDat(Board: TBoard);
694 SubjectList: TStringList;
700 if not FileExists(Board.GetSubjectFileName) then Exit;
701 FileName := Board.GetFolderIndexFileName;
703 SubjectList := TStringList.Create;
705 SubjectList.LoadFromFile(Board.GetSubjectFileName);
706 sl := TStringList.Create;
709 sl.Add(FOLDER_INDEX_VERSION);
710 for i := 0 to SubjectList.Count - 1 do begin
711 Rec := DivideSubject(SubjectList[i]);
713 if (Trim(Rec.FFileName) = '') or (Trim(Rec.FTitle) = '') then
716 s := Format('%x', [cnt]) + #1 //
\94Ô
\8d\86
717 + Rec.FFileName + #1 //
\83t
\83@
\83C
\83\8b\96¼
718 + Rec.FTitle + #1 //
\83^
\83C
\83g
\83\8b
719 + Format('%x', [Rec.FCount]) + #1 //
\83J
\83E
\83\93\83g
720 + Format('%x', [0]) + #1 //size
721 + Format('%x', [0]) + #1 //RoundDate
722 + Format('%x', [0]) + #1 //LastModified
723 + Format('%x', [0]) + #1 //Kokomade
724 + Format('%x', [0]) + #1 //NewReceive
725 + '0' + #1 //
\96¢
\8eg
\97p
726 + Format('%x', [0]) + #1 //UnRead
727 + Format('%x', [0]) + #1 //ScrollTop
728 + Format('%x', [Rec.FCount]) + #1 //AllResCount
729 + Format('%x', [0]) + #1 //NewResCount
730 + Format('%x', [0]); //AgeSage
735 sl.SaveToFile(FileName);
744 (*************************************************************************
745 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X(Thread.dat)
\8f\91\82«
\8d\9e\82Ý
747 *************************************************************************)
748 procedure TGikoSys.WriteThreadDat(Board: TBoard);
750 // Values: array[Boolean] of string = ('0', '1');
756 TmpFileList: TStringList;
758 if not Board.IsThreadDatRead then
760 FileName := Board.GetFolderIndexFileName;
761 ForceDirectoriesEx( ExtractFilePath( FileName ) );
763 sl := TStringList.Create;
764 TmpFileList := TStringList.Create;
765 TmpFileList.Sorted := true;
767 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, false);
769 sl.Add(FOLDER_INDEX_VERSION);
771 //
\83X
\83\8c\94Ô
\8d\86\95Û
\91¶
\82Ì
\82½
\82ß
\83\
\81[
\83g
772 Sort.SortNoFlag := true;
773 Sort.SortOrder := true;
775 //Sort.SortNonAcquiredCountFlag := GikoSys.Setting.NonAcquiredCount;
776 Board.CustomSort(ThreadItemSortProc);
778 for i := 0 to Board.Count - 1 do begin
779 Board.Items[i].No := i + 1;
780 s := Format('%x', [Board.Items[i].No]) + #1
781 + Board.Items[i].FileName + #1
782 + Board.Items[i].Title + #1
783 + Format('%x', [Board.Items[i].Count]) + #1
784 + Format('%x', [Board.Items[i].Size]) + #1
785 + Format('%x', [DateTimeToInt(Board.Items[i].RoundDate)]) + #1
786 + Format('%x', [DateTimeToInt(Board.Items[i].LastModified)]) + #1
787 + Format('%x', [Board.Items[i].Kokomade]) + #1
788 + Format('%x', [Board.Items[i].NewReceive]) + #1
789 + '0' + #1 //
\96¢
\8eg
\97p
790 + Format('%x', [BoolToInt(Board.Items[i].UnRead)]) + #1
791 + Format('%x', [Board.Items[i].ScrollTop]) + #1
792 + Format('%x', [Board.Items[i].AllResCount]) + #1
793 + Format('%x', [Board.Items[i].NewResCount]) + #1
794 + Format('%x', [Ord(Board.Items[i].AgeSage)]);
799 sl.SaveToFile(FileName);
801 for i := 0 to TmpFileList.Count - 1 do begin
802 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[i]);
811 function TGikoSys.ParseIndexLine(Line: string): TIndexRec;
813 Result.FNo := StrToIntDef('$' + RemoveToken(Line, #1), 0);
814 Result.FFileName := RemoveToken(Line, #1);
815 Result.FTitle := RemoveToken(Line, #1);
816 Result.FCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
817 Result.FSize := StrToIntDef('$' + RemoveToken(Line, #1), 0);
818 Result.FRoundDate := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
819 Result.FLastModified := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
820 Result.FKokomade := StrToIntDef('$' + RemoveToken(Line, #1), -1);
821 Result.FNewReceive := StrToIntDef('$' + RemoveToken(Line, #1), 0);
822 RemoveToken(Line, #1);//9: ; //
\96¢
\8eg
\97p
823 Result.FUnRead := IntToBool(StrToIntDef('$' + RemoveToken(Line, #1), 0));
824 Result.FScrollTop := StrToIntDef('$' + RemoveToken(Line, #1), 0);
825 Result.FAllResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
826 Result.FNewResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
827 Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + RemoveToken(Line, #1), 0));
831 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
832 // ListFiles('c:\', '*.txt', list, True);
833 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
836 SearchRec : TSearchRec;
840 maskExt := Copy(Mask, 1, Length(Mask) - 1);
842 Path := IncludeTrailingPathDelimiter(Path);
843 rc := FindFirst(Path + '*.*', faAnyfile, SearchRec);
845 while rc = 0 do begin
846 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
847 s := Path + SearchRec.Name;
848 //if (SearchRec.Attr and faDirectory > 0) then
849 // s := IncludeTrailingPathDelimiter(s)
851 if (SearchRec.Attr and faDirectory = 0) and (MatchesMask(s, Mask)) then
855 List.Add(SearchRec.Name);
856 if SubDir and (SearchRec.Attr and faDirectory > 0) then
857 GetFileList(s, Mask, List, True, IsPathAdd);
859 rc := FindNext(SearchRec);
862 SysUtils.FindClose(SearchRec);
866 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
867 //
\83T
\83u
\83t
\83H
\83\8b\83_
\82Í
\8c\9f\8dõ
\82µ
\82È
\82¢
868 // ListFiles('c:\', '*.txt', list, True);
869 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean);
872 SearchRec : TSearchRec;
875 Path := IncludeTrailingPathDelimiter(Path);
876 rc := FindFirst(Path + Mask, faAnyfile, SearchRec);
878 while rc = 0 do begin
879 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
880 s := Path + SearchRec.Name;
882 if (SearchRec.Attr and faDirectory = 0) then
886 List.Add(SearchRec.Name);
888 rc := FindNext(SearchRec);
891 SysUtils.FindClose(SearchRec);
895 //
\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é
896 procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
899 SearchRec : TSearchRec;
902 Path := IncludeTrailingPathDelimiter(Path);
903 rc := FindFirst(Path + '*.*', faDirectory, SearchRec);
905 while rc = 0 do begin
906 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
907 s := Path + SearchRec.Name;
908 //if (SearchRec.Attr and faDirectory > 0) then
909 // s := IncludeTrailingPathDelimiter(s)
911 if (SearchRec.Attr and faDirectory > 0) and (MatchesMask(s, Mask)) then
912 List.Add( IncludeTrailingPathDelimiter( s ) );
913 if SubDir and (SearchRec.Attr and faDirectory > 0) then
914 GetDirectoryList(s, Mask, List, True);
916 rc := FindNext(SearchRec);
919 SysUtils.FindClose(SearchRec);
923 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
924 function TGikoSys.LoadFromSkin(
926 ThreadItem: TThreadItem;
933 Skin := TStringList.Create;
935 if FileExists( fileName ) then begin
936 Skin.LoadFromFile( fileName );
938 //
\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
940 if ThreadItem.ParentBoard <> nil then
941 if ThreadItem.ParentBoard.ParentCategory <> nil then
942 CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
943 CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
945 CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
946 CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
947 CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
948 CustomStringReplace( Skin, '<SKINPATH/>', Setting.CSSFileName);
949 CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.Count - ThreadItem.NewResCount ));
950 CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
951 CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.Count ));
953 CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
954 CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
955 CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
957 //-----
\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µ
958 //
\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
960 if ThreadItem.ParentBoard <> nil then
961 if ThreadItem.ParentBoard.ParentCategory <> nil then
962 CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
963 CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
965 CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
966 CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
967 CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
968 CustomStringReplace( Skin, '&SKINPATH', Setting.CSSFileName);
969 CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
970 CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
971 CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
973 CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
974 CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
975 CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
976 //-----
\82±
\82±
\82Ü
\82Å
984 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
985 function TGikoSys.SkinedRes(
993 Skin := CustomStringReplace( Skin, '<NUMBER/>',
994 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
995 Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
996 Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
997 Skin := CustomStringReplace( Skin, '<MAILNAME/>',
998 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
999 Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
1000 Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
1001 Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
1003 //-----
\82©
\82¿
\82ã
\81`
\82µ
\82á
\8cÝ
\8a·
\97p
\81B
\83R
\83\81\83\93\83g
\83A
\83E
\83g
\82µ
\82Ä
\82à
\82æ
\82µ
1004 Skin := CustomStringReplace( Skin, '&NUMBER',
1005 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1006 Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
1007 Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
1008 Skin := CustomStringReplace( Skin, '&MAILNAME',
1009 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1010 Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
1011 Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
1012 Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
1013 //-----
\82±
\82±
\82Ü
\82Å
1021 procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
1025 //bufList : TStringList;
1026 ReadList: TStringList;
1027 SaveList: TStringList;
1028 CSSFileName: string;
1031 NewReceiveNo: Integer;
1033 boardPlugIn : TBoardPlugIn;
1035 UserOptionalStyle: string;
1040 function LoadSkin( fileName: string ): string;
1042 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1044 function ReplaceRes( skin: string ): string;
1046 Result := SkinedRes( skin, Res, No );
1049 if ThreadItem <> nil then begin
1050 if ThreadItem.IsBoardPlugInAvailable then begin
1051 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1052 boardPlugIn := ThreadItem.BoardPlugIn;
1053 NewReceiveNo := ThreadItem.NewReceive;
1054 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1055 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1056 UserOptionalStyle := UserOptionalStyle +
1057 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1058 if GikoSys.Setting.BrowserFontSize <> 0 then
1059 UserOptionalStyle := UserOptionalStyle +
1060 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1061 if GikoSys.Setting.BrowserFontColor <> -1 then
1062 UserOptionalStyle := UserOptionalStyle +
1063 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1064 if GikoSys.Setting.BrowserBackColor <> -1 then
1065 UserOptionalStyle := UserOptionalStyle +
1066 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1067 case GikoSys.Setting.BrowserFontBold of
1068 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1069 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1071 case GikoSys.Setting.BrowserFontItalic of
1072 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1073 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1076 SaveList := TStringList.Create;
1079 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1080 // doc.charset := 'Shift_JIS';
1083 SaveList.Add( boardPlugIn.GetHeader( DWORD( threadItem ),
1084 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) );
1086 for i := 0 to threadItem.Count - 1 do begin
1087 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1088 if i <> 0 then begin
1089 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1092 if ThreadItem.Kokomade > (i + 1) then
1095 if NewReceiveNo > (i + 1) then
1098 if (threadItem.Count - i) > ResRange then
1103 //
\90V
\92\85\83}
\81[
\83N
1104 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1106 if GikoSys.Setting.UseSkin then begin
1107 if FileExists( GetSkinNewmarkFileName ) then
1108 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1110 SaveList.Add( '<a name="new"></a>' );
1111 end else if GikoSys.Setting.UseCSS then begin
1112 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>');
1114 SaveList.Add('</dl>');
1115 SaveList.Add('<a name="new"></a>');
1116 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>');
1117 SaveList.Add('<dl>');
1120 SaveList.Add( '<a name="new"></a>' );
1125 SaveList.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
1127 if ThreadItem.Kokomade = (i + 1) then begin
1128 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1130 if GikoSys.Setting.UseSkin then begin
1131 if FileExists( GetSkinBookmarkFileName ) then
1132 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1134 SaveList.Add( '<a name="koko"></a>' );
1135 end else if GikoSys.Setting.UseCSS then begin
1136 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1138 SaveList.Add('</dl>');
1139 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>');
1140 SaveList.Add('<dl>');
1143 SaveList.Add( '<a name="koko"></a>' );
1147 doc.Write(SaveList.Text);
1152 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1153 SaveList.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1155 doc.Write(SaveList.Text);
1164 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1165 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1166 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1167 ShortDayNames[7] := '
\93y';
1168 BBSID := ThreadItem.ParentBoard.BBSID;
1169 NewReceiveNo := ThreadItem.NewReceive;
1170 ReadList := TStringList.Create;
1172 if ThreadItem.IsLogFile then begin
1173 FileName := ThreadItem.GetThreadFileName;
1174 ReadList.LoadFromFile(FileName);
1175 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1176 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1177 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1178 Res := DivideStrLine(ReadList[0]);
1179 Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1180 sTitle := Res.FTitle;
1182 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1184 SaveList := TStringList.Create;
1187 doc.charset := 'Shift_JIS';
1189 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1190 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1191 UserOptionalStyle := UserOptionalStyle +
1192 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1193 if GikoSys.Setting.BrowserFontSize <> 0 then
1194 UserOptionalStyle := UserOptionalStyle +
1195 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1196 if GikoSys.Setting.BrowserFontColor <> -1 then
1197 UserOptionalStyle := UserOptionalStyle +
1198 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1199 if GikoSys.Setting.BrowserBackColor <> -1 then
1200 UserOptionalStyle := UserOptionalStyle +
1201 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1202 case GikoSys.Setting.BrowserFontBold of
1203 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1204 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1206 case GikoSys.Setting.BrowserFontItalic of
1207 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1208 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1211 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1212 if GikoSys.Setting.UseSkin then begin
1213 //
\83X
\83L
\83\93\8eg
\97p
1214 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1216 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1217 if Length( UserOptionalStyle ) > 0 then
1218 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1219 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1220 SaveList.Add( SkinHeader );
1224 SkinNewRes := LoadSkin( GetSkinNewResFileName );
1228 SkinRes := LoadSkin( GetSkinResFileName );
1232 SaveList.Add('<a name="top"></a>');
1234 for i := 0 to ReadList.Count - 1 do begin
1235 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1236 if i <> 0 then begin
1237 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1240 if ThreadItem.Kokomade > (i + 1) then
1243 if NewReceiveNo > (i + 1) then
1246 if (threadItem.Count - i) > ResRange then
1251 //
\90V
\92\85\83}
\81[
\83N
1252 if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
1254 if FileExists( GetSkinNewmarkFileName ) then
1255 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1257 SaveList.Add( '<a name="new"></a>' );
1259 SaveList.Add( '<a name="new"></a>' );
1262 if (Trim(ReadList[i]) <> '') then begin
1263 No := IntToStr(i + 1);
1265 Res := DivideStrLine(ReadList[i]);
1266 if Res.FType = glt2chOld then begin
1267 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1268 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1269 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1272 Res.FBody := AddAnchorTag(Res.FBody);
1273 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1276 if NewReceiveNo <= (i + 1) then
1277 //
\90V
\92\85\83\8c\83X
1278 SaveList.Add( ReplaceRes( SkinNewRes ) )
1280 //
\92Ê
\8fí
\82Ì
\83\8c\83X
1281 SaveList.Add( ReplaceRes( SkinRes ) );
1286 if ThreadItem.Kokomade = (i + 1) then begin
1287 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1289 if FileExists( GetSkinBookmarkFileName ) then
1290 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1292 SaveList.Add( '<a name="koko"></a>' );
1294 SaveList.Add( '<a name="koko"></a>' );
1297 doc.Write(SaveList.Text);
1300 SaveList.Add('<a name="bottom"></a>');
1301 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1303 SaveList.Add( LoadSkin( GetSkinFooterFileName ) );
1306 doc.Write(SaveList.Text);
1308 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1310 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1311 // SaveList.Add('<html lang="ja"><head>');
1312 SaveList.Add('<html><head>');
1313 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1314 SaveList.Add('<title>' + sTitle + '</title>');
1315 SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
1316 if Length( UserOptionalStyle ) > 0 then
1317 SaveList.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1318 SaveList.Add('</head>');
1319 SaveList.Add('<body>');
1320 SaveList.Add('<a name="top"></a>');
1321 SaveList.Add('<div class="title">' + sTitle + '</div>');
1322 doc.Write(SaveList.Text);
1324 //Application.ProcessMessages;
1325 for i := 0 to ReadList.Count - 1 do begin
1326 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1327 if i <> 0 then begin
1328 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1331 if ThreadItem.Kokomade > (i + 1) then
1334 if NewReceiveNo > (i + 1) then
1337 if (threadItem.Count - i) > ResRange then
1342 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1343 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>');
1345 if (Trim(ReadList[i]) <> '') then begin
1346 No := IntToStr(i + 1);
1347 Res := DivideStrLine(ReadList[i]);
1348 Res.FBody := AddAnchorTag(Res.FBody);
1349 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1350 if Res.FMailTo = '' then
1351 SaveList.Add('<a name="' + No + '"></a>'
1352 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1353 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1354 + '<span class="name"><b>' + Res.FName + '</b></span> '
1355 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1356 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1357 + '<div class="mes">' + Res.FBody + ' </div>')
1358 else if GikoSys.Setting.ShowMail then
1359 SaveList.Add('<a name="' + No + '"></a>'
1360 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1361 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1362 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1363 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1364 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1365 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1366 + '<div class="mes">' + Res.FBody + ' </div>')
1368 SaveList.Add('<a name="' + No + '"></a>'
1369 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1370 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1371 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1372 + '<b>' + Res.FName + '</b></a>'
1373 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1374 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1375 + '<div class="mes">' + Res.FBody + ' </div>');
1377 if ThreadItem.Kokomade = (i + 1) then begin
1378 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1381 doc.Write(SaveList.Text);
1384 SaveList.Add('<a name="bottom"></a>');
1385 SaveList.Add('</body></html>');
1386 SaveList.Add('<a name="last"></a>');
1387 SaveList.Add('</body></html>');
1389 doc.Write(SaveList.Text);
1392 // SaveList.Add('<html lang="ja"><head>');
1393 SaveList.Add('<html><head>');
1394 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1395 SaveList.Add('<title>' + sTitle + '</title></head>');
1396 SaveList.Add('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1397 SaveList.Add('<a name="top"></a>');
1398 SaveList.Add('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1399 SaveList.Add('<dl>');
1400 doc.Write(SaveList.Text);
1402 //Application.ProcessMessages;
1403 for i := 0 to ReadList.Count - 1 do begin
1404 // 1
\82Í
\95K
\82¸
\95\
\8e¦
1405 if i <> 0 then begin
1406 //
\95\
\8e¦
\94Í
\88Í
\82ð
\8cÀ
\92è
1409 if ThreadItem.Kokomade > (i + 1) then
1412 if NewReceiveNo > (i + 1) then
1415 if (threadItem.Count - i) > ResRange then
1420 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1421 SaveList.Add('</dl>');
1422 SaveList.Add('<a name="new"></a>');
1423 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>');
1424 SaveList.Add('<dl>');
1426 if (Trim(ReadList[i]) <> '') then begin
1427 No := IntToStr(i + 1);
1428 Res := DivideStrLine(ReadList[i]);
1429 if Res.FType = glt2chOld then begin
1430 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1431 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1432 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1434 Res.FBody := AddAnchorTag(Res.FBody);
1435 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1436 if Res.FMailTo = '' then
1437 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>')
1438 else if GikoSys.Setting.ShowMail then
1439 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>')
1441 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>');
1443 if ThreadItem.Kokomade = (i + 1) then begin
1444 SaveList.Add('</dl>');
1445 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>');
1446 SaveList.Add('<dl>');
1448 doc.Write(SaveList.Text);
1451 SaveList.Add('</dl>');
1452 SaveList.Add('<a name="bottom"></a>');
1453 SaveList.Add('</body></html>');
1454 doc.Write(SaveList.Text);
1464 procedure TGikoSys.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
1468 //bufList : TStringList;
1469 ReadList: TStringList;
1470 // SaveList: TStringList;
1471 CSSFileName: string;
1475 boardPlugIn : TBoardPlugIn;
1477 UserOptionalStyle: string;
1481 function LoadSkin( fileName: string ): string;
1483 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1485 function ReplaceRes( skin: string ): string;
1487 Result := SkinedRes( skin, Res, No );
1491 if ThreadItem <> nil then begin
1492 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1495 if ThreadItem.IsBoardPlugInAvailable then begin
1496 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1497 boardPlugIn := ThreadItem.BoardPlugIn;
1498 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1499 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1500 UserOptionalStyle := UserOptionalStyle +
1501 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1502 if GikoSys.Setting.BrowserFontSize <> 0 then
1503 UserOptionalStyle := UserOptionalStyle +
1504 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1505 if GikoSys.Setting.BrowserFontColor <> -1 then
1506 UserOptionalStyle := UserOptionalStyle +
1507 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1508 if GikoSys.Setting.BrowserBackColor <> -1 then
1509 UserOptionalStyle := UserOptionalStyle +
1510 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1511 case GikoSys.Setting.BrowserFontBold of
1512 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1513 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1515 case GikoSys.Setting.BrowserFontItalic of
1516 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1517 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1521 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1523 tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
1524 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
1525 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1526 if Setting.UseSkin then begin
1527 tmp1 := './' +Setting.CSSFileName;
1528 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1529 tmp1 := CustomStringReplace(tmp1, '\', '/');
1530 tmp := CustomStringReplace(tmp, ExtractFilePath(Setting.CSSFileName), tmp1);
1531 end else if Setting.UseCSS then begin
1532 tmp1 := './' + CSSFileName;
1533 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1534 tmp1 := CustomStringReplace(tmp1, '\', '/');
1535 tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
1539 for i := 0 to threadItem.Count - 1 do begin
1542 html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
1545 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1546 html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1553 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1554 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1555 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1556 ShortDayNames[7] := '
\93y';
1557 BBSID := ThreadItem.ParentBoard.BBSID;
1558 ReadList := TStringList.Create;
1560 if ThreadItem.IsLogFile then begin
1561 FileName := ThreadItem.GetThreadFileName;
1562 ReadList.LoadFromFile(FileName);
1563 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1564 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1565 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1566 Res := DivideStrLine(ReadList[0]);
1567 Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1568 sTitle := Res.FTitle;
1570 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1573 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1574 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1575 UserOptionalStyle := UserOptionalStyle +
1576 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1577 if GikoSys.Setting.BrowserFontSize <> 0 then
1578 UserOptionalStyle := UserOptionalStyle +
1579 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1580 if GikoSys.Setting.BrowserFontColor <> -1 then
1581 UserOptionalStyle := UserOptionalStyle +
1582 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1583 if GikoSys.Setting.BrowserBackColor <> -1 then
1584 UserOptionalStyle := UserOptionalStyle +
1585 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1586 case GikoSys.Setting.BrowserFontBold of
1587 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1588 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1590 case GikoSys.Setting.BrowserFontItalic of
1591 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1592 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1596 if GikoSys.Setting.UseSkin then begin
1597 //
\83X
\83L
\83\93\8eg
\97p
1598 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1600 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1601 if Length( UserOptionalStyle ) > 0 then
1602 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1603 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1604 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1605 tmp1 := './' +Setting.CSSFileName;
1606 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1607 tmp1 := CustomStringReplace(tmp1, '\', '/');
1608 SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(Setting.CSSFileName), tmp1);
1609 html.Append( SkinHeader );
1613 SkinRes := LoadSkin( GetSkinResFileName );
1616 html.Append('<a name="top"></a>');
1617 for i := 0 to ReadList.Count - 1 do begin
1618 if (Trim(ReadList[i]) <> '') then begin
1619 No := IntToStr(i + 1);
1621 Res := DivideStrLine(ReadList[i]);
1622 if Res.FType = glt2chOld then begin
1623 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1624 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1625 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1628 Res.FBody := AddAnchorTag(Res.FBody);
1629 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1632 html.Append( ReplaceRes( SkinRes ) );
1638 html.Append('<a name="bottom"></a>');
1639 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1641 html.Append( LoadSkin( GetSkinFooterFileName ) );
1644 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1646 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1647 html.Append('<html><head>');
1648 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1649 html.Append('<title>' + sTitle + '</title>');
1650 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1651 tmp1 := './' + CSSFileName;
1652 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1653 tmp1 := CustomStringReplace(tmp1, '\', '/');
1655 html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
1656 if Length( UserOptionalStyle ) > 0 then
1657 html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1658 html.Append('</head>');
1659 html.Append('<body>');
1660 html.Append('<a name="top"></a>');
1661 html.Append('<div class="title">' + sTitle + '</div>');
1662 for i := 0 to ReadList.Count - 1 do begin
1663 if (Trim(ReadList[i]) <> '') then begin
1664 No := IntToStr(i + 1);
1665 Res := DivideStrLine(ReadList[i]);
1666 Res.FBody := AddAnchorTag(Res.FBody);
1667 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1668 if Res.FMailTo = '' then
1669 html.Append('<a name="' + No + '"></a>'
1670 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1671 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1672 + '<span class="name"><b>' + Res.FName + '</b></span> '
1673 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1674 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1675 + '<div class="mes">' + Res.FBody + ' </div>')
1676 else if GikoSys.Setting.ShowMail then
1677 html.Append('<a name="' + No + '"></a>'
1678 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1679 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1680 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1681 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1682 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1683 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1684 + '<div class="mes">' + Res.FBody + ' </div>')
1686 html.Append('<a name="' + No + '"></a>'
1687 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1688 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1689 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1690 + '<b>' + Res.FName + '</b></a>'
1691 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1692 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1693 + '<div class="mes">' + Res.FBody + ' </div>');
1696 html.Append('<a name="bottom"></a>');
1697 html.Append('</body></html>');
1698 html.Append('<a name="last"></a>');
1699 html.Append('</body></html>');
1702 html.Append('<html><head>');
1703 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1704 html.Append('<title>' + sTitle + '</title></head>');
1705 html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1706 html.Append('<a name="top"></a>');
1707 html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1708 html.Append('<dl>');
1709 for i := 0 to ReadList.Count - 1 do begin
1710 if (Trim(ReadList[i]) <> '') then begin
1711 No := IntToStr(i + 1);
1712 Res := DivideStrLine(ReadList[i]);
1713 if Res.FType = glt2chOld then begin
1714 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1715 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1716 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1718 Res.FBody := AddAnchorTag(Res.FBody);
1719 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1720 if Res.FMailTo = '' then
1721 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>')
1722 else if GikoSys.Setting.ShowMail then
1723 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>')
1725 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>');
1728 html.Append('</dl>');
1729 html.Append('<a name="bottom"></a>');
1730 html.Append('</body></html>');
1739 function TGikoSys.ConvertResAnchor(res: string): string;
1741 _HEAD : string = '<a href="../';
1742 _TAIL : string = ' target="_blank">';
1743 _ST: string = '&st=';
1744 _TO: string = '&to=';
1745 _STA: string = '&START=';
1746 _END: string = '&END=';
1752 i := AnsiPos(_HEAD, res);
1753 while i <> 0 do begin
1754 Result := Result + Copy(res, 1, i -1);
1755 Delete(res, 1, i - 1);
1756 j := AnsiPos(_TAIL, res);
1758 Result := Result + res;
1761 tmp := Copy(res, 1, j - 1);
1762 Delete(res, 1, j + 16);
1763 if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
1764 Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
1765 Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
1766 Result := Result + '<a href="#' + tmp + '">';
1767 end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
1768 Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
1769 Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
1770 Result := Result + '<a href="#' + tmp + '">';
1772 k := LastDelimiter('/', tmp);
1774 if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
1775 Delete(tmp, AnsiPos('-', tmp), Length(tmp))
1777 Delete(tmp, AnsiPos('"', tmp), Length(tmp));
1779 Result := Result + '<a href="#' + tmp + '">';
1781 i := AnsiPos(_HEAD, res);
1783 Result := Result + res;
1787 (*************************************************************************
1788 *http://
\82Ì
\95¶
\8e\9a\97ñ
\82ðanchor
\83^
\83O
\95t
\82«
\82É
\82·
\82é
\81B
1789 *************************************************************************)
1790 function TGikoSys.AddAnchorTag(s: string): string;
1792 URL_CHAR: string = '0123456789'
1793 + 'abcdefghijklmnopqrstuvwxyz'
1794 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1795 + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
1796 ANCHOR_REF = 'href=';
1797 RES_REF = '>>';
1799 wkIdx: array[0..9] of Integer;
1804 anchorLen : Integer;
1807 // + 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ß
1808 anchorLen := Length( ANCHOR_REF ) + 3;
1811 wkIdx[0] := AnsiPos('http://', s);
1812 wkIdx[1] := AnsiPos('ttp://', s);
1813 wkIdx[2] := AnsiPos('tp://', s);
1814 wkIdx[3] := AnsiPos('ms-help://', s);
1815 wkIdx[4] := AnsiPos('p://', s);
1816 wkIdx[5] := AnsiPos('https://', s);
1817 wkIdx[6] := AnsiPos('www.', s);
1818 wkIdx[7] := AnsiPos('ftp://', s);
1819 wkIdx[8] := AnsiPos('news://', s);
1820 wkIdx[9] := AnsiPos('rtsp://', s);
1824 if wkIdx[i] <> 0 then idx := Min(wkIdx[i], idx);
1826 if idx = MaxInt then begin
1827 //
\83\8a\83\93\83N
\82ª
\96³
\82¢
\82æ
\81B
1828 Result := Result + s;
1833 (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
1834 //
\8aù
\82É
\83\8a\83\93\83N
\83^
\83O
\82ª
\82Â
\82¢
\82Ä
\82¢
\82é
\82Á
\82Û
\82¢
\82Æ
\82«
\82Í
\83\80\83V
1835 href := Copy( s, idx, Length( s ) );
1836 Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
1838 s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
1843 Result := Result + Copy(s, 0, idx - 1);
1845 s := Copy(s, idx, length(s));
1847 b := Length( s ) + 1;
1848 for i := 1 to b do begin
1852 idx := AnsiPos(s[i], URL_CHAR);
1853 if idx = 0 then begin
1854 //URL
\82¶
\82á
\82È
\82¢
\95¶
\8e\9a\94
\8c©
\81I
\82Æ
\82©
\81A
\95¶
\8e\9a\82ª
\82È
\82
\82È
\82Á
\82½
\81B
1855 url := Copy(s, 0, i - 1);
1857 if AnsiPos('ttp://', url) = 1 then
1859 else if AnsiPos('tp://', url) = 1 then
1861 else if AnsiPos('p://', url) = 1 then
1863 else if AnsiPos('www.', url) = 1 then
1864 href := 'http://' + url
1867 Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
1868 s := Copy(s, i, MaxInt);
1875 (*************************************************************************
1876 *
\83T
\83u
\83W
\83F
\83N
\83g
\88ê
\8ds
\82ð
\95ª
\8a\84
1877 *************************************************************************)
1878 function TGikoSys.DivideSubject(Line: string): TSubjectRec;
1888 if AnsiPos('<>', Line) = 0 then
1892 Result.FFileName := RemoveToken(Line, Delim);
1893 Result.FTitle := RemoveToken(Line, Delim);
1895 ws := Trim(Result.FTitle);
1897 if Copy(ws, Length(ws), 1) = ')' then begin
1900 end else if Copy(ws, Length(ws), 1) = '
\81j' then begin
1903 end else if Copy(ws, Length(ws), 1) = '<' then begin
1908 for i := Length(ws) - 1 downto 1 do begin
1909 if ws[i] = LeftK then begin
1910 ws := Copy(ws, i + 1, Length(ws) - i - 1);
1911 if IsNumeric(ws) then
1912 Result.FCount := StrToInt(ws);
1913 Result.FTitle := Trim(CustomStringReplace(Result.FTitle, LeftK + ws + RightK, ''));
1919 (*************************************************************************
1920 * dat
\83t
\83@
\83C
\83\8b\82Ì
\88ê
\83\89\83C
\83\93\82ð
\95ª
\89ð
1921 *************************************************************************)
1922 function TGikoSys.DivideStrLine(Line: string): TResRec;
1927 if AnsiPos('<>', Line) = 0 then begin
1929 Result.FType := glt2chOld;
1932 Result.FType := glt2chNew;
1934 Result.FName := Trim(RemoveToken(Line, Delim));
1935 Result.FMailTo := Trim(RemoveToken(Line, Delim));
1936 Result.FDateTime := Trim(RemoveToken(Line, Delim));
1937 bufBody := Trim(RemoveToken(Line, Delim));
1939 if bufbody = '' then begin
1940 Insert(' ',bufbody, 1);
1942 Result.FBody := bufBody;
1943 Result.FTitle := Trim(RemoveToken(Line, Delim));
1947 (*************************************************************************
1948 * URL
\82©
\82çBBSID
\82ð
\8eæ
\93¾
1949 *************************************************************************)
1950 function TGikoSys.UrlToID(url: string): string;
1957 if url = '' then Exit;
1959 url := Copy(url, 0, Length(url) - 1);
1960 for i := Length(url) downto 0 do begin
1961 if url[i] = '/' then begin
1962 Result := Copy(url, i + 1, Length(url));
1968 (*************************************************************************
1969 *URL
\82©
\82çBBSID
\88È
\8aO
\82Ì
\95\94\95ª(http://teri.2ch.net/)
\82ð
\8eæ
\93¾
1970 *************************************************************************)
1971 function TGikoSys.UrlToServer(url: string): string;
1978 wsURL := Trim(wsURL);
1980 if wsURL = '' then exit;
1982 if Copy(wsURL, Length(wsURL), 1) = '/' then
1983 wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
1985 for i := Length(wsURL) downto 0 do begin
1986 if wsURL[i] = '/' then begin
1987 Result := Copy(wsURL, 0, i);
1993 (*************************************************************************
1994 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\83`
\83F
\83b
\83N
1995 *************************************************************************)
1996 function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
2000 Code := GetFileAttributes(PChar(Name));
2001 Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
2004 (*************************************************************************
2005 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\8dì
\90¬
\81i
\95¡
\90\94\8aK
\91w
\91Î
\89\9e\81j
2006 *************************************************************************)
2007 function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
2010 if Length(Dir) = 0 then
2011 raise Exception.Create('
\83t
\83H
\83\8b\83_
\82ª
\8dì
\90¬
\8fo
\97\88\82Ü
\82¹
\82ñ');
2012 Dir := ExcludeTrailingPathDelimiter(Dir);
2013 if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
2014 or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
2015 Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
2018 (*************************************************************************
2019 *
\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
2020 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2021 *************************************************************************)
2022 function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2026 Result := StrTokNext(sep, Rec);
2029 (*************************************************************************
2030 *
\95¶
\8e\9a\97ñ
\82©
\82ç
\83g
\81[
\83N
\83\93\82Ì
\90Ø
\82è
\8fo
\82µ
2031 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2032 *************************************************************************)
2033 function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
2040 if Len >= Pos then begin
2041 while (Pos <= Len) and (Str[Pos] in sep) do begin
2045 while (Pos<= Len) and not (Str[Pos] in sep) do begin
2046 if IsDBCSLeadByte(Byte(Str[Pos])) then begin
2051 Result := Copy(Str, I, Pos - I);
2052 while (Pos <= Len) and (Str[Pos] in sep) do begin//
\82±
\82ê
\82Í
\82¨
\8dD
\82Ý
2059 (*************************************************************************
2060 *
\83t
\83@
\83C
\83\8b\83T
\83C
\83Y
\8eæ
\93¾
2061 *************************************************************************)
2062 function TGikoSys.GetFileSize(FileName : string): longint;
2067 if not FileExists(FileName) then begin
2071 Assign(F, FileName);
2073 Result := FileSize(F);
2080 (*************************************************************************
2081 *
\83t
\83@
\83C
\83\8b\8ds
\90\94\8eæ
\93¾
2082 *************************************************************************)
2083 function TGikoSys.GetFileLineCount(FileName : string): longint;
2087 sl := TStringList.Create;
2090 sl.LoadFromFile(FileName);
2101 (*************************************************************************
2102 *
\83X
\83\8c\83b
\83h
\83t
\83@
\83C
\83\8b\82©
\82ç
\8ew
\92è
\8ds
\82ð
\8eæ
\93¾
2103 *************************************************************************)
2104 function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
2106 fileTmp : TStringList;
2109 if FileExists(FileName) then begin
2110 fileTmp := TStringList.Create;
2113 fileTmp.LoadFromFile( FileName );
2114 if ( Line >= 1 ) and ( Line < fileTmp.Count + 1 ) then begin
2115 Result := fileTmp.Strings[ Line-1 ];
2118 //on EFOpenError do Result := '';
2126 (*************************************************************************
2127 *
\83V
\83X
\83e
\83\80\83\81\83j
\83\85\81[
\83t
\83H
\83\93\83g
\82Ì
\91®
\90«
\82ð
\8eæ
\93¾
2128 *************************************************************************)
2129 procedure TGikoSys.MenuFont(Font: TFont);
2132 nm: NONCLIENTMETRICS;
2134 nm.cbSize := sizeof(NONCLIENTMETRICS);
2136 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
2137 lf := nm.lfMenuFont;
2139 Font.Name := lf.lfFaceName;
2140 Font.Height := lf.lfHeight;
2142 if lf.lfWeight >= 700 then
2143 Font.Style := Font.Style + [fsBold];
2144 if lf.lfItalic = 1 then
2145 Font.Style := Font.Style + [fsItalic];
2148 (*************************************************************************
2150 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2151 *************************************************************************)
2152 function TGikoSys.RemoveToken(var s: string;const delimiter: string): string;
2156 p := AnsiPos(delimiter, s);
2160 Result := Copy(s, 1, p - 1);
2161 s := Copy(s, Length(Result) + Length(delimiter) + 1, Length(s));
2164 (*************************************************************************
2166 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
2167 *************************************************************************)
2168 function TGikoSys.GetTokenIndex(s: string; delimiter: string; index: Integer): string;
2173 for i := 0 to index do
2174 Result := RemoveToken(s, delimiter);
2177 (*************************************************************************
2179 *************************************************************************)
2180 function TGikoSys.DeleteLink(const s: string): string;
2190 s1 := GetTokenIndex(s, '<a href="', i);
2191 s2 := GetTokenIndex(s, '<a href="', i + 1);
2193 idx := Pos('">', s1);
2195 Delete(s1, 1, idx + 1);
2196 idx := Pos('">', s2);
2198 Delete(s2, 1, idx + 1);
2200 Result := Result + s1 + s2;
2209 //
\83C
\83\93\83f
\83b
\83N
\83X
\96¢
\8dX
\90V
\83o
\83b
\83t
\83@
\82ð
\83t
\83\89\83b
\83V
\83\85\81I
2210 {procedure TGikoSys.FlashExitWrite;
2214 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
2215 for i := 0 to FExitWrite.Count - 1 do
2216 WriteThreadDat(FExitWrite[i]);
2220 (*************************************************************************
2221 *
\83X
\83\8c\96¼
\82È
\82Ç
\82ð
\92Z
\82¢
\96¼
\91O
\82É
\95Ï
\8a·
\82·
\82é
2223 *************************************************************************)
2224 function TGikoSys.GetShortName(const LongName: string; ALength: integer): string;
2226 ERASECHAR : array [1..39] of string =
2227 ('
\81\99','
\81\9a','
\81¡','
\81 ','
\81\9f','
\81\9e','
\81Q','
\81\94','
\81£','
\81¥',
2228 '
\81¢','
\81¤','
\81\9c','
\81\9b','
\81\9d','
\81y','
\81z','
\81ô','
\81s','
\81t',
2229 '
\81g','
\81h','
\81k','
\81l','
\81e','
\81f','
\81\83','
\81\84','
\81á','
\81â',
2230 '
\81o','
\81p','
\81q','
\81r','
\81w','
\81x','
\81¬','
\81c', '
\81@');
2232 Chr : array [0..255] of char;
2236 s := Trim(LongName);
2237 if (Length(s) <= ALength) then begin
2241 for i := Low(ERASECHAR) to High(ERASECHAR) do begin
2242 S := CustomStringReplace(S, ERASECHAR[i], '');
2244 if (Length(S) <= ALength) then begin
2247 Windows.LCMapString(
2248 GetUserDefaultLCID(),
2256 S := Copy(S,1,ALength);
2258 if (ByteType(S, Length(S)) = mbLeadByte ) then begin
2259 S := Copy(S, 1, Length(S) - 1);
2269 (*************************************************************************
2272 *************************************************************************)
2273 function TGikoSys.ConvRes(const Body, Bbs, Key,
2274 ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
2275 DatToHTML: boolean = false): string;
2279 FIndexFrom : integer;
2286 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2300 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2305 FIndex.FIndexFrom := IndexFrom;
2306 FIndex.FIndexTo := IndexTo;
2310 function ChooseString(const Text, Separator: string; Index: integer): string;
2316 for i := 0 to Index - 1 do begin
2317 if (AnsiPos(Separator, S) = 0) then S := ''
2318 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2320 p := AnsiPos(Separator, S);
2321 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2330 List:= TList.Create;
2336 b := ByteType(s, i);
2338 mbSingleByte : begin
2339 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2340 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2348 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2349 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2355 if (not sw) and (Copy(s,i,4) = GT) then begin
2356 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2364 if ((not sw) and (Copy(s,i,1) = ',')) or
2365 ((not sw) and (Copy(s,i,1) = '=')) then begin
2366 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2367 ((Chk) and (oc = '')) or
2368 ((not Chk) and (al)) then
2378 if (AnsiPos(sx, SN) > 0) then begin
2381 if (No <> '') and (No <> '-') then begin
2394 if Copy(s,i,1) = '<' then oc := '';
2395 oc := oc + Copy(s,i,1);
2401 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2407 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2415 if (AnsiPos(sx, ZN) > 0) then begin
2416 No := No + ZenToHan(sx);
2418 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2433 if (i > Length(Body)) then begin
2435 if (No <> '') then Add(sp, i, No);
2440 for i := List.Count - 1 downto 0 do begin
2441 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2442 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2443 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2445 st := PIndex(List[i]).FNo;
2446 et := PIndex(List[i]).FNo;
2448 if not DatToHTML then
2449 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2450 Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2451 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2452 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2453 Copy(r,PIndex(List[i]).FIndexTo,Length(r))
2455 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2456 Format('<a href="#%s">', [st]) +
2457 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2458 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2460 Dispose(PIndex(List[i]));
2466 function TGikoSys.ConvRes(
2467 const Body, Bbs, Key, ParamBBS, ParamKey,
2468 ParamStart, ParamTo, ParamNoFirst,
2469 ParamTrue, FullURL : string
2474 FIndexFrom : integer;
2481 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2495 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2500 FIndex.FIndexFrom := IndexFrom;
2501 FIndex.FIndexTo := IndexTo;
2505 function ChooseString(const Text, Separator: string; Index: integer): string;
2511 for i := 0 to Index - 1 do begin
2512 if (AnsiPos(Separator, S) = 0) then S := ''
2513 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2515 p := AnsiPos(Separator, S);
2516 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2525 List:= TList.Create;
2531 b := ByteType(s, i);
2533 mbSingleByte : begin
2534 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2535 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2543 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2544 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2550 if (not sw) and (Copy(s,i,4) = GT) then begin
2551 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2559 if ((not sw) and (Copy(s,i,1) = ',')) or
2560 ((not sw) and (Copy(s,i,1) = '=')) then begin
2561 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2562 ((Chk) and (oc = '')) or
2563 ((not Chk) and (al)) then
2573 if (AnsiPos(sx, SN) > 0) then begin
2576 if (No <> '') and (No <> '-') then begin
2589 if Copy(s,i,1) = '<' then oc := '';
2590 oc := oc + Copy(s,i,1);
2596 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2602 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2610 if (AnsiPos(sx, ZN) > 0) then begin
2611 No := No + ZenToHan(sx);
2613 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2628 if (i > Length(Body)) then begin
2630 if (No <> '') then Add(sp, i, No);
2635 for i := List.Count - 1 downto 0 do begin
2636 //plName := Copy(PluginName, LastDelimiter('\',PluginName) + 1, Length(PluginName) - LastDelimiter('/',PluginName) -1 );
2637 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2638 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2639 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2641 st := PIndex(List[i]).FNo;
2642 et := PIndex(List[i]).FNo;
2644 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2645 Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2646 [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2647 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2648 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2649 Dispose(PIndex(List[i]));
2656 function TGikoSys.BoolToInt(b: Boolean): Integer;
2658 Result := IfThen(b, 1, 0);
2661 function TGikoSys.IntToBool(i: Integer): Boolean;
2666 //gzip
\82Å
\88³
\8fk
\82³
\82ê
\82½
\82Ì
\82ð
\96ß
\82·
2667 function TGikoSys.GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
2671 GZipStream: TGzipDecompressStream;
2672 TextStream: TStringStream;
2673 buf: array[0..BUF_SIZE - 1] of Byte;
2679 TextStream := TStringStream.Create('');
2681 //
\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¢)
2682 // if LowerCase(Trim(ContentEncoding)) = 'gzip' then begin
2683 if AnsiPos('gzip', LowerCase(Trim(ContentEncoding))) > 0 then begin
2684 ResStream.Position := 0;
2685 GZipStream := TGzipDecompressStream.Create(TextStream);
2688 FillChar(buf, BUF_SIZE, 0);
2689 cnt := ResStream.Read(buf, BUF_SIZE);
2691 GZipStream.Write(buf, BUF_SIZE);
2697 ResStream.Position := 0;
2699 FillChar(buf, BUF_SIZE, 0);
2700 cnt := ResStream.Read(buf, BUF_SIZE);
2702 TextStream.Write(buf, BUF_SIZE);
2706 //NULL
\95¶
\8e\9a\82ð"*"
\82É
\82·
\82é
2707 s := TextStream.DataString;
2709 while (i > 0) and (s[i] = #0) do
2714 while i <> 0 do begin
2724 procedure TGikoSys.LoadKeySetting(ActionList: TActionList);
2726 STD_SEC = 'KeySetting';
2732 SecList: TStringList;
2733 Component: TComponent;
2735 if not FileExists(GetConfigDir + KEY_SETTING_FILE_NAME) then
2737 SecList := TStringList.Create;
2738 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2740 ini.ReadSection(STD_SEC, SecList);
2741 for i := 0 to SecList.Count - 1 do begin
2742 ActionName := SecList[i];
2743 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2744 if ActionKey <> -1 then begin
2745 Component := ActionList.Owner.FindComponent(ActionName);
2746 if TObject(Component) is TAction then begin
2747 TAction(Component).ShortCut := ActionKey;
2757 procedure TGikoSys.SaveKeySetting(ActionList: TActionList);
2759 STD_SEC = 'KeySetting';
2764 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2766 for i := 0 to ActionList.ActionCount - 1 do begin
2767 if ActionList.Actions[i].Tag = -1 then
2769 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2777 procedure TGikoSys.LoadEditorKeySetting(ActionList: TActionList);
2779 STD_SEC = 'KeySetting';
2785 SecList: TStringList;
2786 Component: TComponent;
2788 if not FileExists(GetConfigDir + EKEY_SETTING_FILE_NAME) then
2790 SecList := TStringList.Create;
2791 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2793 ini.ReadSection(STD_SEC, SecList);
2794 for i := 0 to SecList.Count - 1 do begin
2795 ActionName := SecList[i];
2796 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2797 if ActionKey <> -1 then begin
2798 Component := ActionList.Owner.FindComponent(ActionName);
2799 if TObject(Component) is TAction then begin
2800 TAction(Component).ShortCut := ActionKey;
2810 procedure TGikoSys.SaveEditorKeySetting(ActionList: TActionList);
2812 STD_SEC = 'KeySetting';
2817 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2819 for i := 0 to ActionList.ActionCount - 1 do begin
2820 if ActionList.Actions[i].Tag = -1 then
2822 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2831 procedure TGikoSys.CreateProcess(const AppPath: string; const Param: string);
2833 PI: TProcessInformation;
2837 Path := '"' + AppPath + '"';
2839 Path := Path + ' ' + Param;
2841 SI.Cb := SizeOf(Si);
2842 SI.lpReserved := nil;
2843 SI.lpDesktop := nil;
2846 SI.cbReserved2 := 0;
2847 SI.lpReserved2 := nil;
2849 Windows.CreateProcess(nil,
2861 procedure TGikoSys.OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
2865 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2866 gbtUserApp, gbtAuto:
2867 if (Setting.URLApp) and (FileExists(Setting.URLAppFile)) then
2868 GikoSys.CreateProcess(Setting.URLAppFile, URL)
2870 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2874 function TGikoSys.HTMLDecode(const AStr: String): String;
2876 Sp, Rp, Cp, Tp: PChar;
2881 SetLength(Result, Length(AStr));
2883 Rp := PChar(Result);
2886 while Sp^ <> #0 do begin
2892 'a': if AnsiStrPos(Sp, 'amp;') = Sp then
2898 'g': if (AnsiStrPos(Sp, 'lt;') = Sp) or (AnsiStrPos(Sp, 'gt;') = Sp) then
2902 while (Sp^ <> ';') and (Sp^ <> #0) do
2909 'q': if AnsiStrPos(Sp, 'quot;') = Sp then
2917 Num := IsNumeric(Copy(Tp, 1, 1));
2918 while (Sp^ <> ';') and (Sp^ <> #0) do begin
2919 if (Num) and (not IsNumeric(Copy(Sp, 1, 1))) then
2923 SetString(S, Tp, Sp - Tp);
2928 //raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2929 //[Cp^ + Sp^, Cp - PChar(AStr)])
2939 // on E:EConvertError do
2940 // raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2941 // [Cp^ + Sp^, Cp - PChar(AStr)])
2943 SetLength(Result, Rp - PChar(Result));
2946 function TGikoSys.GetHRefText(s: string): string;
2956 Index := AnsiPos('href', LowerCase(s));
2959 s := Trim(Copy(s, Index + 4, Length(s)));
2960 s := Trim(Copy(s, 2, Length(s)));
2962 //
\8en
\82ß
\82Ì
\95¶
\8e\9a\82ª'"'
\82È
\82ç
\8eæ
\82è
\8f\9c\82
2963 //if Copy(s, 1, 1) = '"' then begin
2964 if s[1] = '"' then begin
2965 s := Trim(Copy(s, 2, Length(s)));
2968 Index := AnsiPos('"', s);
2969 if Index <> 0 then begin
2970 //'"'
\82Ü
\82ÅURL
\82Æ
\82·
\82é
2971 s := Copy(s, 1, Index - 1);
2973 //'"'
\82ª
\96³
\82¯
\82ê
\82Î
\83X
\83y
\81[
\83X
\82©">"
\82Ì
\91\81\82¢
\95û
\82Ü
\82Å
\82ðURL
\82Æ
\82·
\82é
2974 Index := AnsiPos(' ', s);
2975 Index2 := AnsiPos('>', s);
2978 if Index > Index2 then
2981 s := Copy(s, 1, Index - 1)
2983 //
\82±
\82ê
\88È
\8fã
\82à
\82¤
\92m
\82ç
\82ñ
\82Ê
2989 //
\83z
\83X
\83g
\96¼
\82ª
\82Q
\82\83\82\88\82©
\82Ç
\82¤
\82©
\83`
\83F
\83b
\83N
\82·
\82é
2990 function TGikoSys.Is2chHost(Host: string): Boolean;
2992 HOST_NAME: array[0..1] of string = ('2ch.net', 'bbspink.com');
2998 if RightStr( Host, 1 ) = '/' then
2999 Host := Copy( Host, 1, Length( Host ) - 1 );
3000 OutputDebugString(pchar(HOST_NAME[0]));
3001 for i := 0 to Length(HOST_NAME) - 1 do begin
3002 // Len := Length(HOST_NAME[i]);
3003 if (AnsiPos(HOST_NAME[i], Host) > 0) and
3004 (AnsiPos(HOST_NAME[i], Host) = (Length(Host) - Length(HOST_NAME[i]) + 1)) then begin
3011 function TGikoSys.Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
3021 Index := AnsiPos(READ_PATH, path);
3022 if Index <> 0 then begin
3023 s := Copy(path, Index + Length(READ_PATH), Length(path));
3026 BBSID := GetTokenIndex(s, '/', 0);
3027 BBSKey := GetTokenIndex(s, '/', 1);
3030 Result := (BBSID <> '') or (BBSKey <> '');
3033 Index := AnsiPos(KAKO_PATH, path);
3034 if Index <> 0 then begin
3035 s := Copy(path, 2, Length(path));
3036 BBSID := GetTokenIndex(s, '/', 0);
3037 if (BBSID = 'log') and (GetTokenIndex(s, '/', 2) = 'kako') then
3038 BBSID := GetTokenIndex(s, '/', 1);
3039 BBSKey := ChangeFileExt(Document, '');
3040 Result := (BBSID <> '') or (BBSKey <> '');
3043 Index := AnsiPos('read.cgi?', URL);
3044 if Index <> 0 then begin
3045 SList := TStringList.Create;
3048 // s := HTMLDecode(Document);
3049 ExtractHTTPFields(['?', '&'], [], PChar(URL), SList, False);
3050 BBSID := SList.Values['bbs'];
3051 BBSKey := SList.Values['key'];
3052 Result := (BBSID <> '') or (BBSKey <> '');
3062 procedure TGikoSys.GetPopupResNumber(URL : string; var stRes, endRes : Int64);
3069 URL := Trim(LowerCase(URL));
3070 if (AnsiPos('&st=', URL ) <> 0) and ( AnsiPos( '&to=',URL) <> 0 ) then begin
3074 buf := Copy( URL, AnsiPos('&st=', URL ) + 4, AnsiPos( '&to=',URL) - AnsiPos('&st=', URL ) - 4 );
3076 stRes := StrToInt64( buf );
3077 if AnsiPos( '&nofirst=',URL) <> 0 then begin
3078 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, AnsiPos( '&nofirst=',URL) - AnsiPos('&to=', URL ) - 4);
3080 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, Length( URL ) - AnsiPos('&to=', URL ) - 4 + 1 );
3083 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3084 buf := Copy( buf, 1, ps );
3088 endRes := StrToInt64(buf)
3095 if (stRes <> 0) and (endRes = 0) then
3096 endRes := stRes + MAX_POPUP_RES
3097 else if (stRes = 0) and (endRes <> 0) then begin
3098 stRes := endRes - MAX_POPUP_RES;
3102 GikoSys.GetBrowsableThreadURL( URL );
3103 end else if( AnsiPos('&res=', URL ) <> 0 ) then begin
3105 buf := Copy( URL, AnsiPos('&res=', URL ) + 5, Length( URL ) - AnsiPos('&res=', URL ) - 5 + 1 );
3108 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3109 buf := Copy( buf, 1, ps );
3112 stRes := StrToInt(buf)
3119 end else if (AnsiPos('&start=', URL ) <> 0) and ( AnsiPos( '&end=',URL) <> 0 ) then begin
3121 stRes := StrToInt64( Copy( URL, AnsiPos('&start=', URL ) + 7, AnsiPos( '&end=',URL) - AnsiPos('&start=', URL ) - 7 ) );
3122 if AnsiPos( '&nofirst=',URL) <> 0 then begin
3123 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, AnsiPos( '&nofirst=',URL) - AnsiPos('&end=', URL ) - 5);
3125 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, Length( URL ) - AnsiPos('&to=', URL ) - 5 + 1 );
3128 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3129 buf := Copy( buf, 1, ps );
3133 endRes := StrToInt64(buf);
3140 end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
3141 buf := Copy(URL, LastDelimiter('/',URL)+1,Length(URL)-LastDelimiter('/',URL)+1);
3142 if Length(buf) > 0 then begin
3143 if AnsiPos('-', buf) = 1 then begin
3148 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3150 convBuf := Copy( buf, 1, ps );
3151 if convBuf <> '' then
3152 endRes := StrToInt64(convBuf)
3158 if endRes <> 0 then begin
3159 stRes := endRes - MAX_POPUP_RES;
3166 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3168 convBuf := Copy( buf, 1, ps );
3169 if convBuf <> '' then begin
3170 stRes := StrToInt64(convBuf);
3174 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
3176 convBuf := Copy( buf, 1, ps );
3177 if convBuf <> '' then
3178 endRes := StrToInt64(convBuf)
3199 function TGikoSys.Parse2chURL2(URL: string): TPathRec;
3204 // convBuf : String;
3215 URL := Trim(LowerCase(URL));
3220 Result.FFirst := False;
3221 Result.FStBegin := False;
3222 Result.FToEnd := False;
3223 Result.FDone := False;
3224 Result.FNoParam := False;
3228 if URL[length(URL)] = '\' then
3230 FAWKStr.RegExp := 'http://.+\.(2ch\.net|bbspink\.com)/';
3231 if FAWKStr.Match(FAWKStr.ProcessEscSeq(URL), RStart, RLength) <> 0 then begin
3232 s := Copy(URL, RStart + RLength - 1, Length(URL));
3234 //
\95W
\8f\80\8f\91\8e®
3235 //
\8dÅ
\8cã
\82Íl50, 10, 10-20, 10n, 10-20n, -10, 10-, 10n-
\82È
\82Ç
3236 //http://xxx.2ch.net/test/read.cgi/bbsid/1000000000/
3237 FAWKStr.RegExp := '/test/read.cgi/.+/[0-9]+/?.*';
3238 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3239 s := Copy(s, 15, Length(s));
3241 SList := TStringList.Create;
3244 FAWKStr.RegExp := '/';
3245 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 3 then begin
3246 Result.FBBS := SList[1];
3247 Result.FKey := SList[2];
3248 if SList.Count >= 4 then
3252 Result.FNoParam := true;
3258 FAWKStr.LineSeparator := mcls_CRLF;
3259 FAWKStr.RegExp := '-';
3260 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) = 0 then begin
3261 Result.FFirst := True;
3263 FAWKStr.RegExp := 'l[0-9]+';
3264 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3265 Result.FFirst := True;
3267 for i := 0 to SList.Count - 1 do begin
3268 if Trim(SList[i]) = '' then begin
3270 Result.FStBegin := True;
3271 if i = (SList.Count - 1) then
3272 Result.FToEnd := True;
3273 end else if IsNumeric(SList[i]) then begin
3274 wkInt := StrToInt(SList[i]);
3275 wkMax := Max(wkMax, wkInt);
3279 wkMin := Min(wkMin, wkInt);
3280 end else if Trim(SList[i]) = 'n' then begin
3281 Result.FFirst := True;
3283 FAWKStr.RegExp := '^n[0-9]+$|^[0-9]+n$';
3284 if FAWKStr.Match(FAWKStr.ProcessEscSeq(SList[i]), RStart, RLength) > 0 then begin
3285 if Copy(SList[i], 1, 1) = 'n' then
3286 wkInt := StrToInt(Copy(SList[i], 2, Length(SList[i])))
3288 wkInt := StrToInt(Copy(SList[i], 1, Length(SList[i]) - 1));
3289 Result.FFirst := True;
3290 wkMax := Max(wkMax, wkInt);
3294 wkMin := Min(wkMin, wkInt);
3298 if Result.FStBegin and (not Result.FToEnd) then
3300 else if (not Result.FStBegin) and Result.FToEnd then
3302 else if (not Result.FStBegin) and (not Result.FToEnd) then begin
3303 Result.FSt := wkMin;
3304 Result.FTo := wkMax;
3306 //Result.FSt := wkMin;
3307 //Result.FTo := wkMax;
3313 Result.FDone := True;
3317 //
\90Vkako
\8f\91\8e®
3318 //http://server.2ch.net/ITA_NAME/kako/1000/10000/1000000000.html
3319 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+/[0-9]+\.html';
3320 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3321 SList := TStringList.Create;
3324 FAWKStr.RegExp := '/';
3325 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3326 Result.FBBS := SList[1];
3327 Result.FKey := ChangeFileExt(SList[5], '');
3328 Result.FFirst := True;
3334 Result.FDone := True;
3338 //
\8b\8ckako
\8f\91\8e®
3339 //http://server.2ch.net/ITA_NAME/kako/999/999999999.html
3340 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+\.html';
3341 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3342 SList := TStringList.Create;
3345 FAWKStr.RegExp := '/';
3346 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 5 then begin
3347 Result.FBBS := SList[1];
3348 Result.FKey := ChangeFileExt(SList[4], '');
3349 Result.FFirst := True;
3355 Result.FDone := True;
3359 //log
\8by
\82Ñlog2
\8f\91\8e®
3360 //http://server.2ch.net/log/ITA_NAME/kako/999/999999999.html
3361 //http://server.2ch.net/log2/ITA_NAME/kako/999/999999999.html
3362 FAWKStr.RegExp := '/log2?/.+/kako/[0-9]+/[0-9]+\.html';
3363 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3364 SList := TStringList.Create;
3367 FAWKStr.RegExp := '/';
3368 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3369 Result.FBBS := SList[2];
3370 Result.FKey := ChangeFileExt(SList[5], '');
3371 Result.FFirst := True;
3377 Result.FDone := True;
3382 //
\8b\8cURL
\8f\91\8e®
3383 //http://server.2ch.net/test/read.cgi?bbs=ITA_NAME&key=1000000000&st=1&to=5&nofirst=true
3384 FAWKStr.RegExp := '/test/read\.cgi\?';
3385 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3386 s := Copy(s, 16, Length(s));
3387 SList := TStringList.Create;
3390 FAWKStr.RegExp := '&';
3391 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
3392 Result.FFirst := True;
3393 for i := 0 to SList.Count - 1 do begin
3394 if Pos('bbs=', SList[i]) = 1 then begin
3395 Result.FBBS := Copy(SList[i], 5, Length(SList[i]));
3396 end else if Pos('key=', SList[i]) = 1 then begin
3397 Result.FKey := Copy(SList[i], 5, Length(SList[i]));
3398 end else if Pos('st=', SList[i]) = 1 then begin
3399 wk := Copy(SList[i], 4, Length(SList[i]));
3400 if IsNumeric(wk) then
3401 Result.FSt := StrToInt(wk)
3402 else if wk = '' then
3403 Result.FStBegin := True;
3404 end else if Pos('to=', SList[i]) = 1 then begin
3405 wk := Copy(SList[i], 4, Length(SList[i]));
3406 if IsNumeric(wk) then
3407 Result.FTo := StrToInt(wk)
3408 else if wk = '' then
3409 Result.FToEnd := True;
3410 end else if Pos('nofirst=', SList[i]) = 1 then begin
3411 Result.FFirst := False;
3420 if (Result.FBBS <> '') and (Result.FKey <> '') then begin
3421 Result.FDone := True;
3428 procedure TGikoSys.ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
3438 URI := TIdURI.Create(URL);
3440 Protocol := URI.Protocol;
3443 Document := URI.Document;
3445 Bookmark := URI.Bookmark;
3451 function TGikoSys.GetVersionBuild: Integer;
3453 FixedFileInfo: PVSFixedFileInfo;
3454 VersionHandle, VersionSize: DWORD;
3455 pVersionInfo: Pointer;
3460 AppFile := Application.ExeName;
3461 VersionSize := GetFileVersionInfoSize(pChar(AppFile), VersionHandle);
3462 if VersionSize = 0 then
3464 GetMem(pVersionInfo, VersionSize);
3466 if GetFileVersionInfo(PChar(AppFile),VersionHandle,VersionSize, pVersionInfo) then
3467 if VerQueryValue(pVersionInfo, '\', Pointer(FixedFileInfo), ItemLen) then
3468 Result := LOWORD(FixedFileInfo^.dwFileVersionLS);
3470 FreeMem(pVersionInfo, VersionSize);
3474 function TGikoSys.GetBrowsableThreadURL(
3478 threadItem : TThreadItem;
3479 boardPlugIn : TBoardPlugIn;
3483 //=====
\83v
\83\89\83O
\83C
\83\93
3485 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
3486 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
3487 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
3488 boardPlugIn := BoardPlugIns[ i ];
3489 threadItem := TThreadItem.Create( boardPlugIn, inURL );
3490 Result := threadItem.URL;
3498 // 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¢
3501 if Length( Result ) = 0 then
3502 Result := GikoSys.Get2chBrowsableThreadURL( inURL );
3506 function TGikoSys.GetThreadURL2BoardURL(
3510 threadItem : TThreadItem;
3511 boardPlugIn : TBoardPlugIn;
3515 //=====
\83v
\83\89\83O
\83C
\83\93
3517 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
3518 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
3519 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
3520 boardPlugIn := BoardPlugIns[ i ];
3521 threadItem := TThreadItem.Create( boardPlugIn, inURL );
3522 Result := BoardPlugIns[ i ].GetBoardURL( Longword( threadItem ) );
3530 // 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¢
3533 if Length( Result ) = 0 then
3534 Result := GikoSys.Get2chThreadURL2BoardURL( inURL );
3538 function TGikoSys.Get2chThreadURL2BoardURL(
3542 Protocol, Host, Path, Document, Port, Bookmark : string;
3543 BBSID, BBSKey : string;
3547 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3548 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3550 foundPos := Pos( '/test/read.cgi', inURL );
3551 if {(Is2chHost(Host)) and} (foundPos > 0) then
3552 Result := Copy( inURL, 1, foundPos ) + BBSID + '/'
3554 Result := Protocol + '://' + Host + '/' + BBSID + '/';
3558 function TGikoSys.Get2chBrowsableThreadURL(
3562 Protocol, Host, Path, Document, Port, Bookmark : string;
3563 BBSID, BBSKey : string;
3567 // if Pos( KAKO_PATH, inURL ) > 0 then begin
3570 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3571 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3572 foundPos := Pos( '/test/read.cgi', inURL ) - 1;
3574 if Is2chHost( Host ) then begin
3575 Result := Protocol + '://' + Host +
3576 READ_PATH + BBSID + '/' + BBSKey + '/l50';
3578 if foundPos > 0 then
3579 Result := Copy( inURL, 1, foundPos ) +
3580 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50'
3582 Result := Protocol + '://' + Host +
3583 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50';
3589 function TGikoSys.Get2chBoard2ThreadURL(
3597 server := UrlToServer( inBoard.URL );
3598 if Is2chHost( server ) then
3599 Result := server + 'test/read.cgi/' + inBoard.BBSID + '/' + inKey + '/l50'
3601 Result := server + 'test/read.cgi?bbs=' + inBoard.BBSID + '&key=' + inKey + '&ls=50';
3605 (*************************************************************************
3606 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\97ñ
\8b\93
3607 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3608 *************************************************************************)
3609 procedure TGikoSys.ListBoardFile;
3611 boardFileList : TStringList;
3617 for i := 0 to Length( BBSs ) - 1 do
3621 SetLength( BBSs, 0 );
3624 //
\94Â
\83\8a\83X
\83g
\82Ì
\97ñ
\8b\93
3625 if FileExists( GikoSys.GetBoardFileName ) then begin
3626 SetLength( BBSs, l + 1 );
3627 BBSs[ l ] := TBBS.Create( GikoSys.GetBoardFileName );
3628 BBSs[ l ].Title := '
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é';
3632 if FileExists( GikoSys.GetCustomBoardFileName ) then begin
3633 SetLength( BBSs, l + 1 );
3634 BBSs[ l ] := TBBS.Create( GikoSys.GetCustomBoardFileName );
3635 BBSs[ l ].Title := '
\82»
\82Ì
\91¼';
3639 // Board
\83t
\83H
\83\8b\83_
3640 if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
3641 BoardFileList := TStringList.Create;
3643 GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
3644 for k := BoardFileList.Count - 1 downto 0 do begin
3645 if AnsiCompareText(ExtractFileExt(BoardFileList[ k ]), '.bak') = 0 then
3646 BoardFileList.Delete(k);
3648 SetLength( BBSs, l + BoardFileList.Count );
3649 for i := BoardFileList.Count - 1 downto 0 do begin
3650 BBSs[ l ] := TBBS.Create( BoardFileList[ i ] );
3651 BBSs[ l ].Title := ChangeFileExt( ExtractFileName( BoardFileList[ i ] ), '' );
3662 (*************************************************************************
3663 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
3664 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3665 *************************************************************************)
3666 procedure TGikoSys.ReadBoardFile( bbs : TBBS );
3671 boardFile : TStringList;
3672 CategoryList : TStringList;
3673 BoardList : TStringList;
3674 Category : TCategory;
3677 RoundItem : TRoundItem;
3679 i, iBound : Integer;
3680 j, jBound : Integer;
3681 k, kBound : Integer;
3684 if not FileExists( bbs.FilePath ) then
3688 ini := TMemIniFile.Create('');
3689 boardFile := TStringList.Create;
3691 boardFile.LoadFromFile( bbs.FilePath );
3693 ini.SetStrings( boardFile );
3694 CategoryList := TStringList.Create;
3695 BoardList := TStringList.Create;
3697 ini.ReadSections( CategoryList );
3699 iBound := CategoryList.Count - 1;
3700 for i := 0 to iBound do begin
3701 ini.ReadSection( CategoryList[i], BoardList );
3702 Category := TCategory.Create;
3703 Category.No := i + 1;
3704 Category.Title := CategoryList[i];
3706 jBound := BoardList.Count - 1;
3707 for j := 0 to jBound do begin
3709 inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
3711 //=====
\83v
\83\89\83O
\83C
\83\93
3713 kBound := Length( BoardPlugIns ) - 1;
3714 for k := 0 to kBound do begin
3715 if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin
3716 if BoardPlugIns[ k ].AcceptURL( inistr ) = atBoard then begin
3717 Board := TBoard.Create( BoardPlugIns[ k ], inistr );
3724 // 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¢
3728 Board := TBoard.Create( nil, inistr );
3731 Board.Title := BoardList[j];
3732 Board.RoundDate := ZERO_DATE;
3734 idx := RoundList.Find(Board);
3735 if idx <> -1 then begin
3736 RoundItem := RoundList.Items[idx, grtBoard];
3737 Board.Round := True;
3738 Board.RoundName := RoundItem.RoundName;
3741 Category.Add(Board);
3746 bbs.Add( Category );
3748 bbs.IsBoardFileRead := True;
3760 function TGikoSys.GetUnknownCategory : TCategory;
3762 UNKNOWN_CATEGORY = '(
\96¼
\8fÌ
\95s
\96¾)';
3765 if Length( BBSs ) < 2 then begin
3770 Result := BBSs[ 1 ].FindCategoryFromTitle( UNKNOWN_CATEGORY );
3771 if Result = nil then begin
3772 Result := TCategory.Create;
3773 Result.Title := UNKNOWN_CATEGORY;
3774 BBSs[ 1 ].Add( Result );
3779 function TGikoSys.GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
3781 category : TCategory;
3783 UNKNOWN_BOARD = '(
\96¼
\8fÌ
\95s
\96¾)';
3786 category := GetUnknownCategory;
3787 if category = nil then begin
3790 Result := category.FindBoardFromTitle( UNKNOWN_BOARD );
3791 if Result = nil then begin
3792 Result := TBoard.Create( inPlugIn, inURL );
3793 Result.Title := UNKNOWN_BOARD;
3794 category.Add( Result );
3799 function TGikoSys.GetSambaFileName : string;
3801 Result := Setting.GetSambaFileName;
3803 procedure TGikoSys.SambaFileExists();
3806 sambaStrList: TStringList;
3808 if not FileExists(GikoSys.GetSambaFileName) then begin
3809 sambaTmp := ChangeFileExt(GikoSys.GetSambaFileName, '.default');
3810 sambaStrList := TStringList.Create;
3812 if FileExists(sambaTmp) then begin
3813 sambaStrList.LoadFromFile(sambaTmp);
3814 sambaStrList.SaveToFile(GikoSys.GetSambaFileName);
3823 GikoSys := TGikoSys.Create;
3826 if GikoSys <> nil then begin