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 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;
169 property Setting: TSetting read FSetting write FSetting;
170 property Dolib: TDolib read FDolib write FDolib;
172 function UrlToID(url: string): string;
173 function UrlToServer(url: string): string;
175 function StrTokFirst(const s:string; const sep:TStrTokSeparator; var Rec:TStrTokRec):string;
176 function StrTokNext(const sep:TStrTokSeparator; var Rec:TStrTokRec): string;
178 function GetFileSize(FileName : string) : longint;
179 function GetFileLineCount(FileName : string): longint;
180 function Get2chDate(aDate: TDateTime): string;
181 function IntToDateTime(val: Int64): TDateTime;
182 function DateTimeToInt(ADate: TDateTime): Int64;
184 function ReadThreadFile(FileName: string; Line: Integer): string;
186 procedure MenuFont(Font: TFont);
188 function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
189 function DeleteLink(const s: string): string;
191 function GetShortName(const LongName: string; ALength: integer): string;
192 function BoolToInt(b: Boolean): Integer;
193 function IntToBool(i: Integer): Boolean;
194 function GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
195 procedure LoadKeySetting(ActionList: TActionList);
196 procedure SaveKeySetting(ActionList: TActionList);
197 procedure LoadEditorKeySetting(ActionList: TActionList);
198 procedure SaveEditorKeySetting(ActionList: TActionList);
200 procedure CreateProcess(const AppPath: string; const Param: string);
201 procedure OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
202 function HTMLDecode(const AStr: String): String;
203 function GetHRefText(s: string): string;
204 function Is2chHost(Host: string): Boolean;
205 function Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
206 function Parse2chURL2(URL: string): TPathRec;
207 procedure ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
208 function GetVersionBuild: Integer;
209 function GetBrowsableThreadURL( inURL : string ) : string;
210 function GetThreadURL2BoardURL( inURL : string ) : string;
211 function Get2chThreadURL2BoardURL( inURL : string ) : string;
212 function Get2chBrowsableThreadURL( inURL : string ) : string;
213 function Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string;
214 procedure ListBoardFile;
215 procedure ReadBoardFile( bbs : TBBS );
217 function GetUnknownCategory : TCategory;
218 function GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
220 procedure GetPopupResNumber(URL : string; var stRes, endRes : Int64);
221 //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é
222 procedure SambaFileExists();
224 property Bayesian : TGikoBayesian read FBayesian write FBayesian;
225 function GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem; limited: boolean):string; overload;
226 function GetSameIDResAnchor(AIDNum : Integer; ThreadItem: TThreadItem; limited: boolean):string; overload;
227 procedure GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList); overload;
228 procedure GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList); overload;
229 function GetSameIDResCount(const AID : string; ThreadItem: TThreadItem):Integer; overload;
230 function GetSameIDResCount(AIDNum : Integer; ThreadItem: TThreadItem):Integer; overload;
233 procedure SpamCountWord( const text : string; wordCount : TWordCount );
234 //!
\8aw
\8fK
\83N
\83\8a\83A
235 procedure SpamForget( wordCount : TWordCount; isSpam : Boolean );
236 //!
\83X
\83p
\83\80\8aw
\8fK
237 procedure SpamLearn( wordCount : TWordCount; isSpam : Boolean );
238 //!
\83X
\83p
\83\80\93x
\90\94
239 function SpamParse( const text : string; wordCount : TWordCount ) : Extended;
240 //
\88ø
\90\94\82ª
\81A
\93ú
\95t
\82Å
\82à
\8e\9e\8d\8f\82Å
\82à
\82È
\82¢
\82±
\82Æ
\82ð
\92²
\82×
\82é
241 function NotDateorTimeString(const AStr : string): boolean;
243 //
\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Á
244 // function AddBeProfileLink(AID : string; ANum: Integer): string;
245 //
\83o
\81[
\83W
\83\87\83\93\8fî
\95ñ
\82Ì
\8eæ
\93¾
246 function GetVersionInfo(KeyWord: TVerResourceKey): string;
247 //Plugin
\82Ì
\8fî
\95ñ
\82Ì
\8eæ
\93¾
248 function GetPluginsInfo(): string;
249 //IE
\82Ì
\83o
\81[
\83W
\83\87\83\93\8fî
\95ñ
\82Ì
\8eæ
\93¾
250 function GetIEVersion: string;
251 function SetUserOptionalStyle(): string;
257 //LENGTH_RESTITLE = 40;
258 ZERO_DATE: Integer = 25569;
259 BETA_VERSION_NAME_E = 'beta';
260 BETA_VERSION_NAME_J = 'ÊÞÀ';
262 BETA_VERSION_BUILD = ''; //debug
\94Å
\82È
\82Ç
263 APP_NAME = 'gikoNavi';
264 BE_PHP_URL = 'http://be.2ch.net/test/p.php?i=';
270 Giko, RoundData, Favorite, Registry, HTMLCreate, MojuUtils;
273 FOLDER_INDEX_VERSION = '1.01';
274 USER_AGENT = 'Monazilla';
275 DEFAULT_NGWORD_FILE_NAME : String = 'NGword.txt';
276 NGWORDs_DIR_NAME : String = 'NGwords';
278 READ_PATH: string = '/test/read.cgi/';
279 OLD_READ_PATH: string = '/test/read.cgi?';
280 KAKO_PATH: string = '/kako/';
282 KeyWordStr: array [TVerResourceKey] of String = (
296 (*************************************************************************
297 *GikoSys
\83R
\83\93\83X
\83g
\83\89\83N
\83^
298 *************************************************************************)
299 constructor TGikoSys.Create;
301 FSetting := TSetting.Create;
302 FDolib := TDolib.Create;
303 FAWKStr := TAWKStr.Create(nil);
304 if DirectoryExists(GetConfigDir) = false then begin
305 CreateDir(GetConfigDir);
307 FAbon := TAbon.Create;
308 FAbon.Setroot(GetConfigDir+NGWORDs_DIR_NAME);
310 FAbon.ReturnNGwordLineNum := FSetting.ShowNGLinesNum;
311 FAbon.SetNGResAnchor := FSetting.AddResAnchor;
312 FAbon.DeleteSyria := FSetting.DeleteSyria;
313 FAbon.Deleterlo := FSetting.AbonDeleterlo;
314 FAbon.Replaceul := FSetting.AbonReplaceul;
315 FAbon.AbonPopupRes := FSetting.PopUpAbon;
317 FSelectResFilter := TAbon.Create;
318 //
\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
319 FSelectResFilter.AbonString := '';
321 ResRange := FSetting.ResRange;
322 FVersion := Trim(GetVersionInfo(vrFileVersion));
323 FBayesian := TGikoBayesian.Create;
324 //FBoardURLList := TStringList.Create;
327 (*************************************************************************
328 *GikoSys
\83f
\83X
\83g
\83\89\83N
\83^
329 *************************************************************************)
330 destructor TGikoSys.Destroy;
333 FileList: TStringList;
335 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
344 FSelectResFilter.Free;
345 //FBoardURLList.Free;
346 //
\83e
\83\93\83|
\83\89\83\8aHTML
\82ð
\8dí
\8f\9c
347 FileList := TStringList.Create;
349 FileList.BeginUpdate;
350 GetFileList(GetTempFolder, '*.html', FileList, False, True);
352 for i := 0 to FileList.Count - 1 do begin
353 DeleteFile(FileList[i]);
361 (*************************************************************************
362 *
\95¶
\8e\9a\97ñ
\90\94\8e\9a\83`
\83F
\83b
\83N
363 *************************************************************************)
365 function TGikoSys.IsNumeric(s: string): boolean;
375 (*************************************************************************
376 *
\95¶
\8e\9a\97ñ
\95\82\93®
\8f¬
\90\94\93_
\90\94\8e\9a\83`
\83F
\83b
\83N
377 *************************************************************************)
378 function TGikoSys.IsFloat(s: string): boolean;
382 Result := TextToFloat(PChar(s), v, fvExtended);
385 (*************************************************************************
386 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
387 *************************************************************************)
388 function TGikoSys.GetBoardFileName: string;
390 Result := Setting.GetBoardFileName;
393 (*************************************************************************
394 *
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
395 *************************************************************************)
396 function TGikoSys.GetCustomBoardFileName: string;
398 Result := Setting.GetCustomBoardFileName;
401 (*************************************************************************
402 *
\83e
\83\93\83|
\83\89\83\8a\83t
\83H
\83\8b\83_
\81[
\96¼
\8eæ
\93¾
403 *************************************************************************)
404 function TGikoSys.GetHtmlTempFileName: string;
406 Result := Setting.GetHtmlTempFileName;
410 (*************************************************************************
411 *
\8eÀ
\8ds
\83t
\83@
\83C
\83\8b\83t
\83H
\83\8b\83_
\8eæ
\93¾
412 *************************************************************************)
413 function TGikoSys.GetAppDir: string;
415 Result := Setting.GetAppDir;
418 (*************************************************************************
419 *TempHtml
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
420 *************************************************************************)
421 function TGikoSys.GetTempFolder: string;
423 Result := Setting.GetTempFolder;
426 (*************************************************************************
427 *sent.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
428 *************************************************************************)
429 function TGikoSys.GetSentFileName: string;
431 Result := Setting.GetSentFileName;
434 (*************************************************************************
435 *outbox.ini
\83t
\83@
\83C
\83\8b\96¼
\8eæ
\93¾
\81i
\83p
\83X
\81{
\83t
\83@
\83C
\83\8b\96¼
\81j
436 *************************************************************************)
437 function TGikoSys.GetOutBoxFileName: string;
439 Result := Setting.GetOutBoxFileName;
442 (*************************************************************************
443 *Config
\83t
\83H
\83\8b\83_
\8eæ
\93¾
444 *************************************************************************)
445 function TGikoSys.GetConfigDir: string;
447 Result := Setting.GetConfigDir;
450 function TGikoSys.GetStyleSheetDir: string;
452 Result := Setting.GetStyleSheetDir;
455 function TGikoSys.GetSkinDir: string;
457 Result := Setting.GetSkinDir;
460 function TGikoSys.GetSkinHeaderFileName: string;
462 Result := Setting.GetSkinHeaderFileName;
465 function TGikoSys.GetSkinFooterFileName: string;
467 Result := Setting.GetSkinFooterFileName;
470 function TGikoSys.GetSkinNewResFileName: string;
472 Result := Setting.GetSkinNewResFileName;
475 function TGikoSys.GetSkinResFileName: string;
477 Result := Setting.GetSkinResFileName;
480 function TGikoSys.GetSkinBookmarkFileName: string;
482 Result := Setting.GetSkinBookmarkFileName;
485 function TGikoSys.GetSkinNewmarkFileName: string;
487 Result := Setting.GetSkinNewmarkFileName;
491 function TGikoSys.GetUserAgent: string;
493 if Dolib.Connected then begin
494 Result := Format('%s %s/%s%d/%s', [
501 Result := Format('%s/%s %s/%s%d/%s', [
511 (*************************************************************************
512 *
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é
\95û
\8e®
\8e\9e\8d\8f\8eæ
\93¾
513 *************************************************************************)
514 function TGikoSys.Get2chDate(aDate: TDateTime): string;
518 d2 := aDate - EncodeTime(9, 0, 0, 0);
519 Result := FloatToStr(Trunc((d2 - ZERO_DATE) * 86400));
522 //val
\82Í
\81A1970/1/1/ 00:00:00
\82©
\82ç
\82Ì
\8co
\89ß
\8e\9e\8aÔ
523 function TGikoSys.IntToDateTime(val: Int64): TDateTime;
525 Result := ZERO_DATE + val / 86400.0;
527 //ADate
\82ð1970/1/1/ 00:00:00
\82©
\82ç
\82Ì
\8co
\89ß
\8e\9e\8aÔ
\82É
\95Ï
\8a·
\82·
\82é
528 function TGikoSys.DateTimeToInt(ADate: TDateTime): Int64;
530 Result := Trunc((ADate - ZERO_DATE) * 86400);
534 (*************************************************************************
535 *Subject
\83t
\83@
\83C
\83\8bRead
536 *************************************************************************)
537 procedure TGikoSys.ReadSubjectFile(Board: TBoard);
539 ThreadItem: TThreadItem;
541 FileList: TStringList;
542 TmpFileList: TStringList;
550 // RoundItem: TRoundItem;
557 //protocol, host, path, document, port, bookmark : string;
560 FavoThreadItem : TFavoriteThreadItem;
564 if Board.IsThreadDatRead then
569 usePlugIn := Board.IsBoardPlugInAvailable;
570 server := UrlToServer( Board.URL );
571 //is2ch := Is2chHost(server);
573 FileName := Board.GetFolderIndexFileName;
575 FileList := TStringList.Create;
576 FileList.Sorted := True;
577 FileList.BeginUpdate;
578 TmpFileList := TStringList.Create;
579 TmpFileList.Sorted := True;
580 TmpFileList.BeginUpdate;
581 //IsLogFile
\97pDAT
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
582 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False);
584 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\97pTmp
\83t
\83@
\83C
\83\8b\83\8a\83X
\83g
585 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False);
586 TmpFileList.EndUpdate;
588 //
\8fd
\95¡
\82ð
\96h
\82®
590 Board.Sorted := True;
592 sl := TStringList.Create;
594 if FileExists(FileName) then begin
595 sl.LoadFromFile(FileName);
597 //
\82Q
\8ds
\96Ú
\82©
\82ç
\81i
\82P
\8ds
\96Ú
\82Í
\83o
\81[
\83W
\83\87\83\93\81j
598 for i := sl.Count - 1 downto 1 do begin
599 Rec := ParseIndexLine(sl[i]);
600 islog := FileList.Find( Rec.FFileName, Index );
602 ThreadItem := TThreadItem.Create(
605 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
607 if Board.is2ch then begin
608 ThreadItem := TThreadItem.Create(
611 server + 'test/read.cgi/' + Board.BBSID + '/' + ChangeFileExt( Rec.FFileName, '' ) + '/l50',
616 ThreadItem := TThreadItem.Create(
619 server + 'test/read.cgi?bbs=' + Board.BBSID + '&key=' + ChangeFileExt( Rec.FFileName, '' ) + '&ls=50',
626 ThreadItem.BeginUpdate;
628 FileList.Delete( Index );
630 ThreadItem.No := Rec.FNo;
631 ThreadItem.FileName := Rec.FFileName;
632 ThreadItem.Title := Rec.FTitle;
633 //ThreadItem.ShortTitle := CustomStringReplace(ZenToHan(ThreadItem.Title), ' ', '');
634 ThreadItem.Count := Rec.FCount;
635 ThreadItem.Size := Rec.FSize;
636 // ThreadItem.RoundNo := Rec.FRoundNo;
637 ThreadItem.RoundDate := Rec.FRoundDate;
638 ThreadItem.LastModified := Rec.FLastModified;
639 ThreadItem.Kokomade := Rec.FKokomade;
640 ThreadItem.NewReceive := Rec.FNewReceive;
641 // ThreadItem.Round := Rec.FRound;
642 ThreadItem.UnRead := Rec.FUnRead;
643 ThreadItem.ScrollTop := Rec.FScrollTop;
644 ThreadItem.AllResCount := Rec.FAllResCount;
645 ThreadItem.NewResCount := Rec.FNewResCount;
646 ThreadItem.AgeSage := Rec.FAgeSage;
647 ThreadItem.ParentBoard := Board;
648 {*
\82¨
\8bC
\82É
\93ü
\82è
\91å
\97Ê
\90¶
\90¬
\83R
\81[
\83h *}
650 FavoThreadItem := TFavoriteThreadItem.Create( ThreadItem.URL, ThreadItem.Title, ThreadItem );
651 Node := FavoriteDM.TreeView.Items.AddChildObject( FavoriteDM.TreeView.Items.Item[0], ThreadItem.Title, FavoThreadItem);
654 {//
\8f\84\89ñ
\83\8a\83X
\83g
\82É
\91¶
\8dÝ
\82µ
\82½
\82ç
\8f\84\89ñ
\83t
\83\89\83O
\83Z
\83b
\83g
655 if ThreadItem.IsLogFile then begin
656 idx := RoundList.Find(ThreadItem);
657 if idx <> -1 then begin
658 RoundItem := RoundList.Items[idx, grtItem];
659 ThreadItem.RoundName := RoundItem.RoundName;
660 ThreadItem.Round := True;
665 ThreadItem.EndUpdate;
666 Board.Add(ThreadItem);
668 if (ThreadItem.IsLogFile) and (ThreadItem.UnRead) then
673 if UnRead <> Board.UnRead then
674 Board.UnRead := UnRead;
676 Boardpath := ExtractFilePath(Board.GetFolderIndexFileName);
677 //
\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
678 for i := 0 to FileList.Count - 1 do begin
679 FileName := Boardpath + FileList[i];
681 //ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
682 if usePlugIn then begin
683 ThreadItem := TThreadItem.Create(
686 Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), FileList[i] ) );
687 ResRec := DivideStrLine(Board.BoardPlugIn.GetDat( DWORD( ThreadItem ), 1 ));
689 ThreadItem := TThreadItem.Create(
692 Get2chBoard2ThreadURL( Board, ChangeFileExt( FileList[i], '' ) ) );
693 ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
696 ThreadItem.BeginUpdate;
697 ThreadItem.FileName := FileList[i];
698 //ThreadItem.FilePath := FileName;
699 ThreadItem.No := Board.Count + 1;
700 ThreadItem.Title := ResRec.FTitle;
701 ThreadItem.Count := GetFileLineCount(FileName);
702 ThreadItem.AllResCount := ThreadItem.Count;
703 ThreadItem.NewResCount := ThreadItem.Count;
704 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é
705 ThreadItem.RoundDate := ZERO_DATE;
706 ThreadItem.LastModified := ZERO_DATE;
707 ThreadItem.Kokomade := -1;
708 ThreadItem.NewReceive := ThreadItem.Count;
709 ThreadItem.ParentBoard := Board;
710 ThreadItem.IsLogFile := True;
711 ThreadItem.Round := False;
712 ThreadItem.UnRead := False;
713 ThreadItem.ScrollTop := 0;
714 ThreadItem.AgeSage := gasNone;
715 ThreadItem.EndUpdate;
716 Board.Add(ThreadItem);
720 //
\91O
\89ñ
\88Ù
\8fí
\8fI
\97¹
\8e\9e\83`
\83F
\83b
\83N
721 for i := TmpFileList.Count - 1 downto 0 do begin
722 //if TmpFileList.Count <> 0 then begin
723 ThreadItem := Board.FindThreadFromFileName(ChangeFileExt(TmpFileList[i], '.dat'));
724 if ThreadItem <> nil then begin
725 //if TmpFileList.Find(ChangeFileExt(ThreadItem.FileName, '.tmp'), Index) then begin
726 ini := TMemIniFile.Create(Boardpath + TmpFileList[i]);
728 tmpStr := ini.ReadString('Setting', 'RoundDate', DateTimeToStr(ZERO_DATE));
729 ThreadItem.RoundDate := ConvertDateTimeString(tmpStr);
731 tmpStr := ini.ReadString('Setting', 'LastModified', DateTimeToStr(ZERO_DATE));
732 ThreadItem.LastModified := ConvertDateTimeString(tmpStr);
733 ThreadItem.Count := ini.ReadInteger('Setting', 'Count', 0);
734 ThreadItem.NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
736 ThreadItem.Size := ini.ReadInteger('Setting', 'Size', 0);
737 if(ThreadItem.Size = 0) and (FileExists(ThreadItem.GetThreadFileName)) then begin
739 ThreadItem.Size := GetFileSize(ThreadItem.GetThreadFileName) - ThreadItem.Count;
744 //
\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ã
745 //ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
746 //ThreadItem.RoundName := ini.ReadString('Setting', 'RoundName', ThreadItem.RoundName);
747 ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
748 ThreadItem.ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
749 ThreadItem.AllResCount := ini.ReadInteger('Setting', 'AllResCount', ThreadItem.Count);
750 ThreadItem.NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
751 ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
755 DeleteFile(Boardpath + TmpFileList[i]);
763 Board.Sorted := False;
765 Board.IsThreadDatRead := True;
768 (*************************************************************************
769 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X
\83t
\83@
\83C
\83\8b(Folder.idx)
\8dì
\90¬
770 *************************************************************************)
771 procedure TGikoSys.CreateThreadDat(Board: TBoard);
775 SubjectList: TStringList;
781 if not FileExists(Board.GetSubjectFileName) then Exit;
782 FileName := Board.GetFolderIndexFileName;
784 SubjectList := TStringList.Create;
786 SubjectList.LoadFromFile(Board.GetSubjectFileName);
787 sl := TStringList.Create;
791 sl.Add(FOLDER_INDEX_VERSION);
792 for i := 0 to SubjectList.Count - 1 do begin
793 Rec := DivideSubject(SubjectList[i]);
795 if (Trim(Rec.FFileName) = '') or (Trim(Rec.FTitle) = '') then
798 {s := Format('%x', [cnt]) + #1 //
\94Ô
\8d\86
799 + Rec.FFileName + #1 //
\83t
\83@
\83C
\83\8b\96¼
800 + Rec.FTitle + #1 //
\83^
\83C
\83g
\83\8b
801 + Format('%x', [Rec.FCount]) + #1 //
\83J
\83E
\83\93\83g
802 + Format('%x', [0]) + #1 //size
803 + Format('%x', [0]) + #1 //RoundDate
804 + Format('%x', [0]) + #1 //LastModified
805 + Format('%x', [0]) + #1 //Kokomade
806 + Format('%x', [0]) + #1 //NewReceive
807 + '0' + #1 //
\96¢
\8eg
\97p
808 + Format('%x', [0]) + #1 //UnRead
809 + Format('%x', [0]) + #1 //ScrollTop
810 + Format('%x', [Rec.FCount]) + #1 //AllResCount
811 + Format('%x', [0]) + #1 //NewResCount
812 + Format('%x', [0]); //AgeSage
814 s := Format('%x'#1'%s'#1'%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1 +
815 '%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x',
817 Rec.FFileName, //
\83t
\83@
\83C
\83\8b\96¼
818 Rec.FTitle, //
\83^
\83C
\83g
\83\8b
819 Rec.FCount, //
\83J
\83E
\83\93\83g
828 Rec.FCount, //AllResCount
837 sl.SaveToFile(FileName);
846 (*************************************************************************
847 *
\83X
\83\8c\83b
\83h
\83C
\83\93\83f
\83b
\83N
\83X(Thread.dat)
\8f\91\82«
\8d\9e\82Ý
849 *************************************************************************)
850 procedure TGikoSys.WriteThreadDat(Board: TBoard);
852 // Values: array[Boolean] of string = ('0', '1');
858 TmpFileList: TStringList;
860 if not Board.IsThreadDatRead then
862 FileName := Board.GetFolderIndexFileName;
863 ForceDirectoriesEx( ExtractFilePath( FileName ) );
865 sl := TStringList.Create;
866 TmpFileList := TStringList.Create;
867 TmpFileList.Sorted := true;
869 TmpFileList.BeginUpdate;
870 GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, false);
871 TmpFileList.EndUpdate;
873 sl.Add(FOLDER_INDEX_VERSION);
875 //
\83X
\83\8c\94Ô
\8d\86\95Û
\91¶
\82Ì
\82½
\82ß
\83\
\81[
\83g
876 Sort.SortNoFlag := true;
877 Sort.SortOrder := true;
879 //Sort.SortNonAcquiredCountFlag := GikoSys.Setting.NonAcquiredCount;
880 Board.CustomSort(ThreadItemSortProc);
882 for i := 0 to Board.Count - 1 do begin
883 Board.Items[i].No := i + 1;
884 s := Format('%x'#1'%s'#1'%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1 +
885 '%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x',
886 [Board.Items[i].No, //
\94Ô
\8d\86
887 Board.Items[i].FileName, //
\83t
\83@
\83C
\83\8b\96¼
888 Board.Items[i].Title, //
\83^
\83C
\83g
\83\8b
889 Board.Items[i].Count, //
\83J
\83E
\83\93\83g
890 Board.Items[i].Size, //size
891 DateTimeToInt(Board.Items[i].RoundDate), //RoundDate
892 DateTimeToInt(Board.Items[i].LastModified), //LastModified
893 Board.Items[i].Kokomade, //Kokomade
894 Board.Items[i].NewReceive, //NewReceive
896 BoolToInt(Board.Items[i].UnRead), //UnRead
897 Board.Items[i].ScrollTop, //ScrollTop
898 Board.Items[i].AllResCount, //AllResCount
899 Board.Items[i].NewResCount, //NewResCount
900 Ord(Board.Items[i].AgeSage)] //AgeSage
906 sl.SaveToFile(FileName);
908 for i := 0 to TmpFileList.Count - 1 do begin
909 DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[i]);
918 function TGikoSys.ParseIndexLine(Line: string): TIndexRec;
920 Result.FNo := StrToIntDef('$' + RemoveToken(Line, #1), 0);
921 Result.FFileName := RemoveToken(Line, #1);
922 Result.FTitle := RemoveToken(Line, #1);
923 Result.FCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
924 Result.FSize := StrToIntDef('$' + RemoveToken(Line, #1), 0);
925 Result.FRoundDate := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
926 Result.FLastModified := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
927 Result.FKokomade := StrToIntDef('$' + RemoveToken(Line, #1), -1);
928 Result.FNewReceive := StrToIntDef('$' + RemoveToken(Line, #1), 0);
929 RemoveToken(Line, #1);//9: ; //
\96¢
\8eg
\97p
930 Result.FUnRead := IntToBool(StrToIntDef('$' + RemoveToken(Line, #1), 0));
931 Result.FScrollTop := StrToIntDef('$' + RemoveToken(Line, #1), 0);
932 Result.FAllResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
933 Result.FNewResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
934 Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + RemoveToken(Line, #1), 0));
938 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
939 // ListFiles('c:\', '*.txt', list, True);
940 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
943 SearchRec : TSearchRec;
947 //maskExt := Copy(Mask, 1, Length(Mask) - 1);
949 Path := IncludeTrailingPathDelimiter(Path);
950 rc := FindFirst(Path + '*.*', faAnyfile, SearchRec);
952 while rc = 0 do begin
953 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
954 s := Path + SearchRec.Name;
955 //if (SearchRec.Attr and faDirectory > 0) then
956 // s := IncludeTrailingPathDelimiter(s)
958 if (SearchRec.Attr and faDirectory = 0) and (MatchesMask(s, Mask)) then
962 List.Add(SearchRec.Name);
963 if SubDir and (SearchRec.Attr and faDirectory > 0) then
964 GetFileList(s, Mask, List, True, IsPathAdd);
966 rc := FindNext(SearchRec);
969 SysUtils.FindClose(SearchRec);
973 //
\8ew
\92è
\83t
\83H
\83\8b\83_
\93à
\82Ì
\8ew
\92è
\83t
\83@
\83C
\83\8b\88ê
\97\97\82ð
\8eæ
\93¾
\82·
\82é
974 //
\83T
\83u
\83t
\83H
\83\8b\83_
\82Í
\8c\9f\8dõ
\82µ
\82È
\82¢
975 // ListFiles('c:\', '*.txt', list, True);
976 procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean);
979 SearchRec : TSearchRec;
982 Path := IncludeTrailingPathDelimiter(Path);
983 rc := FindFirst(Path + Mask, faAnyfile, SearchRec);
985 while rc = 0 do begin
986 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
987 s := Path + SearchRec.Name;
989 if (SearchRec.Attr and faDirectory = 0) then
993 List.Add(SearchRec.Name);
995 rc := FindNext(SearchRec);
998 SysUtils.FindClose(SearchRec);
1002 //
\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é
1003 procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
1006 SearchRec : TSearchRec;
1009 Path := IncludeTrailingPathDelimiter(Path);
1010 rc := FindFirst(Path + '*.*', faDirectory, SearchRec);
1012 while rc = 0 do begin
1013 if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
1014 s := Path + SearchRec.Name;
1015 //if (SearchRec.Attr and faDirectory > 0) then
1016 // s := IncludeTrailingPathDelimiter(s)
1018 if (SearchRec.Attr and faDirectory > 0) and (MatchesMask(s, Mask)) then
1019 List.Add( IncludeTrailingPathDelimiter( s ) );
1020 if SubDir and (SearchRec.Attr and faDirectory > 0) then
1021 GetDirectoryList(s, Mask, List, True);
1023 rc := FindNext(SearchRec);
1026 SysUtils.FindClose(SearchRec);
1031 (*************************************************************************
1032 *http://
\82Ì
\95¶
\8e\9a\97ñ
\82ðanchor
\83^
\83O
\95t
\82«
\82É
\82·
\82é
\81B
1033 *************************************************************************)
1034 function TGikoSys.AddAnchorTag(s: string): string;
1036 URL_CHAR: string = '0123456789'
1037 + 'abcdefghijklmnopqrstuvwxyz'
1038 + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
1039 + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
1040 ANCHOR_REF = 'href=';
1041 RES_REF = '>>';
1042 REF_MARK: array[0..9] of string = ('http://', 'ttp://', 'tp://',
1043 'ms-help://','p://', 'https://',
1044 'www.', 'ftp://','news://','rtsp://');
1047 // wkIdx: array[0..9] of Integer;
1053 anchorLen : Integer;
1059 // + 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ß
1060 anchorLen := Length( ANCHOR_REF ) + 3;
1061 pURLCHARs := PChar(URL_CHAR);
1062 pURLCHARe := pURLCHARs + Length(URL_CHAR);
1066 for j := 0 to 9 do begin
1067 tmp := AnsiPos(REF_MARK[j], s);
1068 if tmp <> 0 then idx := Min(tmp, idx);
1069 if idx = tmp then idx2 := j; //
\82Ç
\82Ì
\83}
\81[
\83N
\82Å
\88ø
\82Á
\82©
\82©
\82Á
\82½
\82©
\82ð
\95Û
\91¶
1071 if idx = MaxInt then begin
1072 //
\83\8a\83\93\83N
\82ª
\96³
\82¢
\82æ
\81B
1073 Result := Result + s;
1078 (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
1079 //
\8aù
\82É
\83\8a\83\93\83N
\83^
\83O
\82ª
\82Â
\82¢
\82Ä
\82¢
\82é
\82Á
\82Û
\82¢
\82Æ
\82«
\82Í
\83\80\83V
1080 href := Copy( s, idx, Length( s ) );
1081 Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
1083 s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
1088 Result := Result + Copy(s, 1, idx - 1);
1090 Delete(s, 1, idx - 1);
1091 b := Length( s ) + 1;
1093 for i := 1 to b do begin
1094 pe := AnsiStrPosEx(pURLCHARs, pURLCHARe, pp, pp + 1);
1096 if pe = nil then begin
1097 //URL
\82¶
\82á
\82È
\82¢
\95¶
\8e\9a\94
\8c©
\81I
\82Æ
\82©
\81A
\95¶
\8e\9a\82ª
\82È
\82
\82È
\82Á
\82½
\81B
1098 url := Copy(s, 1, i - 1);
1100 1 : href := 'h' + url;
1101 2 : href := 'ht' + url;
1102 4 : href := 'htt' + url;
1103 6 : href := 'http://' + url;
1108 Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
1109 Delete(s, 1, i - 1);
1112 //
\88ê
\95¶
\8e\9a\90i
\82ß
\82é
\81B
1118 (*************************************************************************
1119 *
\83T
\83u
\83W
\83F
\83N
\83g
\88ê
\8ds
\82ð
\95ª
\8a\84
1120 *************************************************************************)
1121 function TGikoSys.DivideSubject(Line: string): TSubjectRec;
1131 if AnsiPos('<>', Line) = 0 then
1135 Result.FFileName := RemoveToken(Line, Delim);
1136 Result.FTitle := Trim(RemoveToken(Line, Delim));
1138 ws := Result.FTitle;
1139 if Copy(ws, Length(ws), 1) = ')' then begin
1142 end else if Copy(ws, Length(ws)-1, 2) = '
\81j' then begin
1145 end else if Copy(ws, Length(ws), 1) = '>' then begin
1149 for i := Length(ws) - 1 downto 1 do begin
1150 if Copy(ws, i, Length(LeftK)) = LeftK then begin
1151 Result.FTitle := TrimRight(Copy(ws, 1, i - 1));
1152 ws := Copy(ws, i + Length(LeftK), Length(ws) - i - Length(RightK));
1153 if IsNumeric(ws) then
1154 Result.FCount := StrToInt(ws);
1155 //Delete(Result.FTitle, i, Length(LeftK) + Length(ws) + Length(RightK));
1162 (*************************************************************************
1163 * URL
\82©
\82çBBSID
\82ð
\8eæ
\93¾
1164 *************************************************************************)
1165 function TGikoSys.UrlToID(url: string): string;
1172 if url = '' then Exit;
1174 url := Copy(url, 0, Length(url) - 1);
1175 for i := Length(url) downto 0 do begin
1176 if url[i] = '/' then begin
1177 Result := Copy(url, i + 1, Length(url));
1186 (*************************************************************************
1187 *URL
\82©
\82çBBSID
\88È
\8aO
\82Ì
\95\94\95ª(http://teri.2ch.net/)
\82ð
\8eæ
\93¾
1188 *************************************************************************)
1189 function TGikoSys.UrlToServer(url: string): string;
1196 wsURL := Trim(wsURL);
1198 if wsURL = '' then exit;
1200 if Copy(wsURL, Length(wsURL), 1) = '/' then
1201 wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
1203 for i := Length(wsURL) downto 0 do begin
1204 if wsURL[i] = '/' then begin
1205 Result := Copy(wsURL, 0, i);
1211 (*************************************************************************
1212 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\82ª
\91¶
\8dÝ
\82·
\82é
\82©
\83`
\83F
\83b
\83N
1213 *************************************************************************)
1214 function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
1218 Code := GetFileAttributes(PChar(Name));
1219 Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
1222 (*************************************************************************
1223 *
\83f
\83B
\83\8c\83N
\83g
\83\8a\8dì
\90¬
\81i
\95¡
\90\94\8aK
\91w
\91Î
\89\9e\81j
1224 *************************************************************************)
1225 function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
1228 if Length(Dir) = 0 then
1229 raise Exception.Create('
\83t
\83H
\83\8b\83_
\82ª
\8dì
\90¬
\8fo
\97\88\82Ü
\82¹
\82ñ');
1230 Dir := ExcludeTrailingPathDelimiter(Dir);
1231 if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
1232 or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
1233 Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
1236 (*************************************************************************
1237 *
\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
1238 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1239 *************************************************************************)
1240 function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
1244 Result := StrTokNext(sep, Rec);
1247 (*************************************************************************
1248 *
\95¶
\8e\9a\97ñ
\82©
\82ç
\83g
\81[
\83N
\83\93\82Ì
\90Ø
\82è
\8fo
\82µ
1249 *FDelphi
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1250 *************************************************************************)
1251 function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
1258 if Len >= Pos then begin
1259 while (Pos <= Len) and (Str[Pos] in sep) do begin
1263 while (Pos<= Len) and not (Str[Pos] in sep) do begin
1264 if IsDBCSLeadByte(Byte(Str[Pos])) then begin
1269 Result := Copy(Str, I, Pos - I);
1270 while (Pos <= Len) and (Str[Pos] in sep) do begin//
\82±
\82ê
\82Í
\82¨
\8dD
\82Ý
1277 (*************************************************************************
1278 *
\83t
\83@
\83C
\83\8b\83T
\83C
\83Y
\8eæ
\93¾
1279 *************************************************************************)
1280 function TGikoSys.GetFileSize(FileName : string): longint;
1285 if not FileExists(FileName) then begin
1289 Assign(F, FileName);
1291 Result := FileSize(F);
1298 (*************************************************************************
1299 *
\83t
\83@
\83C
\83\8b\8ds
\90\94\8eæ
\93¾
1300 *************************************************************************)
1301 function TGikoSys.GetFileLineCount(FileName : string): longint;
1305 sl := TStringList.Create;
1308 sl.LoadFromFile(FileName);
1319 (*************************************************************************
1320 *
\83X
\83\8c\83b
\83h
\83t
\83@
\83C
\83\8b\82©
\82ç
\8ew
\92è
\8ds
\82ð
\8eæ
\93¾
1321 *************************************************************************)
1322 function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
1324 fileTmp : TStringList;
1327 if FileExists(FileName) then begin
1328 fileTmp := TStringList.Create;
1331 fileTmp.LoadFromFile( FileName );
1332 if ( Line >= 1 ) and ( Line < fileTmp.Count + 1 ) then begin
1333 Result := fileTmp.Strings[ Line-1 ];
1336 //on EFOpenError do Result := '';
1344 (*************************************************************************
1345 *
\83V
\83X
\83e
\83\80\83\81\83j
\83\85\81[
\83t
\83H
\83\93\83g
\82Ì
\91®
\90«
\82ð
\8eæ
\93¾
1346 *************************************************************************)
1347 procedure TGikoSys.MenuFont(Font: TFont);
1350 nm: NONCLIENTMETRICS;
1352 nm.cbSize := sizeof(NONCLIENTMETRICS);
1354 SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
1355 lf := nm.lfMenuFont;
1357 Font.Name := lf.lfFaceName;
1358 Font.Height := lf.lfHeight;
1360 if lf.lfWeight >= 700 then
1361 Font.Style := Font.Style + [fsBold];
1362 if lf.lfItalic = 1 then
1363 Font.Style := Font.Style + [fsItalic];
1367 (*************************************************************************
1369 *
\82Ç
\82±
\82©
\82Ì
\83T
\83C
\83g
\82©
\82ç
\82Ì
\83p
\83N
\83\8a
1370 *************************************************************************)
1371 function TGikoSys.GetTokenIndex(s: string; delimiter: string; index: Integer): string;
1376 for i := 0 to index do
1377 Result := RemoveToken(s, delimiter);
1380 (*************************************************************************
1382 *************************************************************************)
1383 function TGikoSys.DeleteLink(const s: string): string;
1393 s1 := GetTokenIndex(s, '<a href="', i);
1394 s2 := GetTokenIndex(s, '<a href="', i + 1);
1396 idx := Pos('">', s1);
1398 Delete(s1, 1, idx + 1);
1399 idx := Pos('">', s2);
1401 Delete(s2, 1, idx + 1);
1403 Result := Result + s1 + s2;
1412 //
\83C
\83\93\83f
\83b
\83N
\83X
\96¢
\8dX
\90V
\83o
\83b
\83t
\83@
\82ð
\83t
\83\89\83b
\83V
\83\85\81I
1413 {procedure TGikoSys.FlashExitWrite;
1417 //
\83X
\83\8c\83b
\83h
\83f
\81[
\83^
\83t
\83@
\83C
\83\8b\82ð
\8dX
\90V
1418 for i := 0 to FExitWrite.Count - 1 do
1419 WriteThreadDat(FExitWrite[i]);
1423 (*************************************************************************
1424 *
\83X
\83\8c\96¼
\82È
\82Ç
\82ð
\92Z
\82¢
\96¼
\91O
\82É
\95Ï
\8a·
\82·
\82é
1426 *************************************************************************)
1427 function TGikoSys.GetShortName(const LongName: string; ALength: integer): string;
1429 ERASECHAR : array [1..39] of string =
1430 ('
\81\99','
\81\9a','
\81¡','
\81 ','
\81\9f','
\81\9e','
\81Q','
\81\94','
\81£','
\81¥',
1431 '
\81¢','
\81¤','
\81\9c','
\81\9b','
\81\9d','
\81y','
\81z','
\81ô','
\81s','
\81t',
1432 '
\81g','
\81h','
\81k','
\81l','
\81e','
\81f','
\81\83','
\81\84','
\81á','
\81â',
1433 '
\81o','
\81p','
\81q','
\81r','
\81w','
\81x','
\81¬','
\81c', '
\81@');
1435 Chr : array [0..255] of char;
1439 s := Trim(LongName);
1440 if (Length(s) <= ALength) then begin
1444 for i := Low(ERASECHAR) to High(ERASECHAR) do begin
1445 S := CustomStringReplace(S, ERASECHAR[i], '');
1447 if (Length(S) <= ALength) then begin
1450 Windows.LCMapString(
1451 GetUserDefaultLCID(),
1459 S := Copy(S,1,ALength);
1461 if (ByteType(S, Length(S)) = mbLeadByte ) then begin
1462 S := Copy(S, 1, Length(S) - 1);
1474 function TGikoSys.BoolToInt(b: Boolean): Integer;
1476 Result := IfThen(b, 1, 0);
1479 function TGikoSys.IntToBool(i: Integer): Boolean;
1484 //gzip
\82Å
\88³
\8fk
\82³
\82ê
\82½
\82Ì
\82ð
\96ß
\82·
1485 function TGikoSys.GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
1489 GZipStream: TGzipDecompressStream;
1490 TextStream: TStringStream;
1491 buf: array[0..BUF_SIZE - 1] of Byte;
1497 TextStream := TStringStream.Create('');
1499 //
\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¢)
1500 // if LowerCase(Trim(ContentEncoding)) = 'gzip' then begin
1501 if AnsiPos('gzip', LowerCase(Trim(ContentEncoding))) > 0 then begin
1502 ResStream.Position := 0;
1503 GZipStream := TGzipDecompressStream.Create(TextStream);
1506 FillChar(buf, BUF_SIZE, 0);
1507 cnt := ResStream.Read(buf, BUF_SIZE);
1509 GZipStream.Write(buf, BUF_SIZE);
1515 ResStream.Position := 0;
1517 FillChar(buf, BUF_SIZE, 0);
1518 cnt := ResStream.Read(buf, BUF_SIZE);
1520 TextStream.Write(buf, BUF_SIZE);
1524 //NULL
\95¶
\8e\9a\82ð"*"
\82É
\82·
\82é
1525 s := TextStream.DataString;
1527 while (i > 0) and (s[i] = #0) do
1532 while i <> 0 do begin
1542 procedure TGikoSys.LoadKeySetting(ActionList: TActionList);
1544 STD_SEC = 'KeySetting';
1550 SecList: TStringList;
1551 Component: TComponent;
1553 if not FileExists(GetConfigDir + KEY_SETTING_FILE_NAME) then
1555 SecList := TStringList.Create;
1556 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
1558 ini.ReadSection(STD_SEC, SecList);
1559 for i := 0 to SecList.Count - 1 do begin
1560 ActionName := SecList[i];
1561 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
1562 if ActionKey <> -1 then begin
1563 Component := ActionList.Owner.FindComponent(ActionName);
1564 if TObject(Component) is TAction then begin
1565 TAction(Component).ShortCut := ActionKey;
1575 procedure TGikoSys.SaveKeySetting(ActionList: TActionList);
1577 STD_SEC = 'KeySetting';
1582 ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
1584 for i := 0 to ActionList.ActionCount - 1 do begin
1585 if ActionList.Actions[i].Tag = -1 then
1587 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
1595 procedure TGikoSys.LoadEditorKeySetting(ActionList: TActionList);
1597 STD_SEC = 'KeySetting';
1603 SecList: TStringList;
1604 Component: TComponent;
1606 if not FileExists(GetConfigDir + EKEY_SETTING_FILE_NAME) then
1608 SecList := TStringList.Create;
1609 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
1611 ini.ReadSection(STD_SEC, SecList);
1612 for i := 0 to SecList.Count - 1 do begin
1613 ActionName := SecList[i];
1614 ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
1615 if ActionKey <> -1 then begin
1616 Component := ActionList.Owner.FindComponent(ActionName);
1617 if TObject(Component) is TAction then begin
1618 TAction(Component).ShortCut := ActionKey;
1628 procedure TGikoSys.SaveEditorKeySetting(ActionList: TActionList);
1630 STD_SEC = 'KeySetting';
1635 ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
1637 for i := 0 to ActionList.ActionCount - 1 do begin
1638 if ActionList.Actions[i].Tag = -1 then
1640 ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
1649 procedure TGikoSys.CreateProcess(const AppPath: string; const Param: string);
1651 PI: TProcessInformation;
1655 Path := '"' + AppPath + '"';
1657 Path := Path + ' ' + Param;
1659 SI.Cb := SizeOf(Si);
1660 SI.lpReserved := nil;
1661 SI.lpDesktop := nil;
1664 SI.cbReserved2 := 0;
1665 SI.lpReserved2 := nil;
1667 Windows.CreateProcess(nil,
1679 procedure TGikoSys.OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
1683 HlinkNavigateString(nil, PWideChar(WideString(URL)));
1684 gbtUserApp, gbtAuto:
1685 if (Setting.URLApp) and (FileExists(Setting.URLAppFile)) then
1686 GikoSys.CreateProcess(Setting.URLAppFile, URL)
1688 HlinkNavigateString(nil, PWideChar(WideString(URL)));
1692 function TGikoSys.HTMLDecode(const AStr: String): String;
1694 Sp, Rp, Cp, Tp: PChar;
1699 SetLength(Result, Length(AStr));
1701 Rp := PChar(Result);
1704 while Sp^ <> #0 do begin
1710 'a': if AnsiStrPos(Sp, 'amp;') = Sp then
1716 'g': if (AnsiStrPos(Sp, 'lt;') = Sp) or (AnsiStrPos(Sp, 'gt;') = Sp) then
1720 while (Sp^ <> ';') and (Sp^ <> #0) do
1727 'q': if AnsiStrPos(Sp, 'quot;') = Sp then
1735 Num := IsNumeric(Copy(Tp, 1, 1));
1736 while (Sp^ <> ';') and (Sp^ <> #0) do begin
1737 if (Num) and (not IsNumeric(Copy(Sp, 1, 1))) then
1741 SetString(S, Tp, Sp - Tp);
1746 //raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
1747 //[Cp^ + Sp^, Cp - PChar(AStr)])
1757 // on E:EConvertError do
1758 // raise EConvertError.CreateFmt(sInvalidHTMLEncodedChar,
1759 // [Cp^ + Sp^, Cp - PChar(AStr)])
1761 SetLength(Result, Rp - PChar(Result));
1764 function TGikoSys.GetHRefText(s: string): string;
1774 Index := AnsiPos('href', LowerCase(s));
1777 s := Trim(Copy(s, Index + 4, Length(s)));
1778 s := Trim(Copy(s, 2, Length(s)));
1780 //
\8en
\82ß
\82Ì
\95¶
\8e\9a\82ª'"'
\82È
\82ç
\8eæ
\82è
\8f\9c\82
1781 //if Copy(s, 1, 1) = '"' then begin
1782 if s[1] = '"' then begin
1783 s := Trim(Copy(s, 2, Length(s)));
1786 Index := AnsiPos('"', s);
1787 if Index <> 0 then begin
1788 //'"'
\82Ü
\82ÅURL
\82Æ
\82·
\82é
1789 s := Copy(s, 1, Index - 1);
1791 //'"'
\82ª
\96³
\82¯
\82ê
\82Î
\83X
\83y
\81[
\83X
\82©">"
\82Ì
\91\81\82¢
\95û
\82Ü
\82Å
\82ðURL
\82Æ
\82·
\82é
1792 Index := AnsiPos(' ', s);
1793 Index2 := AnsiPos('>', s);
1796 if Index > Index2 then
1799 s := Copy(s, 1, Index - 1)
1801 //
\82±
\82ê
\88È
\8fã
\82à
\82¤
\92m
\82ç
\82ñ
\82Ê
1807 //
\83z
\83X
\83g
\96¼
\82ª
\82Q
\82\83\82\88\82©
\82Ç
\82¤
\82©
\83`
\83F
\83b
\83N
\82·
\82é
1808 function TGikoSys.Is2chHost(Host: string): Boolean;
1810 HOST_NAME: array[0..1] of string = ('2ch.net', 'bbspink.com');
1816 if RightStr( Host, 1 ) = '/' then
1817 Host := Copy( Host, 1, Length( Host ) - 1 );
1818 OutputDebugString(pchar(HOST_NAME[0]));
1819 for i := 0 to Length(HOST_NAME) - 1 do begin
1820 // Len := Length(HOST_NAME[i]);
1821 if (AnsiPos(HOST_NAME[i], Host) > 0) and
1822 (AnsiPos(HOST_NAME[i], Host) = (Length(Host) - Length(HOST_NAME[i]) + 1)) then begin
1829 function TGikoSys.Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
1839 Index := AnsiPos(READ_PATH, path);
1840 if Index <> 0 then begin
1841 s := Copy(path, Index + Length(READ_PATH), Length(path));
1843 if (Length(s) > 0) and (s[1] = '/') then
1845 BBSID := GetTokenIndex(s, '/', 0);
1846 BBSKey := GetTokenIndex(s, '/', 1);
1849 Result := (BBSID <> '') or (BBSKey <> '');
1852 Index := AnsiPos(KAKO_PATH, path);
1853 if Index <> 0 then begin
1854 s := Copy(path, 2, Length(path));
1855 BBSID := GetTokenIndex(s, '/', 0);
1856 if (BBSID = 'log') and (GetTokenIndex(s, '/', 2) = 'kako') then
1857 BBSID := GetTokenIndex(s, '/', 1);
1858 BBSKey := ChangeFileExt(Document, '');
1859 Result := (BBSID <> '') or (BBSKey <> '');
1862 Index := AnsiPos('read.cgi?', URL);
1863 if Index <> 0 then begin
1864 SList := TStringList.Create;
1867 // s := HTMLDecode(Document);
1868 ExtractHTTPFields(['?', '&'], [], PChar(URL), SList, False);
1869 BBSID := SList.Values['bbs'];
1870 BBSKey := SList.Values['key'];
1871 Result := (BBSID <> '') or (BBSKey <> '');
1881 procedure TGikoSys.GetPopupResNumber(URL : string; var stRes, endRes : Int64);
1888 URL := Trim(LowerCase(URL));
1889 if (AnsiPos('&st=', URL ) <> 0) and ( AnsiPos( '&to=',URL) <> 0 ) then begin
1893 buf := Copy( URL, AnsiPos('&st=', URL ) + 4, AnsiPos( '&to=',URL) - AnsiPos('&st=', URL ) - 4 );
1895 stRes := StrToInt64( buf );
1896 if AnsiPos( '&nofirst=',URL) <> 0 then begin
1897 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, AnsiPos( '&nofirst=',URL) - AnsiPos('&to=', URL ) - 4);
1899 buf := Copy( URL, AnsiPos('&to=', URL ) + 4, Length( URL ) - AnsiPos('&to=', URL ) - 4 + 1 );
1902 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
1903 buf := Copy( buf, 1, ps );
1907 endRes := StrToInt64(buf)
1914 if (stRes <> 0) and (endRes = 0) then
1915 endRes := stRes + MAX_POPUP_RES
1916 else if (stRes = 0) and (endRes <> 0) then begin
1917 stRes := endRes - MAX_POPUP_RES;
1921 GikoSys.GetBrowsableThreadURL( URL );
1922 end else if( AnsiPos('&res=', URL ) <> 0 ) then begin
1924 buf := Copy( URL, AnsiPos('&res=', URL ) + 5, Length( URL ) - AnsiPos('&res=', URL ) - 5 + 1 );
1927 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
1928 buf := Copy( buf, 1, ps );
1931 stRes := StrToInt(buf)
1938 end else if (AnsiPos('&start=', URL ) <> 0) and ( AnsiPos( '&end=',URL) <> 0 ) then begin
1940 stRes := StrToInt64( Copy( URL, AnsiPos('&start=', URL ) + 7, AnsiPos( '&end=',URL) - AnsiPos('&start=', URL ) - 7 ) );
1941 if AnsiPos( '&nofirst=',URL) <> 0 then begin
1942 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, AnsiPos( '&nofirst=',URL) - AnsiPos('&end=', URL ) - 5);
1944 buf := Copy( URL, AnsiPos('&end=', URL ) + 5, Length( URL ) - AnsiPos('&to=', URL ) - 5 + 1 );
1947 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
1948 buf := Copy( buf, 1, ps );
1952 endRes := StrToInt64(buf);
1959 end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
1960 buf := Copy(URL, LastDelimiter('/',URL)+1,Length(URL)-LastDelimiter('/',URL)+1);
1961 if Length(buf) > 0 then begin
1962 if AnsiPos('-', buf) = 1 then begin
1967 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
1969 convBuf := Copy( buf, 1, ps );
1970 if convBuf <> '' then
1971 endRes := StrToInt64(convBuf)
1977 if endRes <> 0 then begin
1978 stRes := endRes - MAX_POPUP_RES;
1985 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
1987 convBuf := Copy( buf, 1, ps );
1988 if convBuf <> '' then begin
1989 stRes := StrToInt64(convBuf);
1993 while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
1995 convBuf := Copy( buf, 1, ps );
1996 if convBuf <> '' then
1997 endRes := StrToInt64(convBuf)
2018 function TGikoSys.Parse2chURL2(URL: string): TPathRec;
2023 // convBuf : String;
2034 URL := Trim(LowerCase(URL));
2039 Result.FFirst := False;
2040 Result.FStBegin := False;
2041 Result.FToEnd := False;
2042 Result.FDone := False;
2043 Result.FNoParam := False;
2047 if URL[length(URL)] = '\' then
2049 FAWKStr.RegExp := 'http://.+\.(2ch\.net|bbspink\.com)/';
2050 if FAWKStr.Match(FAWKStr.ProcessEscSeq(URL), RStart, RLength) <> 0 then begin
2051 s := Copy(URL, RStart + RLength - 1, Length(URL));
2053 //
\95W
\8f\80\8f\91\8e®
2054 //
\8dÅ
\8cã
\82Íl50, 10, 10-20, 10n, 10-20n, -10, 10-, 10n-
\82È
\82Ç
2055 //http://xxx.2ch.net/test/read.cgi/bbsid/1000000000/
2056 FAWKStr.RegExp := '/test/read.cgi/.+/[0-9]+/?.*';
2057 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2058 s := Copy(s, 15, Length(s));
2060 SList := TStringList.Create;
2063 FAWKStr.RegExp := '/';
2064 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 3 then begin
2065 Result.FBBS := SList[1];
2066 Result.FKey := SList[2];
2067 if SList.Count >= 4 then
2071 Result.FNoParam := true;
2077 FAWKStr.LineSeparator := mcls_CRLF;
2078 FAWKStr.RegExp := '-';
2079 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) = 0 then begin
2080 Result.FFirst := True;
2082 FAWKStr.RegExp := 'l[0-9]+';
2083 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2084 Result.FFirst := True;
2086 for i := 0 to SList.Count - 1 do begin
2087 if Trim(SList[i]) = '' then begin
2089 Result.FStBegin := True;
2090 if i = (SList.Count - 1) then
2091 Result.FToEnd := True;
2092 end else if IsNumeric(SList[i]) then begin
2093 wkInt := StrToInt(SList[i]);
2094 wkMax := Max(wkMax, wkInt);
2098 wkMin := Min(wkMin, wkInt);
2099 end else if Trim(SList[i]) = 'n' then begin
2100 Result.FFirst := True;
2102 FAWKStr.RegExp := '^n[0-9]+$|^[0-9]+n$';
2103 if FAWKStr.Match(FAWKStr.ProcessEscSeq(SList[i]), RStart, RLength) > 0 then begin
2104 if Copy(SList[i], 1, 1) = 'n' then
2105 wkInt := StrToInt(Copy(SList[i], 2, Length(SList[i])))
2107 wkInt := StrToInt(Copy(SList[i], 1, Length(SList[i]) - 1));
2108 Result.FFirst := True;
2109 wkMax := Max(wkMax, wkInt);
2113 wkMin := Min(wkMin, wkInt);
2117 if Result.FStBegin and (not Result.FToEnd) then
2119 else if (not Result.FStBegin) and Result.FToEnd then
2121 else if (not Result.FStBegin) and (not Result.FToEnd) then begin
2122 Result.FSt := wkMin;
2123 Result.FTo := wkMax;
2125 //Result.FSt := wkMin;
2126 //Result.FTo := wkMax;
2132 Result.FDone := True;
2136 //
\90Vkako
\8f\91\8e®
2137 //http://server.2ch.net/ITA_NAME/kako/1000/10000/1000000000.html
2138 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+/[0-9]+\.html';
2139 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2140 SList := TStringList.Create;
2143 FAWKStr.RegExp := '/';
2144 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
2145 Result.FBBS := SList[1];
2146 Result.FKey := ChangeFileExt(SList[5], '');
2147 Result.FFirst := True;
2153 Result.FDone := True;
2157 //
\8b\8ckako
\8f\91\8e®
2158 //http://server.2ch.net/ITA_NAME/kako/999/999999999.html
2159 FAWKStr.RegExp := '/.+/kako/[0-9]+/[0-9]+\.html';
2160 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2161 SList := TStringList.Create;
2164 FAWKStr.RegExp := '/';
2165 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 5 then begin
2166 Result.FBBS := SList[1];
2167 Result.FKey := ChangeFileExt(SList[4], '');
2168 Result.FFirst := True;
2174 Result.FDone := True;
2178 //log
\8by
\82Ñlog2
\8f\91\8e®
2179 //http://server.2ch.net/log/ITA_NAME/kako/999/999999999.html
2180 //http://server.2ch.net/log2/ITA_NAME/kako/999/999999999.html
2181 FAWKStr.RegExp := '/log2?/.+/kako/[0-9]+/[0-9]+\.html';
2182 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2183 SList := TStringList.Create;
2186 FAWKStr.RegExp := '/';
2187 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 6 then begin
2188 Result.FBBS := SList[2];
2189 Result.FKey := ChangeFileExt(SList[5], '');
2190 Result.FFirst := True;
2196 Result.FDone := True;
2201 //
\8b\8cURL
\8f\91\8e®
2202 //http://server.2ch.net/test/read.cgi?bbs=ITA_NAME&key=1000000000&st=1&to=5&nofirst=true
2203 FAWKStr.RegExp := '/test/read\.cgi\?';
2204 if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
2205 s := Copy(s, 16, Length(s));
2206 SList := TStringList.Create;
2209 FAWKStr.RegExp := '&';
2210 if FAWKStr.Split(FAWKStr.ProcessEscSeq(s), SList) >= 2 then begin
2211 Result.FFirst := True;
2212 for i := 0 to SList.Count - 1 do begin
2213 if Pos('bbs=', SList[i]) = 1 then begin
2214 Result.FBBS := Copy(SList[i], 5, Length(SList[i]));
2215 end else if Pos('key=', SList[i]) = 1 then begin
2216 Result.FKey := Copy(SList[i], 5, Length(SList[i]));
2217 end else if Pos('st=', SList[i]) = 1 then begin
2218 wk := Copy(SList[i], 4, Length(SList[i]));
2219 if IsNumeric(wk) then
2220 Result.FSt := StrToInt(wk)
2221 else if wk = '' then
2222 Result.FStBegin := True;
2223 end else if Pos('to=', SList[i]) = 1 then begin
2224 wk := Copy(SList[i], 4, Length(SList[i]));
2225 if IsNumeric(wk) then
2226 Result.FTo := StrToInt(wk)
2227 else if wk = '' then
2228 Result.FToEnd := True;
2229 end else if Pos('nofirst=', SList[i]) = 1 then begin
2230 Result.FFirst := False;
2239 if (Result.FBBS <> '') and (Result.FKey <> '') then begin
2240 Result.FDone := True;
2247 procedure TGikoSys.ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
2257 URI := TIdURI.Create(URL);
2259 Protocol := URI.Protocol;
2262 Document := URI.Document;
2264 Bookmark := URI.Bookmark;
2270 function TGikoSys.GetVersionBuild: Integer;
2272 FixedFileInfo: PVSFixedFileInfo;
2273 VersionHandle, VersionSize: DWORD;
2274 pVersionInfo: Pointer;
2279 AppFile := Application.ExeName;
2280 VersionSize := GetFileVersionInfoSize(pChar(AppFile), VersionHandle);
2281 if VersionSize = 0 then
2283 GetMem(pVersionInfo, VersionSize);
2285 if GetFileVersionInfo(PChar(AppFile),VersionHandle,VersionSize, pVersionInfo) then
2286 if VerQueryValue(pVersionInfo, '\', Pointer(FixedFileInfo), ItemLen) then
2287 Result := LOWORD(FixedFileInfo^.dwFileVersionLS);
2289 FreeMem(pVersionInfo, VersionSize);
2293 function TGikoSys.GetBrowsableThreadURL(
2297 threadItem : TThreadItem;
2298 boardPlugIn : TBoardPlugIn;
2303 //=====
\83v
\83\89\83O
\83C
\83\93
2305 for i := Length( BoardGroups ) - 1 downto 1 do begin
2306 if Assigned( Pointer( BoardGroups[i].BoardPlugIn.Module ) ) then begin
2307 if BoardGroups[i].BoardPlugIn.AcceptURL( inURL ) = atThread then begin
2308 board := BBSsFindBoardFromURL( BoardGroups[i].BoardPlugIn.ExtractBoardURL(inURL) );
2309 if board <> nil then begin
2310 boardPlugIn := BoardGroups[i].BoardPlugIn;
2311 threadItem := TThreadItem.Create( boardPlugIn, board, inURL );
2312 Result := threadItem.URL;
2321 // 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¢
2324 if Length( Result ) = 0 then
2325 Result := GikoSys.Get2chBrowsableThreadURL( inURL );
2329 function TGikoSys.GetThreadURL2BoardURL(
2333 threadItem : TThreadItem;
2334 boardPlugIn : TBoardPlugIn;
2339 //=====
\83v
\83\89\83O
\83C
\83\93
2341 for i := Length( BoardGroups ) - 1 downto 1 do begin
2342 if Assigned( Pointer( BoardGroups[i].BoardPlugIn.Module ) ) then begin
2343 if BoardGroups[i].BoardPlugIn.AcceptURL( inURL ) = atThread then begin
2344 board := BBSsFindBoardFromURL(BoardGroups[i].BoardPlugIn.ExtractBoardURL(inURL));
2345 boardPlugIn := BoardGroups[i].BoardPlugIn;
2346 threadItem := TThreadItem.Create( boardPlugIn, board, inURL );
2347 Result := BoardGroups[i].BoardPlugIn.GetBoardURL( Longword( threadItem ) );
2355 // 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¢
2358 if Length( Result ) = 0 then
2359 Result := GikoSys.Get2chThreadURL2BoardURL( inURL );
2363 function TGikoSys.Get2chThreadURL2BoardURL(
2367 Protocol, Host, Path, Document, Port, Bookmark : string;
2368 BBSID, BBSKey : string;
2372 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
2373 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
2375 foundPos := Pos( '/test/read.cgi', inURL );
2376 if {(Is2chHost(Host)) and} (foundPos > 0) then
2377 Result := Copy( inURL, 1, foundPos ) + BBSID + '/'
2379 Result := Protocol + '://' + Host + '/' + BBSID + '/';
2383 function TGikoSys.Get2chBrowsableThreadURL(
2387 Protocol, Host, Path, Document, Port, Bookmark : string;
2388 BBSID, BBSKey : string;
2392 // if Pos( KAKO_PATH, inURL ) > 0 then begin
2395 ParseURI( inURL, Protocol, Host, Path, Document, Port, Bookmark );
2396 Parse2chURL( inURL, Path, Document, BBSID, BBSKey );
2397 foundPos := Pos( '/test/read.cgi', inURL ) - 1;
2399 if Is2chHost( Host ) then begin
2400 Result := Protocol + '://' + Host +
2401 READ_PATH + BBSID + '/' + BBSKey + '/l50';
2403 if foundPos > 0 then
2404 Result := Copy( inURL, 1, foundPos ) +
2405 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50'
2407 Result := Protocol + '://' + Host +
2408 OLD_READ_PATH + 'bbs=' + BBSID + '&key=' + BBSKey + '&ls=50';
2414 function TGikoSys.Get2chBoard2ThreadURL(
2422 server := UrlToServer( inBoard.URL );
2423 //if Is2chHost( server ) then
2424 if inBoard.Is2ch then
2425 Result := server + 'test/read.cgi/' + inBoard.BBSID + '/' + inKey + '/l50'
2427 Result := server + 'test/read.cgi?bbs=' + inBoard.BBSID + '&key=' + inKey + '&ls=50';
2431 (*************************************************************************
2432 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\97ñ
\8b\93
2433 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
2434 *************************************************************************)
2435 procedure TGikoSys.ListBoardFile;
2437 boardFileList : TStringList;
2442 for i := 0 to Length( BBSs ) - 1 do
2446 SetLength( BBSs, 0 );
2449 //
\94Â
\83\8a\83X
\83g
\82Ì
\97ñ
\8b\93
2450 if FileExists( GikoSys.GetBoardFileName ) then begin
2451 SetLength( BBSs, l + 1 );
2452 BBSs[ l ] := TBBS.Create( GikoSys.GetBoardFileName );
2453 BBSs[ l ].Title := '
\82Q
\82¿
\82á
\82ñ
\82Ë
\82é';
2457 if FileExists( GikoSys.GetCustomBoardFileName ) then begin
2458 SetLength( BBSs, l + 1 );
2459 BBSs[ l ] := TBBS.Create( GikoSys.GetCustomBoardFileName );
2460 BBSs[ l ].Title := '
\82»
\82Ì
\91¼';
2464 // Board
\83t
\83H
\83\8b\83_
2465 if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
2466 BoardFileList := TStringList.Create;
2468 BoardFileList.BeginUpdate;
2469 GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
2470 BoardFileList.EndUpdate;
2471 for k := BoardFileList.Count - 1 downto 0 do begin
2472 if AnsiCompareText(ExtractFileExt(BoardFileList[ k ]), '.bak') = 0 then
2473 BoardFileList.Delete(k);
2475 SetLength( BBSs, l + BoardFileList.Count );
2476 for i := BoardFileList.Count - 1 downto 0 do begin
2477 BBSs[ l ] := TBBS.Create( BoardFileList[ i ] );
2478 BBSs[ l ].Title := ChangeFileExt( ExtractFileName( BoardFileList[ i ] ), '' );
2486 (*************************************************************************
2487 *
\8b@
\94\
\96¼
\81@
\81@
\81F
\83{
\81[
\83h
\83t
\83@
\83C
\83\8b\93Ç
\82Ý
\8d\9e\82Ý
2488 *
\89Â
\8e\8b\81@
\81@
\81@
\81FPublic
2489 *************************************************************************)
2490 procedure TGikoSys.ReadBoardFile( bbs : TBBS );
2495 boardFile : TStringList;
2496 CategoryList : TStringList;
2497 BoardList : TStringList;
2498 Category : TCategory;
2502 // RoundItem : TRoundItem;
2504 i, iBound : Integer;
2505 j, jBound : Integer;
2506 k, kBound : Integer;
2509 if not FileExists( bbs.FilePath ) then
2513 ini := TMemIniFile.Create('');
2514 boardFile := TStringList.Create;
2517 boardFile.LoadFromFile( bbs.FilePath );
2519 ini.SetStrings( boardFile );
2520 CategoryList := TStringList.Create;
2521 BoardList := TStringList.Create;
2523 ini.ReadSections( CategoryList );
2525 iBound := CategoryList.Count - 1;
2526 for i := 0 to iBound do begin
2527 ini.ReadSection( CategoryList[i], BoardList );
2528 Category := TCategory.Create;
2529 Category.No := i + 1;
2530 Category.Title := CategoryList[i];
2532 jBound := BoardList.Count - 1;
2533 for j := 0 to jBound do begin
2535 inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
2536 //'http://'
\82ð
\8aÜ
\82Ü
\82È
\82¢
\95¶
\8e\9a\97ñ
\82Ì
\8e\9e\82Í
\96³
\8e\8b\82·
\82é
2537 if (AnsiPos('http://', AnsiLowerCase(inistr)) = 0) then Continue;
2538 //=====
\83v
\83\89\83O
\83C
\83\93
2540 kBound := Length(BoardGroups) - 1;
2541 for k := 1 to kBound do begin //0
\82Í
\81A2
\82¿
\82á
\82ñ
2542 if Assigned( Pointer( BoardGroups[k].BoardPlugIn.Module ) ) then begin
2543 if BoardGroups[k].BoardPlugIn.AcceptURL( inistr ) = atBoard then begin
2544 if not BoardGroups[k].Find(inistr, p) then begin
2545 tmpstring := BoardGroups[k].BoardPlugIn.ExtractBoardURL( inistr );
2546 if AnsiCompareStr(tmpString, inistr) <> 0 then begin
2547 if not BoardGroups[k].Find(tmpstring, p) then begin
2549 Board := TBoard.Create( BoardGroups[k].BoardPlugIn, tmpstring );
2550 BoardGroups[k].AddObject(tmpstring, Board);
2551 Category.Add(Board);
2553 //
\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é
2557 Board := TBoard(BoardGroups[k].Objects[p]);
2558 if Board.ParentCategory <> Category then
2559 Category.Add(Board);
2563 Board := TBoard.Create( BoardGroups[k].BoardPlugIn, tmpstring );
2564 BoardGroups[k].AddObject(tmpstring, Board);
2565 Category.Add(Board);
2567 //
\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é
2572 Board := TBoard(BoardGroups[k].Objects[p]);
2573 if Board.ParentCategory <> Category then
2574 Category.Add(Board);
2581 // 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¢
2584 if (Board = nil) then begin
2585 if not BoardGroups[0].Find(inistr,p) then begin
2586 Board := TBoard.Create( nil, inistr );
2587 BoardGroups[0].AddObject(inistr, Board);
2588 Category.Add(Board);
2590 Board := TBoard(BoardGroups[0].Objects[p]);
2591 if Board.ParentCategory <> Category then
2592 Category.Add(Board);
2596 if (Board.Multiplicity = 0) then begin
2599 Board.Multiplicity := 1;
2600 Board.Title := BoardList[j];
2601 Board.RoundDate := ZERO_DATE;
2606 Board.Multiplicity := Board.Multiplicity + 1;
2611 bbs.Add( Category );
2616 bbs.IsBoardFileRead := True;
2628 function TGikoSys.GetUnknownCategory : TCategory;
2630 UNKNOWN_CATEGORY = '(
\96¼
\8fÌ
\95s
\96¾)';
2633 if Length( BBSs ) < 2 then begin
2638 Result := BBSs[ 1 ].FindCategoryFromTitle( UNKNOWN_CATEGORY );
2639 if Result = nil then begin
2640 Result := TCategory.Create;
2641 Result.Title := UNKNOWN_CATEGORY;
2642 BBSs[ 1 ].Add( Result );
2647 function TGikoSys.GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
2649 category : TCategory;
2651 UNKNOWN_BOARD = '(
\96¼
\8fÌ
\95s
\96¾)';
2654 category := GetUnknownCategory;
2655 if category = nil then begin
2658 Result := category.FindBoardFromTitle( UNKNOWN_BOARD );
2659 if Result = nil then begin
2660 Result := TBoard.Create( inPlugIn, inURL );
2661 Result.Title := UNKNOWN_BOARD;
2662 category.Add( Result );
2667 function TGikoSys.GetSambaFileName : string;
2669 Result := Setting.GetSambaFileName;
2671 procedure TGikoSys.SambaFileExists();
2674 sambaStrList: TStringList;
2676 if not FileExists(GikoSys.GetSambaFileName) then begin
2677 sambaTmp := ChangeFileExt(GikoSys.GetSambaFileName, '.default');
2678 sambaStrList := TStringList.Create;
2680 if FileExists(sambaTmp) then begin
2681 sambaStrList.LoadFromFile(sambaTmp);
2682 sambaStrList.SaveToFile(GikoSys.GetSambaFileName);
2689 function TGikoSys.GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem; limited: boolean):string;
2695 if (not IsNoValidID(AID)) and
2696 (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
2697 body := TStringList.Create;
2699 GetSameIDRes(AID, ThreadItem, body);
2700 if (limited) and (body.Count > 20) then begin
2701 for i := body.Count - 20 to body.Count - 1 do begin
2702 Result := Result + '>' + body[i] + ' ';
2705 for i := 0 to body.Count - 1 do begin
2706 Result := Result + '>' + body[i] + ' ';
2712 Result := HTMLCreater.ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
2715 procedure TGikoSys.GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList);
2718 ReadList: TStringList;
2720 boardPlugIn : TBoardPlugIn;
2722 if (not IsNoValidID(AID)) and
2723 (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
2724 //if ThreadItem.IsBoardPlugInAvailable then begin
2725 if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
2726 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
2727 //boardPlugIn := ThreadItem.BoardPlugIn;
2728 boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
2730 for i := 0 to threadItem.Count - 1 do begin
2732 Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), i + 1));
2733 if(AnsiPos(AID, Res.FDateTime) > 0) then begin
2734 body.Add(IntToStr(i+1));
2738 ReadList := TStringList.Create;
2740 ReadList.LoadFromFile(ThreadItem.GetThreadFileName);
2741 for i := 0 to ReadList.Count - 1 do begin
2742 Res := DivideStrLine(ReadList[i]);
2743 if AnsiPos(AID, Res.FDateTime) > 0 then begin
2744 body.Add(IntToStr(i+1));
2753 function TGikoSys.GetSameIDResAnchor(AIDNum : Integer; ThreadItem: TThreadItem; limited: boolean):string;
2759 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
2760 body := TStringList.Create;
2762 GetSameIDRes(AIDNum, ThreadItem, body);
2763 if (limited) and (body.Count > 20) then begin
2764 for i := body.Count - 20 to body.Count - 1 do begin
2765 Result := Result + '>' + body[i] + ' ';
2768 for i := 0 to body.Count - 1 do begin
2769 Result := Result + '>' + body[i] + ' ';
2775 Result := HTMLCreater.ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
2779 procedure TGikoSys.GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList);
2782 boardPlugIn : TBoardPlugIn;
2784 stList: TStringList;
2787 if (ThreadItem <> nil) and (ThreadItem.IsLogFile)
2788 and (AIDNum > 0) and (AIDNum <= ThreadItem.Count) then begin
2789 //if ThreadItem.IsBoardPlugInAvailable then begin
2790 if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
2791 //=====
\83v
\83\89\83O
\83C
\83\93\82É
\82æ
\82é
\95\
\8e¦
2792 //boardPlugIn := ThreadItem.BoardPlugIn;
2793 boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
2794 Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), AIDNum));
2796 Res := DivideStrLine( ReadThreadFile(ThreadItem.GetThreadFileName, AIDNum));
2798 AID := Res.FDateTime;
2799 if AnsiPos('id', AnsiLowerCase(AID)) > 0 then begin
2800 AID := Copy(AID, AnsiPos('id', AnsiLowerCase(AID)) - 1, 11);
2801 if AnsiPos(' be:', AnsiLowerCase(AID)) > 0 then begin
2802 AID := Copy(AID, 1, AnsiPos(' BE:', AnsiLowerCase(AID)) - 1)
2805 stlist := TStringList.Create;
2807 stList.DelimitedText := AID;
2809 for i := 0 to stList.Count - 1 do
2810 if Length(WideString(stList[i])) = 8 then begin
2811 if NotDateorTimeString(stList[i]) then begin
2820 if not IsNoValidID(AID) then
2821 GetSameIDRes(AID, ThreadItem, body);
2824 function TGikoSys.GetSameIDResCount(const AID : string; ThreadItem: TThreadItem):Integer;
2829 if (not IsNoValidID(AID))
2830 and (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
2831 body := TStringList.Create;
2833 GetSameIDRes(AID, ThreadItem, body);
2834 Result := body.Count;
2841 function TGikoSys.GetSameIDResCount(AIDNum : Integer; ThreadItem: TThreadItem):Integer;
2846 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
2847 body := TStringList.Create;
2849 GetSameIDRes(AIDNum, ThreadItem, body);
2850 Result := body.Count;
2857 function TGikoSys.NotDateorTimeString(const AStr : string): boolean;
2873 procedure TGikoSys.SpamCountWord( const text : string; wordCount : TWordCount );
2876 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
2877 Bayesian.CountWord( text, wordCount );
2881 procedure TGikoSys.SpamForget( wordCount : TWordCount; isSpam : Boolean );
2884 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
2885 Bayesian.Forget( wordCount, isSpam );
2889 procedure TGikoSys.SpamLearn( wordCount : TWordCount; isSpam : Boolean );
2892 if Setting.SpamFilterAlgorithm = gsfaNone then Exit;
2893 Bayesian.Learn( wordCount, isSpam );
2897 function TGikoSys.SpamParse( const text : string; wordCount : TWordCount ) : Extended;
2900 case Setting.SpamFilterAlgorithm of
2901 gsfaNone: Result := 0;
2902 gsfaPaulGraham: Result := Bayesian.Parse( text, wordCount, gbaPaulGraham );
2903 gsfaGaryRobinson: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinson );
2904 gsfaGaryRobinsonFisher: Result := Bayesian.Parse( text, wordCount, gbaGaryRobinsonFisher );
2909 function TGikoSys.SetUserOptionalStyle(): string;
2912 if Length( GikoSys.Setting.BrowserFontName ) > 0 then
2913 Result := 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
2914 if GikoSys.Setting.BrowserFontSize <> 0 then
2915 Result := Result + 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
2916 if GikoSys.Setting.BrowserFontColor <> -1 then
2917 Result := Result + 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
2918 if GikoSys.Setting.BrowserBackColor <> -1 then
2919 Result := Result + 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
2920 case GikoSys.Setting.BrowserFontBold of
2921 -1: Result := Result + 'font-weight:normal;';
2922 1: Result := Result + 'font-weight:bold;';
2924 case GikoSys.Setting.BrowserFontItalic of
2925 -1: Result := Result + 'font-style:normal;';
2926 1: Result := Result + 'font-style:italic;';
2929 //
\83o
\81[
\83W
\83\87\83\93\8fî
\95ñ
\82ð
\8eæ
\93¾
2930 function TGikoSys.GetVersionInfo(KeyWord: TVerResourceKey): string;
2932 Translation = '\VarFileInfo\Translation';
2933 FileInfo = '\StringFileInfo\%0.4s%0.4s\';
2935 BufSize, HWnd: DWORD;
2936 VerInfoBuf: Pointer;
2938 VerDataLen: Longword;
2941 //
\95K
\97v
\82È
\83o
\83b
\83t
\83@
\82Ì
\83T
\83C
\83Y
\82ð
\8eæ
\93¾
2942 BufSize := GetFileVersionInfoSize(PChar(Application.ExeName), HWnd);
2943 if BufSize <> 0 then begin
2944 //
\83\81\83\82\83\8a\82ð
\8am
\95Û
2945 GetMem(VerInfoBuf, BufSize);
2947 GetFileVersionInfo(PChar(Application.ExeName), 0, BufSize, VerInfoBuf);
2948 //
\95Ï
\90\94\8fî
\95ñ
\83u
\83\8d\83b
\83N
\93à
\82Ì
\95Ï
\8a·
\83e
\81[
\83u
\83\8b\82ð
\8ew
\92è
2949 VerQueryValue(VerInfoBuf, PChar(Translation), VerData, VerDataLen);
2951 if not (VerDataLen > 0) then
2952 raise Exception.Create('
\8fî
\95ñ
\82Ì
\8eæ
\93¾
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½');
2954 // 8
\8c\85\82Ì
\82P
\82U
\90i
\90\94\82É
\95Ï
\8a·
2955 //
\81¨'\StringFileInfo\027382\FileDescription'
2956 PathLocale := Format(FileInfo + KeyWordStr[KeyWord],
2957 [IntToHex(Integer(VerData^) and $FFFF, 4),
2958 IntToHex((Integer(VerData^) shr 16) and $FFFF, 4)]);
2959 VerQueryValue(VerInfoBuf, PChar(PathLocale), VerData, VerDataLen);
2961 if VerDataLen > 0 then begin
2962 // VerData
\82Í
\83[
\83\8d\82Å
\8fI
\82í
\82é
\95¶
\8e\9a\97ñ
\82Å
\82Í
\82È
\82¢
\82±
\82Æ
\82É
\92\8d\88Ó
2964 SetLength(result, VerDataLen);
2965 StrLCopy(PChar(result), VerData, VerDataLen);
2969 FreeMem(VerInfoBuf);
2973 //Plugin
\82Ì
\8fî
\95ñ
\82Ì
\8eæ
\93¾
2974 //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·
2976 function TGikoSys.GetPluginsInfo(): String;
2979 major, minor, revision : Cardinal;
2980 agent, release : String;
2982 //
\8c\8b\89Ê
\82ð
\83N
\83\8a\83A
\82µ
\82Ä
\82¨
\82
2985 //BoardGroups
\8co
\97R
\82ÅPlugin
\82É
\83A
\83N
\83Z
\83X
\82·
\82é
2986 for i := 0 to Length(BoardGroups) - 1 do begin
2987 //BoardGroups
\82Ì
\92\86\82É
\82Í
\81APlugin
\82ð
\8e\9d\82Á
\82Ä
\82¢
\82È
\82¢
\82Ì
\81i2
\82¿
\82á
\82ñ
\81j
\82ª
2988 //
\82¢
\82é
\82Ì
\82Å
\82»
\82ê
\82ð
\8f\9c\82
2989 if BoardGroups[i].BoardPlugIn <> nil then begin
2990 BoardGroups[i].BoardPlugIn.VersionInfo(agent, major, minor, release, revision);
2993 //"Plugin
\82Ì
\96¼
\91O(major.minor.revision)"
2995 Format('%s(%d.%d.%d)', [agent, major, minor, revision]) + #13#10;
3001 //IE
\82Ì
\83o
\81[
\83W
\83\87\83\93\82ð
\8eæ
\93¾
\82·
\82é
3002 function TGikoSys.GetIEVersion: string;
3006 R := TRegistry.Create;
3008 //
\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¢
3009 R.Access := KEY_EXECUTE;
3010 R.RootKey := HKEY_LOCAL_MACHINE;
3011 R.OpenKey('Software\Microsoft\Internet Explorer', False);
3013 Result := R.ReadString('version');
3015 Result := '
\83o
\81[
\83W
\83\87\83\93\82Ì
\8eæ
\93¾
\82É
\8e¸
\94s
\82µ
\82Ü
\82µ
\82½
\81B';
3025 GikoSys := TGikoSys.Create;
3028 if GikoSys <> nil then begin