6 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
7 ComCtrls, IniFiles, ShellAPI, ActnList, Math,
15 {HttpApp,} YofUtils, URLMon, IdGlobal, IdURI, {Masks,}
16 Setting, BoardGroup, gzip, Dolib, bmRegExp, AbonUnit,
17 MojuUtils, ExternalBoardManager, ExternalBoardPlugInMain,
22 vrComments, //
\83R
\83\81\83\93\83g
23 vrCompanyName, //
\89ï
\8eÐ
\96¼
24 vrFileDescription, //
\90à
\96¾
25 vrFileVersion, //
\83t
\83@
\83C
\83\8b\83o
\81[
\83W
\83\87\83\93
26 vrInternalName, //
\93à
\95\94\96¼
27 vrLegalCopyright, //
\92\98\8dì
\8c
28 vrLegalTrademarks, //
\8f¤
\95W
29 vrOriginalFilename, //
\90³
\8e®
\83t
\83@
\83C
\83\8b\96¼
30 vrPrivateBuild, //
\83v
\83\89\83C
\83x
\81[
\83g
\83r
\83\8b\83h
\8fî
\95ñ
31 vrProductName, //
\90»
\95i
\96¼
32 vrProductVersion, //
\90»
\95i
\83o
\81[
\83W
\83\87\83\93
33 vrSpecialBuild); //
\83X
\83y
\83V
\83\83\83\8b\83r
\83\8b\83h
\8fî
\95ñ
36 TGikoBBSType = (gbt2ch);
37 //
\83\8d\83O
\83^
\83C
\83v
38 TGikoLogType = (glt2chNew, glt2chOld);
39 //
\83\81\83b
\83Z
\81[
\83W
\83A
\83C
\83R
\83\93
40 TGikoMessageIcon = (gmiOK, gmiSAD, gmiNG, gmiWhat, gmiNone);
41 //URL
\83I
\81[
\83v
\83\93\83u
\83\89\83E
\83U
\83^
\83C
\83v
42 TGikoBrowserType = (gbtIE, gbtUserApp, gbtAuto);
45 TStrTokSeparator = set of Char;
51 //
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b\83\8c\83R
\81[
\83h
59 FRoundDate: TDateTime;
60 FLastModified: TDateTime;
63 FMishiyou: Boolean; //
\96¢
\8eg
\97p
67 FAllResCount: Integer;
68 FNewResCount: Integer;
69 FAgeSage: TGikoAgeSage;
72 //
\83T
\83u
\83W
\83F
\83N
\83g
\83\8c\83R
\81[
\83h
79 //
\83\8c\83X
\83\8c\83R
\81[
\83h
89 //URLPath
\83\8c\83R
\81[
\83h
92 FKey: string; //ThreadID
93 FSt: Int64; //
\8aJ
\8en
\83\8c\83X
\94Ô
94 FTo: Int64; //
\8fI
\97¹
\83\8c\83X
\94Ô
95 FFirst: Boolean; //>>1
\82Ì
\95\
\8e¦
96 FStBegin: Boolean; //1
\81`
\95\
\8e¦
97 FToEnd: Boolean; //
\81`
\8dÅ
\8cã
\82Ü
\82Å
\95\
\8e¦
98 FDone: Boolean; //
\90¬
\8c÷
99 FNoParam: Boolean; //
\83\8c\83X
\94Ô
\83p
\83\89\83\81\81[
\83^
\82È
\82µ
103 TGikoMessageListType = (gmLogout, gmLogin, gmForceLogin, gmSureItiran,
104 gmUnKnown, gmSureSyutoku, gmSureDiff, gmNotMod, gmAbort, gmError,
105 gmNewRes, gmNewSure, gmResError, gmSureError);
107 TGikoSys = class(TObject)
114 FBayesian : TGikoBayesian; //!<
\83x
\83C
\83W
\83A
\83\93\83t
\83B
\83\8b\83^
115 FVersion : String; //
\83t
\83@
\83C
\83\8b\83o
\81[
\83W
\83\87\83\93
116 // FExitWrite: TStringList;
117 // function StrToFloatDef(s: string; Default: Double): Double;
121 FSelectResFilter : TAbon;
122 //FBoardURLList: TStringList;
125 destructor Destroy; override;
126 property ResRange : Longint read FResRange write FResRange;
127 //
\83o
\81[
\83W
\83\87\83\93\8fî
\95ñ
128 property Version : String read FVersion;
129 // function MsgBox(Msg: string; Title: string; Flags: Longint): integer; overload;
130 // function MsgBox(Handle: THandle; Msg: string; Title: string; Flags: Longint): integer; overload;
131 function IsNumeric(s: string): boolean;
132 function IsFloat(s: string): boolean;
133 function DirectoryExistsEx(const Name: string): Boolean;
134 function ForceDirectoriesEx(Dir: string): Boolean;
135 // function GetVersion: string;
137 function GetBoardFileName: string;
138 function GetCustomBoardFileName: string;
139 function GetHtmlTempFileName: string;
140 function GetAppDir: string;
141 function GetTempFolder: string;
142 function GetSentFileName: string;
143 function GetConfigDir: string;
144 function GetSkinDir: string;
145 function GetSkinHeaderFileName: string;
146 function GetSkinFooterFileName: string;
147 function GetSkinResFileName: string;
148 function GetSkinNewResFileName: string;
149 function GetSkinBookmarkFileName: string;
150 function GetSkinNewmarkFileName: string;
151 function GetStyleSheetDir: string;
152 function GetOutBoxFileName: string;
153 function GetUserAgent: string;
154 function GetSambaFileName : string;
156 procedure ReadSubjectFile(Board: TBoard);
157 procedure CreateThreadDat(Board: TBoard);
158 procedure WriteThreadDat(Board: TBoard);
159 function ParseIndexLine(Line: string): TIndexRec;
160 procedure GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean); overload;
161 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¢
162 procedure GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
164 procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
165 function AddAnchorTag(s: string): string;
167 function DivideSubject(Line: string): TSubjectRec;
168 function DivideStrLine(Line: string): TResRec;
170 property Setting: TSetting read FSetting write FSetting;
171 property Dolib: TDolib read FDolib write FDolib;
173 function UrlToID(url: string): string;
174 function UrlToServer(url: string): string;
176 function StrTokFirst(const s:string; const sep:TStrTokSeparator; var Rec:TStrTokRec):string;
177 function StrTokNext(const sep:TStrTokSeparator; var Rec:TStrTokRec): string;
179 function GetFileSize(FileName : string) : longint;
180 function GetFileLineCount(FileName : string): longint;
181 function Get2chDate(aDate: TDateTime): string;
182 function IntToDateTime(val: Int64): TDateTime;
183 function DateTimeToInt(ADate: TDateTime): Int64;
185 function ReadThreadFile(FileName: string; Line: Integer): string;
187 procedure MenuFont(Font: TFont);
189 function RemoveToken(var s:string; const delimiter:string):string;
190 function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
191 function DeleteLink(const s: string): string;
193 function GetShortName(const LongName: string; ALength: integer): string;
194 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;
195 function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
196 function ConvertResAnchor(res: string): string;
197 function BoolToInt(b: Boolean): Integer;
198 function IntToBool(i: Integer): Boolean;
199 function GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
200 procedure LoadKeySetting(ActionList: TActionList);
201 procedure SaveKeySetting(ActionList: TActionList);
202 procedure LoadEditorKeySetting(ActionList: TActionList);
203 procedure SaveEditorKeySetting(ActionList: TActionList);
205 procedure CreateProcess(const AppPath: string; const Param: string);
206 procedure OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
207 function HTMLDecode(const AStr: String): String;
208 function GetHRefText(s: string): string;
209 function Is2chHost(Host: string): Boolean;
210 function Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
211 function Parse2chURL2(URL: string): TPathRec;
212 procedure ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
213 function GetVersionBuild: Integer;
214 function GetBrowsableThreadURL( inURL : string ) : string;
215 function GetThreadURL2BoardURL( inURL : string ) : string;
216 function Get2chThreadURL2BoardURL( inURL : string ) : string;
217 function Get2chBrowsableThreadURL( inURL : string ) : string;
218 function Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string;
219 procedure ListBoardFile;
220 procedure ReadBoardFile( bbs : TBBS );
222 function GetUnknownCategory : TCategory;
223 function GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
225 procedure GetPopupResNumber(URL : string; var stRes, endRes : Int64);
227 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
228 function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string;
229 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
230 function SkinedRes( skin: string; Res: TResRec; No: string ): string;
232 //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é
233 procedure SambaFileExists();
235 property Bayesian : TGikoBayesian read FBayesian write FBayesian;
236 function GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem; limited: boolean):string; overload;
237 function GetSameIDResAnchor(AIDNum : Integer; ThreadItem: TThreadItem; limited: boolean):string; overload;
238 procedure GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList); overload;
239 procedure GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList); overload;
240 function GetSameIDResCount(const AID : string; ThreadItem: TThreadItem):Integer; overload;
241 function GetSameIDResCount(AIDNum : Integer; ThreadItem: TThreadItem):Integer; overload;
244 procedure SpamCountWord( const text : string; wordCount : TWordCount );
245 //!
\8aw
\8fK
\83N
\83\8a\83A
246 procedure SpamForget( wordCount : TWordCount; isSpam : Boolean );
247 //!
\83X
\83p
\83\80\8aw
\8fK
248 procedure SpamLearn( wordCount : TWordCount; isSpam : Boolean );
249 //!
\83X
\83p
\83\80\93x
\90\94
250 function SpamParse( const text : string; wordCount : TWordCount ) : Extended;
251 //
\88ø
\90\94\82ª
\81A
\93ú
\95t
\82Å
\82à
\8e\9e\8d\8f\82Å
\82à
\82È
\82¢
\82±
\82Æ
\82ð
\92²
\82×
\82é
252 function NotDateorTimeString(const AStr : string): boolean;
254 //
\88ø
\90\94\82É
\91\97\82ç
\82ê
\82Ä
\82«
\82½
\93ú
\95t/ID
\95\94\82ÉBE
\82Ì
\95¶
\8e\9a\97ñ
\82ª
\82 \82Á
\82½
\82ç
\81A
\83v
\83\8d\83t
\83@
\83C
\83\8b\82Ö
\82Ì
\83\8a\83\93\83N
\82ð
\92Ç
\89Á
255 // function AddBeProfileLink(AID : string; ANum: Integer): string;
256 //
\83o
\81[
\83W
\83\87\83\93\8fî
\95ñ
\82Ì
\8eæ
\93¾
257 function GetVersionInfo(KeyWord: TVerResourceKey): string;
258 //Plugin
\82Ì
\8fî
\95ñ
\82Ì
\8eæ
\93¾
259 function GetPluginsInfo(): string;
260 //IE
\82Ì
\83o
\81[
\83W
\83\87\83\93\8fî
\95ñ
\82Ì
\8eæ
\93¾
261 function GetIEVersion: string;
262 function SetUserOptionalStyle(): string;
268 //LENGTH_RESTITLE = 40;
269 ZERO_DATE: Integer = 25569;
270 BETA_VERSION_NAME_E = 'beta';
271 BETA_VERSION_NAME_J = 'ÊÞÀ';
273 BETA_VERSION_BUILD = ''; //debug
\94Å
\82È
\82Ç
274 APP_NAME = 'gikoNavi';
275 BE_PHP_URL = 'http://be.2ch.net/test/p.php?i=';
281 Giko, RoundData, Favorite, Registry, HTMLCreate;
284 FOLDER_INDEX_VERSION = '1.01';
285 USER_AGENT = 'Monazilla';
286 DEFAULT_NGWORD_FILE_NAME : String = 'NGword.txt';
287 NGWORDs_DIR_NAME : String = 'NGwords';
289 READ_PATH: string = '/test/read.cgi/';
290 OLD_READ_PATH: string = '/test/read.cgi?';
291 KAKO_PATH: string = '/kako/';
293 KeyWordStr: array [TVerResourceKey] of String = (
307 (*************************************************************************
308 *GikoSys
\83R
\83\93\83X
\83g
\83\89\83N
\83^
309 *************************************************************************)
310 constructor TGikoSys.Create;
312 FSetting := TSetting.Create;
313 FDolib := TDolib.Create;
314 FAWKStr := TAWKStr.Create(nil);
315 if DirectoryExists(GetConfigDir) = false then begin
316 CreateDir(GetConfigDir);
318 FAbon := TAbon.Create;
319 FAbon.Setroot(GetConfigDir+NGWORDs_DIR_NAME);
321 FAbon.ReturnNGwordLineNum := FSetting.ShowNGLinesNum;
322 FAbon.SetNGResAnchor := FSetting.AddResAnchor;
323 FAbon.DeleteSyria := FSetting.DeleteSyria;
324 FAbon.Deleterlo := FSetting.AbonDeleterlo;
325 FAbon.Replaceul := FSetting.AbonReplaceul;
326 FAbon.AbonPopupRes := FSetting.PopUpAbon;
328 FSelectResFilter := TAbon.Create;
329 //
\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
330 FSelectResFilter.AbonString := '';
332 ResRange := FSetting.ResRange;
333 FVersion := Trim(GetVersionInfo(vrFileVersion));
334 FBayesian := TGikoBayesian.Create;
335 //FBoardURLList := TStringList.Create;
338 (*************************************************************************
339 *GikoSys
\83f
\83X
\83g
\83\89\83N
\83^
340 *************************************************************************)
341 destructor TGikoSys.Destroy;
344 FileList: TStringList;
346 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
355 FSelectResFilter.Free;
356 //FBoardURLList.Free;
357 //
\83e
\83\93\83|
\83\89\83\8aHTML
\82ð
\8dí
\8f\9c
358 FileList := TStringList.Create;
360 FileList.BeginUpdate;
361 GetFileList(GetTempFolder, '*.html', FileList, False, True);
363 for i := 0 to FileList.Count - 1 do begin
364 DeleteFile(FileList[i]);
372 (*************************************************************************
373 *
\95¶
\8e\9a\97ñ
\90\94\8e\9a\83`
\83F
\83b
\83N
374 *************************************************************************)
376 function TGikoSys.IsNumeric(s: string): boolean;
386 (*************************************************************************
387 *
\95¶
\8e\9a\97ñ
\95\82\93®
\8f¬
\90\94\93_
\90\94\8e\9a\83`
\83F
\83b
\83N
388 *************************************************************************)
389 function TGikoSys.IsFloat(s: string): boolean;
393 Result := TextToFloat(PChar(s), v, fvExtended);
396 (*************************************************************************
397 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
398 *************************************************************************)
399 function TGikoSys.GetBoardFileName: string;
401 Result := Setting.GetBoardFileName;
404 (*************************************************************************
405 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
406 *************************************************************************)
407 function TGikoSys.GetCustomBoardFileName: string;
409 Result := Setting.GetCustomBoardFileName;
412 (*************************************************************************
413 *
\83e
\83\93\83|
\83\89\83\8a\83t
\83H
\83\8b\83_
\81[
\96¼
\8eæ
\93¾
414 *************************************************************************)
415 function TGikoSys.GetHtmlTempFileName: string;
417 Result := Setting.GetHtmlTempFileName;
421 (*************************************************************************
422 *
\8eÀ
\8ds
\83t
\83@
\83C
\83\8b\83t
\83H
\83\8b\83_
\8eæ
\93¾
423 *************************************************************************)
424 function TGikoSys.GetAppDir: string;
426 Result := Setting.GetAppDir;
429 (*************************************************************************
430 *TempHtml
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
431 *************************************************************************)
432 function TGikoSys.GetTempFolder: string;
434 Result := Setting.GetTempFolder;
437 (*************************************************************************
438 *sent.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
439 *************************************************************************)
440 function TGikoSys.GetSentFileName: string;
442 Result := Setting.GetSentFileName;
445 (*************************************************************************
446 *outbox.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
447 *************************************************************************)
448 function TGikoSys.GetOutBoxFileName: string;
450 Result := Setting.GetOutBoxFileName;
453 (*************************************************************************
454 *Config
\83t
\83H
\83\8b\83_
\8eæ
\93¾
455 *************************************************************************)
456 function TGikoSys.GetConfigDir: string;
458 Result := Setting.GetConfigDir;
461 function TGikoSys.GetStyleSheetDir: string;
463 Result := Setting.GetStyleSheetDir;
466 function TGikoSys.GetSkinDir: string;
468 Result := Setting.GetSkinDir;
471 function TGikoSys.GetSkinHeaderFileName: string;
473 Result := Setting.GetSkinHeaderFileName;
476 function TGikoSys.GetSkinFooterFileName: string;
478 Result := Setting.GetSkinFooterFileName;
481 function TGikoSys.GetSkinNewResFileName: string;
483 Result := Setting.GetSkinNewResFileName;
486 function TGikoSys.GetSkinResFileName: string;
488 Result := Setting.GetSkinResFileName;
491 function TGikoSys.GetSkinBookmarkFileName: string;
493 Result := Setting.GetSkinBookmarkFileName;
496 function TGikoSys.GetSkinNewmarkFileName: string;
498 Result := Setting.GetSkinNewmarkFileName;
502 function TGikoSys.GetUserAgent: string;
504 if Dolib.Connected then begin
505 Result := Format('%s %s/%s%d/%s', [
512 Result := Format('%s/%s %s/%s%d/%s', [
522 (*************************************************************************
523 *
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é
\95û
\8e®
\8e\9e\8d\8f\8eæ
\93¾
524 *************************************************************************)
525 function TGikoSys.Get2chDate(aDate: TDateTime): string;
529 d2 := aDate - EncodeTime(9, 0, 0, 0);
530 Result := FloatToStr(Trunc((d2 - ZERO_DATE) * 86400));
533 //val
\82Í
\81A1970/1/1/ 00:00:00
\82©
\82ç
\82Ì
\8co
\89ß
\8e\9e\8aÔ
534 function TGikoSys.IntToDateTime(val: Int64): TDateTime;
536 Result := ZERO_DATE + val / 86400.0;
538 //ADate
\82ð1970/1/1/ 00:00:00
\82©
\82ç
\82Ì
\8co
\89ß
\8e\9e\8aÔ
\82É
\95Ï
\8a·
\82·
\82é
539 function TGikoSys.DateTimeToInt(ADate: TDateTime): Int64;
541 Result := Trunc((ADate - ZERO_DATE) * 86400);
545 (*************************************************************************
546 *Subject
\83t
\83@
\83C
\83\8bRead
547 *************************************************************************)
548 procedure TGikoSys.ReadSubjectFile(Board: TBoard);
550 ThreadItem: TThreadItem;
552 FileList: TStringList;
553 TmpFileList: TStringList;
561 // RoundItem: TRoundItem;
568 //protocol, host, path, document, port, bookmark : string;
571 FavoThreadItem : TFavoriteThreadItem;
575 if Board.IsThreadDatRead then
580 usePlugIn := Board.IsBoardPlugInAvailable;
581 server := UrlToServer( Board.URL );
582 //is2ch := Is2chHost(server);
584 FileName := Board.GetFolderIndexFileName;
586 FileList := TStringList.Create;
587 FileList.Sorted := True;
588 FileList.BeginUpdate;
589 TmpFileList := TStringList.Create;
590 TmpFileList.Sorted := True;
591 TmpFileList.BeginUpdate;
592 //IsLogFile
\97pDAT
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
593 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False);
595 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\97pTmp
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
596 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False);
597 TmpFileList.EndUpdate;
599 //
\8fd
\95¡
\82ð
\96h
\82®
601 Board.Sorted := True;
603 sl := TStringList.Create;
605 if FileExists(FileName) then begin
606 sl.LoadFromFile(FileName);
608 //
\82Q
\8ds
\96Ú
\82©
\82ç
\81i
\82P
\8ds
\96Ú
\82Í
\83o
\81[
\83W
\83\87\83\93\81j
609 for i := sl.Count - 1 downto 1 do begin
610 Rec := ParseIndexLine(sl[i]);
611 islog := FileList.Find( Rec.FFileName, Index );
613 ThreadItem := TThreadItem.Create(
616 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
618 if Board.is2ch then begin
619 ThreadItem := TThreadItem.Create(
622 server + 'test/read.cgi/' + Board.BBSID + '/' + ChangeFileExt( Rec.FFileName, '' ) + '/l50',
627 ThreadItem := TThreadItem.Create(
630 server + 'test/read.cgi?bbs=' + Board.BBSID + '&key=' + ChangeFileExt( Rec.FFileName, '' ) + '&ls=50',
637 ThreadItem.BeginUpdate;
639 FileList.Delete( Index );
641 ThreadItem.No := Rec.FNo;
642 ThreadItem.FileName := Rec.FFileName;
643 ThreadItem.Title := Rec.FTitle;
644 //ThreadItem.ShortTitle := CustomStringReplace(ZenToHan(ThreadItem.Title), ' ', '');
645 ThreadItem.Count := Rec.FCount;
646 ThreadItem.Size := Rec.FSize;
647 // ThreadItem.RoundNo := Rec.FRoundNo;
648 ThreadItem.RoundDate := Rec.FRoundDate;
649 ThreadItem.LastModified := Rec.FLastModified;
650 ThreadItem.Kokomade := Rec.FKokomade;
651 ThreadItem.NewReceive := Rec.FNewReceive;
652 // ThreadItem.Round := Rec.FRound;
653 ThreadItem.UnRead := Rec.FUnRead;
654 ThreadItem.ScrollTop := Rec.FScrollTop;
655 ThreadItem.AllResCount := Rec.FAllResCount;
656 ThreadItem.NewResCount := Rec.FNewResCount;
657 ThreadItem.AgeSage := Rec.FAgeSage;
658 ThreadItem.ParentBoard := Board;
659 {*
\82¨
\8bC
\82É
\93ü
\82è
\91å
\97Ê
\90¶
\90¬
\83R
\81[
\83h *}
661 FavoThreadItem := TFavoriteThreadItem.Create( ThreadItem.URL, ThreadItem.Title, ThreadItem );
662 Node := FavoriteDM.TreeView.Items.AddChildObject( FavoriteDM.TreeView.Items.Item[0], ThreadItem.Title, FavoThreadItem);
665 {//
\8f\84\89ñ
\83\8a\83X
\83g
\82É
\91¶
\8dÝ
\82µ
\82½
\82ç
\8f\84\89ñ
\83t
\83\89\83O
\83Z
\83b
\83g
666 if ThreadItem.IsLogFile then begin
667 idx := RoundList.Find(ThreadItem);
668 if idx <> -1 then begin
669 RoundItem := RoundList.Items[idx, grtItem];
670 ThreadItem.RoundName := RoundItem.RoundName;
671 ThreadItem.Round := True;
676 ThreadItem.EndUpdate;
677 Board.Add(ThreadItem);
679 if (ThreadItem.IsLogFile) and (ThreadItem.UnRead) then
684 if UnRead <> Board.UnRead then
685 Board.UnRead := UnRead;
687 Boardpath := ExtractFilePath(Board.GetFolderIndexFileName);
688 //
\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
689 for i := 0 to FileList.Count - 1 do begin
690 FileName := Boardpath + FileList[i];
692 //ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
693 if usePlugIn then begin
694 ThreadItem := TThreadItem.Create(
697 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), FileList[i] ) );
698 ResRec := DivideStrLine(Board.BoardPlugIn.GetDat( DWORD( ThreadItem ), 1 ));
700 ThreadItem := TThreadItem.Create(
703 Get2chBoard2ThreadURL( Board, ChangeFileExt( FileList[i], '' ) ) );
704 ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
707 ThreadItem.BeginUpdate;
708 ThreadItem.FileName := FileList[i];
709 //ThreadItem.FilePath := FileName;
710 ThreadItem.No := Board.Count + 1;
711 ThreadItem.Title := ResRec.FTitle;
712 ThreadItem.Count := GetFileLineCount(FileName);
713 ThreadItem.AllResCount := ThreadItem.Count;
714 ThreadItem.NewResCount := ThreadItem.Count;
715 ThreadItem.Size := GetFileSize(FileName) - ThreadItem.Count;//1byte
\82¸
\82ê
\82é
\82Æ
\82«
\82ª
\82 \82é
\82¯
\82Ç
\82»
\82ê
\82Í
\82 \82«
\82ç
\82ß
\82é
716 ThreadItem.RoundDate := ZERO_DATE;
717 ThreadItem.LastModified := ZERO_DATE;
718 ThreadItem.Kokomade := -1;
719 ThreadItem.NewReceive := ThreadItem.Count;
720 ThreadItem.ParentBoard := Board;
721 ThreadItem.IsLogFile := True;
722 ThreadItem.Round := False;
723 ThreadItem.UnRead := False;
724 ThreadItem.ScrollTop := 0;
725 ThreadItem.AgeSage := gasNone;
726 ThreadItem.EndUpdate;
727 Board.Add(ThreadItem);
731 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\83`
\83F
\83b
\83N
732 for i := TmpFileList.Count - 1 downto 0 do begin
733 //if TmpFileList.Count <> 0 then begin
734 ThreadItem := Board.FindThreadFromFileName(ChangeFileExt(TmpFileList[i], '.dat'));
735 if ThreadItem <> nil then begin
736 //if TmpFileList.Find(ChangeFileExt(ThreadItem.FileName, '.tmp'), Index) then begin
737 ini := TMemIniFile.Create(Boardpath + TmpFileList[i]);
739 tmpStr := ini.ReadString('Setting', 'RoundDate', DateTimeToStr(ZERO_DATE));
740 ThreadItem.RoundDate := ConvertDateTimeString(tmpStr);
742 tmpStr := ini.ReadString('Setting', 'LastModified', DateTimeToStr(ZERO_DATE));
743 ThreadItem.LastModified := ConvertDateTimeString(tmpStr);
744 ThreadItem.Count := ini.ReadInteger('Setting', 'Count', 0);
745 ThreadItem.NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
747 ThreadItem.Size := ini.ReadInteger('Setting', 'Size', 0);
748 if(ThreadItem.Size = 0) and (FileExists(ThreadItem.GetThreadFileName)) then begin
750 ThreadItem.Size := GetFileSize(ThreadItem.GetThreadFileName) - ThreadItem.Count;
755 //
\8f\84\89ñ
\82Ì
\90Ý
\92è
\82ÍRoundData
\82Ì
\95û
\82ª
\82â
\82é
\82©
\82ç
\8f\9f\8eè
\82É
\90Ý
\92è
\82µ
\82Ä
\82Í
\83_
\83\81\81I
\81@by
\82à
\82¶
\82ã
756 //ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
757 //ThreadItem.RoundName := ini.ReadString('Setting', 'RoundName', ThreadItem.RoundName);
758 ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
759 ThreadItem.ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
760 ThreadItem.AllResCount := ini.ReadInteger('Setting', 'AllResCount', ThreadItem.Count);
761 ThreadItem.NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
762 ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
766 DeleteFile(Boardpath + TmpFileList[i]);
774 Board.Sorted := False;
776 Board.IsThreadDatRead := True;
779 (*************************************************************************
780 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b(Folder.idx)
\8dì
\90¬
781 *************************************************************************)
782 procedure TGikoSys.CreateThreadDat(Board: TBoard);
786 SubjectList: TStringList;
792 if not FileExists(Board.GetSubjectFileName) then Exit;
793 FileName := Board.GetFolderIndexFileName;
795 SubjectList := TStringList.Create;
797 SubjectList.LoadFromFile(Board.GetSubjectFileName);
798 sl := TStringList.Create;
802 sl.Add(FOLDER_INDEX_VERSION);
803 for i := 0 to SubjectList.Count - 1 do begin
804 Rec := DivideSubject(SubjectList[i]);
806 if (Trim(Rec.FFileName) = '') or (Trim(Rec.FTitle) = '') then
809 {s := Format('%x', [cnt]) + #1 //
\94Ô
\8d\86
810 + Rec.FFileName + #1 //
\83t
\83@
\83C
\83\8b\96¼
811 + Rec.FTitle + #1 //
\83^
\83C
\83g
\83\8b
812 + Format('%x', [Rec.FCount]) + #1 //
\83J
\83E
\83\93\83g
813 + Format('%x', [0]) + #1 //size
814 + Format('%x', [0]) + #1 //RoundDate
815 + Format('%x', [0]) + #1 //LastModified
816 + Format('%x', [0]) + #1 //Kokomade
817 + Format('%x', [0]) + #1 //NewReceive
818 + '0' + #1 //
\96¢
\8eg
\97p
819 + Format('%x', [0]) + #1 //UnRead
820 + Format('%x', [0]) + #1 //ScrollTop
821 + Format('%x', [Rec.FCount]) + #1 //AllResCount
822 + Format('%x', [0]) + #1 //NewResCount
823 + Format('%x', [0]); //AgeSage
825 s := Format('%x'#1'%s'#1'%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1 +
826 '%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x',
828 Rec.FFileName, //
\83t
\83@
\83C
\83\8b\96¼
829 Rec.FTitle, //
\83^
\83C
\83g
\83\8b
830 Rec.FCount, //
\83J
\83E
\83\93\83g
839 Rec.FCount, //AllResCount
848 sl.SaveToFile(FileName);
857 (*************************************************************************
858 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X(Thread.dat)
\8f\91\82«
\8d\9e\82Ý
860 *************************************************************************)
861 procedure TGikoSys.WriteThreadDat(Board: TBoard);
863 // Values: array[Boolean] of string = ('0', '1');
869 TmpFileList: TStringList;
871 if not Board.IsThreadDatRead then
873 FileName := Board.GetFolderIndexFileName;
874 ForceDirectoriesEx( ExtractFilePath( FileName ) );
876 sl := TStringList.Create;
877 TmpFileList := TStringList.Create;
878 TmpFileList.Sorted := true;
880 TmpFileList.BeginUpdate;
881 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, false);
882 TmpFileList.EndUpdate;
884 sl.Add(FOLDER_INDEX_VERSION);
886 //
\83X
\83\8c\94Ô
\8d\86\95Û
\91¶
\82Ì
\82½
\82ß
\83\
\81[
\83g
887 Sort.SortNoFlag := true;
888 Sort.SortOrder := true;
890 //Sort.SortNonAcquiredCountFlag := GikoSys.Setting.NonAcquiredCount;
891 Board.CustomSort(ThreadItemSortProc);
893 for i := 0 to Board.Count - 1 do begin
894 Board.Items[i].No := i + 1;
895 s := Format('%x'#1'%s'#1'%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1 +
896 '%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x',
897 [Board.Items[i].No, //
\94Ô
\8d\86
898 Board.Items[i].FileName, //
\83t
\83@
\83C
\83\8b\96¼
899 Board.Items[i].Title, //
\83^
\83C
\83g
\83\8b
900 Board.Items[i].Count, //
\83J
\83E
\83\93\83g
901 Board.Items[i].Size, //size
902 DateTimeToInt(Board.Items[i].RoundDate), //RoundDate
903 DateTimeToInt(Board.Items[i].LastModified), //LastModified
904 Board.Items[i].Kokomade, //Kokomade
905 Board.Items[i].NewReceive, //NewReceive
907 BoolToInt(Board.Items[i].UnRead), //UnRead
908 Board.Items[i].ScrollTop, //ScrollTop
909 Board.Items[i].AllResCount, //AllResCount
910 Board.Items[i].NewResCount, //NewResCount
911 Ord(Board.Items[i].AgeSage)] //AgeSage
917 sl.SaveToFile(FileName);
919 for i := 0 to TmpFileList.Count - 1 do begin
920 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[i]);
929 function TGikoSys.ParseIndexLine(Line: string): TIndexRec;
931 Result.FNo := StrToIntDef('$' + RemoveToken(Line, #1), 0);
932 Result.FFileName := RemoveToken(Line, #1);
933 Result.FTitle := RemoveToken(Line, #1);
934 Result.FCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
935 Result.FSize := StrToIntDef('$' + RemoveToken(Line, #1), 0);
936 Result.FRoundDate := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
937 Result.FLastModified := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
938 Result.FKokomade := StrToIntDef('$' + RemoveToken(Line, #1), -1);
939 Result.FNewReceive := StrToIntDef('$' + RemoveToken(Line, #1), 0);
940 RemoveToken(Line, #1);//9: ; //
\96¢
\8eg
\97p
941 Result.FUnRead := IntToBool(StrToIntDef('$' + RemoveToken(Line, #1), 0));
942 Result.FScrollTop := StrToIntDef('$' + RemoveToken(Line, #1), 0);
943 Result.FAllResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
944 Result.FNewResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
945 Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + RemoveToken(Line, #1), 0));
949 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
950 // ListFiles('c:\', '*.txt', list, True);
951 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
954 SearchRec : TSearchRec;
958 //maskExt := Copy(Mask, 1, Length(Mask) - 1);
960 Path := IncludeTrailingPathDelimiter(Path);
961 rc := FindFirst(Path + '*.*', faAnyfile, SearchRec);
963 while rc = 0 do begin
964 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
965 s := Path + SearchRec.Name;
966 //if (SearchRec.Attr and faDirectory > 0) then
967 // s := IncludeTrailingPathDelimiter(s)
969 if (SearchRec.Attr and faDirectory = 0) and (MatchesMask(s, Mask)) then
973 List.Add(SearchRec.Name);
974 if SubDir and (SearchRec.Attr and faDirectory > 0) then
975 GetFileList(s, Mask, List, True, IsPathAdd);
977 rc := FindNext(SearchRec);
980 SysUtils.FindClose(SearchRec);
984 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
985 //
\83T
\83u
\83t
\83H
\83\8b\83_
\82Í
\8c\9f\8dõ
\82µ
\82È
\82¢
986 // ListFiles('c:\', '*.txt', list, True);
987 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean);
990 SearchRec : TSearchRec;
993 Path := IncludeTrailingPathDelimiter(Path);
994 rc := FindFirst(Path + Mask, faAnyfile, SearchRec);
996 while rc = 0 do begin
997 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
998 s := Path + SearchRec.Name;
1000 if (SearchRec.Attr and faDirectory = 0) then
1004 List.Add(SearchRec.Name);
1006 rc := FindNext(SearchRec);
1009 SysUtils.FindClose(SearchRec);
1013 //
\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é
1014 procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
1017 SearchRec : TSearchRec;
1020 Path := IncludeTrailingPathDelimiter(Path);
1021 rc := FindFirst(Path + '*.*', faDirectory, SearchRec);
1023 while rc = 0 do begin
1024 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
1025 s := Path + SearchRec.Name;
1026 //if (SearchRec.Attr and faDirectory > 0) then
1027 // s := IncludeTrailingPathDelimiter(s)
1029 if (SearchRec.Attr and faDirectory > 0) and (MatchesMask(s, Mask)) then
1030 List.Add( IncludeTrailingPathDelimiter( s ) );
1031 if SubDir and (SearchRec.Attr and faDirectory > 0) then
1032 GetDirectoryList(s, Mask, List, True);
1034 rc := FindNext(SearchRec);
1037 SysUtils.FindClose(SearchRec);
1041 //
\83X
\83L
\83\93\82ð
\93Ç
\82Ý
\8d\9e\82Ý
\81A
\92l
\82ð
\92u
\8a·
\82·
\82é
1042 function TGikoSys.LoadFromSkin(
1044 ThreadItem: TThreadItem;
1051 Skin := TStringList.Create;
1053 if FileExists( fileName ) then begin
1054 Skin.LoadFromFile( fileName );
1056 //
\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
1058 if ThreadItem.ParentBoard <> nil then
1059 if ThreadItem.ParentBoard.ParentCategory <> nil then
1060 CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
1061 CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
1063 CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
1064 CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
1065 CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
1066 CustomStringReplace( Skin, '<SKINPATH/>', Setting.CSSFileName);
1067 CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.Count - ThreadItem.NewResCount ));
1068 CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
1069 CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.Count ));
1071 CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
1072 CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
1073 CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
1075 //-----
\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µ
1076 //
\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
1078 if ThreadItem.ParentBoard <> nil then
1079 if ThreadItem.ParentBoard.ParentCategory <> nil then
1080 CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
1081 CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
1083 CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
1084 CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
1085 CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
1086 CustomStringReplace( Skin, '&SKINPATH', Setting.CSSFileName);
1087 CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
1088 CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
1089 CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
1091 CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
1092 CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
1093 CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
1094 //-----
\82±
\82±
\82Ü
\82Å
1096 Result := Skin.Text;
1102 //
\83\8c\83X
\82Ì
\92l
\82ð
\92u
\8a·
\82·
\82é
1103 function TGikoSys.SkinedRes(
1109 spamminess : Extended;
1110 wordCount : TWordCount;
1113 wordCount := TWordCount.Create;
1115 spamminess := Floor( SpamParse(
1116 Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 );
1118 Skin := CustomStringReplace( Skin, '<NUMBER/>',
1119 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1120 Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
1121 Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
1122 Skin := CustomStringReplace( Skin, '<MAILNAME/>',
1123 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1124 Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
1125 Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
1126 Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
1127 Skin := CustomStringReplace( Skin, '<SPAMMINESS/>', FloatToStr( spamminess ) );
1128 Skin := CustomStringReplace( Skin, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );
1130 //-----
\82©
\82¿
\82ã
\81`
\82µ
\82á
\8cÝ
\8a·
\97p
\81B
\83R
\83\81\83\93\83g
\83A
\83E
\83g
\82µ
\82Ä
\82à
\82æ
\82µ
1131 Skin := CustomStringReplace( Skin, '&NUMBER',
1132 '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
1133 Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
1134 Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
1135 Skin := CustomStringReplace( Skin, '&MAILNAME',
1136 '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
1137 Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
1138 Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
1139 Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
1140 Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );
1141 Skin := CustomStringReplace( Skin, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );
1142 //-----
\82±
\82±
\82Ü
\82Å
1151 procedure TGikoSys.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
1155 //bufList : TStringList;
1156 ReadList: TStringList;
1157 // SaveList: TStringList;
1158 CSSFileName: string;
1162 boardPlugIn : TBoardPlugIn;
1164 UserOptionalStyle: string;
1168 function LoadSkin( fileName: string ): string;
1170 Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
1172 function ReplaceRes( skin: string ): string;
1174 Result := SkinedRes( skin, Res, No );
1178 if ThreadItem <> nil then begin
1179 CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
1182 //if ThreadItem.IsBoardPlugInAvailable then begin
1183 if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
1184 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
1185 //boardPlugIn := ThreadItem.BoardPlugIn;
1186 boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
1187 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1188 UserOptionalStyle := SetUserOptionalStyle;
1190 //
\95¶
\8e\9a\83R
\81[
\83h
\82Í
\83v
\83\89\83O
\83C
\83\93\82É
\94C
\82¹
\82é
1192 tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
1193 '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
1194 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1195 if Setting.UseSkin then begin
1196 tmp1 := './' +Setting.CSSFileName;
1197 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1198 tmp1 := CustomStringReplace(tmp1, '\', '/');
1199 tmp := CustomStringReplace(tmp, ExtractFilePath(Setting.CSSFileName), tmp1);
1200 end else if Setting.UseCSS then begin
1201 tmp1 := './' + CSSFileName;
1202 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1203 tmp1 := CustomStringReplace(tmp1, '\', '/');
1204 tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
1208 for i := 0 to threadItem.Count - 1 do begin
1211 html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
1214 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1215 html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
1221 ShortDayNames[1] := '
\93ú'; ShortDayNames[2] := '
\8c\8e';
1222 ShortDayNames[3] := '
\89Î'; ShortDayNames[4] := '
\90\85';
1223 ShortDayNames[5] := '
\96Ø'; ShortDayNames[6] := '
\8bà';
1224 ShortDayNames[7] := '
\93y';
1225 BBSID := ThreadItem.ParentBoard.BBSID;
1226 ReadList := TStringList.Create;
1228 if ThreadItem.IsLogFile then begin
1229 FileName := ThreadItem.GetThreadFileName;
1230 ReadList.LoadFromFile(FileName);
1231 FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
1232 FAbon.Execute(ReadList); //
\82 \82Ú
\81`
\82ñ
\82µ
\82Ä
1233 FSelectResFilter.Execute(ReadList); //
\83\8c\83X
\82Ì
\83t
\83B
\83\8b\83^
\83\8a\83\93\83O
\82ð
\82·
\82é
1234 Res := DivideStrLine(ReadList[0]);
1235 //Res.FTitle := CustomStringReplace(Res.FTitle, '
\81\97\81M', ',');
1236 sTitle := Res.FTitle;
1238 sTitle := CustomStringReplace(ThreadItem.Title, '
\81\97\81M', ',');
1241 //
\83t
\83H
\83\93\83g
\82â
\83T
\83C
\83Y
\82Ì
\90Ý
\92è
1242 UserOptionalStyle := SetUserOptionalStyle;
1244 if GikoSys.Setting.UseSkin then begin
1245 //
\83X
\83L
\83\93\8eg
\97p
1246 //
\83X
\83L
\83\93\82Ì
\90Ý
\92è
1248 SkinHeader := LoadSkin( GetSkinHeaderFileName );
1249 if Length( UserOptionalStyle ) > 0 then
1250 SkinHeader := CustomStringReplace( SkinHeader, '</head>',
1251 '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
1252 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1253 tmp1 := './' +Setting.CSSFileName;
1254 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1255 tmp1 := CustomStringReplace(tmp1, '\', '/');
1256 SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(Setting.CSSFileName), tmp1);
1257 html.Append( SkinHeader );
1261 SkinRes := LoadSkin( GetSkinResFileName );
1264 html.Append('<a name="top"></a>');
1265 for i := 0 to ReadList.Count - 1 do begin
1266 if (Trim(ReadList[i]) <> '') then begin
1267 No := IntToStr(i + 1);
1269 Res := DivideStrLine(ReadList[i]);
1270 Res.FBody := AddAnchorTag(Res.FBody);
1271 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1274 html.Append( ReplaceRes( SkinRes ) );
1280 html.Append('<a name="bottom"></a>');
1281 //
\83X
\83L
\83\93(
\83t
\83b
\83^)
1283 html.Append( LoadSkin( GetSkinFooterFileName ) );
1286 end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
1288 //CSSFileName := GetAppDir + CSS_FILE_NAME;
1289 html.Append('<html><head>');
1290 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1291 html.Append('<title>' + sTitle + '</title>');
1292 //
\90â
\91Î
\8eQ
\8fÆ
\82©
\82ç
\91\8a\91Î
\8eQ
\8fÆ
\82Ö
1293 tmp1 := './' + CSSFileName;
1294 tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
1295 tmp1 := CustomStringReplace(tmp1, '\', '/');
1297 html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
1298 if Length( UserOptionalStyle ) > 0 then
1299 html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
1300 html.Append('</head>');
1301 html.Append('<body>');
1302 html.Append('<a name="top"></a>');
1303 html.Append('<div class="title">' + sTitle + '</div>');
1304 for i := 0 to ReadList.Count - 1 do begin
1305 if (Trim(ReadList[i]) <> '') then begin
1306 No := IntToStr(i + 1);
1307 Res := DivideStrLine(ReadList[i]);
1308 Res.FBody := AddAnchorTag(Res.FBody);
1309 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1310 if Res.FMailTo = '' then
1311 html.Append('<a name="' + No + '"></a>'
1312 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
1313 + '<span class="name_label">
\96¼
\91O
\81F</span> '
1314 + '<span class="name"><b>' + Res.FName + '</b></span> '
1315 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span> '
1316 + '<span class="date">' + Res.FDateTime+ '</span></div>'
1317 + '<div class="mes">' + Res.FBody + ' </div>')
1318 else if GikoSys.Setting.ShowMail then
1319 html.Append('<a name="' + No + '"></a>'
1320 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1321 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1322 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1323 + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
1324 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1325 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1326 + '<div class="mes">' + Res.FBody + ' </div>')
1328 html.Append('<a name="' + No + '"></a>'
1329 + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
1330 + '<span class="name_label">
\96¼
\91O
\81F </span>'
1331 + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
1332 + '<b>' + Res.FName + '</b></a>'
1333 + '<span class="date_label">
\93\8a\8de
\93ú
\81F</span>'
1334 + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
1335 + '<div class="mes">' + Res.FBody + ' </div>');
1338 html.Append('<a name="bottom"></a>');
1339 html.Append('<a name="last"></a>');
1340 html.Append('</body></html>');
1343 html.Append('<html><head>');
1344 html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
1345 html.Append('<title>' + sTitle + '</title></head>');
1346 html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
1347 html.Append('<a name="top"></a>');
1348 html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
1349 html.Append('<dl>');
1350 for i := 0 to ReadList.Count - 1 do begin
1351 if (Trim(ReadList[i]) <> '') then begin
1352 No := IntToStr(i + 1);
1353 Res := DivideStrLine(ReadList[i]);
1354 Res.FBody := AddAnchorTag(Res.FBody);
1355 Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
1356 if Res.FMailTo = '' then
1357 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<font color="forestgreen"><b> ' + Res.FName + ' </b></font>
\93\8a\8de
\93ú
\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1358 else if GikoSys.Setting.ShowMail then
1359 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + ']
\93\8a\8de
\93ú
\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>')
1361 html.Append('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a>
\96¼
\91O
\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a>
\93\8a\8de
\93ú
\81F ' + Res.FDateTime+ '<br><dd>' + Res.Fbody + ' <br><br><br>');
1364 html.Append('</dl>');
1365 html.Append('<a name="bottom"></a>');
1366 html.Append('</body></html>');
1377 function TGikoSys.ConvertResAnchor(res: string): string;
1379 _HEAD : string = '<a href="../';
1380 _TAIL : string = ' target="_blank">';
1381 _ST: string = '&st=';
1382 _TO: string = '&to=';
1383 _STA: string = '&START=';
1384 _END: string = '&END=';
1390 i := AnsiPos(_HEAD, res);
1391 while i <> 0 do begin
1392 Result := Result + Copy(res, 1, i -1);
1393 Delete(res, 1, i - 1);
1394 j := AnsiPos(_TAIL, res);
1396 Result := Result + res;
1399 tmp := Copy(res, 1, j - 1);
1400 Delete(res, 1, j + 16);
1401 if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
1402 Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
1403 Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
1404 Result := Result + '<a href="#' + tmp + '">';
1405 end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
1406 Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
1407 Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
1408 Result := Result + '<a href="#' + tmp + '">';
1410 k := LastDelimiter('/', tmp);
1412 if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
1413 Delete(tmp, AnsiPos('-', tmp), Length(tmp))
1415 Delete(tmp, AnsiPos('"', tmp), Length(tmp));
1417 Result := Result + '<a href="#' + tmp + '">';
1419 i := AnsiPos(_HEAD, res);
1421 Result := Result + res;
1425 (*************************************************************************
1426 *http://
\82Ì
\95¶
\8e\9a\97ñ
\82ðanchor
\83^
\83O
\95t
\82«
\82É
\82·
\82é
\81B
1427 *************************************************************************)
1428 function TGikoSys.AddAnchorTag(s: string): string;
1430 URL_CHAR: string = '0123456789'
1431 + 'abcdefghijklmnopqrstuvwxyz'
1432 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1433 + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
1434 ANCHOR_REF = 'href=';
1435 RES_REF = '>>';
1436 REF_MARK: array[0..9] of string = ('http://', 'ttp://', 'tp://',
1437 'ms-help://','p://', 'https://',
1438 'www.', 'ftp://','news://','rtsp://');
1441 // wkIdx: array[0..9] of Integer;
1447 anchorLen : Integer;
1453 // + 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ß
1454 anchorLen := Length( ANCHOR_REF ) + 3;
1455 pURLCHARs := PChar(URL_CHAR);
1456 pURLCHARe := pURLCHARs + Length(URL_CHAR);
1460 for j := 0 to 9 do begin
1461 tmp := AnsiPos(REF_MARK[j], s);
1462 if tmp <> 0 then idx := Min(tmp, idx);
1463 if idx = tmp then idx2 := j; //
\82Ç
\82Ì
\83}
\81[
\83N
\82Å
\88ø
\82Á
\82©
\82©
\82Á
\82½
\82©
\82ð
\95Û
\91¶
1465 if idx = MaxInt then begin
1466 //
\83\8a\83\93\83N
\82ª
\96³
\82¢
\82æ
\81B
1467 Result := Result + s;
1472 (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
1473 //
\8aù
\82É
\83\8a\83\93\83N
\83^
\83O
\82ª
\82Â
\82¢
\82Ä
\82¢
\82é
\82Á
\82Û
\82¢
\82Æ
\82«
\82Í
\83\80\83V
1474 href := Copy( s, idx, Length( s ) );
1475 Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
1477 s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
1482 Result := Result + Copy(s, 1, idx - 1);
1484 Delete(s, 1, idx - 1);
1485 b := Length( s ) + 1;
1487 for i := 1 to b do begin
1488 pe := AnsiStrPosEx(pURLCHARs, pURLCHARe, pp, pp + 1);
1490 if pe = nil then begin
1491 //URL
\82¶
\82á
\82È
\82¢
\95¶
\8e\9a\94
\8c©
\81I
\82Æ
\82©
\81A
\95¶
\8e\9a\82ª
\82È
\82
\82È
\82Á
\82½
\81B
1492 url := Copy(s, 1, i - 1);
1494 1 : href := 'h' + url;
1495 2 : href := 'ht' + url;
1496 4 : href := 'htt' + url;
1497 6 : href := 'http://' + url;
1502 Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
1503 Delete(s, 1, i - 1);
1506 //
\88ê
\95¶
\8e\9a\90i
\82ß
\82é
\81B
1512 (*************************************************************************
1513 *
\83T
\83u
\83W
\83F
\83N
\83g
\88ê
\8ds
\82ð
\95ª
\8a\84
1514 *************************************************************************)
1515 function TGikoSys.DivideSubject(Line: string): TSubjectRec;
1525 if AnsiPos('<>', Line) = 0 then
1529 Result.FFileName := RemoveToken(Line, Delim);
1530 Result.FTitle := Trim(RemoveToken(Line, Delim));
1532 ws := Result.FTitle;
1533 if Copy(ws, Length(ws), 1) = ')' then begin
1536 end else if Copy(ws, Length(ws)-1, 2) = '
\81j' then begin
1539 end else if Copy(ws, Length(ws), 1) = '>' then begin
1543 for i := Length(ws) - 1 downto 1 do begin
1544 if Copy(ws, i, Length(LeftK)) = LeftK then begin
1545 Result.FTitle := TrimRight(Copy(ws, 1, i - 1));
1546 ws := Copy(ws, i + Length(LeftK), Length(ws) - i - Length(RightK));
1547 if IsNumeric(ws) then
1548 Result.FCount := StrToInt(ws);
1549 //Delete(Result.FTitle, i, Length(LeftK) + Length(ws) + Length(RightK));
1555 (*************************************************************************
1556 * dat
\83t
\83@
\83C
\83\8b\82Ì
\88ê
\83\89\83C
\83\93\82ð
\95ª
\89ð
1557 *************************************************************************)
1558 function TGikoSys.DivideStrLine(Line: string): TResRec;
1562 if AnsiPos('<>', Line) = 0 then begin
1564 //Result.FType := glt2chOld;
1565 Line := CustomStringReplace(Line, '<>', '<>');
1566 Line := CustomStringReplace(Line, ',', '<>');
1567 Line := CustomStringReplace(Line, '
\81\97\81M', ',');
1570 Result.FType := glt2chNew;
1571 //Trim
\82µ
\82Ä
\82Í
\82¢
\82¯
\82È
\82¢
\8bC
\82ª
\82·
\82é
\81@by
\82à
\82¶
\82ã
1572 Result.FName := RemoveToken(Line, Delim);
1573 Result.FMailTo := RemoveToken(Line, Delim);
1574 Result.FDateTime := RemoveToken(Line, Delim);
1575 Result.FBody := RemoveToken(Line, Delim);
1576 //
\8bó
\82¾
\82Æ
\96â
\91è
\82ª
\8bN
\82«
\82é
\82©
\82ç
\81A
\8bó
\94\92\82ð
\90Ý
\92è
\82·
\82é
1577 if Result.FBody = '' then begin
1578 Result.FBody := ' ';
1579 end else if ( Result.FBody[1] = ' ' ) then begin
1580 //
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é
\82Æ
\82©
\82¾
\82Æ
\81A
\96{
\95¶
\82Ì
\90æ
\93ª
\82É
\82P
\82Â
\94¼
\8ap
\8bó
\94\92\82ª
\93ü
\82Á
\82Ä
\82¢
\82é
\82Ì
\82Å
\8dí
\8f\9c\82·
\82é
1581 //
\91¼
\82Ì
\8cf
\8e¦
\94Â
\82Å
\81A
\83\8c\83X
\8e©
\91Ì
\82Ì
\8bó
\94\92\82©
\82à
\82µ
\82ê
\82È
\82¢
\82¯
\82Ç
\82»
\82ê
\82Í
\92ú
\82ß
\82é
1582 Delete(Result.FBody, 1, 1);
1584 //Result.FTitle := Trim(RemoveToken(Line, Delim));
1585 Result.FTitle := RemoveToken(Line, Delim);
1589 (*************************************************************************
1590 * URL
\82©
\82çBBSID
\82ð
\8eæ
\93¾
1591 *************************************************************************)
1592 function TGikoSys.UrlToID(url: string): string;
1599 if url = '' then Exit;
1601 url := Copy(url, 0, Length(url) - 1);
1602 for i := Length(url) downto 0 do begin
1603 if url[i] = '/' then begin
1604 Result := Copy(url, i + 1, Length(url));
1613 (*************************************************************************
1614 *URL
\82©
\82çBBSID
\88È
\8aO
\82Ì
\95\94\95ª(http://teri.2ch.net/)
\82ð
\8eæ
\93¾
1615 *************************************************************************)
1616 function TGikoSys.UrlToServer(url: string): string;
1623 wsURL := Trim(wsURL);
1625 if wsURL = '' then exit;
1627 if Copy(wsURL, Length(wsURL), 1) = '/' then
1628 wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
1630 for i := Length(wsURL) downto 0 do begin
1631 if wsURL[i] = '/' then begin
1632 Result := Copy(wsURL, 0, i);
1638 (*************************************************************************
1639 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\83`
\83F
\83b
\83N
1640 *************************************************************************)
1641 function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
1645 Code := GetFileAttributes(PChar(Name));
1646 Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
1649 (*************************************************************************
1650 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\8dì
\90¬
\81i
\95¡
\90\94\8aK
\91w
\91Î
\89\9e\81j
1651 *************************************************************************)
1652 function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
1655 if Length(Dir) = 0 then
1656 raise Exception.Create('
\83t
\83H
\83\8b\83_
\82ª
\8dì
\90¬
\8fo
\97\88\82Ü
\82¹
\82ñ');
1657 Dir := ExcludeTrailingPathDelimiter(Dir);
1658 if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
1659 or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
1660 Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
1663 (*************************************************************************
1664 *
\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
1665 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1666 *************************************************************************)
1667 function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
1671 Result := StrTokNext(sep, Rec);
1674 (*************************************************************************
1675 *
\95¶
\8e\9a\97ñ
\82©
\82ç
\83g
\81[
\83N
\83\93\82Ì
\90Ø
\82è
\8fo
\82µ
1676 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1677 *************************************************************************)
1678 function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
1685 if Len >= Pos then begin
1686 while (Pos <= Len) and (Str[Pos] in sep) do begin
1690 while (Pos<= Len) and not (Str[Pos] in sep) do begin
1691 if IsDBCSLeadByte(Byte(Str[Pos])) then begin
1696 Result := Copy(Str, I, Pos - I);
1697 while (Pos <= Len) and (Str[Pos] in sep) do begin//
\82±
\82ê
\82Í
\82¨
\8dD
\82Ý
1704 (*************************************************************************
1705 *
\83t
\83@
\83C
\83\8b\83T
\83C
\83Y
\8eæ
\93¾
1706 *************************************************************************)
1707 function TGikoSys.GetFileSize(FileName : string): longint;
1712 if not FileExists(FileName) then begin
1716 Assign(F, FileName);
1718 Result := FileSize(F);
1725 (*************************************************************************
1726 *
\83t
\83@
\83C
\83\8b\8ds
\90\94\8eæ
\93¾
1727 *************************************************************************)
1728 function TGikoSys.GetFileLineCount(FileName : string): longint;
1732 sl := TStringList.Create;
1735 sl.LoadFromFile(FileName);
1746 (*************************************************************************
1747 *
\83X
\83\8c\83b
\83h
\83t
\83@
\83C
\83\8b\82©
\82ç
\8ew
\92è
\8ds
\82ð
\8eæ
\93¾
1748 *************************************************************************)
1749 function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
1751 fileTmp : TStringList;
1754 if FileExists(FileName) then begin
1755 fileTmp := TStringList.Create;
1758 fileTmp.LoadFromFile( FileName );
1759 if ( Line >= 1 ) and ( Line < fileTmp.Count + 1 ) then begin
1760 Result := fileTmp.Strings[ Line-1 ];
1763 //on EFOpenError do Result := '';
1771 (*************************************************************************
1772 *
\83V
\83X
\83e
\83\80\83\81\83j
\83\85\81[
\83t
\83H
\83\93\83g
\82Ì
\91®
\90«
\82ð
\8eæ
\93¾
1773 *************************************************************************)
1774 procedure TGikoSys.MenuFont(Font: TFont);
1777 nm: NONCLIENTMETRICS;
1779 nm.cbSize := sizeof(NONCLIENTMETRICS);
1781 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
1782 lf := nm.lfMenuFont;
1784 Font.Name := lf.lfFaceName;
1785 Font.Height := lf.lfHeight;
1787 if lf.lfWeight >= 700 then
1788 Font.Style := Font.Style + [fsBold];
1789 if lf.lfItalic = 1 then
1790 Font.Style := Font.Style + [fsItalic];
1793 (*************************************************************************
1795 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1796 *************************************************************************)
1797 function TGikoSys.RemoveToken(var s: string;const delimiter: string): string;
1801 p := AnsiPos(delimiter, s);
1805 Result := Copy(s, 1, p - 1);
1806 Delete(s, 1, Length(Result) + Length(delimiter));
1809 (*************************************************************************
1811 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1812 *************************************************************************)
1813 function TGikoSys.GetTokenIndex(s: string; delimiter: string; index: Integer): string;
1818 for i := 0 to index do
1819 Result := RemoveToken(s, delimiter);
1822 (*************************************************************************
1824 *************************************************************************)
1825 function TGikoSys.DeleteLink(const s: string): string;
1835 s1 := GetTokenIndex(s, '<a href="', i);
1836 s2 := GetTokenIndex(s, '<a href="', i + 1);
1838 idx := Pos('">', s1);
1840 Delete(s1, 1, idx + 1);
1841 idx := Pos('">', s2);
1843 Delete(s2, 1, idx + 1);
1845 Result := Result + s1 + s2;
1854 //
\83C
\83\93\83f
\83b
\83N
\83X
\96¢
\8dX
\90V
\83o
\83b
\83t
\83@
\82ð
\83t
\83\89\83b
\83V
\83\85\81I
1855 {procedure TGikoSys.FlashExitWrite;
1859 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
1860 for i := 0 to FExitWrite.Count - 1 do
1861 WriteThreadDat(FExitWrite[i]);
1865 (*************************************************************************
1866 *
\83X
\83\8c\96¼
\82È
\82Ç
\82ð
\92Z
\82¢
\96¼
\91O
\82É
\95Ï
\8a·
\82·
\82é
1868 *************************************************************************)
1869 function TGikoSys.GetShortName(const LongName: string; ALength: integer): string;
1871 ERASECHAR : array [1..39] of string =
1872 ('
\81\99','
\81\9a','
\81¡','
\81 ','
\81\9f','
\81\9e','
\81Q','
\81\94','
\81£','
\81¥',
1873 '
\81¢','
\81¤','
\81\9c','
\81\9b','
\81\9d','
\81y','
\81z','
\81ô','
\81s','
\81t',
1874 '
\81g','
\81h','
\81k','
\81l','
\81e','
\81f','
\81\83','
\81\84','
\81á','
\81â',
1875 '
\81o','
\81p','
\81q','
\81r','
\81w','
\81x','
\81¬','
\81c', '
\81@');
1877 Chr : array [0..255] of char;
1881 s := Trim(LongName);
1882 if (Length(s) <= ALength) then begin
1886 for i := Low(ERASECHAR) to High(ERASECHAR) do begin
1887 S := CustomStringReplace(S, ERASECHAR[i], '');
1889 if (Length(S) <= ALength) then begin
1892 Windows.LCMapString(
1893 GetUserDefaultLCID(),
1901 S := Copy(S,1,ALength);
1903 if (ByteType(S, Length(S)) = mbLeadByte ) then begin
1904 S := Copy(S, 1, Length(S) - 1);
1914 (*************************************************************************
1917 *************************************************************************)
1918 function TGikoSys.ConvRes(const Body, Bbs, Key,
1919 ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
1920 DatToHTML: boolean = false): string;
1924 FIndexFrom : integer;
1931 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
1945 procedure Add(IndexFrom, IndexTo: integer; const No: string);
1950 FIndex.FIndexFrom := IndexFrom;
1951 FIndex.FIndexTo := IndexTo;
1955 function ChooseString(const Text, Separator: string; Index: integer): string;
1961 for i := 0 to Index - 1 do begin
1962 if (AnsiPos(Separator, S) = 0) then S := ''
1963 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
1965 p := AnsiPos(Separator, S);
1966 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
1975 List:= TList.Create;
1981 b := ByteType(s, i);
1983 mbSingleByte : begin
1984 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
1985 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
1993 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
1994 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2000 if (not sw) and (Copy(s,i,4) = GT) then begin
2001 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2009 if ((not sw) and (Copy(s,i,1) = ',')) or
2010 ((not sw) and (Copy(s,i,1) = '=')) then begin
2011 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2012 ((Chk) and (oc = '')) or
2013 ((not Chk) and (al)) then
2023 if (AnsiPos(sx, SN) > 0) then begin
2026 if (No <> '') and (No <> '-') then begin
2039 if Copy(s,i,1) = '<' then oc := '';
2040 oc := oc + Copy(s,i,1);
2046 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2052 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2060 if (AnsiPos(sx, ZN) > 0) then begin
2061 No := No + ZenToHan(sx);
2063 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2078 if (i > Length(Body)) then begin
2080 if (No <> '') then Add(sp, i, No);
2085 for i := List.Count - 1 downto 0 do begin
2086 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2087 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2088 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2090 st := PIndex(List[i]).FNo;
2091 et := PIndex(List[i]).FNo;
2093 if not DatToHTML then
2094 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2095 Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2096 [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2097 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2098 Copy(r,PIndex(List[i]).FIndexTo,Length(r))
2100 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2101 Format('<a href="#%s">', [st]) +
2102 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2103 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2105 Dispose(PIndex(List[i]));
2111 function TGikoSys.ConvRes(
2112 const Body, Bbs, Key, ParamBBS, ParamKey,
2113 ParamStart, ParamTo, ParamNoFirst,
2114 ParamTrue, FullURL : string
2119 FIndexFrom : integer;
2126 ZN = '
\82O
\82P
\82Q
\82R
\82S
\82T
\82U
\82V
\82W
\82X
\81|';
2140 procedure Add(IndexFrom, IndexTo: integer; const No: string);
2145 FIndex.FIndexFrom := IndexFrom;
2146 FIndex.FIndexTo := IndexTo;
2150 function ChooseString(const Text, Separator: string; Index: integer): string;
2156 for i := 0 to Index - 1 do begin
2157 if (AnsiPos(Separator, S) = 0) then S := ''
2158 else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
2160 p := AnsiPos(Separator, S);
2161 if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
2170 List:= TList.Create;
2176 b := ByteType(s, i);
2178 mbSingleByte : begin
2179 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2180 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2188 if (not sw) and (Copy(s,i,8) = GT + GT) then begin
2189 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
2195 if (not sw) and (Copy(s,i,4) = GT) then begin
2196 if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
2204 if ((not sw) and (Copy(s,i,1) = ',')) or
2205 ((not sw) and (Copy(s,i,1) = '=')) then begin
2206 if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
2207 ((Chk) and (oc = '')) or
2208 ((not Chk) and (al)) then
2218 if (AnsiPos(sx, SN) > 0) then begin
2221 if (No <> '') and (No <> '-') then begin
2234 if Copy(s,i,1) = '<' then oc := '';
2235 oc := oc + Copy(s,i,1);
2241 if (not sw) and (Copy(s,i,4) = '
\81\84\81\84') then begin
2247 if (not sw) and (Copy(s,i,2) = '
\81\84') then begin
2255 if (AnsiPos(sx, ZN) > 0) then begin
2256 No := No + ZenToHan(sx);
2258 if (No <> '') and (No <> '-') and (No <> '
\81|') then begin
2273 if (i > Length(Body)) then begin
2275 if (No <> '') then Add(sp, i, No);
2280 for i := List.Count - 1 downto 0 do begin
2281 //plName := Copy(PluginName, LastDelimiter('\',PluginName) + 1, Length(PluginName) - LastDelimiter('/',PluginName) -1 );
2282 if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
2283 st := ChooseString(PIndex(List[i]).FNo, '-', 0);
2284 et := ChooseString(PIndex(List[i]).FNo, '-', 1);
2286 st := PIndex(List[i]).FNo;
2287 et := PIndex(List[i]).FNo;
2289 r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
2290 Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',
2291 [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
2292 Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
2293 Copy(r,PIndex(List[i]).FIndexTo,Length(r));
2294 Dispose(PIndex(List[i]));
2301 function TGikoSys.BoolToInt(b: Boolean): Integer;
2303 Result := IfThen(b, 1, 0);
2306 function TGikoSys.IntToBool(i: Integer): Boolean;
2311 //gzip
\82Å
\88³
\8fk
\82³
\82ê
\82½
\82Ì
\82ð
\96ß
\82·
2312 function TGikoSys.GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
2316 GZipStream: TGzipDecompressStream;
2317 TextStream: TStringStream;
2318 buf: array[0..BUF_SIZE - 1] of Byte;
2324 TextStream := TStringStream.Create('');
2326 //
\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¢)
2327 // if LowerCase(Trim(ContentEncoding)) = 'gzip' then begin
2328 if AnsiPos('gzip', LowerCase(Trim(ContentEncoding))) > 0 then begin
2329 ResStream.Position := 0;
2330 GZipStream := TGzipDecompressStream.Create(TextStream);
2333 FillChar(buf, BUF_SIZE, 0);
2334 cnt := ResStream.Read(buf, BUF_SIZE);
2336 GZipStream.Write(buf, BUF_SIZE);
2342 ResStream.Position := 0;
2344 FillChar(buf, BUF_SIZE, 0);
2345 cnt := ResStream.Read(buf, BUF_SIZE);
2347 TextStream.Write(buf, BUF_SIZE);
2351 //NULL
\95¶
\8e\9a\82ð"*"
\82É
\82·
\82é
2352 s := TextStream.DataString;
2354 while (i > 0) and (s[i] = #0) do
2359 while i <> 0 do begin
2369 procedure TGikoSys.LoadKeySetting(ActionList: TActionList);
2371 STD_SEC = 'KeySetting';
2377 SecList: TStringList;
2378 Component: TComponent;
2380 if not FileExists(GetConfigDir + KEY_SETTING_FILE_NAME) then
2382 SecList := TStringList.Create;
2383 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2385 ini.ReadSection(STD_SEC, SecList);
2386 for i := 0 to SecList.Count - 1 do begin
2387 ActionName := SecList[i];
2388 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2389 if ActionKey <> -1 then begin
2390 Component := ActionList.Owner.FindComponent(ActionName);
2391 if TObject(Component) is TAction then begin
2392 TAction(Component).ShortCut := ActionKey;
2402 procedure TGikoSys.SaveKeySetting(ActionList: TActionList);
2404 STD_SEC = 'KeySetting';
2409 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
2411 for i := 0 to ActionList.ActionCount - 1 do begin
2412 if ActionList.Actions[i].Tag = -1 then
2414 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2422 procedure TGikoSys.LoadEditorKeySetting(ActionList: TActionList);
2424 STD_SEC = 'KeySetting';
2430 SecList: TStringList;
2431 Component: TComponent;
2433 if not FileExists(GetConfigDir + EKEY_SETTING_FILE_NAME) then
2435 SecList := TStringList.Create;
2436 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2438 ini.ReadSection(STD_SEC, SecList);
2439 for i := 0 to SecList.Count - 1 do begin
2440 ActionName := SecList[i];
2441 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
2442 if ActionKey <> -1 then begin
2443 Component := ActionList.Owner.FindComponent(ActionName);
2444 if TObject(Component) is TAction then begin
2445 TAction(Component).ShortCut := ActionKey;
2455 procedure TGikoSys.SaveEditorKeySetting(ActionList: TActionList);
2457 STD_SEC = 'KeySetting';
2462 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
2464 for i := 0 to ActionList.ActionCount - 1 do begin
2465 if ActionList.Actions[i].Tag = -1 then
2467 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
2476 procedure TGikoSys.CreateProcess(const AppPath: string; const Param: string);
2478 PI: TProcessInformation;
2482 Path := '"' + AppPath + '"';
2484 Path := Path + ' ' + Param;
2486 SI.Cb := SizeOf(Si);
2487 SI.lpReserved := nil;
2488 SI.lpDesktop := nil;
2491 SI.cbReserved2 := 0;
2492 SI.lpReserved2 := nil;
2494 Windows.CreateProcess(nil,
2506 procedure TGikoSys.OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
2510 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2511 gbtUserApp, gbtAuto:
2512 if (Setting.URLApp) and (FileExists(Setting.URLAppFile)) then
2513 GikoSys.CreateProcess(Setting.URLAppFile, URL)
2515 HlinkNavigateString(nil, PWideChar(WideString(URL)));
2519 function TGikoSys.HTMLDecode(const AStr: String): String;
2521 Sp, Rp, Cp, Tp: PChar;
2526 SetLength(Result, Length(AStr));
2528 Rp := PChar(Result);
2531 while Sp^ <> #0 do begin
2537 'a': if AnsiStrPos(Sp, 'amp;') = Sp then
2543 'g': if (AnsiStrPos(Sp, 'lt;') = Sp) or (AnsiStrPos(Sp, 'gt;') = Sp) then
2547 while (Sp^ <> ';') and (Sp^ <> #0) do
2554 'q': if AnsiStrPos(Sp, 'quot;') = Sp then
2562 Num := IsNumeric(Copy(Tp, 1, 1));
2563 while (Sp^ <> ';') and (Sp^ <> #0) do begin
2564 if (Num) and (not IsNumeric(Copy(Sp, 1, 1))) then
2568 SetString(S, Tp, Sp - Tp);
2573 //raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2574 //[Cp^ + Sp^, Cp - PChar(AStr)])
2584 // on E:EConvertError do
2585 // raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
2586 // [Cp^ + Sp^, Cp - PChar(AStr)])
2588 SetLength(Result, Rp - PChar(Result));
2591 function TGikoSys.GetHRefText(s: string): string;
2601 Index := AnsiPos('href', LowerCase(s));
2604 s := Trim(Copy(s, Index + 4, Length(s)));
2605 s := Trim(Copy(s, 2, Length(s)));
2607 //
\8en
\82ß
\82Ì
\95¶
\8e\9a\82ª'"'
\82È
\82ç
\8eæ
\82è
\8f\9c\82
2608 //if Copy(s, 1, 1) = '"' then begin
2609 if s[1] = '"' then begin
2610 s := Trim(Copy(s, 2, Length(s)));
2613 Index := AnsiPos('"', s);
2614 if Index <> 0 then begin
2615 //'"'
\82Ü
\82ÅURL
\82Æ
\82·
\82é
2616 s := Copy(s, 1, Index - 1);
2618 //'"'
\82ª
\96³
\82¯
\82ê
\82Î
\83X
\83y
\81[
\83X
\82©">"
\82Ì
\91\81\82¢
\95û
\82Ü
\82Å
\82ðURL
\82Æ
\82·
\82é
2619 Index := AnsiPos(' ', s);
2620 Index2 := AnsiPos('>', s);
2623 if Index > Index2 then
2626 s := Copy(s, 1, Index - 1)
2628 //
\82±
\82ê
\88È
\8fã
\82à
\82¤
\92m
\82ç
\82ñ
\82Ê
2634 //
\83z
\83X
\83g
\96¼
\82ª
\82Q
\82\83\82\88\82©
\82Ç
\82¤
\82©
\83`
\83F
\83b
\83N
\82·
\82é
2635 function TGikoSys.Is2chHost(Host: string): Boolean;
2637 HOST_NAME: array[0..1] of string = ('2ch.net', 'bbspink.com');
2643 if RightStr( Host, 1 ) = '/' then
2644 Host := Copy( Host, 1, Length( Host ) - 1 );
2645 OutputDebugString(pchar(HOST_NAME[0]));
2646 for i := 0 to Length(HOST_NAME) - 1 do begin
2647 // Len := Length(HOST_NAME[i]);
2648 if (AnsiPos(HOST_NAME[i], Host) > 0) and
2649 (AnsiPos(HOST_NAME[i], Host) = (Length(Host) - Length(HOST_NAME[i]) + 1)) then begin
2656 function TGikoSys.Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
2666 Index := AnsiPos(READ_PATH, path);
2667 if Index <> 0 then begin
2668 s := Copy(path, Index + Length(READ_PATH), Length(path));
2670 if (Length(s) > 0) and (s[1] = '/') then
2672 BBSID := GetTokenIndex(s, '/', 0);
2673 BBSKey := GetTokenIndex(s, '/', 1);
2676 Result := (BBSID <> '') or (BBSKey <> '');
2679 Index := AnsiPos(KAKO_PATH, path);
2680 if Index <> 0 then begin
2681 s := Copy(path, 2, Length(path));
2682 BBSID := GetTokenIndex(s, '/', 0);
2683 if (BBSID = 'log') and (GetTokenIndex(s, '/', 2) = 'kako') then
2684 BBSID := GetTokenIndex(s, '/', 1);
2685 BBSKey := ChangeFileExt(Document, '');
2686 Result := (BBSID <> '') or (BBSKey <> '');
2689 Index := AnsiPos('read.cgi?', URL);
2690 if Index <> 0 then begin
2691 SList := TStringList.Create;
2694 // s := HTMLDecode(Document);
2695 ExtractHTTPFields(['?', '&'], [], PChar(URL), SList, False);
2696 BBSID := SList.Values['bbs'];
2697 BBSKey := SList.Values['key'];
2698 Result := (BBSID <> '') or (BBSKey <> '');
2708 procedure TGikoSys.GetPopupResNumber(URL : string; var stRes, endRes : Int64);
2715 URL := Trim(LowerCase(URL));
2716 if (AnsiPos('&st=', URL ) <> 0) and ( AnsiPos( '&to=',URL) <> 0 ) then begin
2720 buf := Copy( URL, AnsiPos('&st=', URL ) + 4, AnsiPos( '&to=',URL) - AnsiPos('&st=', URL ) - 4 );
2722 stRes := StrToInt64( buf );
2723 if AnsiPos( '&nofirst=',URL) <> 0 then begin
2724 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, AnsiPos( '&nofirst=',URL) - AnsiPos('&to=', URL ) - 4);
2726 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, Length( URL ) - AnsiPos('&to=', URL ) - 4 + 1 );
2729 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
2730 buf := Copy( buf, 1, ps );
2734 endRes := StrToInt64(buf)
2741 if (stRes <> 0) and (endRes = 0) then
2742 endRes := stRes + MAX_POPUP_RES
2743 else if (stRes = 0) and (endRes <> 0) then begin
2744 stRes := endRes - MAX_POPUP_RES;
2748 GikoSys.GetBrowsableThreadURL( URL );
2749 end else if( AnsiPos('&res=', URL ) <> 0 ) then begin
2751 buf := Copy( URL, AnsiPos('&res=', URL ) + 5, Length( URL ) - AnsiPos('&res=', URL ) - 5 + 1 );
2754 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
2755 buf := Copy( buf, 1, ps );
2758 stRes := StrToInt(buf)
2765 end else if (AnsiPos('&start=', URL ) <> 0) and ( AnsiPos( '&end=',URL) <> 0 ) then begin
2767 stRes := StrToInt64( Copy( URL, AnsiPos('&start=', URL ) + 7, AnsiPos( '&end=',URL) - AnsiPos('&start=', URL ) - 7 ) );
2768 if AnsiPos( '&nofirst=',URL) <> 0 then begin
2769 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, AnsiPos( '&nofirst=',URL) - AnsiPos('&end=', URL ) - 5);
2771 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, Length( URL ) - AnsiPos('&to=', URL ) - 5 + 1 );
2774 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
2775 buf := Copy( buf, 1, ps );
2779 endRes := StrToInt64(buf);
2786 end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
2787 buf := Copy(URL, LastDelimiter('/',URL)+1,Length(URL)-LastDelimiter('/',URL)+1);
2788 if Length(buf) > 0 then begin
2789 if AnsiPos('-', buf) = 1 then begin
2794 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
2796 convBuf := Copy( buf, 1, ps );
2797 if convBuf <> '' then
2798 endRes := StrToInt64(convBuf)
2804 if endRes <> 0 then begin
2805 stRes := endRes - MAX_POPUP_RES;
2812 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
2814 convBuf := Copy( buf, 1, ps );
2815 if convBuf <> '' then begin
2816 stRes := StrToInt64(convBuf);
2820 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
2822 convBuf := Copy( buf, 1, ps );
2823 if convBuf <> '' then
2824 endRes := StrToInt64(convBuf)
2845 function TGikoSys.Parse2chURL2(URL: string): TPathRec;
2850 // convBuf : String;
2861 URL := Trim(LowerCase(URL));
2866 Result.FFirst := False;
2867 Result.FStBegin := False;
2868 Result.FToEnd := False;
2869 Result.FDone := False;
2870 Result.FNoParam := False;
2874 if URL[length(URL)] = '\' then
2876 FAWKStr.RegExp := 'http://.+\.(2ch\.net|bbspink\.com)/';
2877 if FAWKStr.Match(FAWKStr.ProcessEscSeq(URL), RStart, RLength) <> 0 then begin
2878 s := Copy(URL, RStart + RLength - 1, Length(URL));
2880 //
\95W
\8f\80\8f\91\8e®
2881 //
\8dÅ
\8cã
\82Íl50, 10, 10-20, 10n, 10-20n, -10, 10-, 10n-
\82È
\82Ç
2882 //http://xxx.2ch.net/test/read.cgi/bbsid/1000000000/
2883 FAWKStr.RegExp := '/test/read.cgi/.+/[0-9]+/?.*';
2884 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2885 s := Copy(s, 15, Length(s));
2887 SList := TStringList.Create;
2890 FAWKStr.RegExp := '/';
2891 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 3 then begin
2892 Result.FBBS := SList[1];
2893 Result.FKey := SList[2];
2894 if SList.Count >= 4 then
2898 Result.FNoParam := true;
2904 FAWKStr.LineSeparator := mcls_CRLF;
2905 FAWKStr.RegExp := '-';
2906 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) = 0 then begin
2907 Result.FFirst := True;
2909 FAWKStr.RegExp := 'l[0-9]+';
2910 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2911 Result.FFirst := True;
2913 for i := 0 to SList.Count - 1 do begin
2914 if Trim(SList[i]) = '' then begin
2916 Result.FStBegin := True;
2917 if i = (SList.Count - 1) then
2918 Result.FToEnd := True;
2919 end else if IsNumeric(SList[i]) then begin
2920 wkInt := StrToInt(SList[i]);
2921 wkMax := Max(wkMax, wkInt);
2925 wkMin := Min(wkMin, wkInt);
2926 end else if Trim(SList[i]) = 'n' then begin
2927 Result.FFirst := True;
2929 FAWKStr.RegExp := '^n[0-9]+$|^[0-9]+n$';
2930 if FAWKStr.Match(FAWKStr.ProcessEscSeq(SList[i]), RStart, RLength) > 0 then begin
2931 if Copy(SList[i], 1, 1) = 'n' then
2932 wkInt := StrToInt(Copy(SList[i], 2, Length(SList[i])))
2934 wkInt := StrToInt(Copy(SList[i], 1, Length(SList[i]) - 1));
2935 Result.FFirst := True;
2936 wkMax := Max(wkMax, wkInt);
2940 wkMin := Min(wkMin, wkInt);
2944 if Result.FStBegin and (not Result.FToEnd) then
2946 else if (not Result.FStBegin) and Result.FToEnd then
2948 else if (not Result.FStBegin) and (not Result.FToEnd) then begin
2949 Result.FSt := wkMin;
2950 Result.FTo := wkMax;
2952 //Result.FSt := wkMin;
2953 //Result.FTo := wkMax;
2959 Result.FDone := True;
2963 //
\90Vkako
\8f\91\8e®
2964 //http://server.2ch.net/ITA_NAME/kako/1000/10000/1000000000.html
2965 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+/[0-9]+\.html';
2966 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2967 SList := TStringList.Create;
2970 FAWKStr.RegExp := '/';
2971 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
2972 Result.FBBS := SList[1];
2973 Result.FKey := ChangeFileExt(SList[5], '');
2974 Result.FFirst := True;
2980 Result.FDone := True;
2984 //
\8b\8ckako
\8f\91\8e®
2985 //http://server.2ch.net/ITA_NAME/kako/999/999999999.html
2986 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+\.html';
2987 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2988 SList := TStringList.Create;
2991 FAWKStr.RegExp := '/';
2992 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 5 then begin
2993 Result.FBBS := SList[1];
2994 Result.FKey := ChangeFileExt(SList[4], '');
2995 Result.FFirst := True;
3001 Result.FDone := True;
3005 //log
\8by
\82Ñlog2
\8f\91\8e®
3006 //http://server.2ch.net/log/ITA_NAME/kako/999/999999999.html
3007 //http://server.2ch.net/log2/ITA_NAME/kako/999/999999999.html
3008 FAWKStr.RegExp := '/log2?/.+/kako/[0-9]+/[0-9]+\.html';
3009 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3010 SList := TStringList.Create;
3013 FAWKStr.RegExp := '/';
3014 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
3015 Result.FBBS := SList[2];
3016 Result.FKey := ChangeFileExt(SList[5], '');
3017 Result.FFirst := True;
3023 Result.FDone := True;
3028 //
\8b\8cURL
\8f\91\8e®
3029 //http://server.2ch.net/test/read.cgi?bbs=ITA_NAME&key=1000000000&st=1&to=5&nofirst=true
3030 FAWKStr.RegExp := '/test/read\.cgi\?';
3031 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
3032 s := Copy(s, 16, Length(s));
3033 SList := TStringList.Create;
3036 FAWKStr.RegExp := '&';
3037 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
3038 Result.FFirst := True;
3039 for i := 0 to SList.Count - 1 do begin
3040 if Pos('bbs=', SList[i]) = 1 then begin
3041 Result.FBBS := Copy(SList[i], 5, Length(SList[i]));
3042 end else if Pos('key=', SList[i]) = 1 then begin
3043 Result.FKey := Copy(SList[i], 5, Length(SList[i]));
3044 end else if Pos('st=', SList[i]) = 1 then begin
3045 wk := Copy(SList[i], 4, Length(SList[i]));
3046 if IsNumeric(wk) then
3047 Result.FSt := StrToInt(wk)
3048 else if wk = '' then
3049 Result.FStBegin := True;
3050 end else if Pos('to=', SList[i]) = 1 then begin
3051 wk := Copy(SList[i], 4, Length(SList[i]));
3052 if IsNumeric(wk) then
3053 Result.FTo := StrToInt(wk)
3054 else if wk = '' then
3055 Result.FToEnd := True;
3056 end else if Pos('nofirst=', SList[i]) = 1 then begin
3057 Result.FFirst := False;
3066 if (Result.FBBS <> '') and (Result.FKey <> '') then begin
3067 Result.FDone := True;
3074 procedure TGikoSys.ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
3084 URI := TIdURI.Create(URL);
3086 Protocol := URI.Protocol;
3089 Document := URI.Document;
3091 Bookmark := URI.Bookmark;
3097 function TGikoSys.GetVersionBuild: Integer;
3099 FixedFileInfo: PVSFixedFileInfo;
3100 VersionHandle, VersionSize: DWORD;
3101 pVersionInfo: Pointer;
3106 AppFile := Application.ExeName;
3107 VersionSize := GetFileVersionInfoSize(pChar(AppFile), VersionHandle);
3108 if VersionSize = 0 then
3110 GetMem(pVersionInfo, VersionSize);
3112 if GetFileVersionInfo(PChar(AppFile),VersionHandle,VersionSize, pVersionInfo) then
3113 if VerQueryValue(pVersionInfo, '\', Pointer(FixedFileInfo), ItemLen) then
3114 Result := LOWORD(FixedFileInfo^.dwFileVersionLS);
3116 FreeMem(pVersionInfo, VersionSize);
3120 function TGikoSys.GetBrowsableThreadURL(
3124 threadItem : TThreadItem;
3125 boardPlugIn : TBoardPlugIn;
3130 //=====
\83v
\83\89\83O
\83C
\83\93
3132 for i := Length( BoardGroups ) - 1 downto 1 do begin
3133 if Assigned( Pointer( BoardGroups[i].BoardPlugIn.Module ) ) then begin
3134 if BoardGroups[i].BoardPlugIn.AcceptURL( inURL ) = atThread then begin
3135 board := BBSsFindBoardFromURL( BoardGroups[i].BoardPlugIn.ExtractBoardURL(inURL) );
3136 if board <> nil then begin
3137 boardPlugIn := BoardGroups[i].BoardPlugIn;
3138 threadItem := TThreadItem.Create( boardPlugIn, board, inURL );
3139 Result := threadItem.URL;
3148 // 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¢
3151 if Length( Result ) = 0 then
3152 Result := GikoSys.Get2chBrowsableThreadURL( inURL );
3156 function TGikoSys.GetThreadURL2BoardURL(
3160 threadItem : TThreadItem;
3161 boardPlugIn : TBoardPlugIn;
3166 //=====
\83v
\83\89\83O
\83C
\83\93
3168 for i := Length( BoardGroups ) - 1 downto 1 do begin
3169 if Assigned( Pointer( BoardGroups[i].BoardPlugIn.Module ) ) then begin
3170 if BoardGroups[i].BoardPlugIn.AcceptURL( inURL ) = atThread then begin
3171 board := BBSsFindBoardFromURL(BoardGroups[i].BoardPlugIn.ExtractBoardURL(inURL));
3172 boardPlugIn := BoardGroups[i].BoardPlugIn;
3173 threadItem := TThreadItem.Create( boardPlugIn, board, inURL );
3174 Result := BoardGroups[i].BoardPlugIn.GetBoardURL( Longword( threadItem ) );
3182 // 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¢
3185 if Length( Result ) = 0 then
3186 Result := GikoSys.Get2chThreadURL2BoardURL( inURL );
3190 function TGikoSys.Get2chThreadURL2BoardURL(
3194 Protocol, Host, Path, Document, Port, Bookmark : string;
3195 BBSID, BBSKey : string;
3199 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3200 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3202 foundPos := Pos( '/test/read.cgi', inURL );
3203 if {(Is2chHost(Host)) and} (foundPos > 0) then
3204 Result := Copy( inURL, 1, foundPos ) + BBSID + '/'
3206 Result := Protocol + '://' + Host + '/' + BBSID + '/';
3210 function TGikoSys.Get2chBrowsableThreadURL(
3214 Protocol, Host, Path, Document, Port, Bookmark : string;
3215 BBSID, BBSKey : string;
3219 // if Pos( KAKO_PATH, inURL ) > 0 then begin
3222 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
3223 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
3224 foundPos := Pos( '/test/read.cgi', inURL ) - 1;
3226 if Is2chHost( Host ) then begin
3227 Result := Protocol + '://' + Host +
3228 READ_PATH + BBSID + '/' + BBSKey + '/l50';
3230 if foundPos > 0 then
3231 Result := Copy( inURL, 1, foundPos ) +
3232 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50'
3234 Result := Protocol + '://' + Host +
3235 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50';
3241 function TGikoSys.Get2chBoard2ThreadURL(
3249 server := UrlToServer( inBoard.URL );
3250 //if Is2chHost( server ) then
3251 if inBoard.Is2ch then
3252 Result := server + 'test/read.cgi/' + inBoard.BBSID + '/' + inKey + '/l50'
3254 Result := server + 'test/read.cgi?bbs=' + inBoard.BBSID + '&key=' + inKey + '&ls=50';
3258 (*************************************************************************
3259 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\97ñ
\8b\93
3260 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3261 *************************************************************************)
3262 procedure TGikoSys.ListBoardFile;
3264 boardFileList : TStringList;
3269 for i := 0 to Length( BBSs ) - 1 do
3273 SetLength( BBSs, 0 );
3276 //
\94Â
\83\8a\83X
\83g
\82Ì
\97ñ
\8b\93
3277 if FileExists( GikoSys.GetBoardFileName ) then begin
3278 SetLength( BBSs, l + 1 );
3279 BBSs[ l ] := TBBS.Create( GikoSys.GetBoardFileName );
3280 BBSs[ l ].Title := '
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é';
3284 if FileExists( GikoSys.GetCustomBoardFileName ) then begin
3285 SetLength( BBSs, l + 1 );
3286 BBSs[ l ] := TBBS.Create( GikoSys.GetCustomBoardFileName );
3287 BBSs[ l ].Title := '
\82»
\82Ì
\91¼';
3291 // Board
\83t
\83H
\83\8b\83_
3292 if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
3293 BoardFileList := TStringList.Create;
3295 BoardFileList.BeginUpdate;
3296 GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
3297 BoardFileList.EndUpdate;
3298 for k := BoardFileList.Count - 1 downto 0 do begin
3299 if AnsiCompareText(ExtractFileExt(BoardFileList[ k ]), '.bak') = 0 then
3300 BoardFileList.Delete(k);
3302 SetLength( BBSs, l + BoardFileList.Count );
3303 for i := BoardFileList.Count - 1 downto 0 do begin
3304 BBSs[ l ] := TBBS.Create( BoardFileList[ i ] );
3305 BBSs[ l ].Title := ChangeFileExt( ExtractFileName( BoardFileList[ i ] ), '' );
3313 (*************************************************************************
3314 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
3315 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
3316 *************************************************************************)
3317 procedure TGikoSys.ReadBoardFile( bbs : TBBS );
3322 boardFile : TStringList;
3323 CategoryList : TStringList;
3324 BoardList : TStringList;
3325 Category : TCategory;
3329 // RoundItem : TRoundItem;
3331 i, iBound : Integer;
3332 j, jBound : Integer;
3333 k, kBound : Integer;
3336 if not FileExists( bbs.FilePath ) then
3340 ini := TMemIniFile.Create('');
3341 boardFile := TStringList.Create;
3344 boardFile.LoadFromFile( bbs.FilePath );
3346 ini.SetStrings( boardFile );
3347 CategoryList := TStringList.Create;
3348 BoardList := TStringList.Create;
3350 ini.ReadSections( CategoryList );
3352 iBound := CategoryList.Count - 1;
3353 for i := 0 to iBound do begin
3354 ini.ReadSection( CategoryList[i], BoardList );
3355 Category := TCategory.Create;
3356 Category.No := i + 1;
3357 Category.Title := CategoryList[i];
3359 jBound := BoardList.Count - 1;
3360 for j := 0 to jBound do begin
3362 inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
3363 //'http://'
\82ð
\8aÜ
\82Ü
\82È
\82¢
\95¶
\8e\9a\97ñ
\82Ì
\8e\9e\82Í
\96³
\8e\8b\82·
\82é
3364 if (AnsiPos('http://', AnsiLowerCase(inistr)) = 0) then Continue;
3365 //=====
\83v
\83\89\83O
\83C
\83\93
3367 kBound := Length(BoardGroups) - 1;
3368 for k := 1 to kBound do begin //0
\82Í
\81A2
\82¿
\82á
\82ñ
3369 if Assigned( Pointer( BoardGroups[k].BoardPlugIn.Module ) ) then begin
3370 if BoardGroups[k].BoardPlugIn.AcceptURL( inistr ) = atBoard then begin
3371 if not BoardGroups[k].Find(inistr, p) then begin
3372 tmpstring := BoardGroups[k].BoardPlugIn.ExtractBoardURL( inistr );
3373 if AnsiCompareStr(tmpString, inistr) <> 0 then begin
3374 if not BoardGroups[k].Find(tmpstring, p) then begin
3376 Board := TBoard.Create( BoardGroups[k].BoardPlugIn, tmpstring );
3377 BoardGroups[k].AddObject(tmpstring, Board);
3378 Category.Add(Board);
3380 //
\82±
\82±
\82É
\97\88\82é
\82Æ
\82µ
\82½
\82çBoard
\82Ì
\8dì
\90¬
\82É
\8e¸
\94s
\82µ
\82½
\82Æ
\82«
\82¾
\82©
\82çBoard
\82ðnil
\82É
\82·
\82é
3384 Board := TBoard(BoardGroups[k].Objects[p]);
3385 if Board.ParentCategory <> Category then
3386 Category.Add(Board);
3390 Board := TBoard.Create( BoardGroups[k].BoardPlugIn, tmpstring );
3391 BoardGroups[k].AddObject(tmpstring, Board);
3392 Category.Add(Board);
3394 //
\82±
\82±
\82É
\97\88\82é
\82Æ
\82µ
\82½
\82çBoard
\82Ì
\8dì
\90¬
\82É
\8e¸
\94s
\82µ
\82½
\82Æ
\82«
\82¾
\82©
\82çBoard
\82ðnil
\82É
\82·
\82é
3399 Board := TBoard(BoardGroups[k].Objects[p]);
3400 if Board.ParentCategory <> Category then
3401 Category.Add(Board);
3408 // 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¢
3411 if (Board = nil) then begin
3412 if not BoardGroups[0].Find(inistr,p) then begin
3413 Board := TBoard.Create( nil, inistr );
3414 BoardGroups[0].AddObject(inistr, Board);
3415 Category.Add(Board);
3417 Board := TBoard(BoardGroups[0].Objects[p]);
3418 if Board.ParentCategory <> Category then
3419 Category.Add(Board);
3423 if (Board.Multiplicity = 0) then begin
3426 Board.Multiplicity := 1;
3427 Board.Title := BoardList[j];
3428 Board.RoundDate := ZERO_DATE;
3433 Board.Multiplicity := Board.Multiplicity + 1;
3438 bbs.Add( Category );
3443 bbs.IsBoardFileRead := True;
3455 function TGikoSys.GetUnknownCategory : TCategory;
3457 UNKNOWN_CATEGORY = '(
\96¼
\8fÌ
\95s
\96¾)';
3460 if Length( BBSs ) < 2 then begin
3465 Result := BBSs[ 1 ].FindCategoryFromTitle( UNKNOWN_CATEGORY );
3466 if Result = nil then begin
3467 Result := TCategory.Create;
3468 Result.Title := UNKNOWN_CATEGORY;
3469 BBSs[ 1 ].Add( Result );
3474 function TGikoSys.GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
3476 category : TCategory;
3478 UNKNOWN_BOARD = '(
\96¼
\8fÌ
\95s
\96¾)';
3481 category := GetUnknownCategory;
3482 if category = nil then begin
3485 Result := category.FindBoardFromTitle( UNKNOWN_BOARD );
3486 if Result = nil then begin
3487 Result := TBoard.Create( inPlugIn, inURL );
3488 Result.Title := UNKNOWN_BOARD;
3489 category.Add( Result );
3494 function TGikoSys.GetSambaFileName : string;
3496 Result := Setting.GetSambaFileName;
3498 procedure TGikoSys.SambaFileExists();
3501 sambaStrList: TStringList;
3503 if not FileExists(GikoSys.GetSambaFileName) then begin
3504 sambaTmp := ChangeFileExt(GikoSys.GetSambaFileName, '.default');
3505 sambaStrList := TStringList.Create;
3507 if FileExists(sambaTmp) then begin
3508 sambaStrList.LoadFromFile(sambaTmp);
3509 sambaStrList.SaveToFile(GikoSys.GetSambaFileName);
3516 function TGikoSys.GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem; limited: boolean):string;
3522 if (not IsNoValidID(AID)) and
3523 (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3524 body := TStringList.Create;
3526 GetSameIDRes(AID, ThreadItem, body);
3527 if (limited) and (body.Count > 20) then begin
3528 for i := body.Count - 20 to body.Count - 1 do begin
3529 Result := Result + '>' + body[i] + ' ';
3532 for i := 0 to body.Count - 1 do begin
3533 Result := Result + '>' + body[i] + ' ';
3539 Result := ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
3542 procedure TGikoSys.GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList);
3545 ReadList: TStringList;
3547 boardPlugIn : TBoardPlugIn;
3549 if (not IsNoValidID(AID)) and
3550 (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3551 //if ThreadItem.IsBoardPlugInAvailable then begin
3552 if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
3553 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
3554 //boardPlugIn := ThreadItem.BoardPlugIn;
3555 boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
3557 for i := 0 to threadItem.Count - 1 do begin
3559 Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), i + 1));
3560 if(AnsiPos(AID, Res.FDateTime) > 0) then begin
3561 body.Add(IntToStr(i+1));
3565 ReadList := TStringList.Create;
3567 ReadList.LoadFromFile(ThreadItem.GetThreadFileName);
3568 for i := 0 to ReadList.Count - 1 do begin
3569 Res := DivideStrLine(ReadList[i]);
3570 if AnsiPos(AID, Res.FDateTime) > 0 then begin
3571 body.Add(IntToStr(i+1));
3580 function TGikoSys.GetSameIDResAnchor(AIDNum : Integer; ThreadItem: TThreadItem; limited: boolean):string;
3586 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3587 body := TStringList.Create;
3589 GetSameIDRes(AIDNum, ThreadItem, body);
3590 if (limited) and (body.Count > 20) then begin
3591 for i := body.Count - 20 to body.Count - 1 do begin
3592 Result := Result + '>' + body[i] + ' ';
3595 for i := 0 to body.Count - 1 do begin
3596 Result := Result + '>' + body[i] + ' ';
3602 Result := ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
3606 procedure TGikoSys.GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList);
3609 boardPlugIn : TBoardPlugIn;
3611 stList: TStringList;
3614 if (ThreadItem <> nil) and (ThreadItem.IsLogFile)
3615 and (AIDNum > 0) and (AIDNum <= ThreadItem.Count) then begin
3616 //if ThreadItem.IsBoardPlugInAvailable then begin
3617 if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
3618 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
3619 //boardPlugIn := ThreadItem.BoardPlugIn;
3620 boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
3621 Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), AIDNum));
3623 Res := DivideStrLine( ReadThreadFile(ThreadItem.GetThreadFileName, AIDNum));
3625 AID := Res.FDateTime;
3626 if AnsiPos('id', AnsiLowerCase(AID)) > 0 then begin
3627 AID := Copy(AID, AnsiPos('id', AnsiLowerCase(AID)) - 1, 11);
3628 if AnsiPos(' be:', AnsiLowerCase(AID)) > 0 then begin
3629 AID := Copy(AID, 1, AnsiPos(' BE:', AnsiLowerCase(AID)) - 1)
3632 stlist := TStringList.Create;
3634 stList.DelimitedText := AID;
3636 for i := 0 to stList.Count - 1 do
3637 if Length(WideString(stList[i])) = 8 then begin
3638 if NotDateorTimeString(stList[i]) then begin
3647 if not IsNoValidID(AID) then
3648 GetSameIDRes(AID, ThreadItem, body);
3651 function TGikoSys.GetSameIDResCount(const AID : string; ThreadItem: TThreadItem):Integer;
3656 if (not IsNoValidID(AID))
3657 and (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3658 body := TStringList.Create;
3660 GetSameIDRes(AID, ThreadItem, body);
3661 Result := body.Count;
3668 function TGikoSys.GetSameIDResCount(AIDNum : Integer; ThreadItem: TThreadItem):Integer;
3673 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
3674 body := TStringList.Create;
3676 GetSameIDRes(AIDNum, ThreadItem, body);
3677 Result := body.Count;
3684 function TGikoSys.NotDateorTimeString(const AStr : string): boolean;
3700 procedure TGikoSys.SpamCountWord( const text : string; wordCount : TWordCount );
3703 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
3704 Bayesian.CountWord( text, wordCount );
3708 procedure TGikoSys.SpamForget( wordCount : TWordCount; isSpam : Boolean );
3711 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
3712 Bayesian.Forget( wordCount, isSpam );
3716 procedure TGikoSys.SpamLearn( wordCount : TWordCount; isSpam : Boolean );
3719 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
3720 Bayesian.Learn( wordCount, isSpam );
3724 function TGikoSys.SpamParse( const text : string; wordCount : TWordCount ) : Extended;
3727 case Setting.SpamFilterAlgorithm of
3728 gsfaNone: Result := 0;
3729 gsfaPaulGraham: Result := Bayesian.Parse( text, wordCount, gbaPaulGraham );
3730 gsfaGaryRobinson: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinson );
3731 gsfaGaryRobinsonFisher: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinsonFisher );
3736 function TGikoSys.SetUserOptionalStyle(): string;
3739 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
3740 Result := 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
3741 if GikoSys.Setting.BrowserFontSize <> 0 then
3742 Result := Result + 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
3743 if GikoSys.Setting.BrowserFontColor <> -1 then
3744 Result := Result + 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
3745 if GikoSys.Setting.BrowserBackColor <> -1 then
3746 Result := Result + 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
3747 case GikoSys.Setting.BrowserFontBold of
3748 -1: Result := Result + 'font-weight:normal;';
3749 1: Result := Result + 'font-weight:bold;';
3751 case GikoSys.Setting.BrowserFontItalic of
3752 -1: Result := Result + 'font-style:normal;';
3753 1: Result := Result + 'font-style:italic;';
3756 //
\83o
\81[
\83W
\83\87\83\93\8fî
\95ñ
\82ð
\8eæ
\93¾
3757 function TGikoSys.GetVersionInfo(KeyWord: TVerResourceKey): string;
3759 Translation = '\VarFileInfo\Translation';
3760 FileInfo = '\StringFileInfo\%0.4s%0.4s\';
3762 BufSize, HWnd: DWORD;
3763 VerInfoBuf: Pointer;
3765 VerDataLen: Longword;
3768 //
\95K
\97v
\82È
\83o
\83b
\83t
\83@
\82Ì
\83T
\83C
\83Y
\82ð
\8eæ
\93¾
3769 BufSize := GetFileVersionInfoSize(PChar(Application.ExeName), HWnd);
3770 if BufSize <> 0 then begin
3771 //
\83\81\83\82\83\8a\82ð
\8am
\95Û
3772 GetMem(VerInfoBuf, BufSize);
3774 GetFileVersionInfo(PChar(Application.ExeName), 0, BufSize, VerInfoBuf);
3775 //
\95Ï
\90\94\8fî
\95ñ
\83u
\83\8d\83b
\83N
\93à
\82Ì
\95Ï
\8a·
\83e
\81[
\83u
\83\8b\82ð
\8ew
\92è
3776 VerQueryValue(VerInfoBuf, PChar(Translation), VerData, VerDataLen);
3778 if not (VerDataLen > 0) then
3779 raise Exception.Create('
\8fî
\95ñ
\82Ì
\8eæ
\93¾
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
3781 // 8
\8c\85\82Ì
\82P
\82U
\90i
\90\94\82É
\95Ï
\8a·
3782 //
\81¨'\StringFileInfo\027382\FileDescription'
3783 PathLocale := Format(FileInfo + KeyWordStr[KeyWord],
3784 [IntToHex(Integer(VerData^) and $FFFF, 4),
3785 IntToHex((Integer(VerData^) shr 16) and $FFFF, 4)]);
3786 VerQueryValue(VerInfoBuf, PChar(PathLocale), VerData, VerDataLen);
3788 if VerDataLen > 0 then begin
3789 // VerData
\82Í
\83[
\83\8d\82Å
\8fI
\82í
\82é
\95¶
\8e\9a\97ñ
\82Å
\82Í
\82È
\82¢
\82±
\82Æ
\82É
\92\8d\88Ó
3791 SetLength(result, VerDataLen);
3792 StrLCopy(PChar(result), VerData, VerDataLen);
3796 FreeMem(VerInfoBuf);
3800 //Plugin
\82Ì
\8fî
\95ñ
\82Ì
\8eæ
\93¾
3801 //Load
\82³
\82ê
\82½
\91S
\82Ä
\82Ì
\83v
\83\89\83O
\83C
\83\93\82Ì
\83o
\81[
\83W
\83\87\83\93\8fî
\95ñ
\82ð
\95Ô
\82·
3803 function TGikoSys.GetPluginsInfo(): String;
3806 major, minor, revision : Cardinal;
3807 agent, release : String;
3809 //
\8c\8b\89Ê
\82ð
\83N
\83\8a\83A
\82µ
\82Ä
\82¨
\82
3812 //BoardGroups
\8co
\97R
\82ÅPlugin
\82É
\83A
\83N
\83Z
\83X
\82·
\82é
3813 for i := 0 to Length(BoardGroups) - 1 do begin
3814 //BoardGroups
\82Ì
\92\86\82É
\82Í
\81APlugin
\82ð
\8e\9d\82Á
\82Ä
\82¢
\82È
\82¢
\82Ì
\81i2
\82¿
\82á
\82ñ
\81j
\82ª
3815 //
\82¢
\82é
\82Ì
\82Å
\82»
\82ê
\82ð
\8f\9c\82
3816 if BoardGroups[i].BoardPlugIn <> nil then begin
3817 BoardGroups[i].BoardPlugIn.VersionInfo(agent, major, minor, release, revision);
3820 //"Plugin
\82Ì
\96¼
\91O(major.minor.revision)"
3822 Format('%s(%d.%d.%d)', [agent, major, minor, revision]) + #13#10;
3828 //IE
\82Ì
\83o
\81[
\83W
\83\87\83\93\82ð
\8eæ
\93¾
\82·
\82é
3829 function TGikoSys.GetIEVersion: string;
3833 R := TRegistry.Create;
3835 //
\93Ç
\82Ý
\8eæ
\82è
\90ê
\97p
\82É
\82µ
\82È
\82¢
\82Æ
\81A
\90§
\8cÀUSER
\82Æ
\82©
\82Ì
\8fê
\8d\87\81A
\8aJ
\82¯
\82È
\82¢
\82Ý
\82½
\82¢
3836 R.Access := KEY_EXECUTE;
3837 R.RootKey := HKEY_LOCAL_MACHINE;
3838 R.OpenKey('Software\Microsoft\Internet Explorer', False);
3840 Result := R.ReadString('version');
3842 Result := '
\83o
\81[
\83W
\83\87\83\93\82Ì
\8eæ
\93¾
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½
\81B';
3852 GikoSys := TGikoSys.Create;
3855 if GikoSys <> nil then begin