6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
7 ComCtrls, IniFiles, ShellAPI, ActnList, Math,
15 {HttpApp,} YofUtils, URLMon, IdGlobal, IdURI, {Masks,}
16 Setting, BoardGroup, gzip, Dolib, bmRegExp, AbonUnit,
17 MojuUtils, ExternalBoardManager, ExternalBoardPlugInMain;
21 TGikoBBSType = (gbt2ch);
22 //
\83\8d\83O
\83^
\83C
\83v
23 TGikoLogType = (glt2chNew, glt2chOld);
24 //
\83\81\83b
\83Z
\81[
\83W
\83A
\83C
\83R
\83\93
25 TGikoMessageIcon = (gmiOK, gmiSAD, gmiNG, gmiWhat, gmiNone);
26 //URL
\83I
\81[
\83v
\83\93\83u
\83\89\83E
\83U
\83^
\83C
\83v
27 TGikoBrowserType = (gbtIE, gbtUserApp, gbtAuto);
30 TStrTokSeparator = set of Char;
36 //
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b\83\8c\83R
\81[
\83h
44 FRoundDate: TDateTime;
45 FLastModified: TDateTime;
48 FMishiyou: Boolean; //
\96¢
\8eg
\97p
52 FAllResCount: Integer;
53 FNewResCount: Integer;
54 FAgeSage: TGikoAgeSage;
57 //
\83T
\83u
\83W
\83F
\83N
\83g
\83\8c\83R
\81[
\83h
64 //
\83\8c\83X
\83\8c\83R
\81[
\83h
74 //URLPath
\83\8c\83R
\81[
\83h
77 FKey: string; //ThreadID
78 FSt: Int64; //
\8aJ
\8en
\83\8c\83X
\94Ô
79 FTo: Int64; //
\8fI
\97¹
\83\8c\83X
\94Ô
80 FFirst: Boolean; //>>1
\82Ì
\95\
\8e¦
81 FStBegin: Boolean; //1
\81`
\95\
\8e¦
82 FToEnd: Boolean; //
\81`
\8dÅ
\8cã
\82Ü
\82Å
\95\
\8e¦
83 FDone: Boolean; //
\90¬
\8c÷
86 TGikoSys = class(TObject)
92 FOnlyAHundredRes : Boolean;
94 // FExitWrite: TStringList;
95 // function StrToFloatDef(s: string; Default: Double): Double;
99 FSelectResFilter : TAbon;
102 destructor Destroy; override;
103 property OnlyAHundredRes : Boolean read FOnlyAHundredRes write FOnlyAHundredRes;
104 // function MsgBox(Msg: string; Title: string; Flags: Longint): integer; overload;
105 // function MsgBox(Handle: THandle; Msg: string; Title: string; Flags: Longint): integer; overload;
106 function IsNumeric(s: string): boolean;
107 function IsFloat(s: string): boolean;
108 function DirectoryExistsEx(const Name: string): Boolean;
109 function ForceDirectoriesEx(Dir: string): Boolean;
110 // function GetVersion: string;
112 function GetBoardFileName: string;
113 function GetCustomBoardFileName: string;
114 function GetHtmlTempFileName: string;
115 function GetAppDir: string;
116 function GetTempFolder: string;
117 function GetSentFileName: string;
118 function GetConfigDir: string;
119 function GetSkinDir: string;
120 function GetSkinHeaderFileName: string;
121 function GetSkinFooterFileName: string;
122 function GetSkinResFileName: string;
123 function GetSkinNewResFileName: string;
124 function GetSkinBookmarkFileName: string;
125 function GetSkinNewmarkFileName: string;
126 function GetStyleSheetDir: string;
127 function GetOutBoxFileName: string;
128 function GetUserAgent: string;
129 function GetSambaFileName : string;
131 procedure ReadSubjectFile(Board: TBoard);
132 procedure CreateThreadDat(Board: TBoard);
133 procedure WriteThreadDat(Board: TBoard);
134 function ParseIndexLine(Line: string): TIndexRec;
135 procedure GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean); overload;
136 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¢
137 procedure GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
139 procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
140 function AddAnchorTag(s: string): string;
142 function DivideSubject(Line: string): TSubjectRec;
143 function DivideStrLine(Line: string): TResRec;
145 property Setting: TSetting read FSetting write FSetting;
146 property Dolib: TDolib read FDolib write FDolib;
148 function UrlToID(url: string): string;
149 function UrlToServer(url: string): string;
151 function StrTokFirst(const s:string; const sep:TStrTokSeparator; var Rec:TStrTokRec):string;
152 function StrTokNext(const sep:TStrTokSeparator; var Rec:TStrTokRec): string;
154 function GetFileSize(FileName : string) : longint;
155 function GetFileLineCount(FileName : string): longint;
156 function Get2chDate(aDate: TDateTime): string;
157 function IntToDateTime(val: Int64): TDateTime;
158 function DateTimeToInt(ADate: TDateTime): Int64;
160 function ReadThreadFile(FileName: string; Line: Integer): string;
162 procedure MenuFont(Font: TFont);
164 function RemoveToken(var s:string; const delimiter:string):string;
165 function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
166 function DeleteLink(const s: string): string;
168 function GetShortName(const LongName: string; ALength: integer): string;
169 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string): string; overload;
170 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
172 function ZenToHan(const s: string): string;
173 function VaguePos(const Substr, S: string): Integer;
174 function BoolToInt(b: Boolean): Integer;
175 function IntToBool(i: Integer): Boolean;
176 function GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
177 procedure LoadKeySetting(ActionList: TActionList);
178 procedure SaveKeySetting(ActionList: TActionList);
179 procedure LoadEditorKeySetting(ActionList: TActionList);
180 procedure SaveEditorKeySetting(ActionList: TActionList);
182 procedure CreateProcess(const AppPath: string; const Param: string);
183 procedure OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
184 function HTMLDecode(const AStr: String): String;
185 function GetHRefText(s: string): string;
186 function Is2chHost(Host: string): Boolean;
187 function Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
188 function Parse2chURL2(URL: string): TPathRec;
189 procedure ParseURI(var URL, Protocol, Host, Path, Document, Port, Bookmark: string);
190 function GetVersionBuild: Integer;
191 function GetBrowsableThreadURL( inURL : string ) : string;
192 function GetThreadURL2BoardURL( inURL : string ) : string;
193 function Get2chThreadURL2BoardURL( inURL : string ) : string;
194 function Get2chBrowsableThreadURL( inURL : string ) : string;
195 function Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string;
196 procedure ListBoardFile;
197 procedure ReadBoardFile( bbs : TBBS );
199 function GetUnknownCategory : TCategory;
200 function GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
202 procedure GetPopupResNumber(URL : string; var stRes, endRes : Int64);
204 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
205 function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string;
206 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
207 function SkinedRes( skin: string; Res: TResRec; No: string ): string;
209 //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é
210 procedure SambaFileExists();
216 //LENGTH_RESTITLE = 40;
217 ZERO_DATE: Integer = 25569;
218 BETA_VERSION_NAME_E = 'beta';
219 BETA_VERSION_NAME_J = 'ÊÞÀ';
221 BETA_VERSION_BUILD = ''; //debug
\94Å
\82È
\82Ç
222 APP_NAME = 'gikoNavi';
230 FOLDER_INDEX_VERSION = '1.01';
231 USER_AGENT = 'Monazilla';
232 DEFAULT_NGWORD_FILE_NAME : String = 'NGword.txt';
233 NGWORDs_DIR_NAME : String = 'NGwords';
235 READ_PATH: string = '/test/read.cgi/';
236 OLD_READ_PATH: string = '/test/read.cgi?';
237 KAKO_PATH: string = '/kako/';
239 (*************************************************************************
240 *GikoSys
\83R
\83\93\83X
\83g
\83\89\83N
\83^
241 *************************************************************************)
242 constructor TGikoSys.Create;
244 FSetting := TSetting.Create;
245 FDolib := TDolib.Create;
246 FAWKStr := TAWKStr.Create(nil);
247 if DirectoryExists(GetConfigDir) = false then begin
248 CreateDir(GetConfigDir);
250 FAbon := TAbon.Create;
251 FAbon.Setroot(GetConfigDir+NGWORDs_DIR_NAME);
253 FAbon.ReturnNGwordLineNum := FSetting.ShowNGLinesNum;
254 FAbon.SetNGResAnchor := FSetting.AddResAnchor;
255 FAbon.DeleteSyria := FSetting.DeleteSyria;
256 FAbon.Deleterlo := FSetting.AbonDeleterlo;
257 FAbon.Replaceul := FSetting.AbonReplaceul;
258 FAbon.AbonPopupRes := FSetting.PopUpAbon;
260 FSelectResFilter := TAbon.Create;
261 //
\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
262 FSelectResFilter.AbonString := '';
264 OnlyAHundredRes := FSetting.OnlyAHundredRes;
267 (*************************************************************************
268 *GikoSys
\83f
\83X
\83g
\83\89\83N
\83^
269 *************************************************************************)
270 destructor TGikoSys.Destroy;
273 FileList: TStringList;
275 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
283 FSelectResFilter.Free;
284 //
\83e
\83\93\83|
\83\89\83\8aHTML
\82ð
\8dí
\8f\9c
285 FileList := TStringList.Create;
287 GetFileList(GetTempFolder, '*.html', FileList, False, True);
288 for i := 0 to FileList.Count - 1 do begin
289 DeleteFile(FileList[i]);
297 (*************************************************************************
298 *
\95¶
\8e\9a\97ñ
\90\94\8e\9a\83`
\83F
\83b
\83N
299 *************************************************************************)
301 function TGikoSys.IsNumeric(s: string): boolean;
311 (*************************************************************************
312 *
\95¶
\8e\9a\97ñ
\95\82\93®
\8f¬
\90\94\93_
\90\94\8e\9a\83`
\83F
\83b
\83N
313 *************************************************************************)
314 function TGikoSys.IsFloat(s: string): boolean;
318 Result := TextToFloat(PChar(s), v, fvExtended);
321 (*************************************************************************
322 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
323 *************************************************************************)
324 function TGikoSys.GetBoardFileName: string;
326 Result := Setting.GetBoardFileName;
329 (*************************************************************************
330 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
331 *************************************************************************)
332 function TGikoSys.GetCustomBoardFileName: string;
334 Result := Setting.GetCustomBoardFileName;
337 (*************************************************************************
338 *
\83e
\83\93\83|
\83\89\83\8a\83t
\83H
\83\8b\83_
\81[
\96¼
\8eæ
\93¾
339 *************************************************************************)
340 function TGikoSys.GetHtmlTempFileName: string;
342 Result := Setting.GetHtmlTempFileName;
346 (*************************************************************************
347 *
\8eÀ
\8ds
\83t
\83@
\83C
\83\8b\83t
\83H
\83\8b\83_
\8eæ
\93¾
348 *************************************************************************)
349 function TGikoSys.GetAppDir: string;
351 Result := Setting.GetAppDir;
354 (*************************************************************************
355 *TempHtml
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
356 *************************************************************************)
357 function TGikoSys.GetTempFolder: string;
359 Result := Setting.GetTempFolder;
362 (*************************************************************************
363 *sent.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
364 *************************************************************************)
365 function TGikoSys.GetSentFileName: string;
367 Result := Setting.GetSentFileName;
370 (*************************************************************************
371 *outbox.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
372 *************************************************************************)
373 function TGikoSys.GetOutBoxFileName: string;
375 Result := Setting.GetOutBoxFileName;
378 (*************************************************************************
379 *Config
\83t
\83H
\83\8b\83_
\8eæ
\93¾
380 *************************************************************************)
381 function TGikoSys.GetConfigDir: string;
383 Result := Setting.GetConfigDir;
386 function TGikoSys.GetStyleSheetDir: string;
388 Result := Setting.GetStyleSheetDir;
391 function TGikoSys.GetSkinDir: string;
393 Result := Setting.GetSkinDir;
396 function TGikoSys.GetSkinHeaderFileName: string;
398 Result := Setting.GetSkinHeaderFileName;
401 function TGikoSys.GetSkinFooterFileName: string;
403 Result := Setting.GetSkinFooterFileName;
406 function TGikoSys.GetSkinNewResFileName: string;
408 Result := Setting.GetSkinNewResFileName;
411 function TGikoSys.GetSkinResFileName: string;
413 Result := Setting.GetSkinResFileName;
416 function TGikoSys.GetSkinBookmarkFileName: string;
418 Result := Setting.GetSkinBookmarkFileName;
421 function TGikoSys.GetSkinNewmarkFileName: string;
423 Result := Setting.GetSkinNewmarkFileName;
427 function TGikoSys.GetUserAgent: string;
429 if Dolib.Connected then begin
430 Result := Format('%s %s/%s%d%s', [
437 BETA_VERSION_BUILD]);
439 Result := Format('%s/%s %s/%s%d%s', [
447 BETA_VERSION_BUILD]);
451 (*************************************************************************
452 *
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é
\95û
\8e®
\8e\9e\8d\8f\8eæ
\93¾
453 *************************************************************************)
454 function TGikoSys.Get2chDate(aDate: TDateTime): string;
459 d1 := EncodeDate(1970, 1, 1);
460 d2 := aDate - EncodeTime(9, 0, 0, 0);
461 //Result := FloatToStr(Trunc((d2 - d1) * 24 * 60 * 60));
462 Result := FloatToStr(Trunc((d2 - d1) * 86400));
466 function TGikoSys.IntToDateTime(val: Int64): TDateTime;
471 d1 := EncodeDate(1970, 1, 1);
472 d2 := val / 86400.0;//(val * 1000) / (24 * 60 * 60 * 1000);
476 function TGikoSys.DateTimeToInt(ADate: TDateTime): Int64;
481 d := EncodeDate(1970, 1, 1);
482 c := (ADate - d) * 86400; //(ADate - d) * 24 * 60 * 60;
487 (*************************************************************************
488 *Subject
\83t
\83@
\83C
\83\8bRead
489 *************************************************************************)
490 procedure TGikoSys.ReadSubjectFile(Board: TBoard);
492 ThreadItem: TThreadItem;
494 FileList: TStringList;
495 TmpFileList: TStringList;
496 // SrchRec: TSearchRec;
503 // TmpUpdate: Boolean;
506 RoundItem: TRoundItem;
511 if Board.IsThreadDatRead then
515 // TmpUpdate := False;
517 usePlugIn := Board.IsBoardPlugInAvailable;
519 FileName := Board.GetFolderIndexFileName;
521 // if not FileExists(FileName) then CreateThreadDat(Board);
522 // if not FileExists(FileName) then Exit;
524 { R := FindFirst(ExtractFileDir(Board.GetFolderIndexFileName) + '\*.dat', 0, SrchRec);
526 FileList.Add(SrchRec.Name);
527 R := FindNext(SrchRec);
531 FileList := TStringList.Create;
532 FileList.Sorted := True;
533 TmpFileList := TStringList.Create;
534 TmpFileList.Sorted := True;
536 //IsLogFile
\97pDAT
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
537 //GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False, False);
538 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False);
540 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\97pTmp
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
541 //GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False, False);
542 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False);
544 //
\8fd
\95¡
\82ð
\96h
\82®
546 Board.Sorted := True;
548 sl := TStringList.Create;
550 if FileExists(FileName) then begin
551 sl.LoadFromFile(FileName);
553 //
\82Q
\8ds
\96Ú
\82©
\82ç
\81i
\82P
\8ds
\96Ú
\82Í
\83o
\81[
\83W
\83\87\83\93\81j
554 for i := sl.Count - 1 downto 1 do begin
555 Rec := ParseIndexLine(sl[i]);
557 ThreadItem := TThreadItem.Create(
559 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
561 ThreadItem := TThreadItem.Create(
563 Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' ) ) );
565 if FileList.Count <> 0 then
566 if FileList.Find( ThreadItem.FileName, Index ) then
567 //ThreadItem.IsLogFile := True;
568 FileList.Delete( Index );
570 ThreadItem.BeginUpdate;
571 ThreadItem.No := Rec.FNo;
572 ThreadItem.FileName := Rec.FFileName;
573 ThreadItem.Title := Rec.FTitle;
574 ThreadItem.Count := Rec.FCount;
575 ThreadItem.Size := Rec.FSize;
576 // ThreadItem.RoundNo := Rec.FRoundNo;
577 ThreadItem.RoundDate := Rec.FRoundDate;
578 ThreadItem.LastModified := Rec.FLastModified;
579 ThreadItem.Kokomade := Rec.FKokomade;
580 ThreadItem.NewReceive := Rec.FNewReceive;
581 // ThreadItem.Round := Rec.FRound;
582 ThreadItem.UnRead := Rec.FUnRead;
583 ThreadItem.ScrollTop := Rec.FScrollTop;
584 ThreadItem.AllResCount := Rec.FAllResCount;
585 ThreadItem.NewResCount := Rec.FNewResCount;
586 ThreadItem.AgeSage := Rec.FAgeSage;
587 ThreadItem.ParentBoard := Board;
589 //
\8f\84\89ñ
\83\8a\83X
\83g
\82É
\91¶
\8dÝ
\82µ
\82½
\82ç
\8f\84\89ñ
\83t
\83\89\83O
\83Z
\83b
\83g
590 if ThreadItem.IsLogFile then begin
591 idx := RoundList.Find(ThreadItem);
592 if idx <> -1 then begin
593 RoundItem := RoundList.Items[idx, grtItem];
594 ThreadItem.RoundName := RoundItem.RoundName;
595 ThreadItem.Round := True;
599 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\83`
\83F
\83b
\83N
600 if TmpFileList.Count <> 0 then begin
601 Index := TmpFileList.IndexOf(ChangeFileExt(ThreadItem.FileName, '.tmp'));
602 //if TmpFileList.Find(ChangeFileExt(ThreadItem.FileName, '.tmp'), Index) then begin
603 if Index <> -1 then begin
604 ini := TMemIniFile.Create(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
606 //ThreadItem.RoundDate := ini.ReadDateTime('Setting', 'RoundDate', ZERO_DATE);
607 tmpStr := ini.ReadString('Setting', 'RoundDate', DateTimeToStr(ZERO_DATE));
608 ThreadItem.RoundDate := ConvertDateTimeString(tmpStr);
610 //ThreadItem.LastModified := ini.ReadDateTime('Setting', 'LastModified', ZERO_DATE);
611 tmpStr := ini.ReadString('Setting', 'LastModified', DateTimeToStr(ZERO_DATE));
612 ThreadItem.LastModified := ConvertDateTimeString(tmpStr);
614 ThreadItem.Size := ini.ReadInteger('Setting', 'Size', 0);
615 if ThreadItem.Size = 0 then begin
617 ThreadItem.Size := FileSizeByName(ThreadItem.GetThreadFileName) - ThreadItem.Count;
621 ThreadItem.Count := ini.ReadInteger('Setting', 'Count', 0);
622 ThreadItem.NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
623 ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
624 ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
625 ThreadItem.ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
626 ThreadItem.AllResCount := ini.ReadInteger('Setting', 'AllResCount', ThreadItem.Count);
627 ThreadItem.NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
628 ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
632 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
633 TmpFileList.Delete(Index);
637 ThreadItem.EndUpdate;
638 Board.Add(ThreadItem);
640 // if (ThreadItem.IsLogFile) and (ThreadItem.Count > ThreadItem.Kokomade) then
641 if (ThreadItem.IsLogFile) and (ThreadItem.UnRead) then
646 if UnRead <> Board.UnRead then
647 Board.UnRead := UnRead;
649 //
\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
650 for i := 0 to FileList.Count - 1 do begin
651 FileName := ExtractFileDir(Board.GetFolderIndexFileName) + '\' + FileList[i];
653 //ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
654 if usePlugIn then begin
655 ThreadItem := TThreadItem.Create(
657 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), FileList[i] ) );
658 ResRec := DivideStrLine(Board.BoardPlugIn.GetDat( DWORD( ThreadItem ), 1 ));
660 ThreadItem := TThreadItem.Create(
661 nil, Get2chBoard2ThreadURL( Board, ChangeFileExt( FileList[i], '' ) ) );
662 ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
665 ThreadItem.BeginUpdate;
666 ThreadItem.FilePath := FileName;
667 ThreadItem.No := Board.Count + 1;
668 ThreadItem.FileName := FileList[i];
669 ThreadItem.Title := ResRec.FTitle;
670 ThreadItem.Count := GetFileLineCount(FileName);
671 ThreadItem.AllResCount := ThreadItem.Count;
672 ThreadItem.NewResCount := ThreadItem.Count;
673 ThreadItem.Size := FileSizeByName(FileName) - ThreadItem.Count;//1byte
\82¸
\82ê
\82é
\82Æ
\82«
\82ª
\82 \82é
\82¯
\82Ç
\82»
\82ê
\82Í
\82 \82«
\82ç
\82ß
\82é
674 ThreadItem.RoundDate := ZERO_DATE;
675 ThreadItem.LastModified := ZERO_DATE;
676 ThreadItem.Kokomade := -1;
677 ThreadItem.NewReceive := ThreadItem.Count;
678 ThreadItem.ParentBoard := Board;
679 ThreadItem.IsLogFile := True;
680 ThreadItem.Round := False;
681 ThreadItem.UnRead := False;
682 ThreadItem.ScrollTop := 0;
683 ThreadItem.AgeSage := gasNone;
684 ThreadItem.EndUpdate;
685 Board.Add(ThreadItem);
692 Board.Sorted := False;
694 Board.IsThreadDatRead := True;
695 if not FileExists(Board.GetFolderIndexFileName) then begin
696 WriteThreadDat(Board);
697 CreateThreadDat(Board);
701 (*************************************************************************
702 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b(Folder.idx)
\8dì
\90¬
703 *************************************************************************)
704 procedure TGikoSys.CreateThreadDat(Board: TBoard);
708 SubjectList: TStringList;
714 if not FileExists(Board.GetSubjectFileName) then Exit;
715 FileName := Board.GetFolderIndexFileName;
717 SubjectList := TStringList.Create;
719 SubjectList.LoadFromFile(Board.GetSubjectFileName);
720 sl := TStringList.Create;
723 sl.Add(FOLDER_INDEX_VERSION);
724 for i := 0 to SubjectList.Count - 1 do begin
725 Rec := DivideSubject(SubjectList[i]);
727 if (Trim(Rec.FFileName) = '') or (Trim(Rec.FTitle) = '') then
730 s := Format('%x', [cnt]) + #1 //
\94Ô
\8d\86
731 + Rec.FFileName + #1 //
\83t
\83@
\83C
\83\8b\96¼
732 + Rec.FTitle + #1 //
\83^
\83C
\83g
\83\8b
733 + Format('%x', [Rec.FCount]) + #1 //
\83J
\83E
\83\93\83g
734 + Format('%x', [0]) + #1 //size
735 + Format('%x', [0]) + #1 //RoundDate
736 + Format('%x', [0]) + #1 //LastModified
737 + Format('%x', [0]) + #1 //Kokomade
738 + Format('%x', [0]) + #1 //NewReceive
739 + '0' + #1 //
\96¢
\8eg
\97p
740 + Format('%x', [0]) + #1 //UnRead
741 + Format('%x', [0]) + #1 //ScrollTop
742 + Format('%x', [Rec.FCount]) + #1 //AllResCount
743 + Format('%x', [0]) + #1 //NewResCount
744 + Format('%x', [0]); //AgeSage
749 sl.SaveToFile(FileName);
758 (*************************************************************************
759 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X(Thread.dat)
\8f\91\82«
\8d\9e\82Ý
761 *************************************************************************)
762 procedure TGikoSys.WriteThreadDat(Board: TBoard);
764 // Values: array[Boolean] of string = ('0', '1');
772 TmpFileList: TStringList;
775 if not Board.IsThreadDatRead then
777 FileName := Board.GetFolderIndexFileName;
778 ForceDirectoriesEx( ExtractFilePath( FileName ) );
780 sl := TStringList.Create;
781 TmpFileList := TStringList.Create;
783 //GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False, true);
784 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, false);
787 sl.Add(FOLDER_INDEX_VERSION);
788 for i := 0 to Board.Count - 1 do begin
789 if Board.Items[i].No = 0 then
790 Board.Items[i].No := i + 1;
792 if TmpFileList.Count <> 0 then begin
793 //if TmpFileList.Find(ChangeFileExt(Board.Items[i].FileName, '.tmp'), Index) then begin
794 Index := TmpFileList.IndexOf(ChangeFileExt(Board.Items[i].FileName, '.tmp'));
795 if Index <> -1 then begin
796 ini := TMemIniFile.Create(ChangeFileExt(Board.Items[Index].GetThreadFileName, '.tmp'));
798 tmpSize := ini.ReadInteger('Setting', 'Size', 0);
799 if Board.Items[i].Size < tmpSize then begin
800 //Board.Items[i].RoundDate := ini.ReadDateTime('Setting', 'RoundDate', ZERO_DATE);
801 //Board.Items[i].LastModified := ini.ReadDateTime('Setting', 'LastModified', ZERO_DATE);
802 Board.Items[i].Size := tmpSize;
803 Board.Items[i].Count := ini.ReadInteger('Setting', 'Count', 0);
804 Board.Items[i].NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
805 //Board.Items[i].Round := ini.ReadBool('Setting', 'Round', False);
806 //Board.Items[i].UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
807 //Board.Items[i].ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
808 Board.Items[i].AllResCount := ini.ReadInteger('Setting', 'AllResCount', Board.Items[i].Count);
809 Board.Items[i].NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
810 //Board.Items[i].AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
815 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList.Strings[Index]);
816 TmpFileList.Delete(Index);
820 s := Format('%x', [Board.Items[i].No]) + #1
821 + Board.Items[i].FileName + #1
822 + Board.Items[i].Title + #1
823 + Format('%x', [Board.Items[i].Count]) + #1
824 + Format('%x', [Board.Items[i].Size]) + #1
825 + Format('%x', [DateTimeToInt(Board.Items[i].RoundDate)]) + #1
826 + Format('%x', [DateTimeToInt(Board.Items[i].LastModified)]) + #1
827 + Format('%x', [Board.Items[i].Kokomade]) + #1
828 + Format('%x', [Board.Items[i].NewReceive]) + #1
829 + '0' + #1 //
\96¢
\8eg
\97p
830 + Format('%x', [BoolToInt(Board.Items[i].UnRead)]) + #1
831 + Format('%x', [Board.Items[i].ScrollTop]) + #1
832 + Format('%x', [Board.Items[i].AllResCount]) + #1
833 + Format('%x', [Board.Items[i].NewResCount]) + #1
834 + Format('%x', [Ord(Board.Items[i].AgeSage)]);
839 sl.SaveToFile(FileName);
841 for i := 0 to TmpFileList.Count - 1 do begin
842 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[i]);
851 function TGikoSys.ParseIndexLine(Line: string): TIndexRec;
856 {for i := 0 to 14 do begin
857 s := GetTokenIndex(Line, #1, i);
859 0: Result.FNo := StrToIntDef('$' + s, 0);
860 1: Result.FFileName := s;
861 2: Result.FTitle := s;
862 3: Result.FCount := StrToIntDef('$' + s, 0);
863 4: Result.FSize := StrToIntDef('$' + s, 0);
864 5: Result.FRoundDate := IntToDateTime(StrToIntDef('$' + s, ZERO_DATE));
865 6: Result.FLastModified := IntToDateTime(StrToIntDef('$' + s, ZERO_DATE));
866 7: Result.FKokomade := StrToIntDef('$' + s, -1);
867 8: Result.FNewReceive := StrToIntDef('$' + s, 0);
869 10: Result.FUnRead := IntToBool(StrToIntDef('$' + s, 0));
870 11: Result.FScrollTop := StrToIntDef('$' + s, 0);
871 12: Result.FAllResCount := StrToIntDef('$' + s, 0);
872 13: Result.FNewResCount := StrToIntDef('$' + s, 0);
873 14: Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + s, 0));
877 Result.FNo := StrToIntDef('$' + RemoveToken(Line, #1), 0);
878 Result.FFileName := RemoveToken(Line, #1);
879 Result.FTitle := RemoveToken(Line, #1);
880 Result.FCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
881 Result.FSize := StrToIntDef('$' + RemoveToken(Line, #1), 0);
882 Result.FRoundDate := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
883 Result.FLastModified := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
884 Result.FKokomade := StrToIntDef('$' + RemoveToken(Line, #1), -1);
885 Result.FNewReceive := StrToIntDef('$' + RemoveToken(Line, #1), 0);
886 RemoveToken(Line, #1);//9: ; //
\96¢
\8eg
\97p
887 Result.FUnRead := IntToBool(StrToIntDef('$' + RemoveToken(Line, #1), 0));
888 Result.FScrollTop := StrToIntDef('$' + RemoveToken(Line, #1), 0);
889 Result.FAllResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
890 Result.FNewResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
891 Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + RemoveToken(Line, #1), 0));
895 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
896 // ListFiles('c:\', '*.txt', list, True);
897 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
900 SearchRec : TSearchRec;
904 maskExt := Copy(Mask, 1, Length(Mask) - 1);
906 Path := IncludeTrailingPathDelimiter(Path);
907 rc := FindFirst(Path + '*.*', faAnyfile, SearchRec);
909 while rc = 0 do begin
910 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
911 s := Path + SearchRec.Name;
912 //if (SearchRec.Attr and faDirectory > 0) then
913 // s := IncludeTrailingPathDelimiter(s)
915 if (SearchRec.Attr and faDirectory = 0) and (MatchesMask(s, Mask)) then
919 List.Add(SearchRec.Name);
920 if SubDir and (SearchRec.Attr and faDirectory > 0) then
921 GetFileList(s, Mask, List, True, IsPathAdd);
923 rc := FindNext(SearchRec);
926 SysUtils.FindClose(SearchRec);
930 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
931 //
\83T
\83u
\83t
\83H
\83\8b\83_
\82Í
\8c\9f\8dõ
\82µ
\82È
\82¢
932 // ListFiles('c:\', '*.txt', list, True);
933 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean);
936 SearchRec : TSearchRec;
939 Path := IncludeTrailingPathDelimiter(Path);
940 rc := FindFirst(Path + Mask, faAnyfile, SearchRec);
942 while rc = 0 do begin
943 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
944 s := Path + SearchRec.Name;
946 if (SearchRec.Attr and faDirectory = 0) then
950 List.Add(SearchRec.Name);
952 rc := FindNext(SearchRec);
955 SysUtils.FindClose(SearchRec);
959 //
\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é
960 procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
963 SearchRec : TSearchRec;
966 Path := IncludeTrailingPathDelimiter(Path);
967 rc := FindFirst(Path + '*.*', faDirectory, SearchRec);
969 while rc = 0 do begin
970 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
971 s := Path + SearchRec.Name;
972 //if (SearchRec.Attr and faDirectory > 0) then
973 // s := IncludeTrailingPathDelimiter(s)
975 if (SearchRec.Attr and faDirectory > 0) and (MatchesMask(s, Mask)) then
976 List.Add( IncludeTrailingPathDelimiter( s ) );
977 if SubDir and (SearchRec.Attr and faDirectory > 0) then
978 GetDirectoryList(s, Mask, List, True);
980 rc := FindNext(SearchRec);
983 SysUtils.FindClose(SearchRec);
987 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
988 function TGikoSys.LoadFromSkin(
990 ThreadItem: TThreadItem;
997 Skin := TStringList.Create;
999 if FileExists( fileName ) then begin
1000 Skin.LoadFromFile( fileName );
1002 //
\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
1004 if ThreadItem.ParentBoard <> nil then
1005 if ThreadItem.ParentBoard.ParentCategory <> nil then
1006 CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
1007 CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
1009 CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
1010 CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
1011 CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
1012 CustomStringReplace( Skin, '<SKINPATH/>', Setting.CSSFileName);
1013 CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.NewReceive - 1 ));
1014 CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
1015 CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.AllResCount ));
1017 CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
1018 CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
1019 CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
1021 //-----
\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µ
1022 //
\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
1024 if ThreadItem.ParentBoard <> nil then
1025 if ThreadItem.ParentBoard.ParentCategory <> nil then
1026 CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
1027 CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
1029 CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
1030 CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
1031 CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
1032 CustomStringReplace( Skin, '&SKINPATH', Setting.CSSFileName);
1033 CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
1034 CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
1035 CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
1037 CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
1038 CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
1039 CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
1040 //-----
\82±
\82±
\82Ü
\82Å
1042 Result := Skin.Text;
1048 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
1049 function TGikoSys.SkinedRes(
1057 Skin := CustomStringReplace( Skin, '<NUMBER/>',
1058 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1059 Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
1060 Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
1061 Skin := CustomStringReplace( Skin, '<MAILNAME/>',
1062 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1063 Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
1064 Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
1065 Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
1067 //-----
\82©
\82¿
\82ã
\81`
\82µ
\82á
\8cÝ
\8a·
\97p
\81B
\83R
\83\81\83\93\83g
\83A
\83E
\83g
\82µ
\82Ä
\82à
\82æ
\82µ
1068 Skin := CustomStringReplace( Skin, '&NUMBER',
1069 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1070 Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
1071 Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
1072 Skin := CustomStringReplace( Skin, '&MAILNAME',
1073 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1074 Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
1075 Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
1076 Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
1077 //-----
\82±
\82±
\82Ü
\82Å
1085 procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
1089 //bufList : TStringList;
1090 ReadList: TStringList;
1091 SaveList: TStringList;
1092 CSSFileName: string;
1095 NewReceiveNo: Integer;
1097 boardPlugIn : TBoardPlugIn;
1099 UserOptionalStyle: string;
1103 // SizeByte: Integer;
1105 function LoadSkin( fileName: string ): string;
1107 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1109 function ReplaceRes( skin: string ): string;
1111 Result := SkinedRes( skin, Res, No );
1114 if ThreadItem <> nil then begin
1115 if ThreadItem.IsBoardPlugInAvailable then begin
1116 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1117 boardPlugIn := ThreadItem.BoardPlugIn;
1118 NewReceiveNo := ThreadItem.NewReceive;
1119 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1120 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1121 UserOptionalStyle := UserOptionalStyle +
1122 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1123 if GikoSys.Setting.BrowserFontSize <> 0 then
1124 UserOptionalStyle := UserOptionalStyle +
1125 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1126 if GikoSys.Setting.BrowserFontColor <> -1 then
1127 UserOptionalStyle := UserOptionalStyle +
1128 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1129 if GikoSys.Setting.BrowserBackColor <> -1 then
1130 UserOptionalStyle := UserOptionalStyle +
1131 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1132 case GikoSys.Setting.BrowserFontBold of
1133 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1134 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1136 case GikoSys.Setting.BrowserFontItalic of
1137 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1138 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1141 SaveList := TStringList.Create;
1144 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1145 // doc.charset := 'Shift_JIS';
1146 threadItem.SizeByte := 0;
1149 SaveList.Add( boardPlugIn.GetHeader( DWORD( threadItem ),
1150 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) );
1152 for i := 0 to threadItem.Count - 1 do begin
1153 if (OnlyAHundredRes = true) and ( i <> 0 ) and ( (threadItem.Count-i) > 101 ) then begin
1157 //
\90V
\92\85\83}
\81[
\83N
1158 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1160 if GikoSys.Setting.UseSkin then begin
1161 if FileExists( GetSkinNewmarkFileName ) then
1162 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1164 SaveList.Add( '<a name="new"></a>' );
1165 end else if GikoSys.Setting.UseCSS then begin
1166 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>');
1168 SaveList.Add('</dl>');
1169 SaveList.Add('<a name="new"></a>');
1170 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>');
1171 SaveList.Add('<dl>');
1174 SaveList.Add( '<a name="new"></a>' );
1179 SaveList.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
1181 if ThreadItem.Kokomade = (i + 1) then begin
1182 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1184 if GikoSys.Setting.UseSkin then begin
1185 if FileExists( GetSkinBookmarkFileName ) then
1186 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1188 SaveList.Add( '<a name="koko"></a>' );
1189 end else if GikoSys.Setting.UseCSS then begin
1190 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1192 SaveList.Add('</dl>');
1193 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>');
1194 SaveList.Add('<dl>');
1197 SaveList.Add( '<a name="koko"></a>' );
1201 threadItem.SizeByte := threadItem.SizeByte + Length( SaveList.Text );
1202 doc.Write(SaveList.Text);
1206 threadItem.SizeByte := threadItem.SizeByte + Length( SaveList.Text );
1208 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1209 SaveList.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1211 doc.Write(SaveList.Text);
1220 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1221 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1222 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1223 ShortDayNames[7] := '
\93y';
1225 BBSID := ThreadItem.ParentBoard.BBSID;
1226 NewReceiveNo := ThreadItem.NewReceive;
1227 ReadList := TStringList.Create;
1229 if ThreadItem.IsLogFile then begin
1230 FileName := ThreadItem.GetThreadFileName;
1231 ReadList.LoadFromFile(FileName);
1232 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1233 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1234 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1235 Res := DivideStrLine(ReadList[0]);
1236 Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1237 sTitle := Res.FTitle;
1239 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1241 SaveList := TStringList.Create;
1244 doc.charset := 'Shift_JIS';
1246 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1247 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
1248 UserOptionalStyle := UserOptionalStyle +
1249 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
1250 if GikoSys.Setting.BrowserFontSize <> 0 then
1251 UserOptionalStyle := UserOptionalStyle +
1252 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
1253 if GikoSys.Setting.BrowserFontColor <> -1 then
1254 UserOptionalStyle := UserOptionalStyle +
1255 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
1256 if GikoSys.Setting.BrowserBackColor <> -1 then
1257 UserOptionalStyle := UserOptionalStyle +
1258 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
1259 case GikoSys.Setting.BrowserFontBold of
1260 -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
1261 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
1263 case GikoSys.Setting.BrowserFontItalic of
1264 -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
1265 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
1268 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1269 if GikoSys.Setting.UseSkin then begin
1270 //
\83X
\83L
\83\93\8eg
\97p
1271 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1273 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1274 if Length( UserOptionalStyle ) > 0 then
1275 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1276 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1277 SaveList.Add( SkinHeader );
1281 SkinNewRes := LoadSkin( GetSkinNewResFileName );
1285 SkinRes := LoadSkin( GetSkinResFileName );
1289 SaveList.Add('<a name="top"></a>');
1291 for i := 0 to ReadList.Count - 1 do begin
1292 if (OnlyAHundredRes = true) and ( i <> 0 ) and ( (ReadList.Count-i) > 101 ) then begin
1295 //
\90V
\92\85\83}
\81[
\83N
1296 if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
1298 if FileExists( GetSkinNewmarkFileName ) then
1299 SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
1301 SaveList.Add( '<a name="new"></a>' );
1303 SaveList.Add( '<a name="new"></a>' );
1306 if (Trim(ReadList[i]) <> '') then begin
1307 No := IntToStr(i + 1);
1309 Res := DivideStrLine(ReadList[i]);
1310 if Res.FType = glt2chOld then begin
1311 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1312 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1313 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1316 Res.FBody := AddAnchorTag(Res.FBody);
1317 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1319 { DivideStrLine
\83\81\83\
\83b
\83h
\93à
\82Åbody
\82ª
1320 \81@
\8bó
\82É
\82È
\82ç
\82È
\82¢
\82æ
\82¤
\82É
\82µ
\82Ä
\82¢
\82é
\82Ì
\82Å
\95s
\97v
1321 if Res.FName = '' then
1322 Res.FName := ' ';
1325 if NewReceiveNo <= (i + 1) then
1326 //
\90V
\92\85\83\8c\83X
1327 SaveList.Add( ReplaceRes( SkinNewRes ) )
1329 //
\92Ê
\8fí
\82Ì
\83\8c\83X
1330 SaveList.Add( ReplaceRes( SkinRes ) );
1335 if ThreadItem.Kokomade = (i + 1) then begin
1336 //
\82±
\82±
\82Ü
\82Å
\93Ç
\82ñ
\82¾
1338 if FileExists( GetSkinBookmarkFileName ) then
1339 SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
1341 SaveList.Add( '<a name="koko"></a>' );
1343 SaveList.Add( '<a name="koko"></a>' );
1346 // SizeByte := SizeByte + Length( SaveList.Text );
1347 doc.Write(SaveList.Text);
1350 SaveList.Add('<a name="bottom"></a>');
1351 // SizeByte := SizeByte + Length( SaveList.Text );
1352 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1354 SaveList.Add( LoadSkin( GetSkinFooterFileName ) );
1357 doc.Write(SaveList.Text);
1359 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1361 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1362 // SaveList.Add('<html lang="ja"><head>');
1363 SaveList.Add('<html><head>');
1364 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1365 SaveList.Add('<title>' + sTitle + '</title>');
1366 SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
1367 if Length( UserOptionalStyle ) > 0 then
1368 SaveList.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1369 SaveList.Add('</head>');
1370 SaveList.Add('<body>');
1371 SaveList.Add('<a name="top"></a>');
1372 SaveList.Add('<div class="title">' + sTitle + '</div>');
1373 doc.Write(SaveList.Text);
1375 //Application.ProcessMessages;
1376 for i := 0 to ReadList.Count - 1 do begin
1377 if (OnlyAHundredRes = true) and ( i <> 0 ) and ( (ReadList.Count-i) > 101 ) then begin
1380 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1381 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>');
1383 if (Trim(ReadList[i]) <> '') then begin
1384 No := IntToStr(i + 1);
1385 Res := DivideStrLine(ReadList[i]);
1386 Res.FBody := AddAnchorTag(Res.FBody);
1387 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1389 if Res.FName = '' then
1390 Res.FName := ' ';
1392 if Res.FMailTo = '' then
1393 SaveList.Add('<a name="' + No + '"></a>'
1394 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1395 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1396 + '<span class="name"><b>' + Res.FName + '</b></span> '
1397 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1398 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1399 + '<div class="mes">' + Res.FBody + ' </div>')
1400 else if GikoSys.Setting.ShowMail then
1401 SaveList.Add('<a name="' + No + '"></a>'
1402 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1403 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1404 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1405 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1406 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1407 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1408 + '<div class="mes">' + Res.FBody + ' </div>')
1410 SaveList.Add('<a name="' + No + '"></a>'
1411 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1412 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1413 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1414 + '<b>' + Res.FName + '</b></a>'
1415 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1416 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1417 + '<div class="mes">' + Res.FBody + ' </div>');
1419 if ThreadItem.Kokomade = (i + 1) then begin
1420 SaveList.Add('<a name="koko"></a><div class="koko">
\83R
\83R
\82Ü
\82Å
\93Ç
\82ñ
\82¾</div>');
1423 doc.Write(SaveList.Text);
1427 SaveList.Add('<a name="bottom"></a>');
1428 SaveList.Add('</body></html>');
1429 SaveList.Add('<a name="last"></a>');
1430 SaveList.Add('</body></html>');
1432 doc.Write(SaveList.Text);
1435 // SaveList.Add('<html lang="ja"><head>');
1436 SaveList.Add('<html><head>');
1437 SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1438 SaveList.Add('<title>' + sTitle + '</title></head>');
1439 SaveList.Add('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1440 SaveList.Add('<a name="top"></a>');
1441 SaveList.Add('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1442 SaveList.Add('<dl>');
1443 doc.Write(SaveList.Text);
1445 //Application.ProcessMessages;
1446 for i := 0 to ReadList.Count - 1 do begin
1447 if (OnlyAHundredRes = true) and ( i <> 0 ) and ( (ReadList.Count-i) > 101 ) then begin
1450 if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
1451 SaveList.Add('</dl>');
1452 SaveList.Add('<a name="new"></a>');
1453 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>');
1454 SaveList.Add('<dl>');
1456 if (Trim(ReadList[i]) <> '') then begin
1457 No := IntToStr(i + 1);
1458 Res := DivideStrLine(ReadList[i]);
1459 if Res.FType = glt2chOld then begin
1460 Res.FMailTo := CustomStringReplace(Res.FMailTo, '
\81\97\81M', ',');
1461 Res.FName := CustomStringReplace(Res.FName, '
\81\97\81M', ',');
1462 Res.FBody := CustomStringReplace(Res.FBody, '
\81\97\81M', ',');
1464 Res.FBody := AddAnchorTag(Res.FBody);
1465 Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
1466 if Res.FMailTo = '' then
1467 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>')
1468 else if GikoSys.Setting.ShowMail then
1469 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>')
1471 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>');
1473 if ThreadItem.Kokomade = (i + 1) then begin
1474 SaveList.Add('</dl>');
1475 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>');
1476 SaveList.Add('<dl>');
1478 doc.Write(SaveList.Text);
1481 SaveList.Add('</dl>');
1482 SaveList.Add('<a name="bottom"></a>');
1483 SaveList.Add('</body></html>');
1484 doc.Write(SaveList.Text);
1494 (*************************************************************************
1495 *http://
\82Ì
\95¶
\8e\9a\97ñ
\82ðanchor
\83^
\83O
\95t
\82«
\82É
\82·
\82é
\81B
1496 *************************************************************************)
1497 function TGikoSys.AddAnchorTag(s: string): string;
1499 URL_CHAR: string = '0123456789'
1500 + 'abcdefghijklmnopqrstuvwxyz'
1501 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1502 + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
1503 ANCHOR_REF = 'href=';
1504 RES_REF = '>>';
1506 wkIdx: array[0..9] of Integer;
1511 anchorLen : Integer;
1514 // + 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ß
1515 anchorLen := Length( ANCHOR_REF ) + 3;
1518 wkIdx[0] := AnsiPos('http://', s);
1519 wkIdx[1] := AnsiPos('ttp://', s);
1520 wkIdx[2] := AnsiPos('tp://', s);
1521 wkIdx[3] := AnsiPos('ms-help://', s);
1522 wkIdx[4] := AnsiPos('p://', s);
1523 wkIdx[5] := AnsiPos('https://', s);
1524 wkIdx[6] := AnsiPos('www.', s);
1525 wkIdx[7] := AnsiPos('ftp://', s);
1526 wkIdx[8] := AnsiPos('news://', s);
1527 wkIdx[9] := AnsiPos('rtsp://', s);
1531 if wkIdx[i] <> 0 then idx := Min(wkIdx[i], idx);
1533 if idx = MaxInt then begin
1534 //
\83\8a\83\93\83N
\82ª
\96³
\82¢
\82æ
\81B
1535 Result := Result + s;
1540 (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
1541 //
\8aù
\82É
\83\8a\83\93\83N
\83^
\83O
\82ª
\82Â
\82¢
\82Ä
\82¢
\82é
\82Á
\82Û
\82¢
\82Æ
\82«
\82Í
\83\80\83V
1542 href := Copy( s, idx, Length( s ) );
1543 Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
1545 s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
1550 Result := Result + Copy(s, 0, idx - 1);
1552 s := Copy(s, idx, length(s));
1554 b := Length( s ) + 1;
1555 for i := 1 to b do begin
1559 idx := AnsiPos(s[i], URL_CHAR);
1560 if idx = 0 then begin
1561 //URL
\82¶
\82á
\82È
\82¢
\95¶
\8e\9a\94
\8c©
\81I
\82Æ
\82©
\81A
\95¶
\8e\9a\82ª
\82È
\82
\82È
\82Á
\82½
\81B
1562 url := Copy(s, 0, i - 1);
1564 if AnsiPos('ttp://', url) = 1 then
1566 else if AnsiPos('tp://', url) = 1 then
1568 else if AnsiPos('p://', url) = 1 then
1570 else if AnsiPos('www.', url) = 1 then
1571 href := 'http://' + url
1574 Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
1575 s := Copy(s, i, MaxInt);
1582 (*************************************************************************
1583 *
\83T
\83u
\83W
\83F
\83N
\83g
\88ê
\8ds
\82ð
\95ª
\8a\84
1584 *************************************************************************)
1585 function TGikoSys.DivideSubject(Line: string): TSubjectRec;
1595 if AnsiPos('<>', Line) = 0 then
1600 Result.FFileName := GetTokenIndex(Line, Delim, 0);
1601 Result.FTitle := GetTokenIndex(Line, Delim, 1);
1603 Result.FFileName := RemoveToken(Line, Delim);
1604 Result.FTitle := RemoveToken(Line, Delim);
1606 ws := Trim(Result.FTitle);
1608 if Copy(ws, Length(ws), 1) = ')' then begin
1611 end else if Copy(ws, Length(ws), 1) = '
\81j' then begin
1614 end else if Copy(ws, Length(ws), 1) = '<' then begin
1619 for i := Length(ws) - 1 downto 1 do begin
1620 if ws[i] = LeftK then begin
1621 ws := Copy(ws, i + 1, Length(ws) - i - 1);
1622 if IsNumeric(ws) then
1623 Result.FCount := StrToInt(ws);
1624 Result.FTitle := Trim(CustomStringReplace(Result.FTitle, LeftK + ws + RightK, ''));
1630 (*************************************************************************
1631 * dat
\83t
\83@
\83C
\83\8b\82Ì
\88ê
\83\89\83C
\83\93\82ð
\95ª
\89ð
1632 *************************************************************************)
1633 function TGikoSys.DivideStrLine(Line: string): TResRec;
1638 if AnsiPos('<>', Line) = 0 then begin
1640 Result.FType := glt2chOld;
1643 Result.FType := glt2chNew;
1646 Result.FName := Trim(GetTokenIndex(Line, Delim, 0));
1647 Result.FMailTo := Trim(GetTokenIndex(Line, Delim, 1));
1648 Result.FDateTime := Trim(GetTokenIndex(Line, Delim, 2));
1649 bufBody := Trim(GetTokenIndex(Line, Delim, 3));
1651 Result.FName := Trim(RemoveToken(Line, Delim));
1652 Result.FMailTo := Trim(RemoveToken(Line, Delim));
1653 Result.FDateTime := Trim(RemoveToken(Line, Delim));
1654 bufBody := Trim(RemoveToken(Line, Delim));
1656 if bufbody = '' then begin
1657 Insert(' ',bufbody, 1);
1659 Result.FBody := bufBody;
1660 //Result.FTitle := Trim(GetTokenIndex(Line, Delim, 4));
1661 Result.FTitle := Trim(RemoveToken(Line, Delim));
1665 (*************************************************************************
1666 * URL
\82©
\82çBBSID
\82ð
\8eæ
\93¾
1667 *************************************************************************)
1668 function TGikoSys.UrlToID(url: string): string;
1675 if url = '' then Exit;
1677 url := Copy(url, 0, Length(url) - 1);
1678 for i := Length(url) downto 0 do begin
1679 if url[i] = '/' then begin
1680 Result := Copy(url, i + 1, Length(url));
1686 (*************************************************************************
1687 *URL
\82©
\82çBBSID
\88È
\8aO
\82Ì
\95\94\95ª(http://teri.2ch.net/)
\82ð
\8eæ
\93¾
1688 *************************************************************************)
1689 function TGikoSys.UrlToServer(url: string): string;
1696 wsURL := Trim(wsURL);
1698 if wsURL = '' then exit;
1700 if Copy(wsURL, Length(wsURL), 1) = '/' then
1701 wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
1703 for i := Length(wsURL) downto 0 do begin
1704 if wsURL[i] = '/' then begin
1705 Result := Copy(wsURL, 0, i);
1711 (*************************************************************************
1712 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\83`
\83F
\83b
\83N
1713 *************************************************************************)
1714 function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
1718 Code := GetFileAttributes(PChar(Name));
1719 Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
1722 (*************************************************************************
1723 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\8dì
\90¬
\81i
\95¡
\90\94\8aK
\91w
\91Î
\89\9e\81j
1724 *************************************************************************)
1725 function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
1728 if Length(Dir) = 0 then
1729 raise Exception.Create('
\83t
\83H
\83\8b\83_
\82ª
\8dì
\90¬
\8fo
\97\88\82Ü
\82¹
\82ñ');
1730 Dir := ExcludeTrailingPathDelimiter(Dir);
1731 if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
1732 or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
1733 Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
1736 (*************************************************************************
1737 *
\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
1738 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1739 *************************************************************************)
1740 function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
1744 Result := StrTokNext(sep, Rec);
1747 (*************************************************************************
1748 *
\95¶
\8e\9a\97ñ
\82©
\82ç
\83g
\81[
\83N
\83\93\82Ì
\90Ø
\82è
\8fo
\82µ
1749 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1750 *************************************************************************)
1751 function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
1758 if Len >= Pos then begin
1759 while (Pos <= Len) and (Str[Pos] in sep) do begin
1763 while (Pos<= Len) and not (Str[Pos] in sep) do begin
1764 if IsDBCSLeadByte(Byte(Str[Pos])) then begin
1769 Result := Copy(Str, I, Pos - I);
1770 while (Pos <= Len) and (Str[Pos] in sep) do begin//
\82±
\82ê
\82Í
\82¨
\8dD
\82Ý
1777 (*************************************************************************
1778 *
\83t
\83@
\83C
\83\8b\83T
\83C
\83Y
\8eæ
\93¾
1779 *************************************************************************)
1780 function TGikoSys.GetFileSize(FileName : string): longint;
1785 if not FileExists(FileName) then begin
1789 Assign(F, FileName);
1791 Result := FileSize(F);
1798 (*************************************************************************
1799 *
\83t
\83@
\83C
\83\8b\8ds
\90\94\8eæ
\93¾
1800 *************************************************************************)
1801 function TGikoSys.GetFileLineCount(FileName : string): longint;
1805 sl := TStringList.Create;
1808 sl.LoadFromFile(FileName);
1819 (*************************************************************************
1820 *
\83X
\83\8c\83b
\83h
\83t
\83@
\83C
\83\8b\82©
\82ç
\8ew
\92è
\8ds
\82ð
\8eæ
\93¾
1821 *************************************************************************)
1822 function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
1824 fileTmp : TStringList;
1827 if FileExists(FileName) then begin
1828 fileTmp := TStringList.Create;
1831 fileTmp.LoadFromFile( FileName );
1832 if ( Line >= 1 ) and ( Line < fileTmp.Count + 1 ) then begin
1833 Result := fileTmp.Strings[ Line-1 ];
1836 //on EFOpenError do Result := '';
1844 (*************************************************************************
1845 *
\83V
\83X
\83e
\83\80\83\81\83j
\83\85\81[
\83t
\83H
\83\93\83g
\82Ì
\91®
\90«
\82ð
\8eæ
\93¾
1846 *************************************************************************)
1847 procedure TGikoSys.MenuFont(Font: TFont);
1850 nm: NONCLIENTMETRICS;
1852 nm.cbSize := sizeof(NONCLIENTMETRICS);
1854 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
1855 lf := nm.lfMenuFont;
1857 Font.Name := lf.lfFaceName;
1858 Font.Height := lf.lfHeight;
1860 if lf.lfWeight >= 700 then
1861 Font.Style := Font.Style + [fsBold];
1862 if lf.lfItalic = 1 then
1863 Font.Style := Font.Style + [fsItalic];
1866 (*************************************************************************
1868 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1869 *************************************************************************)
1870 function TGikoSys.RemoveToken(var s: string;const delimiter: string): string;
1874 p := AnsiPos(delimiter, s);
1878 Result := Copy(s, 1, p - 1);
1879 s := Copy(s, Length(Result) + Length(delimiter) + 1, Length(s));
1882 (*************************************************************************
1884 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1885 *************************************************************************)
1886 function TGikoSys.GetTokenIndex(s: string; delimiter: string; index: Integer): string;
1891 for i := 0 to index do
1892 Result := RemoveToken(s, delimiter);
1895 (*************************************************************************
1897 *************************************************************************)
1898 function TGikoSys.DeleteLink(const s: string): string;
1908 s1 := GetTokenIndex(s, '<a href="', i);
1909 s2 := GetTokenIndex(s, '<a href="', i + 1);
1911 idx := Pos('">', s1);
1913 Delete(s1, 1, idx + 1);
1914 idx := Pos('">', s2);
1916 Delete(s2, 1, idx + 1);
1918 Result := Result + s1 + s2;
1927 //
\83C
\83\93\83f
\83b
\83N
\83X
\96¢
\8dX
\90V
\83o
\83b
\83t
\83@
\82ð
\83t
\83\89\83b
\83V
\83\85\81I
1928 {procedure TGikoSys.FlashExitWrite;
1932 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
1933 for i := 0 to FExitWrite.Count - 1 do
1934 WriteThreadDat(FExitWrite[i]);
1938 (*************************************************************************
1939 *
\83X
\83\8c\96¼
\82È
\82Ç
\82ð
\92Z
\82¢
\96¼
\91O
\82É
\95Ï
\8a·
\82·
\82é
1941 *************************************************************************)
1942 function TGikoSys.GetShortName(const LongName: string; ALength: integer): string;
1944 ERASECHAR : array [1..39] of string =
1945 ('
\81\99','
\81\9a','
\81¡','
\81 ','
\81\9f','
\81\9e','
\81Q','
\81\94','
\81£','
\81¥',
1946 '
\81¢','
\81¤','
\81\9c','
\81\9b','
\81\9d','
\81y','
\81z','
\81ô','
\81s','
\81t',
1947 '
\81g','
\81h','
\81k','
\81l','
\81e','
\81f','
\81\83','
\81\84','
\81á','
\81â',
1948 '
\81o','
\81p','
\81q','
\81r','
\81w','
\81x','
\81¬','
\81c', '
\81@');
1950 Chr : array [0..255] of char;
1954 s := Trim(LongName);
1955 if (Length(s) <= ALength) then begin
1959 for i := Low(ERASECHAR) to High(ERASECHAR) do begin
1960 S := CustomStringReplace(S, ERASECHAR[i], '');
1962 if (Length(S) <= ALength) then begin
1965 Windows.LCMapString(
1966 GetUserDefaultLCID(),
1974 S := Copy(S,1,ALength);
1976 if (ByteType(S, Length(S)) = mbLeadByte ) then begin
1977 S := Copy(S, 1, Length(S) - 1);
1987 (*************************************************************************
1990 *************************************************************************)
1991 function TGikoSys.ConvRes(const Body, Bbs, Key,
1992 ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string): string;
1996 FIndexFrom : integer;
2003 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2017 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2022 FIndex.FIndexFrom := IndexFrom;
2023 FIndex.FIndexTo := IndexTo;
2027 function ChooseString(const Text, Separator: string; Index: integer): string;
2033 for i := 0 to Index - 1 do begin
2034 if (AnsiPos(Separator, S) = 0) then S := ''
2035 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2037 p := AnsiPos(Separator, S);
2038 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2047 List:= TList.Create;
2053 b := ByteType(s, i);
2055 mbSingleByte : begin
2056 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2057 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2065 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2066 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2072 if (not sw) and (Copy(s,i,4) = GT) then begin
2073 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2081 if ((not sw) and (Copy(s,i,1) = ',')) or
2082 ((not sw) and (Copy(s,i,1) = '=')) then begin
2083 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2084 ((Chk) and (oc = '')) or
2085 ((not Chk) and (al)) then
2095 if (AnsiPos(sx, SN) > 0) then begin
2098 if (No <> '') and (No <> '-') then begin
2111 if Copy(s,i,1) = '<' then oc := '';
2112 oc := oc + Copy(s,i,1);
2118 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2124 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2132 if (AnsiPos(sx, ZN) > 0) then begin
2133 No := No + ZenToHan(sx);
2135 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2150 if (i > Length(Body)) then begin
2152 if (No <> '') then Add(sp, i, No);
2157 for i := List.Count - 1 downto 0 do begin
2158 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2159 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2160 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2162 st := PIndex(List[i]).FNo;
2163 et := PIndex(List[i]).FNo;
2165 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2166 Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2167 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2168 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2169 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2170 Dispose(PIndex(List[i]));
2176 function TGikoSys.ConvRes(
2177 const Body, Bbs, Key, ParamBBS, ParamKey,
2178 ParamStart, ParamTo, ParamNoFirst,
2179 ParamTrue, FullURL : string
2184 FIndexFrom : integer;
2191 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2205 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2210 FIndex.FIndexFrom := IndexFrom;
2211 FIndex.FIndexTo := IndexTo;
2215 function ChooseString(const Text, Separator: string; Index: integer): string;
2221 for i := 0 to Index - 1 do begin
2222 if (AnsiPos(Separator, S) = 0) then S := ''
2223 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2225 p := AnsiPos(Separator, S);
2226 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2235 List:= TList.Create;
2241 b := ByteType(s, i);
2243 mbSingleByte : begin
2244 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2245 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2253 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2254 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2260 if (not sw) and (Copy(s,i,4) = GT) then begin
2261 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2269 if ((not sw) and (Copy(s,i,1) = ',')) or
2270 ((not sw) and (Copy(s,i,1) = '=')) then begin
2271 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2272 ((Chk) and (oc = '')) or
2273 ((not Chk) and (al)) then
2283 if (AnsiPos(sx, SN) > 0) then begin
2286 if (No <> '') and (No <> '-') then begin
2299 if Copy(s,i,1) = '<' then oc := '';
2300 oc := oc + Copy(s,i,1);
2306 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2312 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2320 if (AnsiPos(sx, ZN) > 0) then begin
2321 No := No + ZenToHan(sx);
2323 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2338 if (i > Length(Body)) then begin
2340 if (No <> '') then Add(sp, i, No);
2345 for i := List.Count - 1 downto 0 do begin
2346 //plName := Copy(PluginName, LastDelimiter('\',PluginName) + 1, Length(PluginName) - LastDelimiter('/',PluginName) -1 );
2347 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2348 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2349 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2351 st := PIndex(List[i]).FNo;
2352 et := PIndex(List[i]).FNo;
2354 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2355 Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2356 [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2357 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2358 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2359 Dispose(PIndex(List[i]));
2365 (*************************************************************************
2366 *
\91S
\8ap
\81¨
\94¼
\8ap
2368 *************************************************************************)
2369 function TGikoSys.ZenToHan(const s: string): string;
2371 Chr: array [0..255] of char;
2373 Windows.LCMapString(
2374 GetUserDefaultLCID(),
2376 LCMAP_HALFWIDTH or LCMAP_KATAKANA or LCMAP_LOWERCASE,
2385 (*************************************************************************
2386 *
\91S
\8ap
\94¼
\8ap
\82Ð
\82ç
\82ª
\82È
\82©
\82½
\82©
\82È
\82ð
\8bæ
\95Ê
\82µ
\82È
\82¢
\90¦
\82¢Pos
2387 *************************************************************************)
2388 function TGikoSys.VaguePos(const Substr, S: string): Integer;
2390 Result := AnsiPos(ZenToHan(Substr), ZenToHan(S));
2393 function TGikoSys.BoolToInt(b: Boolean): Integer;
2395 Result := IfThen(b, 1, 0);
2398 function TGikoSys.IntToBool(i: Integer): Boolean;
2403 //gzip
\82Å
\88³
\8fk
\82³
\82ê
\82½
\82Ì
\82ð
\96ß
\82·
2404 function TGikoSys.GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
2408 GZipStream: TGzipDecompressStream;
2409 TextStream: TStringStream;
2410 buf: array[0..BUF_SIZE - 1] of Byte;
2416 TextStream := TStringStream.Create('');
2418 //
\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¢)
2419 // if LowerCase(Trim(ContentEncoding)) = 'gzip' then begin
2420 if AnsiPos('gzip', LowerCase(Trim(ContentEncoding))) > 0 then begin
2421 ResStream.Position := 0;
2422 GZipStream := TGzipDecompressStream.Create(TextStream);
2425 FillChar(buf, BUF_SIZE, 0);
2426 cnt := ResStream.Read(buf, BUF_SIZE);
2428 GZipStream.Write(buf, BUF_SIZE);
2434 ResStream.Position := 0;
2436 FillChar(buf, BUF_SIZE, 0);
2437 cnt := ResStream.Read(buf, BUF_SIZE);
2439 TextStream.Write(buf, BUF_SIZE);
2443 //NULL
\95¶
\8e\9a\82ð"*"
\82É
\82·
\82é
2444 s := TextStream.DataString;
2446 while (i > 0) and (s[i] = #0) do
2451 while i <> 0 do begin
2461 procedure TGikoSys.LoadKeySetting(ActionList: TActionList);
2463 STD_SEC = 'KeySetting';
2469 SecList: TStringList;
2470 Component: TComponent;
2472 if not FileExists(GetConfigDir + KEY_SETTING_FILE_NAME) then
2474 SecList := TStringList.Create;
2475 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2477 ini.ReadSection(STD_SEC, SecList);
2478 for i := 0 to SecList.Count - 1 do begin
2479 ActionName := SecList[i];
2480 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2481 if ActionKey <> -1 then begin
2482 Component := ActionList.Owner.FindComponent(ActionName);
2483 if TObject(Component) is TAction then begin
2484 TAction(Component).ShortCut := ActionKey;
2494 procedure TGikoSys.SaveKeySetting(ActionList: TActionList);
2496 STD_SEC = 'KeySetting';
2501 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2503 for i := 0 to ActionList.ActionCount - 1 do begin
2504 if ActionList.Actions[i].Tag = -1 then
2506 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2514 procedure TGikoSys.LoadEditorKeySetting(ActionList: TActionList);
2516 STD_SEC = 'KeySetting';
2522 SecList: TStringList;
2523 Component: TComponent;
2525 if not FileExists(GetConfigDir + EKEY_SETTING_FILE_NAME) then
2527 SecList := TStringList.Create;
2528 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2530 ini.ReadSection(STD_SEC, SecList);
2531 for i := 0 to SecList.Count - 1 do begin
2532 ActionName := SecList[i];
2533 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2534 if ActionKey <> -1 then begin
2535 Component := ActionList.Owner.FindComponent(ActionName);
2536 if TObject(Component) is TAction then begin
2537 TAction(Component).ShortCut := ActionKey;
2547 procedure TGikoSys.SaveEditorKeySetting(ActionList: TActionList);
2549 STD_SEC = 'KeySetting';
2554 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2556 for i := 0 to ActionList.ActionCount - 1 do begin
2557 if ActionList.Actions[i].Tag = -1 then
2559 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2568 procedure TGikoSys.CreateProcess(const AppPath: string; const Param: string);
2570 PI: TProcessInformation;
2574 Path := '"' + AppPath + '"';
2576 Path := Path + ' ' + Param;
2578 SI.Cb := SizeOf(Si);
2579 SI.lpReserved := nil;
2580 SI.lpDesktop := nil;
2583 SI.cbReserved2 := 0;
2584 SI.lpReserved2 := nil;
2586 Windows.CreateProcess(nil,
2598 procedure TGikoSys.OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
2602 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2603 gbtUserApp, gbtAuto:
2604 if (Setting.URLApp) and (FileExists(Setting.URLAppFile)) then
2605 GikoSys.CreateProcess(Setting.URLAppFile, URL)
2607 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2611 function TGikoSys.HTMLDecode(const AStr: String): String;
2613 Sp, Rp, Cp, Tp: PChar;
2618 SetLength(Result, Length(AStr));
2620 Rp := PChar(Result);
2623 while Sp^ <> #0 do begin
2629 'a': if AnsiStrPos(Sp, 'amp;') = Sp then
2635 'g': if (AnsiStrPos(Sp, 'lt;') = Sp) or (AnsiStrPos(Sp, 'gt;') = Sp) then
2639 while (Sp^ <> ';') and (Sp^ <> #0) do
2646 'q': if AnsiStrPos(Sp, 'quot;') = Sp then
2654 Num := IsNumeric(Copy(Tp, 1, 1));
2655 while (Sp^ <> ';') and (Sp^ <> #0) do begin
2656 if (Num) and (not IsNumeric(Copy(Sp, 1, 1))) then
2660 SetString(S, Tp, Sp - Tp);
2665 //raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2666 //[Cp^ + Sp^, Cp - PChar(AStr)])
2676 // on E:EConvertError do
2677 // raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2678 // [Cp^ + Sp^, Cp - PChar(AStr)])
2680 SetLength(Result, Rp - PChar(Result));
2683 function TGikoSys.GetHRefText(s: string): string;
2693 Index := AnsiPos('href', LowerCase(s));
2696 s := Trim(Copy(s, Index + 4, Length(s)));
2697 s := Trim(Copy(s, 2, Length(s)));
2699 //
\8en
\82ß
\82Ì
\95¶
\8e\9a\82ª'"'
\82È
\82ç
\8eæ
\82è
\8f\9c\82
2700 //if Copy(s, 1, 1) = '"' then begin
2701 if s[1] = '"' then begin
2702 s := Trim(Copy(s, 2, Length(s)));
2705 Index := AnsiPos('"', s);
2706 if Index <> 0 then begin
2707 //'"'
\82Ü
\82ÅURL
\82Æ
\82·
\82é
2708 s := Copy(s, 1, Index - 1);
2710 //'"'
\82ª
\96³
\82¯
\82ê
\82Î
\83X
\83y
\81[
\83X
\82©">"
\82Ì
\91\81\82¢
\95û
\82Ü
\82Å
\82ðURL
\82Æ
\82·
\82é
2711 Index := AnsiPos(' ', s);
2712 Index2 := AnsiPos('>', s);
2715 if Index > Index2 then
2718 s := Copy(s, 1, Index - 1)
2720 //
\82±
\82ê
\88È
\8fã
\82à
\82¤
\92m
\82ç
\82ñ
\82Ê
2726 //
\83z
\83X
\83g
\96¼
\82ª
\82Q
\82\83\82\88\82©
\82Ç
\82¤
\82©
\83`
\83F
\83b
\83N
\82·
\82é
2727 function TGikoSys.Is2chHost(Host: string): Boolean;
2729 HOST_NAME: array[0..1] of string = ('2ch.net', 'bbspink.com');
2735 if RightStr( Host, 1 ) = '/' then
2736 Host := Copy( Host, 1, Length( Host ) - 1 );
2737 OutputDebugString(pchar(HOST_NAME[0]));
2738 for i := 0 to Length(HOST_NAME) - 1 do begin
2739 // Len := Length(HOST_NAME[i]);
2740 if AnsiPos(HOST_NAME[i], Host) = (Length(Host) - Length(HOST_NAME[i]) + 1) then begin
2747 function TGikoSys.Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
2757 Index := AnsiPos(READ_PATH, path);
2758 if Index <> 0 then begin
2759 s := Copy(path, Length(READ_PATH) + 1, Length(path));
2760 BBSID := GetTokenIndex(s, '/', 0);
2761 BBSKey := GetTokenIndex(s, '/', 1);
2764 Result := (BBSID <> '') or (BBSKey <> '');
2767 Index := AnsiPos(KAKO_PATH, path);
2768 if Index <> 0 then begin
2769 s := Copy(path, 2, Length(path));
2770 BBSID := GetTokenIndex(s, '/', 0);
2771 if (BBSID = 'log') and (GetTokenIndex(s, '/', 2) = 'kako') then
2772 BBSID := GetTokenIndex(s, '/', 1);
2773 BBSKey := ChangeFileExt(Document, '');
2774 Result := (BBSID <> '') or (BBSKey <> '');
2777 Index := AnsiPos('read.cgi?', URL);
2778 if Index <> 0 then begin
2779 SList := TStringList.Create;
2782 // s := HTMLDecode(Document);
2783 ExtractHTTPFields(['?', '&'], [], PChar(URL), SList, False);
2784 BBSID := SList.Values['bbs'];
2785 BBSKey := SList.Values['key'];
2786 Result := (BBSID <> '') or (BBSKey <> '');
2796 procedure TGikoSys.GetPopupResNumber(URL : string; var stRes, endRes : Int64);
2803 URL := Trim(LowerCase(URL));
2804 if (AnsiPos('&st=', URL ) <> 0) and ( AnsiPos( '&to=',URL) <> 0 ) then begin
2806 stRes := StrToInt64( Copy( URL, AnsiPos('&st=', URL ) + 4, AnsiPos( '&to=',URL) - AnsiPos('&st=', URL ) - 4 ) );
2807 if AnsiPos( '&nofirst=',URL) <> 0 then begin
2808 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, AnsiPos( '&nofirst=',URL) - AnsiPos('&to=', URL ) - 4);
2810 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, Length( URL ) - AnsiPos('&to=', URL ) - 4 + 1 );
2813 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
2814 buf := Copy( buf, 1, ps );
2818 endRes := StrToInt64(buf);
2825 GikoSys.GetBrowsableThreadURL( URL );
2826 end else if( AnsiPos('&res=', URL ) <> 0 ) then begin
2828 buf := Copy( URL, AnsiPos('&res=', URL ) + 5, Length( URL ) - AnsiPos('&res=', URL ) - 5 + 1 );
2831 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
2832 buf := Copy( buf, 1, ps );
2835 stRes := StrToInt(buf)
2842 end else if (AnsiPos('&start=', URL ) <> 0) and ( AnsiPos( '&end=',URL) <> 0 ) then begin
2844 stRes := StrToInt64( Copy( URL, AnsiPos('&start=', URL ) + 7, AnsiPos( '&end=',URL) - AnsiPos('&start=', URL ) - 7 ) );
2845 if AnsiPos( '&nofirst=',URL) <> 0 then begin
2846 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, AnsiPos( '&nofirst=',URL) - AnsiPos('&end=', URL ) - 5);
2848 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, Length( URL ) - AnsiPos('&to=', URL ) - 5 + 1 );
2851 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
2852 buf := Copy( buf, 1, ps );
2856 endRes := StrToInt64(buf);
2863 end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
2864 buf := Copy(URL, LastDelimiter('/',URL)+1,Length(URL)-LastDelimiter('/',URL)+1);
2865 if Length(buf) > 0 then begin
2868 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
2870 convBuf := Copy( buf, 1, ps );
2871 if convBuf <> '' then begin
2872 stRes := StrToInt64(convBuf);
2876 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
2878 convBuf := Copy( buf, 1, ps );
2879 if convBuf <> '' then
2880 endRes := StrToInt64(convBuf)
2902 function TGikoSys.Parse2chURL2(URL: string): TPathRec;
2907 // convBuf : String;
2918 URL := Trim(LowerCase(URL));
2923 Result.FFirst := False;
2924 Result.FStBegin := False;
2925 Result.FToEnd := False;
2926 Result.FDone := False;
2930 if URL[length(URL)] = '\' then
2932 FAWKStr.RegExp := 'http://.+\.(2ch\.net|bbspink\.com)/';
2933 if FAWKStr.Match(FAWKStr.ProcessEscSeq(URL), RStart, RLength) <> 0 then begin
2934 s := Copy(URL, RStart + RLength - 1, Length(URL));
2936 //
\95W
\8f\80\8f\91\8e®
2937 //
\8dÅ
\8cã
\82Íl50, 10, 10-20, 10n, 10-20n, -10, 10-, 10n-
\82È
\82Ç
2938 //http://xxx.2ch.net/test/read.cgi/bbsid/1000000000/
2939 FAWKStr.RegExp := '/test/read.cgi/.+/[0-9]+/.*';
2940 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2941 s := Copy(s, 15, Length(s));
2943 SList := TStringList.Create;
2946 FAWKStr.RegExp := '/';
2947 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
2948 Result.FBBS := SList[1];
2949 Result.FKey := SList[2];
2950 if SList.Count >= 3 then
2958 FAWKStr.LineSeparator := mcls_CRLF;
2959 FAWKStr.RegExp := '-';
2960 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) = 0 then begin
2961 Result.FFirst := True;
2963 FAWKStr.RegExp := 'l[0-9]+';
2964 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2965 Result.FFirst := True;
2967 for i := 0 to SList.Count - 1 do begin
2968 if Trim(SList[i]) = '' then begin
2970 Result.FStBegin := True;
2971 if i = (SList.Count - 1) then
2972 Result.FToEnd := True;
2973 end else if IsNumeric(SList[i]) then begin
2974 wkInt := StrToInt(SList[i]);
2975 wkMax := Max(wkMax, wkInt);
2979 wkMin := Min(wkMin, wkInt);
2980 end else if Trim(SList[i]) = 'n' then begin
2981 Result.FFirst := True;
2983 FAWKStr.RegExp := '^n[0-9]+$|^[0-9]+n$';
2984 if FAWKStr.Match(FAWKStr.ProcessEscSeq(SList[i]), RStart, RLength) > 0 then begin
2985 if Copy(SList[i], 1, 1) = 'n' then
2986 wkInt := StrToInt(Copy(SList[i], 2, Length(SList[i])))
2988 wkInt := StrToInt(Copy(SList[i], 1, Length(SList[i]) - 1));
2989 Result.FFirst := True;
2990 wkMax := Max(wkMax, wkInt);
2994 wkMin := Min(wkMin, wkInt);
2998 if Result.FStBegin and (not Result.FToEnd) then
3000 else if (not Result.FStBegin) and Result.FToEnd then
3002 else if (not Result.FStBegin) and (not Result.FToEnd) then begin
3003 Result.FSt := wkMin;
3004 Result.FTo := wkMax;
3006 //Result.FSt := wkMin;
3007 //Result.FTo := wkMax;
3013 Result.FDone := True;
3017 //
\90Vkako
\8f\91\8e®
3018 //http://server.2ch.net/ITA_NAME/kako/1000/10000/1000000000.html
3019 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+/[0-9]+\.html';
3020 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3021 SList := TStringList.Create;
3024 FAWKStr.RegExp := '/';
3025 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3026 Result.FBBS := SList[1];
3027 Result.FKey := ChangeFileExt(SList[5], '');
3028 Result.FFirst := True;
3034 Result.FDone := True;
3038 //
\8b\8ckako
\8f\91\8e®
3039 //http://server.2ch.net/ITA_NAME/kako/999/999999999.html
3040 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+\.html';
3041 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3042 SList := TStringList.Create;
3045 FAWKStr.RegExp := '/';
3046 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 5 then begin
3047 Result.FBBS := SList[1];
3048 Result.FKey := ChangeFileExt(SList[4], '');
3049 Result.FFirst := True;
3055 Result.FDone := True;
3059 //log
\8by
\82Ñlog2
\8f\91\8e®
3060 //http://server.2ch.net/log/ITA_NAME/kako/999/999999999.html
3061 //http://server.2ch.net/log2/ITA_NAME/kako/999/999999999.html
3062 FAWKStr.RegExp := '/log2?/.+/kako/[0-9]+/[0-9]+\.html';
3063 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3064 SList := TStringList.Create;
3067 FAWKStr.RegExp := '/';
3068 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3069 Result.FBBS := SList[2];
3070 Result.FKey := ChangeFileExt(SList[5], '');
3071 Result.FFirst := True;
3077 Result.FDone := True;
3082 //
\8b\8cURL
\8f\91\8e®
3083 //http://server.2ch.net/test/read.cgi?bbs=ITA_NAME&key=1000000000&st=1&to=5&nofirst=true
3084 FAWKStr.RegExp := '/test/read\.cgi\?';
3085 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3086 s := Copy(s, 16, Length(s));
3087 SList := TStringList.Create;
3090 FAWKStr.RegExp := '&';
3091 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
3092 Result.FFirst := True;
3093 for i := 0 to SList.Count - 1 do begin
3094 if Pos('bbs=', SList[i]) = 1 then begin
3095 Result.FBBS := Copy(SList[i], 5, Length(SList[i]));
3096 end else if Pos('key=', SList[i]) = 1 then begin
3097 Result.FKey := Copy(SList[i], 5, Length(SList[i]));
3098 end else if Pos('st=', SList[i]) = 1 then begin
3099 wk := Copy(SList[i], 4, Length(SList[i]));
3100 if IsNumeric(wk) then
3101 Result.FSt := StrToInt(wk)
3102 else if wk = '' then
3103 Result.FStBegin := True;
3104 end else if Pos('to=', SList[i]) = 1 then begin
3105 wk := Copy(SList[i], 4, Length(SList[i]));
3106 if IsNumeric(wk) then
3107 Result.FTo := StrToInt(wk)
3108 else if wk = '' then
3109 Result.FToEnd := True;
3110 end else if Pos('nofirst=', SList[i]) = 1 then begin
3111 Result.FFirst := False;
3120 if (Result.FBBS <> '') and (Result.FKey <> '') then begin
3121 Result.FDone := True;
3128 procedure TGikoSys.ParseURI(var URL, Protocol, Host, Path, Document, Port, Bookmark: string);
3138 URI := TIdURI.Create(URL);
3140 Protocol := URI.Protocol;
3143 Document := URI.Document;
3145 Bookmark := URI.Bookmark;
3151 function TGikoSys.GetVersionBuild: Integer;
3153 FixedFileInfo: PVSFixedFileInfo;
3154 VersionHandle, VersionSize: DWORD;
3155 pVersionInfo: Pointer;
3160 AppFile := Application.ExeName;
3161 VersionSize := GetFileVersionInfoSize(pChar(AppFile), VersionHandle);
3162 if VersionSize = 0 then
3164 GetMem(pVersionInfo, VersionSize);
3166 if GetFileVersionInfo(PChar(AppFile),VersionHandle,VersionSize, pVersionInfo) then
3167 if VerQueryValue(pVersionInfo, '\', Pointer(FixedFileInfo), ItemLen) then
3168 Result := LOWORD(FixedFileInfo^.dwFileVersionLS);
3170 FreeMem(pVersionInfo, VersionSize);
3174 function TGikoSys.GetBrowsableThreadURL(
3178 threadItem : TThreadItem;
3179 boardPlugIn : TBoardPlugIn;
3183 //=====
\83v
\83\89\83O
\83C
\83\93
3185 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
3186 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
3187 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
3188 boardPlugIn := BoardPlugIns[ i ];
3189 threadItem := TThreadItem.Create( boardPlugIn, inURL );
3190 Result := threadItem.URL;
3198 // 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¢
3201 if Length( Result ) = 0 then
3202 Result := GikoSys.Get2chBrowsableThreadURL( inURL );
3206 function TGikoSys.GetThreadURL2BoardURL(
3210 threadItem : TThreadItem;
3211 boardPlugIn : TBoardPlugIn;
3215 //=====
\83v
\83\89\83O
\83C
\83\93
3217 for i := Length( BoardPlugIns ) - 1 downto 0 do begin
3218 if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
3219 if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
3220 boardPlugIn := BoardPlugIns[ i ];
3221 threadItem := TThreadItem.Create( boardPlugIn, inURL );
3222 Result := BoardPlugIns[ i ].GetBoardURL( Longword( threadItem ) );
3230 // 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¢
3233 if Length( Result ) = 0 then
3234 Result := GikoSys.Get2chThreadURL2BoardURL( inURL );
3238 function TGikoSys.Get2chThreadURL2BoardURL(
3242 Protocol, Host, Path, Document, Port, Bookmark : string;
3243 BBSID, BBSKey : string;
3247 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3248 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3250 foundPos := Pos( '/test/read.cgi', inURL );
3251 if foundPos > 0 then
3252 Result := Copy( inURL, 1, foundPos ) + BBSID + '/'
3254 Result := Protocol + '://' + Host + '/' + BBSID + '/';
3258 function TGikoSys.Get2chBrowsableThreadURL(
3262 Protocol, Host, Path, Document, Port, Bookmark : string;
3263 BBSID, BBSKey : string;
3267 // if Pos( KAKO_PATH, inURL ) > 0 then begin
3270 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3271 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3272 foundPos := Pos( '/test/read.cgi', inURL ) - 1;
3274 if Is2chHost( Host ) then begin
3275 Result := Protocol + '://' + Host +
3276 READ_PATH + BBSID + '/' + BBSKey + '/l50';
3278 if foundPos > 0 then
3279 Result := Copy( inURL, 1, foundPos ) +
3280 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50'
3282 Result := Protocol + '://' + Host +
3283 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50';
3289 function TGikoSys.Get2chBoard2ThreadURL(
3297 server := UrlToServer( inBoard.URL );
3298 if Is2chHost( server ) then
3299 Result := server + 'test/read.cgi/' + inBoard.BBSID + '/' + inKey + '/l50'
3301 Result := server + 'test/read.cgi?bbs=' + inBoard.BBSID + '&key=' + inKey + '&ls=50';
3305 (*************************************************************************
3306 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\97ñ
\8b\93
3307 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3308 *************************************************************************)
3309 procedure TGikoSys.ListBoardFile;
3311 boardFileList : TStringList;
3317 for i := 0 to Length( BBSs ) - 1 do
3321 SetLength( BBSs, 0 );
3324 //
\94Â
\83\8a\83X
\83g
\82Ì
\97ñ
\8b\93
3325 if FileExists( GikoSys.GetBoardFileName ) then begin
3326 SetLength( BBSs, l + 1 );
3327 BBSs[ l ] := TBBS.Create( GikoSys.GetBoardFileName );
3328 BBSs[ l ].Title := '
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é';
3332 if FileExists( GikoSys.GetCustomBoardFileName ) then begin
3333 SetLength( BBSs, l + 1 );
3334 BBSs[ l ] := TBBS.Create( GikoSys.GetCustomBoardFileName );
3335 BBSs[ l ].Title := '
\82»
\82Ì
\91¼';
3339 // Board
\83t
\83H
\83\8b\83_
3340 if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
3341 BoardFileList := TStringList.Create;
3343 GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
3344 SetLength( BBSs, l + BoardFileList.Count );
3345 for i := BoardFileList.Count - 1 downto 0 do begin
3346 BBSs[ l ] := TBBS.Create( BoardFileList[ i ] );
3347 BBSs[ l ].Title := ChangeFileExt( ExtractFileName( BoardFileList[ i ] ), '' );
3358 (*************************************************************************
3359 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
3360 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3361 *************************************************************************)
3362 procedure TGikoSys.ReadBoardFile( bbs : TBBS );
3367 boardFile : TStringList;
3368 CategoryList : TStringList;
3369 BoardList : TStringList;
3370 Category : TCategory;
3373 RoundItem : TRoundItem;
3375 i, iBound : Integer;
3376 j, jBound : Integer;
3377 k, kBound : Integer;
3380 if not FileExists( bbs.FilePath ) then
3384 ini := TMemIniFile.Create('');
3385 boardFile := TStringList.Create;
3387 boardFile.LoadFromFile( bbs.FilePath );
3389 ini.SetStrings( boardFile );
3390 CategoryList := TStringList.Create;
3391 BoardList := TStringList.Create;
3393 ini.ReadSections( CategoryList );
3395 iBound := CategoryList.Count - 1;
3396 for i := 0 to iBound do begin
3397 ini.ReadSection( CategoryList[i], BoardList );
3398 Category := TCategory.Create;
3399 Category.No := i + 1;
3400 Category.Title := CategoryList[i];
3402 jBound := BoardList.Count - 1;
3403 for j := 0 to jBound do begin
3405 inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
3407 //=====
\83v
\83\89\83O
\83C
\83\93
3409 kBound := Length( BoardPlugIns ) - 1;
3410 for k := 0 to kBound do begin
3411 if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin
3412 if BoardPlugIns[ k ].AcceptURL( inistr ) = atBoard then begin
3413 Board := TBoard.Create( BoardPlugIns[ k ], inistr );
3420 // 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¢
3424 Board := TBoard.Create( nil, inistr );
3427 Board.Title := BoardList[j];
3428 Board.RoundDate := ZERO_DATE;
3430 idx := RoundList.Find(Board);
3431 if idx <> -1 then begin
3432 RoundItem := RoundList.Items[idx, grtBoard];
3433 Board.Round := True;
3434 Board.RoundName := RoundItem.RoundName;
3437 Category.Add(Board);
3442 bbs.Add( Category );
3444 bbs.IsBoardFileRead := True;
3456 function TGikoSys.GetUnknownCategory : TCategory;
3458 UNKNOWN_CATEGORY = '(
\96¼
\8fÌ
\95s
\96¾)';
3461 if Length( BBSs ) < 2 then begin
3466 Result := BBSs[ 1 ].FindCategoryFromTitle( UNKNOWN_CATEGORY );
3467 if Result = nil then begin
3468 Result := TCategory.Create;
3469 Result.Title := UNKNOWN_CATEGORY;
3470 BBSs[ 1 ].Add( Result );
3475 function TGikoSys.GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
3477 category : TCategory;
3479 UNKNOWN_BOARD = '(
\96¼
\8fÌ
\95s
\96¾)';
3482 category := GetUnknownCategory;
3483 if category = nil then begin
3486 Result := category.FindBoardFromTitle( UNKNOWN_BOARD );
3487 if Result = nil then begin
3488 Result := TBoard.Create( inPlugIn, inURL );
3489 Result.Title := UNKNOWN_BOARD;
3490 category.Add( Result );
3495 function TGikoSys.GetSambaFileName : string;
3497 Result := Setting.GetSambaFileName;
3499 procedure TGikoSys.SambaFileExists();
3502 sambaStrList: TStringList;
3504 if not FileExists(GikoSys.GetSambaFileName) then begin
3505 sambaTmp := ChangeFileExt(GikoSys.GetSambaFileName, '.default');
3506 sambaStrList := TStringList.Create;
3508 if FileExists(sambaTmp) then begin
3509 sambaStrList.LoadFromFile(sambaTmp);
3510 sambaStrList.SaveToFile(GikoSys.GetSambaFileName);
3519 GikoSys := TGikoSys.Create;
3522 if GikoSys <> nil then begin