uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
- ComCtrls, IniFiles, ShellAPI, ActnList, Math,
+ ComCtrls, {IniFiles,} ShellAPI, ActnList, Math,
{$IF Defined(DELPRO) }
SHDocVw,
MSHTML,
SHDocVw_TLB,
MSHTML_TLB,
{$IFEND}
- {HttpApp,} YofUtils, URLMon, IdGlobal, IdURI, {Masks,}
+ {HttpApp,} URLMon, IdGlobal, IdURI, {Masks,}
Setting, BoardGroup, gzip, Dolib, bmRegExp, AbonUnit,
- MojuUtils, ExternalBoardManager, ExternalBoardPlugInMain,
- Sort, GikoBayesian;
+ ExternalBoardManager, ExternalBoardPlugInMain,
+ GikoBayesian, GikoMessage, Belib;
type
- //BBS\83^\83C\83v
+ TVerResourceKey = (
+ vrComments, //!< \83R\83\81\83\93\83g
+ vrCompanyName, //!< \89ï\8eÐ\96¼
+ vrFileDescription, //!< \90à\96¾
+ vrFileVersion, //!< \83t\83@\83C\83\8b\83o\81[\83W\83\87\83\93
+ vrInternalName, //!< \93à\95\94\96¼
+ vrLegalCopyright, //!< \92\98\8dì\8c
+ vrLegalTrademarks, //!< \8f¤\95W
+ vrOriginalFilename, //!< \90³\8e®\83t\83@\83C\83\8b\96¼
+ vrPrivateBuild, //!< \83v\83\89\83C\83x\81[\83g\83r\83\8b\83h\8fî\95ñ
+ vrProductName, //!< \90»\95i\96¼
+ vrProductVersion, //!< \90»\95i\83o\81[\83W\83\87\83\93
+ vrSpecialBuild); //!< \83X\83y\83V\83\83\83\8b\83r\83\8b\83h\8fî\95ñ
+
+ //! BBS\83^\83C\83v
TGikoBBSType = (gbt2ch);
- //\83\8d\83O\83^\83C\83v
+ //! \83\8d\83O\83^\83C\83v
TGikoLogType = (glt2chNew, glt2chOld);
- //\83\81\83b\83Z\81[\83W\83A\83C\83R\83\93
+ //! \83\81\83b\83Z\81[\83W\83A\83C\83R\83\93
TGikoMessageIcon = (gmiOK, gmiSAD, gmiNG, gmiWhat, gmiNone);
- //URL\83I\81[\83v\83\93\83u\83\89\83E\83U\83^\83C\83v
+ //! URL\83I\81[\83v\83\93\83u\83\89\83E\83U\83^\83C\83v
TGikoBrowserType = (gbtIE, gbtUserApp, gbtAuto);
Pos: Integer;
end;
- //\83C\83\93\83f\83b\83N\83X\83t\83@\83C\83\8b\83\8c\83R\81[\83h
+ //! \83C\83\93\83f\83b\83N\83X\83t\83@\83C\83\8b\83\8c\83R\81[\83h
TIndexRec = record
FNo: Integer;
FFileName: string;
FLastModified: TDateTime;
FKokomade: Integer;
FNewReceive: Integer;
- FMishiyou: Boolean; //\96¢\8eg\97p
+ FMishiyou: Boolean; //!< \96¢\8eg\97p
FUnRead: Boolean;
FScrollTop: Integer;
//Index Ver 1.01
FAgeSage: TGikoAgeSage;
end;
- //\83T\83u\83W\83F\83N\83g\83\8c\83R\81[\83h
+ //! \83T\83u\83W\83F\83N\83g\83\8c\83R\81[\83h
TSubjectRec = record
FFileName: string;
FTitle: string;
FCount: Integer;
end;
- //\83\8c\83X\83\8c\83R\81[\83h
+ //! \83\8c\83X\83\8c\83R\81[\83h\82Ö\82Ì\83|\83C\83\93\83^
+ PResRec = ^TResRec;
+
+ //! \83\8c\83X\83\8c\83R\81[\83h
TResRec = record
FTitle: string;
FMailTo: string;
FType: TGikoLogType;
end;
- //URLPath\83\8c\83R\81[\83h
+ //! URLPath\83\8c\83R\81[\83h
TPathRec = record
- FBBS: string; //BBSID
- FKey: string; //ThreadID
- FSt: Int64; //\8aJ\8en\83\8c\83X\94Ô
- FTo: Int64; //\8fI\97¹\83\8c\83X\94Ô
- FFirst: Boolean; //>>1\82Ì\95\\8e¦
- FStBegin: Boolean; //1\81`\95\\8e¦
- FToEnd: Boolean; //\81`\8dÅ\8cã\82Ü\82Å\95\\8e¦
- FDone: Boolean; //\90¬\8c÷
- FNoParam: Boolean; //\83\8c\83X\94Ô\83p\83\89\83\81\81[\83^\82È\82µ
+ FBBS: string; //!< BBSID
+ FKey: string; //!< ThreadID
+ FSt: Int64; //!< \8aJ\8en\83\8c\83X\94Ô
+ FTo: Int64; //!< \8fI\97¹\83\8c\83X\94Ô
+ FFirst: Boolean; //!< >>1\82Ì\95\\8e¦
+ FStBegin: Boolean; //!< 1\81`\95\\8e¦
+ FToEnd: Boolean; //!< \81`\8dÅ\8cã\82Ü\82Å\95\\8e¦
+ FDone: Boolean; //!< \90¬\8c÷
+ FNoParam: Boolean; //!< \83\8c\83X\94Ô\83p\83\89\83\81\81[\83^\82È\82µ
end;
TGikoSys = class(TObject)
FAWKStr: TAWKStr;
FResRange : Longint;
FBayesian : TGikoBayesian; //!< \83x\83C\83W\83A\83\93\83t\83B\83\8b\83^
-
-// FExitWrite: TStringList;
-// function StrToFloatDef(s: string; Default: Double): Double;
-
+ FVersion : String; //!< \83t\83@\83C\83\8b\83o\81[\83W\83\87\83\93
+ FGikoMessage: TGikoMessage;
+ FBelib: TBelib;
+ //! \82 \82é\83Z\83p\83\8c\81[\83^\82Å\8bæ\90Ø\82ç\82ê\82½\95¶\8e\9a\97ñ\82©\82ç\82\8e\94Ô\96Ú\82Ì\95¶\8e\9a\97ñ\82ð\8eæ\82è\8fo\82·
+ function ChooseString(const Text, Separator: string; Index: integer): string;
+ //! \88ê\8e\9e\83t\83@\83C\83\8b\82©\82ç\82Ì\95\9c\8b\8c
+ procedure RestoreThreadData(Board: TBoard);
public
{ Public \90é\8c¾ }
FAbon : TAbon;
FSelectResFilter : TAbon;
+ //FBoardURLList: TStringList;
constructor Create;
destructor Destroy; override;
property ResRange : Longint read FResRange write FResRange;
-// function MsgBox(Msg: string; Title: string; Flags: Longint): integer; overload;
-// function MsgBox(Handle: THandle; Msg: string; Title: string; Flags: Longint): integer; overload;
+ //! \83o\81[\83W\83\87\83\93\8fî\95ñ
+ property Version : String read FVersion;
function IsNumeric(s: string): boolean;
function IsFloat(s: string): boolean;
function DirectoryExistsEx(const Name: string): Boolean;
function ForceDirectoriesEx(Dir: string): Boolean;
-// function GetVersion: string;
function GetBoardFileName: string;
function GetCustomBoardFileName: string;
function GetUserAgent: string;
function GetSambaFileName : string;
+ function GetMainKeyFileName : String;
+ function GetEditorKeyFileName: String;
+ function GetInputAssistFileName: String;
procedure ReadSubjectFile(Board: TBoard);
procedure CreateThreadDat(Board: TBoard);
procedure WriteThreadDat(Board: TBoard);
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¢
procedure GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
- procedure CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
- procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
- function AddAnchorTag(s: string): string;
-
function DivideSubject(Line: string): TSubjectRec;
- function DivideStrLine(Line: string): TResRec;
-
property Setting: TSetting read FSetting write FSetting;
property Dolib: TDolib read FDolib write FDolib;
+ property Belib: TBelib read FBelib write FBelib;
function UrlToID(url: string): string;
function UrlToServer(url: string): string;
function GetFileSize(FileName : string) : longint;
function GetFileLineCount(FileName : string): longint;
- function Get2chDate(aDate: TDateTime): string;
function IntToDateTime(val: Int64): TDateTime;
function DateTimeToInt(ADate: TDateTime): Int64;
procedure MenuFont(Font: TFont);
- function RemoveToken(var s:string; const delimiter:string):string;
+// function RemoveToken(var s:string; const delimiter:string):string;
function GetTokenIndex(s: string; delimiter: string; index: Integer): string;
- function DeleteLink(const s: string): string;
function GetShortName(const LongName: string; ALength: integer): string;
- function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string; DatToHTML: boolean = false): string; overload;
- function ConvRes(const Body, Bbs, Key, ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue, FullURL : string): string; overload;
- function ConvertResAnchor(res: string): string;
function BoolToInt(b: Boolean): Integer;
function IntToBool(i: Integer): Boolean;
function GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
- procedure LoadKeySetting(ActionList: TActionList);
- procedure SaveKeySetting(ActionList: TActionList);
- procedure LoadEditorKeySetting(ActionList: TActionList);
- procedure SaveEditorKeySetting(ActionList: TActionList);
-
+ procedure LoadKeySetting(ActionList: TActionList; FileName: String);
+ procedure SaveKeySetting(ActionList: TActionList; FileName: String);
procedure CreateProcess(const AppPath: string; const Param: string);
procedure OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
function HTMLDecode(const AStr: String): String;
procedure GetPopupResNumber(URL : string; var stRes, endRes : Int64);
- // \83X\83L\83\93\82ð\93Ç\82Ý\8d\9e\82Ý\81A\92l\82ð\92u\8a·\82·\82é
- function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string;
- // \83\8c\83X\82Ì\92l\82ð\92u\8a·\82·\82é
- function SkinedRes( skin: string; Res: TResRec; No: string ): string;
-
- //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é
- procedure SambaFileExists();
-
property Bayesian : TGikoBayesian read FBayesian write FBayesian;
- function GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem):string; overload;
- function GetSameIDResAnchor(AIDNum : Integer; ThreadItem: TThreadItem):string; overload;
+ function CreateResAnchor(var Numbers: TStringList; ThreadItem: TThreadItem; limited: Integer):string;
procedure GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList); overload;
procedure GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList); overload;
+ function GetResID(AIDNum: Integer; ThreadItem: TThreadItem): String;
+ function ExtructResID(ADateStr: String): String;
//! \92P\8cê\89ð\90Í
procedure SpamCountWord( const text : string; wordCount : TWordCount );
//! \8aw\8fK\83N\83\8a\83A
procedure SpamLearn( wordCount : TWordCount; isSpam : Boolean );
//! \83X\83p\83\80\93x\90\94
function SpamParse( const text : string; wordCount : TWordCount ) : Extended;
- //\88ø\90\94\82ª\81A\93ú\95t\82Å\82à\8e\9e\8d\8f\82Å\82à\82È\82¢\82±\82Æ\82ð\92²\82×\82é
- function NotDateorTimeString(const AStr : string): boolean;
+
+ //! \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Á
+ function AddBeProfileLink(AID : string; ANum: Integer): string;
+ //! \83o\81[\83W\83\87\83\93\8fî\95ñ\82Ì\8eæ\93¾
+ function GetVersionInfo(KeyWord: TVerResourceKey): string;
+ //! Plugin\82Ì\8fî\95ñ\82Ì\8eæ\93¾
+ function GetPluginsInfo(): string;
+ //! IE\82Ì\83o\81[\83W\83\87\83\93\8fî\95ñ\82Ì\8eæ\93¾
+ function GetIEVersion: string;
+ function SetUserOptionalStyle(): string;
+ //! \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\82ð\90Ý\92è\82·\82é
+ procedure SetGikoMessage;
+ //! \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\82ð\8eæ\93¾\82·\82é
+ function GetGikoMessage(MesType: TGikoMessageListType): String;
+ //! GMT\82Ì\8e\9e\8d\8f\82ðTDateTime\82É\95Ï\8a·\82·\82é
+ function DateStrToDateTime(const DateStr: string): TDateTime;
+ //! User32.dll\82ª\97\98\97p\82Å\82«\82é\82©
+ function CanUser32DLL: Boolean;
+ //! OE\88ø\97p\95\84\8eæ\93¾
+ function GetOEIndentChar : string;
+ //! \92u\8a·\90Ý\92è\83t\83@\83C\83\8b\8eæ\93¾
+ function GetReplaceFileName: String;
+ //! \83C\83\93\83f\83b\83N\83X\82É\82È\82¢dat\81i\82Í\82®\82êdat\81j\82Ì\92Ç\89Á
+ procedure AddOutofIndexDat(Board: TBoard; DatList: TStringList; AllCreate: boolean = True);
+ //! \83t\83@\83C\83\8b\96¼\82©\82ç\82Ì\83X\83\8c\83b\83h\8dì\90¬\93ú\82Ì\8eæ\93¾
+ function GetCreateDateFromName(FileName: String): TDateTime;
+ function GetExtpreviewFileName: String;
+
+ procedure ShowRefCount(msg: String; unk: IUnknown);
+ //! \96`\8c¯\82Ì\8f\91Cookie\8eæ\93¾
+ function GetBoukenCookie(AURL: String): String;
+ //! \96`\8c¯\82Ì\8f\91Cookie\90Ý\92è
+ procedure SetBoukenCookie(ACookieValue, ADomain: String);
+ //! \96`\8c¯\82Ì\8f\91Cookie\8dí\8f\9c
+ procedure DelBoukenCookie(ADomain: String);
+ //! \96`\8c¯\82Ì\8f\91Domain\88ê\97\97\8eæ\93¾
+ procedure GetBoukenDomain(var ADomain: TStringList);
+ //! \96`\8c¯\82Ì\8f\91\83h\83\81\83C\83\93\96¼Cookie\8eæ\93¾
+ function GetBouken(AURL: String; var Domain: String): String;
end;
var
ZERO_DATE: Integer = 25569;
BETA_VERSION_NAME_E = 'beta';
BETA_VERSION_NAME_J = 'ÊÞÀ';
- BETA_VERSION = 50;
- BETA_VERSION_BUILD = ''; //debug\94Å\82È\82Ç
+ BETA_VERSION = 63;
+ BETA_VERSION_BUILD = ''; //!< debug\94Å\82È\82Ç
APP_NAME = 'gikoNavi';
+ BE_PHP_URL = 'http://be.2ch.net/test/p.php?i=';
+
implementation
uses
- Giko, RoundData, Favorite;
+ Giko, RoundData, Favorite, Registry, HTMLCreate, MojuUtils, Sort, YofUtils,
+ IniFiles, DateUtils, SkinFiles;
const
FOLDER_INDEX_VERSION = '1.01';
NGWORDs_DIR_NAME : String = 'NGwords';
READ_PATH: string = '/test/read.cgi/';
+ HTML_READ_PATH: string = '/test/read.html/';
OLD_READ_PATH: string = '/test/read.cgi?';
KAKO_PATH: string = '/kako/';
-(*************************************************************************
- *GikoSys\83R\83\93\83X\83g\83\89\83N\83^
- *************************************************************************)
+ KeyWordStr: array [TVerResourceKey] of String = (
+ 'Comments',
+ 'CompanyName',
+ 'FileDescription',
+ 'FileVersion',
+ 'InternalName',
+ 'LegalCopyright',
+ 'LegalTrademarks',
+ 'OriginalFilename',
+ 'PrivateBuild',
+ 'ProductName',
+ 'ProductVersion',
+ 'SpecialBuild');
+
+// *************************************************************************
+//! GikoSys\83R\83\93\83X\83g\83\89\83N\83^
+// *************************************************************************
constructor TGikoSys.Create;
begin
+ Inherited;
FSetting := TSetting.Create;
FDolib := TDolib.Create;
+ FBelib := TBelib.Create;
FAWKStr := TAWKStr.Create(nil);
if DirectoryExists(GetConfigDir) = false then begin
CreateDir(GetConfigDir);
end;
FAbon := TAbon.Create;
+ FAbon.IgnoreKana := FSetting.IgnoreKana;
FAbon.Setroot(GetConfigDir+NGWORDs_DIR_NAME);
FAbon.GoHome;
FAbon.ReturnNGwordLineNum := FSetting.ShowNGLinesNum;
FAbon.SetNGResAnchor := FSetting.AddResAnchor;
- FAbon.DeleteSyria := FSetting.DeleteSyria;
+ FAbon.DeleteSyria := FSetting.DeleteSyria;
FAbon.Deleterlo := FSetting.AbonDeleterlo;
FAbon.Replaceul := FSetting.AbonReplaceul;
FAbon.AbonPopupRes := FSetting.PopUpAbon;
FSelectResFilter := TAbon.Create;
+ FSelectResFilter.IgnoreKana := True;
// \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
FSelectResFilter.AbonString := '';
- //
+ //
ResRange := FSetting.ResRange;
+ FVersion := Trim(GetVersionInfo(vrFileVersion));
FBayesian := TGikoBayesian.Create;
+ //FBoardURLList := TStringList.Create;
+ //\83\81\83b\83Z\81[\83W\82Ì\8dì\90¬
+ FGikoMessage := TGikoMessage.Create;
end;
-(*************************************************************************
- *GikoSys\83f\83X\83g\83\89\83N\83^
- *************************************************************************)
+// *************************************************************************
+//! GikoSys\83f\83X\83g\83\89\83N\83^
+// *************************************************************************
destructor TGikoSys.Destroy;
var
i: Integer;
FileList: TStringList;
begin
- //\83X\83\8c\83b\83h\83f\81[\83^\83t\83@\83C\83\8b\82ð\8dX\90V
-// FlashExitWrite;
-
-// FExitWrite.Free;
- FBayesian.Free;
- FAWKStr.Free;
- FSetting.Free;
- FDolib.Free;
- FAbon.Free;
- FSelectResFilter.Free;
//\83e\83\93\83|\83\89\83\8aHTML\82ð\8dí\8f\9c
FileList := TStringList.Create;
try
+ FileList.BeginUpdate;
GetFileList(GetTempFolder, '*.html', FileList, False, True);
+ FileList.EndUpdate;
for i := 0 to FileList.Count - 1 do begin
DeleteFile(FileList[i]);
end;
finally
FileList.Free;
end;
+ FreeAndNil(FGikoMessage);
+ FreeAndNil(FBayesian);
+ FreeAndNil(FSelectResFilter);
+ FreeAndNil(FAbon);
+ FreeAndNil(FAWKStr);
+ FreeAndNil(FBelib);
+ FreeAndNil(FDolib);
+ FreeAndNil(FSetting);
inherited;
end;
-(*************************************************************************
- *\95¶\8e\9a\97ñ\90\94\8e\9a\83`\83F\83b\83N
- *************************************************************************)
+{!
+\brief \95¶\8e\9a\97ñ\90\94\8e\9a\83`\83F\83b\83N
+\param s \83`\83F\83b\83N\82·\82é\95¶\8e\9a\97ñ
+\return s \82ª\95\84\8d\86\95t\82«\90®\90\94\82Æ\82µ\82Ä\94F\8e¯\89Â\94\\82È\82ç True
+}
{$HINTS OFF}
function TGikoSys.IsNumeric(s: string): boolean;
var
end;
{$HINTS ON}
-(*************************************************************************
- *\95¶\8e\9a\97ñ\95\82\93®\8f¬\90\94\93_\90\94\8e\9a\83`\83F\83b\83N
- *************************************************************************)
+{!
+\brief \95¶\8e\9a\97ñ\95\82\93®\8f¬\90\94\93_\90\94\8e\9a\83`\83F\83b\83N
+\param s \83`\83F\83b\83N\82·\82é\95¶\8e\9a\97ñ
+\return s \82ª\95\84\8d\86\95t\82«\95\82\93®\8f¬\90\94\82Æ\82µ\82Ä\94F\8e¯\89Â\94\\82È\82ç True
+}
function TGikoSys.IsFloat(s: string): boolean;
var
v: Extended;
Result := TextToFloat(PChar(s), v, fvExtended);
end;
-(*************************************************************************
- *\83{\81[\83h\83t\83@\83C\83\8b\96¼\8eæ\93¾\81i\83p\83X\81{\83t\83@\83C\83\8b\96¼\81j
- *************************************************************************)
+// *************************************************************************
+//! \83{\81[\83h\83t\83@\83C\83\8b\96¼\8eæ\93¾\81i\83p\83X\81{\83t\83@\83C\83\8b\96¼\81j
+// *************************************************************************
function TGikoSys.GetBoardFileName: string;
begin
Result := Setting.GetBoardFileName;
end;
-(*************************************************************************
- *\83{\81[\83h\83t\83@\83C\83\8b\96¼\8eæ\93¾\81i\83p\83X\81{\83t\83@\83C\83\8b\96¼\81j
- *************************************************************************)
+// *************************************************************************
+//! \83{\81[\83h\83t\83@\83C\83\8b\96¼\8eæ\93¾\81i\83p\83X\81{\83t\83@\83C\83\8b\96¼\81j
+// *************************************************************************
function TGikoSys.GetCustomBoardFileName: string;
begin
Result := Setting.GetCustomBoardFileName;
end;
-(*************************************************************************
- *\83e\83\93\83|\83\89\83\8a\83t\83H\83\8b\83_\81[\96¼\8eæ\93¾
- *************************************************************************)
+// *************************************************************************
+//! \83e\83\93\83|\83\89\83\8a\83t\83H\83\8b\83_\81[\96¼\8eæ\93¾
+// *************************************************************************
function TGikoSys.GetHtmlTempFileName: string;
begin
Result := Setting.GetHtmlTempFileName;
end;
-(*************************************************************************
- *\8eÀ\8ds\83t\83@\83C\83\8b\83t\83H\83\8b\83_\8eæ\93¾
- *************************************************************************)
+// *************************************************************************
+//! \8eÀ\8ds\83t\83@\83C\83\8b\83t\83H\83\8b\83_\8eæ\93¾
+// *************************************************************************
function TGikoSys.GetAppDir: string;
begin
Result := Setting.GetAppDir;
end;
-(*************************************************************************
- *TempHtml\83t\83@\83C\83\8b\96¼\8eæ\93¾\81i\83p\83X\81{\83t\83@\83C\83\8b\96¼\81j
- *************************************************************************)
+// *************************************************************************
+//! TempHtml\83t\83@\83C\83\8b\96¼\8eæ\93¾\81i\83p\83X\81{\83t\83@\83C\83\8b\96¼\81j
+// *************************************************************************
function TGikoSys.GetTempFolder: string;
begin
Result := Setting.GetTempFolder;
end;
-(*************************************************************************
- *sent.ini\83t\83@\83C\83\8b\96¼\8eæ\93¾\81i\83p\83X\81{\83t\83@\83C\83\8b\96¼\81j
- *************************************************************************)
+// *************************************************************************
+//! sent.ini\83t\83@\83C\83\8b\96¼\8eæ\93¾\81i\83p\83X\81{\83t\83@\83C\83\8b\96¼\81j
+// *************************************************************************)
function TGikoSys.GetSentFileName: string;
begin
Result := Setting.GetSentFileName;
end;
-(*************************************************************************
- *outbox.ini\83t\83@\83C\83\8b\96¼\8eæ\93¾\81i\83p\83X\81{\83t\83@\83C\83\8b\96¼\81j
- *************************************************************************)
+// *************************************************************************
+//! outbox.ini\83t\83@\83C\83\8b\96¼\8eæ\93¾\81i\83p\83X\81{\83t\83@\83C\83\8b\96¼\81j
+// *************************************************************************
function TGikoSys.GetOutBoxFileName: string;
begin
Result := Setting.GetOutBoxFileName;
end;
-(*************************************************************************
- *Config\83t\83H\83\8b\83_\8eæ\93¾
- *************************************************************************)
+// *************************************************************************
+//! Config\83t\83H\83\8b\83_\8eæ\93¾
+// *************************************************************************
function TGikoSys.GetConfigDir: string;
begin
Result := Setting.GetConfigDir;
end;
+//! \83X\83^\83C\83\8b\83V\81[\83g\83t\83H\83\8b\83_
function TGikoSys.GetStyleSheetDir: string;
begin
Result := Setting.GetStyleSheetDir;
end;
+//! \83X\83L\83\93\83t\83H\83\8b\83_
function TGikoSys.GetSkinDir: string;
begin
Result := Setting.GetSkinDir;
end;
+//! Skin:\83w\83b\83_\82Ì\83t\83@\83C\83\8b\96¼
function TGikoSys.GetSkinHeaderFileName: string;
begin
- Result := Setting.GetSkinHeaderFileName;
+ Result := Setting.SkinFiles.GetSkinHeaderFileName;
end;
+//! Skin:\83t\83b\83^\82Ì\83t\83@\83C\83\8b\96¼
function TGikoSys.GetSkinFooterFileName: string;
begin
- Result := Setting.GetSkinFooterFileName;
+ Result := Setting.SkinFiles.GetSkinFooterFileName;
end;
+//! Skin:\90V\92\85\83\8c\83X\82Ì\83t\83@\83C\83\8b\96¼
function TGikoSys.GetSkinNewResFileName: string;
begin
- Result := Setting.GetSkinNewResFileName;
+ Result := Setting.SkinFiles.GetSkinNewResFileName;
end;
+//! Skin:\94ñ\90V\92\85\83\8c\83X\82Ì\83t\83@\83C\83\8b\96¼
function TGikoSys.GetSkinResFileName: string;
begin
- Result := Setting.GetSkinResFileName;
+ Result := Setting.SkinFiles.GetSkinResFileName;
end;
+//! Skin:\82µ\82¨\82è(\82±\82±\82Ü\82Å\93Ç\82ñ\82¾)\82Ì\83t\83@\83C\83\8b\96¼
function TGikoSys.GetSkinBookmarkFileName: string;
begin
- Result := Setting.GetSkinBookmarkFileName;
+ Result := Setting.SkinFiles.GetSkinBookmarkFileName;
end;
+//! Skin:\82µ\82¨\82è(\90V\92\85\83\8c\83X)\82Ì\83t\83@\83C\83\8b\96¼
function TGikoSys.GetSkinNewmarkFileName: string;
begin
- Result := Setting.GetSkinNewmarkFileName;
+ Result := Setting.SkinFiles.GetSkinNewmarkFileName;
end;
-// UserAgent\8eæ\93¾
+//! UserAgent\8eæ\93¾
function TGikoSys.GetUserAgent: string;
begin
if Dolib.Connected then begin
- Result := Format('%s %s/%s%d%s', [
+ Result := Format('%s %s/%s%d/%s', [
Dolib.UserAgent,
APP_NAME,
- //MAJOR_VERSION,
- //MINOR_VERSION,
BETA_VERSION_NAME_E,
BETA_VERSION,
- BETA_VERSION_BUILD]);
+ Version]);
end else begin
- Result := Format('%s/%s %s/%s%d%s', [
+ Result := Format('%s/%s %s/%s%d/%s', [
USER_AGENT,
Dolib.Version,
APP_NAME,
- //MAJOR_VERSION,
- //MINOR_VERSION,
BETA_VERSION_NAME_E,
BETA_VERSION,
- BETA_VERSION_BUILD]);
+ Version]);
end;
end;
-(*************************************************************************
- *\82Q\82¿\82á\82ñ\82Ë\82é\95û\8e®\8e\9e\8d\8f\8eæ\93¾
- *************************************************************************)
-function TGikoSys.Get2chDate(aDate: TDateTime): string;
-var
- d1: TDateTime;
- d2: TDateTime;
-begin
- d1 := EncodeDate(1970, 1, 1);
- d2 := aDate - EncodeTime(9, 0, 0, 0);
- //Result := FloatToStr(Trunc((d2 - d1) * 24 * 60 * 60));
- Result := FloatToStr(Trunc((d2 - d1) * 86400));
-end;
-
-
+{!
+\brief \8co\89ß\95b\82ð TDateTime \82É\95Ï\8a·
+\param val 1970/1/1/ 00:00:00 \82©\82ç\82Ì\8co\89ß\95b
+\return val \82ð\8e¦\82· TDateTime
+}
function TGikoSys.IntToDateTime(val: Int64): TDateTime;
-var
- d1: tdatetime;
- d2: tdatetime;
begin
- d1 := EncodeDate(1970, 1, 1);
- d2 := val / 86400.0;//(val * 1000) / (24 * 60 * 60 * 1000);
- Result := d1 + d2;
+ Result := ZERO_DATE + val / 86400.0;
end;
+{!
+\brief TDateTime \82ð\8co\89ß\95b\82É\95Ï\8a·
+\param ADate \95Ï\8a·\82·\82é\8e\9e\8d\8f
+\return 1970/1/1/ 00:00:00 \82©\82ç\82Ì\8co\89ß\95b
+}
function TGikoSys.DateTimeToInt(ADate: TDateTime): Int64;
-var
- d: TDateTime;
- c: Currency;
begin
- d := EncodeDate(1970, 1, 1);
- c := (ADate - d) * 86400; //(ADate - d) * 24 * 60 * 60;
- Result := Trunc(c);
+ Result := Trunc((ADate - ZERO_DATE) * 86400);
end;
-(*************************************************************************
- *Subject\83t\83@\83C\83\8bRead
- *************************************************************************)
+{!
+\brief Subject\83t\83@\83C\83\8bRead
+\param Board \83X\83\8c\88ê\97\97\82ð\8eæ\93¾\82·\82é\94Â
+}
procedure TGikoSys.ReadSubjectFile(Board: TBoard);
var
ThreadItem: TThreadItem;
FileName: string;
FileList: TStringList;
- TmpFileList: TStringList;
Index: Integer;
sl: TStringList;
i: Integer;
Rec: TIndexRec;
UnRead: Integer;
- ini: TMemIniFile;
- ResRec: TResRec;
- RoundItem: TRoundItem;
- idx: Integer;
usePlugIn : Boolean;
- tmpStr: string;
+ islog : Boolean;
+ urlHead: String;
+ datFileCheck: Boolean;
{*
FavoThreadItem : TFavoriteThreadItem;
Node: TTreeNode;
*}
+{$IFDEF DEBUG}
+ st, rt: Cardinal;
+{$ENDIF}
begin
+{$IFDEF DEBUG}
+ st := GetTickCount;
+{$ENDIF}
if Board.IsThreadDatRead then
Exit;
Board.Clear;
UnRead := 0;
-
usePlugIn := Board.IsBoardPlugInAvailable;
+ //server := UrlToServer( Board.URL );
+ // \83X\83\8c\83b\83h\82Å\8b¤\92Ê\82ÌURL\95\94
+ if Board.is2ch then begin
+ urlHead := UrlToServer( Board.URL ) + 'test/read.cgi/' + Board.BBSID + '/';
+ end else begin
+ urlHead := UrlToServer( Board.URL ) + 'test/read.cgi?bbs=' + Board.BBSID + '&key=';
+ end;
FileName := Board.GetFolderIndexFileName;
- FileList := TStringList.Create;
- FileList.Sorted := True;
- TmpFileList := TStringList.Create;
- TmpFileList.Sorted := True;
-
- //IsLogFile\97pDAT\83t\83@\83C\83\8b\83\8a\83X\83g
- GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False);
- //\91O\89ñ\88Ù\8fí\8fI\97¹\8e\9e\97pTmp\83t\83@\83C\83\8b\83\8a\83X\83g
- GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, False);
+ //
+ datFileCheck := (Setting.CheckDatFile) or (not FileExists(FileName));
+ if (datFileCheck) then begin
+ FileList := TStringList.Create;
+ FileList.Sorted := True;
+ FileList.BeginUpdate;
+ //IsLogFile\97pDAT\83t\83@\83C\83\8b\83\8a\83X\83g
+ GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.dat', FileList, False);
+ FileList.EndUpdate;
+ end;
// \8fd\95¡\82ð\96h\82®
Board.BeginUpdate;
Board.Sorted := True;
-
sl := TStringList.Create;
try
if FileExists(FileName) then begin
sl.LoadFromFile(FileName);
-
//\82Q\8ds\96Ú\82©\82ç\81i\82P\8ds\96Ú\82Í\83o\81[\83W\83\87\83\93\81j
for i := sl.Count - 1 downto 1 do begin
Rec := ParseIndexLine(sl[i]);
+ if (datFileCheck) then begin
+ islog := FileList.Find( Rec.FFileName, Index );
+ end else begin
+ islog := (Rec.FSize <> 0) and (Rec.FCount <> 0);
+ end;
if usePlugIn then
ThreadItem := TThreadItem.Create(
Board.BoardPlugIn,
+ Board,
Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), Rec.FFileName ) )
- else
- ThreadItem := TThreadItem.Create(
- nil,
- Get2chBoard2ThreadURL( Board, ChangeFileExt( Rec.FFileName, '' ) ) );
+ else begin
+ if Board.is2ch then begin
+ ThreadItem := TThreadItem.Create(
+ nil,
+ Board,
+ urlHead + ChangeFileExt( Rec.FFileName, '' ) + '/l50',
+ islog,
+ Rec.FFileName
+ );
+ end else begin
+ ThreadItem := TThreadItem.Create(
+ nil,
+ Board,
+ urlHead + ChangeFileExt( Rec.FFileName, '' ) + '&ls=50',
+ islog,
+ Rec.FFileName
+ );
+ end;
+ end;
- if FileList.Count <> 0 then
- if FileList.Find( ThreadItem.FileName, Index ) then
- FileList.Delete( Index );
+ //ThreadItem.BeginUpdate;
+ if (datFileCheck) and (islog) then
+ FileList.Delete( Index );
- ThreadItem.BeginUpdate;
ThreadItem.No := Rec.FNo;
ThreadItem.FileName := Rec.FFileName;
- ThreadItem.Title := Rec.FTitle;
- //ThreadItem.ShortTitle := CustomStringReplace(ZenToHan(ThreadItem.Title), ' ', '');
+ ThreadItem.Title := MojuUtils.UnSanitize(Rec.FTitle);
ThreadItem.Count := Rec.FCount;
ThreadItem.Size := Rec.FSize;
-// ThreadItem.RoundNo := Rec.FRoundNo;
ThreadItem.RoundDate := Rec.FRoundDate;
ThreadItem.LastModified := Rec.FLastModified;
ThreadItem.Kokomade := Rec.FKokomade;
ThreadItem.NewReceive := Rec.FNewReceive;
-// ThreadItem.Round := Rec.FRound;
ThreadItem.UnRead := Rec.FUnRead;
ThreadItem.ScrollTop := Rec.FScrollTop;
ThreadItem.AllResCount := Rec.FAllResCount;
Node := FavoriteDM.TreeView.Items.AddChildObject( FavoriteDM.TreeView.Items.Item[0], ThreadItem.Title, FavoThreadItem);
*}
- //\8f\84\89ñ\83\8a\83X\83g\82É\91¶\8dÝ\82µ\82½\82ç\8f\84\89ñ\83t\83\89\83O\83Z\83b\83g
- if ThreadItem.IsLogFile then begin
- idx := RoundList.Find(ThreadItem);
- if idx <> -1 then begin
- RoundItem := RoundList.Items[idx, grtItem];
- ThreadItem.RoundName := RoundItem.RoundName;
- ThreadItem.Round := True;
- end;
- end;
-
- //\91O\89ñ\88Ù\8fí\8fI\97¹\8e\9e\83`\83F\83b\83N
- if TmpFileList.Count <> 0 then begin
- if TmpFileList.Find(ChangeFileExt(ThreadItem.FileName, '.tmp'), Index) then begin
- ini := TMemIniFile.Create(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
- try
- tmpStr := ini.ReadString('Setting', 'RoundDate', DateTimeToStr(ZERO_DATE));
- ThreadItem.RoundDate := ConvertDateTimeString(tmpStr);
-
- tmpStr := ini.ReadString('Setting', 'LastModified', DateTimeToStr(ZERO_DATE));
- ThreadItem.LastModified := ConvertDateTimeString(tmpStr);
- ThreadItem.Count := ini.ReadInteger('Setting', 'Count', 0);
- ThreadItem.NewReceive := ini.ReadInteger('Setting', 'NewReceive', 0);
-
- ThreadItem.Size := ini.ReadInteger('Setting', 'Size', 0);
- if(ThreadItem.Size = 0) and (FileExists(ThreadItem.GetThreadFileName)) then begin
- try
- ThreadItem.Size := GetFileSize(ThreadItem.GetThreadFileName) - ThreadItem.Count;
- except
- end;
- end;
-
-
- ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
- ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
- ThreadItem.ScrollTop := ini.ReadInteger('Setting', 'ScrollTop', 0);
- ThreadItem.AllResCount := ini.ReadInteger('Setting', 'AllResCount', ThreadItem.Count);
- ThreadItem.NewResCount := ini.ReadInteger('Setting', 'NewResCount', 0);
- ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger('Setting', 'AgeSage', Ord(gasNone)));
- finally
- ini.Free;
- end;
- DeleteFile(ExtractFilePath(Board.GetFolderIndexFileName) + TmpFileList[Index]);
- TmpFileList.Delete(Index);
- end;
- end;
-
- ThreadItem.EndUpdate;
+ //ThreadItem.EndUpdate;
Board.Add(ThreadItem);
- if (ThreadItem.IsLogFile) and (ThreadItem.UnRead) then
+ if (ThreadItem.UnRead) and (ThreadItem.IsLogFile) then
Inc(UnRead);
end;
end;
if UnRead <> Board.UnRead then
Board.UnRead := UnRead;
- //\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
- for i := 0 to FileList.Count - 1 do begin
- FileName := ExtractFileDir(Board.GetFolderIndexFileName) + '\' + FileList[i];
-
- //ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
- if usePlugIn then begin
- ThreadItem := TThreadItem.Create(
- Board.BoardPlugIn,
- Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), FileList[i] ) );
- ResRec := DivideStrLine(Board.BoardPlugIn.GetDat( DWORD( ThreadItem ), 1 ));
- end else begin
- ThreadItem := TThreadItem.Create(
- nil, Get2chBoard2ThreadURL( Board, ChangeFileExt( FileList[i], '' ) ) );
- ResRec := DivideStrLine(ReadThreadFile(FileName, 1));
- end;
-
- ThreadItem.BeginUpdate;
- ThreadItem.FilePath := FileName;
- ThreadItem.No := Board.Count + 1;
- ThreadItem.FileName := FileList[i];
- ThreadItem.Title := ResRec.FTitle;
- ThreadItem.Count := GetFileLineCount(FileName);
- ThreadItem.AllResCount := ThreadItem.Count;
- ThreadItem.NewResCount := ThreadItem.Count;
- 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é
- ThreadItem.RoundDate := ZERO_DATE;
- ThreadItem.LastModified := ZERO_DATE;
- ThreadItem.Kokomade := -1;
- ThreadItem.NewReceive := ThreadItem.Count;
- ThreadItem.ParentBoard := Board;
- ThreadItem.IsLogFile := True;
- ThreadItem.Round := False;
- ThreadItem.UnRead := False;
- ThreadItem.ScrollTop := 0;
- ThreadItem.AgeSage := gasNone;
- ThreadItem.EndUpdate;
- Board.Add(ThreadItem);
- end;
+ if (datFileCheck) then begin
+ //\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
+ AddOutofIndexDat(Board, FileList);
+ end;
Board.EndUpdate;
+
+ //\91O\89ñ\88Ù\8fí\8fI\97¹\8e\9e\83`\83F\83b\83N
+ RestoreThreadData( Board );
finally
sl.Free;
- FileList.Free;
- TmpFileList.Free;
+ if (datFileCheck) then begin
+ FileList.Free;
+ end;
Board.Sorted := False;
end;
Board.IsThreadDatRead := True;
+{$IFDEF DEBUG}
+ rt := GetTickCount - st;
+ Writeln('Read Done.' + Board.Title + ':' + IntToStr(rt) + ' ms');
+{$ENDIF}
+end;
+{!
+\brief \83C\83\93\83f\83b\83N\83X\82É\82È\82¢dat\81i\82Í\82®\82êdat\81j\82Ì\92Ç\89Á
+\param Board \92Ç\89Á\82·\82é\94Â
+\param DatList dat\83t\83@\83C\83\8b\96¼
+}
+procedure TGikoSys.AddOutofIndexDat(Board: TBoard; DatList: TStringList; AllCreate: Boolean = True);
+var
+ i : Integer;
+ Boardpath,FileName : String;
+ ResRec: TResRec;
+ ThreadItem: TThreadItem;
+ create: Boolean;
+begin
+ create := False;
+ Boardpath := ExtractFilePath(Board.GetFolderIndexFileName);
+ //\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
+ for i := 0 to DatList.Count - 1 do begin
+ FileName := Boardpath + DatList[i];
+ ThreadItem := nil;
+ if (not AllCreate) then begin
+ create := False;
+ ThreadItem := Board.FindThreadFromFileName(DatList[i]);
+ if (ThreadItem = nil) then begin
+ create := True;
+ end else begin
+ if Board.IsBoardPlugInAvailable then begin
+ THTMLCreate.DivideStrLine(Board.BoardPlugIn.GetDat( DWORD( ThreadItem ), 1 ), @ResRec);
+ end else begin
+ THTMLCreate.DivideStrLine(ReadThreadFile(FileName, 1), @ResRec);
+ end;
+ end;
+ end;
+ if (ThreadItem = nil) then begin
+ if Board.IsBoardPlugInAvailable then begin
+ ThreadItem := TThreadItem.Create(
+ Board.BoardPlugIn,
+ Board,
+ Board.BoardPlugIn.FileName2ThreadURL( DWORD( Board ), DatList[i] ) );
+ THTMLCreate.DivideStrLine(Board.BoardPlugIn.GetDat( DWORD( ThreadItem ), 1 ), @ResRec);
+ end else begin
+ ThreadItem := TThreadItem.Create(
+ nil,
+ Board,
+ Get2chBoard2ThreadURL( Board, ChangeFileExt( DatList[i], '' ) ) );
+ THTMLCreate.DivideStrLine(ReadThreadFile(FileName, 1), @ResRec);
+ end;
+ end;
+
+
+ ThreadItem.BeginUpdate;
+ ThreadItem.FileName := DatList[i];
+ //ThreadItem.FilePath := FileName;
+ ThreadItem.No := Board.Count + 1;
+ ThreadItem.Title := ResRec.FTitle;
+ ThreadItem.Count := GetFileLineCount(FileName);
+ ThreadItem.AllResCount := ThreadItem.Count;
+ ThreadItem.NewResCount := ThreadItem.Count;
+ 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é
+ ThreadItem.RoundDate := FileDateToDateTime( FileAge( FileName ) );
+ ThreadItem.LastModified := ThreadItem.RoundDate;
+ ThreadItem.Kokomade := -1;
+ ThreadItem.NewReceive := 0;
+ ThreadItem.ParentBoard := Board;
+ ThreadItem.IsLogFile := True;
+ ThreadItem.Round := False;
+ ThreadItem.UnRead := False;
+ ThreadItem.ScrollTop := 0;
+ ThreadItem.AgeSage := gasNone;
+ ThreadItem.EndUpdate;
+ if (AllCreate) or (create) then begin
+ Board.Add(ThreadItem);
+ end;
+ end;
end;
-
-(*************************************************************************
- *\83X\83\8c\83b\83h\83C\83\93\83f\83b\83N\83X\83t\83@\83C\83\8b(Folder.idx)\8dì\90¬
- *************************************************************************)
+{!
+\brief \83X\83\8c\83b\83h\83C\83\93\83f\83b\83N\83X\83t\83@\83C\83\8b(Folder.idx)\8dì\90¬
+\param Board Folder.idx \82ð\8dì\90¬\82·\82é\94Â
+}
procedure TGikoSys.CreateThreadDat(Board: TBoard);
var
i: integer;
sl := TStringList.Create;
try
cnt := 1;
+ sl.BeginUpdate;
sl.Add(FOLDER_INDEX_VERSION);
for i := 0 to SubjectList.Count - 1 do begin
Rec := DivideSubject(SubjectList[i]);
if (Trim(Rec.FFileName) = '') or (Trim(Rec.FTitle) = '') then
Continue;
- s := Format('%x', [cnt]) + #1 //\94Ô\8d\86
+ {s := Format('%x', [cnt]) + #1 //\94Ô\8d\86
+ Rec.FFileName + #1 //\83t\83@\83C\83\8b\96¼
+ Rec.FTitle + #1 //\83^\83C\83g\83\8b
+ Format('%x', [Rec.FCount]) + #1 //\83J\83E\83\93\83g
+ Format('%x', [Rec.FCount]) + #1 //AllResCount
+ Format('%x', [0]) + #1 //NewResCount
+ Format('%x', [0]); //AgeSage
+ }
+ s := Format('%x'#1'%s'#1'%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1 +
+ '%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x',
+ [cnt, //\94Ô\8d\86
+ Rec.FFileName, //\83t\83@\83C\83\8b\96¼
+ MojuUtils.Sanitize(Rec.FTitle), //\83^\83C\83g\83\8b
+ Rec.FCount, //\83J\83E\83\93\83g
+ 0, //size
+ 0, //RoundDate
+ 0, //LastModified
+ 0, //Kokomade
+ 0, //NewReceive
+ '0', //\96¢\8eg\97p
+ 0, //UnRead
+ 0, //ScrollTop
+ Rec.FCount, //AllResCount
+ 0, //NewResCount
+ 0] //AgeSage
+ );
sl.Add(s);
inc(cnt);
end;
+ sl.EndUpdate;
sl.SaveToFile(FileName);
finally
sl.Free;
end;
end;
-(*************************************************************************
- *\83X\83\8c\83b\83h\83C\83\93\83f\83b\83N\83X(Thread.dat)\8f\91\82«\8d\9e\82Ý
- *Public
- *************************************************************************)
+{!
+\brief \83X\83\8c\83b\83h\83C\83\93\83f\83b\83N\83X(Thread.dat)\8f\91\82«\8d\9e\82Ý
+\param Thread.dat \82ð\8dì\90¬\82·\82é\94Â
+}
procedure TGikoSys.WriteThreadDat(Board: TBoard);
//const
// Values: array[Boolean] of string = ('0', '1');
TmpFileList := TStringList.Create;
TmpFileList.Sorted := true;
try
+ TmpFileList.BeginUpdate;
GetFileList(ExtractFileDir(Board.GetFolderIndexFileName), '*.tmp', TmpFileList, false);
+ TmpFileList.EndUpdate;
sl.BeginUpdate;
sl.Add(FOLDER_INDEX_VERSION);
// \83X\83\8c\94Ô\8d\86\95Û\91¶\82Ì\82½\82ß\83\\81[\83g
- Sort.SortNoFlag := true;
- Sort.SortOrder := true;
- Sort.SortIndex := 0;
+ Sort.SetSortNoFlag(true);
+ Sort.SetSortOrder(true);
+ Sort.SetSortIndex(0);
//Sort.SortNonAcquiredCountFlag := GikoSys.Setting.NonAcquiredCount;
Board.CustomSort(ThreadItemSortProc);
for i := 0 to Board.Count - 1 do begin
Board.Items[i].No := i + 1;
- s := Format('%x', [Board.Items[i].No]) + #1
- + Board.Items[i].FileName + #1
- + Board.Items[i].Title + #1
- + Format('%x', [Board.Items[i].Count]) + #1
- + Format('%x', [Board.Items[i].Size]) + #1
- + Format('%x', [DateTimeToInt(Board.Items[i].RoundDate)]) + #1
- + Format('%x', [DateTimeToInt(Board.Items[i].LastModified)]) + #1
- + Format('%x', [Board.Items[i].Kokomade]) + #1
- + Format('%x', [Board.Items[i].NewReceive]) + #1
- + '0' + #1 //\96¢\8eg\97p
- + Format('%x', [BoolToInt(Board.Items[i].UnRead)]) + #1
- + Format('%x', [Board.Items[i].ScrollTop]) + #1
- + Format('%x', [Board.Items[i].AllResCount]) + #1
- + Format('%x', [Board.Items[i].NewResCount]) + #1
- + Format('%x', [Ord(Board.Items[i].AgeSage)]);
+ s := Format('%x'#1'%s'#1'%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x'#1 +
+ '%s'#1'%x'#1'%x'#1'%x'#1'%x'#1'%x',
+ [Board.Items[i].No, //\94Ô\8d\86
+ Board.Items[i].FileName, //\83t\83@\83C\83\8b\96¼
+ MojuUtils.Sanitize(Board.Items[i].Title), //\83^\83C\83g\83\8b
+ Board.Items[i].Count, //\83J\83E\83\93\83g
+ Board.Items[i].Size, //size
+ DateTimeToInt(Board.Items[i].RoundDate), //RoundDate
+ DateTimeToInt(Board.Items[i].LastModified), //LastModified
+ Board.Items[i].Kokomade, //Kokomade
+ Board.Items[i].NewReceive, //NewReceive
+ '0', //\96¢\8eg\97p
+ BoolToInt(Board.Items[i].UnRead), //UnRead
+ Board.Items[i].ScrollTop, //ScrollTop
+ Board.Items[i].AllResCount, //AllResCount
+ Board.Items[i].NewResCount, //NewResCount
+ Ord(Board.Items[i].AgeSage)] //AgeSage
+ );
sl.Add(s);
end;
end;
end;
+{!
+\brief Folder.idx \82ð 1 \8ds\89ð\8eß
+\param Line Folder.idx \82ð\8d\\90¬\82·\82é 1 \8ds
+\return \83X\83\8c\83b\83h\8fî\95ñ
+}
function TGikoSys.ParseIndexLine(Line: string): TIndexRec;
begin
- Result.FNo := StrToIntDef('$' + RemoveToken(Line, #1), 0);
- Result.FFileName := RemoveToken(Line, #1);
- Result.FTitle := RemoveToken(Line, #1);
- Result.FCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
- Result.FSize := StrToIntDef('$' + RemoveToken(Line, #1), 0);
- Result.FRoundDate := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
- Result.FLastModified := IntToDateTime(StrToIntDef('$' + RemoveToken(Line, #1), ZERO_DATE));
- Result.FKokomade := StrToIntDef('$' + RemoveToken(Line, #1), -1);
- Result.FNewReceive := StrToIntDef('$' + RemoveToken(Line, #1), 0);
- RemoveToken(Line, #1);//9: ; //\96¢\8eg\97p
- Result.FUnRead := IntToBool(StrToIntDef('$' + RemoveToken(Line, #1), 0));
- Result.FScrollTop := StrToIntDef('$' + RemoveToken(Line, #1), 0);
- Result.FAllResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
- Result.FNewResCount := StrToIntDef('$' + RemoveToken(Line, #1), 0);
- Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + RemoveToken(Line, #1), 0));
-
-end;
-
-//\8ew\92è\83t\83H\83\8b\83_\93à\82Ì\8ew\92è\83t\83@\83C\83\8b\88ê\97\97\82ð\8eæ\93¾\82·\82é
-// ListFiles('c:\', '*.txt', list, True);
+ Result.FNo := StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), 0);
+ Result.FFileName := MojuUtils.RemoveToken(Line, #1);
+ Result.FTitle := MojuUtils.UnSanitize(MojuUtils.RemoveToken(Line, #1));
+ Result.FCount := StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), 0);
+ Result.FSize := StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), 0);
+ Result.FRoundDate := IntToDateTime(StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), ZERO_DATE));
+ Result.FLastModified := IntToDateTime(StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), ZERO_DATE));
+ Result.FKokomade := StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), -1);
+ Result.FNewReceive := StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), 0);
+ MojuUtils.RemoveToken(Line, #1);//9: ; //\96¢\8eg\97p
+ Result.FUnRead := IntToBool(StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), 0));
+ Result.FScrollTop := StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), 0);
+ Result.FAllResCount := StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), 0);
+ Result.FNewResCount := StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), 0);
+ Result.FAgeSage := TGikoAgeSage(StrToIntDef('$' + MojuUtils.RemoveToken(Line, #1), 0));
+
+end;
+
+{!
+\brief \8ew\92è\83t\83H\83\8b\83_\93à\82Ì\8ew\92è\83t\83@\83C\83\8b\88ê\97\97\82ð\8eæ\93¾\82·\82é
+\param Path \8bN\93_\82Æ\82È\82é\83t\83H\83\8b\83_\83p\83X
+\param Mask \83t\83@\83C\83\8b\96¼\82Ì\83}\83X\83N
+\param List OUT:\8eæ\93¾\82³\82ê\82½\83t\83@\83C\83\8b\96¼\88ê\97\97\82ª\95Ô\82é
+\param SubDir \92\86\82Ì\83t\83H\83\8b\83_\82Ü\82Å\8dÄ\8bA\93I\82É\83\8a\83X\83g\82·\82é\8fê\8d\87\82Í True
+\param IsPathAdd \83p\83X\95t\82«\82Å\83\8a\83X\83g\83A\83b\83v\82·\82é\8fê\8d\87\82Í True
+
+Mask \82ð '*.txt' \82Ì\82æ\82¤\82É\8ew\92è\82·\82é\82±\82Æ\82Å\81A
+\93Á\92è\82Ì\83t\83@\83C\83\8b\96¼\82â\93Á\92è\82Ì\8ag\92£\8eq\82É\8di\82Á\82½\83\8a\83X\83g\83A\83b\83v\82ª\89Â\94\\82Å\82·\81B
+
+\par \97á:
+\code
+GetFileList('c:\', '*.txt', list, True, True);
+\endcode
+}
procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; SubDir: Boolean; IsPathAdd: Boolean);
var
rc: Integer;
SearchRec : TSearchRec;
s: string;
- maskExt: string;
begin
- maskExt := Copy(Mask, 1, Length(Mask) - 1);
-
Path := IncludeTrailingPathDelimiter(Path);
rc := FindFirst(Path + '*.*', faAnyfile, SearchRec);
try
while rc = 0 do begin
if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
s := Path + SearchRec.Name;
- //if (SearchRec.Attr and faDirectory > 0) then
- // s := IncludeTrailingPathDelimiter(s)
if (SearchRec.Attr and faDirectory = 0) and (MatchesMask(s, Mask)) then
if IsPathAdd then
end;
List.Sort;
end;
-//\8ew\92è\83t\83H\83\8b\83_\93à\82Ì\8ew\92è\83t\83@\83C\83\8b\88ê\97\97\82ð\8eæ\93¾\82·\82é
-//\83T\83u\83t\83H\83\8b\83_\82Í\8c\9f\8dõ\82µ\82È\82¢
-// ListFiles('c:\', '*.txt', list, True);
+
+{!
+\breif \8ew\92è\83t\83H\83\8b\83_\93à\82Ì\8ew\92è\83t\83@\83C\83\8b\88ê\97\97\82ð\8eæ\93¾\82·\82é\81B
+ \83T\83u\83t\83H\83\8b\83_\82Í\8c\9f\8dõ\82µ\82È\82¢
+\param Path \8bN\93_\82Æ\82È\82é\83t\83H\83\8b\83_\83p\83X
+\param Mask \83t\83@\83C\83\8b\96¼\82Ì\83}\83X\83N
+\param List OUT:\8eæ\93¾\82³\82ê\82½\83t\83@\83C\83\8b\96¼\88ê\97\97\82ª\95Ô\82é
+\param IsPathAdd \83p\83X\95t\82«\82Å\83\8a\83X\83g\83A\83b\83v\82·\82é\8fê\8d\87\82Í True
+\note \8dÄ\8bN\8ew\92è\89Â\94\\82È GetFileList() \82ª\82 \82é\82Ì\82Å\82±\82Ì\8aÖ\90\94\82Í\95s\97v?
+\par \97á
+\code
+GetFileList('c:\', '*.txt', list, True);
+\endcode
+}
procedure TGikoSys.GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean);
var
rc: Integer;
SearchRec : TSearchRec;
- s: string;
begin
Path := IncludeTrailingPathDelimiter(Path);
rc := FindFirst(Path + Mask, faAnyfile, SearchRec);
try
while rc = 0 do begin
if (SearchRec.Name <> '..') and (SearchRec.Name <> '.') then begin
- s := Path + SearchRec.Name;
-
- if (SearchRec.Attr and faDirectory = 0) then
- if IsPathAdd then
- List.Add(s)
- else
- List.Add(SearchRec.Name);
+ if (SearchRec.Attr and faDirectory = 0) then begin
+ if IsPathAdd then begin
+ List.Add(Path + SearchRec.Name)
+ end else begin
+ List.Add(SearchRec.Name);
+ end;
+ end;
end;
rc := FindNext(SearchRec);
end;
end;
List.Sort;
end;
-//\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é
+
+{!
+\brief \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é
+\param Path \8bN\93_\82Æ\82È\82é\83t\83H\83\8b\83_\83p\83X
+\param Mask \83t\83H\83\8b\83_\96¼\82Ì\83}\83X\83N
+\param List OUT:\8eæ\93¾\82³\82ê\82½\83t\83H\83\8b\83_\96¼\88ê\97\97\82ª\95Ô\82é
+\param SubDir \92\86\82Ì\83t\83H\83\8b\83_\82Ü\82Å\8dÄ\8bA\93I\82É\83\8a\83X\83g\82·\82é\8fê\8d\87\82Í True
+
+Mask \82ð '*.txt' \82Ì\82æ\82¤\82É\8ew\92è\82·\82é\82±\82Æ\82Å\81A
+\93Á\92è\82Ì\83t\83@\83C\83\8b\96¼\82â\93Á\92è\82Ì\8ag\92£\8eq\82É\8di\82Á\82½\83\8a\83X\83g\83A\83b\83v\82ª\89Â\94\\82Å\82·\81B
+
+\par \97á:
+\code
+GetDirectoryList('c:\', '*.txt', list, True);
+\endcode
+}
procedure TGikoSys.GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean);
var
rc: Integer;
end;
end;
-// \83X\83L\83\93\82ð\93Ç\82Ý\8d\9e\82Ý\81A\92l\82ð\92u\8a·\82·\82é
-function TGikoSys.LoadFromSkin(
- fileName: string;
- ThreadItem: TThreadItem;
- SizeByte: Integer
-): string;
+
+{!
+\brief Subject.txt \88ê\8ds\82ð\89ð\8eß
+\param Line Subject.txt \82ð\8d\\90¬\82·\82é 1 \8ds
+\return \83X\83\8c\83b\83h\8fî\95ñ
+}
+function TGikoSys.DivideSubject(Line: string): TSubjectRec;
var
- Skin: TStringList;
+ i: integer;
+ ws: WideString;
+ Delim: string;
+ LeftK: string;
+ RightK: string;
begin
+ Result.FCount := 0;
- Skin := TStringList.Create;
- try
- if FileExists( fileName ) then begin
- Skin.LoadFromFile( fileName );
+ if AnsiPos('<>', Line) = 0 then
+ Delim := ','
+ else
+ Delim := '<>';
+ Result.FFileName := MojuUtils.RemoveToken(Line, Delim);
+ Result.FTitle := Trim(MojuUtils.RemoveToken(Line, Delim));
- // \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
- try
- if ThreadItem.ParentBoard <> nil then
- if ThreadItem.ParentBoard.ParentCategory <> nil then
- CustomStringReplace( Skin, '<BBSNAME/>', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
- CustomStringReplace( Skin, '<THREADURL/>', ThreadItem.URL);
- except end;
- CustomStringReplace( Skin, '<BOARDNAME/>', ThreadItem.ParentBoard.Title);
- CustomStringReplace( Skin, '<BOARDURL/>', ThreadItem.ParentBoard.URL);
- CustomStringReplace( Skin, '<THREADNAME/>', ThreadItem.Title);
- CustomStringReplace( Skin, '<SKINPATH/>', Setting.CSSFileName);
- CustomStringReplace( Skin, '<GETRESCOUNT/>', IntToStr( ThreadItem.Count - ThreadItem.NewResCount ));
- CustomStringReplace( Skin, '<NEWRESCOUNT/>', IntToStr( ThreadItem.NewResCount ));
- CustomStringReplace( Skin, '<ALLRESCOUNT/>', IntToStr( ThreadItem.Count ));
-
- CustomStringReplace( Skin, '<NEWDATE/>',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
- CustomStringReplace( Skin, '<SIZEKB/>', IntToStr( Floor( SizeByte / 1024 ) ));
- CustomStringReplace( Skin, '<SIZE/>', IntToStr( SizeByte ));
-
- //----- \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µ
- // \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
- try
- if ThreadItem.ParentBoard <> nil then
- if ThreadItem.ParentBoard.ParentCategory <> nil then
- CustomStringReplace( Skin, '&BBSNAME', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title);
- CustomStringReplace( Skin, '&THREADURL', ThreadItem.URL);
- except end;
- CustomStringReplace( Skin, '&BOARDNAME', ThreadItem.ParentBoard.Title);
- CustomStringReplace( Skin, '&BOARDURL', ThreadItem.ParentBoard.URL);
- CustomStringReplace( Skin, '&THREADNAME', ThreadItem.Title);
- CustomStringReplace( Skin, '&SKINPATH', Setting.CSSFileName);
- CustomStringReplace( Skin, '&GETRESCOUNT', IntToStr( ThreadItem.NewReceive - 1 ));
- CustomStringReplace( Skin, '&NEWRESCOUNT', IntToStr( ThreadItem.NewResCount ));
- CustomStringReplace( Skin, '&ALLRESCOUNT', IntToStr( ThreadItem.AllResCount ));
-
- CustomStringReplace( Skin, '&NEWDATE', FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate));
- CustomStringReplace( Skin, '&SIZEKB', IntToStr( Floor( SizeByte / 1024 ) ));
- CustomStringReplace( Skin, '&SIZE', IntToStr( SizeByte ));
- //----- \82±\82±\82Ü\82Å
+ ws := Result.FTitle;
+ if Copy(ws, Length(ws), 1) = ')' then begin
+ LeftK := '(';
+ RightK := ')';
+ end else if Copy(ws, Length(ws)-1, 2) = '\81j' then begin
+ LeftK := '\81i';
+ RightK := '\81j';
+ end else if Copy(ws, Length(ws), 1) = '>' then begin
+ LeftK := '<';
+ RightK := '>';
+ end;
+ for i := Length(ws) - 1 downto 1 do begin
+ if Copy(ws, i, Length(LeftK)) = LeftK then begin
+ Result.FTitle := TrimRight(Copy(ws, 1, i - 1));
+ ws := Copy(ws, i + Length(LeftK), Length(ws) - i - Length(RightK));
+ if IsNumeric(ws) then
+ Result.FCount := StrToInt(ws);
+ //Delete(Result.FTitle, i, Length(LeftK) + Length(ws) + Length(RightK));
+ break;
end;
- Result := Skin.Text;
- finally
- Skin.Free;
end;
end;
-// \83\8c\83X\82Ì\92l\82ð\92u\8a·\82·\82é
-function TGikoSys.SkinedRes(
- skin: string;
- Res: TResRec;
- No: string
-): string;
+{!
+\brief URL\82©\82çBBSID\82ð\8eæ\93¾
+\param url BBSID \82ð\8eæ\93¾\82·\82é URL
+\return BBSID
+}
+function TGikoSys.UrlToID(url: string): string;
var
- spamminess : Extended;
- wordCount : TWordCount;
+ i: integer;
begin
+ Result := '';
+ url := Trim(url);
- wordCount := TWordCount.Create;
+ if url = '' then Exit;
try
- spamminess := Floor( SpamParse(
- Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 );
-
- Skin := CustomStringReplace( Skin, '<NUMBER/>',
- '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
- Skin := CustomStringReplace( Skin, '<PLAINNUMBER/>', No);
- Skin := CustomStringReplace( Skin, '<NAME/>', '<b>' + Res.FName + '</b>');
- Skin := CustomStringReplace( Skin, '<MAILNAME/>',
- '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
- Skin := CustomStringReplace( Skin, '<MAIL/>', Res.FMailTo);
- Skin := CustomStringReplace( Skin, '<DATE/>', Res.FDateTime);
- Skin := CustomStringReplace( Skin, '<MESSAGE/>', Res.FBody);
- Skin := CustomStringReplace( Skin, '<SPAMMINESS/>', FloatToStr( spamminess ) );
- Skin := CustomStringReplace( Skin, '<NONSPAMMINESS/>', FloatToStr( 100 - spamminess ) );
-
- //----- \82©\82¿\82ã\81`\82µ\82á\8cÝ\8a·\97p\81B\83R\83\81\83\93\83g\83A\83E\83g\82µ\82Ä\82à\82æ\82µ
- Skin := CustomStringReplace( Skin, '&NUMBER',
- '<a href="menu:' + No + '" name="' + No + '">' + No + '</a>');
- Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No);
- Skin := CustomStringReplace( Skin, '&NAME', '<b>' + Res.FName + '</b>');
- Skin := CustomStringReplace( Skin, '&MAILNAME',
- '<a href="mailto:' + Res.FMailTo + '"><b>' + Res.FName + '</b></a>');
- Skin := CustomStringReplace( Skin, '&MAIL', Res.FMailTo);
- Skin := CustomStringReplace( Skin, '&DATE', Res.FDateTime);
- Skin := CustomStringReplace( Skin, '&MESSAGE', Res.FBody);
- Skin := CustomStringReplace( Skin, '&SPAMMINESS', FloatToStr( spamminess ) );
- Skin := CustomStringReplace( Skin, '&NONSPAMMINESS', FloatToStr( 100 - spamminess ) );
- //----- \82±\82±\82Ü\82Å
-
- Result := Skin;
- finally
- wordCount.Free;
+ url := Copy(url, 0, Length(url) - 1);
+ for i := Length(url) downto 0 do begin
+ if url[i] = '/' then begin
+ Result := Copy(url, i + 1, Length(url));
+ Break;
+ end;
+ end;
+ except
+ Result := '';
end;
-
end;
-procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string);
+{!
+\brief URL\82©\82ç\8dÅ\8cã\82Ì\97v\91f\82ð\8dí\8f\9c
+\param url \89ð\8eß\82·\82é URL
+\return \90Ø\82è\8eæ\82ç\82ê\82½\8cã\82Ì URL
+
+URL \82©\82ç BBSID\88È\8aO\82Ì\95\94\95ª\82ð\8eæ\93¾\82·\82é\82Ì\82É\8eg\97p\82µ\82Ü\82·\81B
+}
+function TGikoSys.UrlToServer(url: string): string;
var
i: integer;
- No: string;
- //bufList : TStringList;
- ReadList: TStringList;
- SaveList: TStringList;
- CSSFileName: string;
- BBSID: string;
- FileName: string;
- NewReceiveNo: Integer;
- Res: TResRec;
- boardPlugIn : TBoardPlugIn;
+ wsURL: WideString;
+begin
+ Result := '';
+ wsURL := url;
+ wsURL := Trim(wsURL);
- UserOptionalStyle: string;
- SkinHeader: string;
- SkinNewRes: string;
- SkinRes: string;
+ if wsURL = '' then exit;
- strTmp : string;
+ if Copy(wsURL, Length(wsURL), 1) = '/' then
+ wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
- function LoadSkin( fileName: string ): string;
- begin
- Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
- end;
- function ReplaceRes( skin: string ): string;
- begin
- Result := SkinedRes( skin, Res, No );
+ for i := Length(wsURL) downto 0 do begin
+ if wsURL[i] = '/' then begin
+ Result := Copy(wsURL, 0, i);
+ break;
+ end;
end;
-begin
- if ThreadItem <> nil then begin
- if ThreadItem.IsBoardPlugInAvailable then begin
- //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
- boardPlugIn := ThreadItem.BoardPlugIn;
- NewReceiveNo := ThreadItem.NewReceive;
- // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
- if Length( GikoSys.Setting.BrowserFontName ) > 0 then
- UserOptionalStyle := UserOptionalStyle +
- 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
- if GikoSys.Setting.BrowserFontSize <> 0 then
- UserOptionalStyle := UserOptionalStyle +
- 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
- if GikoSys.Setting.BrowserFontColor <> -1 then
- UserOptionalStyle := UserOptionalStyle +
- 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
- if GikoSys.Setting.BrowserBackColor <> -1 then
- UserOptionalStyle := UserOptionalStyle +
- 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
- case GikoSys.Setting.BrowserFontBold of
- -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
- 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
- end;
- case GikoSys.Setting.BrowserFontItalic of
- -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
- 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
- end;
-
- SaveList := TStringList.Create;
- try
- doc.open;
- // \95¶\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
- // doc.charset := 'Shift_JIS';
-
- // \83w\83b\83_
- SaveList.Add( boardPlugIn.GetHeader( DWORD( threadItem ),
- '<style type="text/css">body {' + UserOptionalStyle + '}</style>' ) );
-
- SaveList.Add('<p id="idSearch"></p>');
- for i := 0 to threadItem.Count - 1 do begin
- // 1 \82Í\95K\82¸\95\\8e¦
- if i <> 0 then begin
- // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
- case ResRange of
- Ord( grrKoko ):
- if ThreadItem.Kokomade > (i + 1) then
- Continue;
- Ord( grrNew ):
- if NewReceiveNo > (i + 1) then
- Continue;
- 10..65535:
- if (threadItem.Count - i) > ResRange then
- Continue;
- end;
- end;
+end;
- // \90V\92\85\83}\81[\83N
- if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
- try
- if GikoSys.Setting.UseSkin then begin
- if FileExists( GetSkinNewmarkFileName ) then
- SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
- else
- SaveList.Add( '<a name="new"></a>' );
- end else if GikoSys.Setting.UseCSS then begin
- SaveList.Add('<a name="new"></a><div class="new">\90V\92\85\83\8c\83X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
- end else begin
- SaveList.Add('</dl>');
- SaveList.Add('<a name="new"></a>');
- SaveList.Add('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>\90V\92\85\83\8c\83X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
- SaveList.Add('<dl>');
- end;
- except
- SaveList.Add( '<a name="new"></a>' );
- end;
- end;
+{!
+\brief \83f\83B\83\8c\83N\83g\83\8a\82ª\91¶\8dÝ\82·\82é\82©\83`\83F\83b\83N
+\param Name \91¶\8dÝ\82ð\8am\94F\82·\82é\83t\83H\83\8b\83_\83p\83X
+\return \83t\83H\83\8b\83_\82ª\91¶\8dÝ\82·\82é\82È\82ç True
+}
+function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
+var
+ Code: Cardinal;
+begin
+ Code := GetFileAttributes(PChar(Name));
+ Result := (Code <> Cardinal(-1)) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
+end;
- // \83\8c\83X
- SaveList.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) );
+{!
+\brief \83f\83B\83\8c\83N\83g\83\8a\8dì\90¬\81i\95¡\90\94\8aK\91w\91Î\89\9e\81j
+\param Dir \8dì\90¬\82·\82é\83p\83X
+\return \8dì\90¬\82É\90¬\8c÷\82µ\82½\8fê\8d\87\82Í True
+}
+function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
+begin
+ Result := True;
+ if Length(Dir) = 0 then
+ raise Exception.Create('\83t\83H\83\8b\83_\82ª\8dì\90¬\8fo\97\88\82Ü\82¹\82ñ');
+ Dir := ExcludeTrailingPathDelimiter(Dir);
+ if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
+ or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
+ Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
+end;
- if ThreadItem.Kokomade = (i + 1) then begin
- // \82±\82±\82Ü\82Å\93Ç\82ñ\82¾
- try
- if GikoSys.Setting.UseSkin then begin
- if FileExists( GetSkinBookmarkFileName ) then
- SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
- else
- SaveList.Add( '<a name="koko"></a>' );
- end else if GikoSys.Setting.UseCSS then begin
- SaveList.Add('<a name="koko"></a><div class="koko">\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</div>');
- end else begin
- SaveList.Add('</dl>');
- SaveList.Add('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</b></font></td></tr></table>');
- SaveList.Add('<dl>');
- end;
- except
- SaveList.Add( '<a name="koko"></a>' );
- end;
- end;
+{!
+\brief \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
+ FDelphi\82©\82ç\82Ì\83p\83N\83\8a
+\param s \8c³\82É\82È\82é\83L\83\83\83\89\83N\83^
+\param sep \8bæ\90Ø\82è\82É\82È\82é\95¶\8e\9a\97ñ
+\param Rec OUT:\95¶\8e\9a\97ñ\91\96\8d¸\8fî\95ñ\82ª\95Ô\82é
+\return \90Ø\82è\8fo\82µ\82½\83g\81[\83N\83\93
+\todo Split, RemoveToken, GetTokenIndex, NthField \8ds\82«
+}
+function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
+begin
+ Rec.Str := s;
+ Rec.Pos := 1;
+ Result := StrTokNext(sep, Rec);
+end;
- doc.Write(SaveList.Text);
- SaveList.Clear;
+{!
+\brief \95¶\8e\9a\97ñ\82©\82ç\83g\81[\83N\83\93\82Ì\90Ø\82è\8fo\82µ
+ FDelphi\82©\82ç\82Ì\83p\83N\83\8a
+\param sep \8bæ\90Ø\82è\82É\82È\82é\83L\83\83\83\89\83N\83^
+\param Rec IN/OUT:StrTokFirst\82Å\8dì\90¬\82³\82ê\82½\95¶\8e\9a\97ñ\91\96\8d¸\8fî\95ñ
+\return \90Ø\82è\8fo\82µ\82½\83g\81[\83N\83\93
+\todo Split, RemoveToken, GetTokenIndex, NthField \8ds\82«
+}
+function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
+var
+ Len, I: Integer;
+begin
+ with Rec do begin
+ Len := Length(Str);
+ Result := '';
+ if Len >= Pos then begin
+ while (Pos <= Len) and (Str[Pos] in sep) do begin
+ Inc(Pos);
+ end;
+ I := Pos;
+ while (Pos<= Len) and not (Str[Pos] in sep) do begin
+ if IsDBCSLeadByte(Byte(Str[Pos])) then begin
+ Inc(Pos);
end;
-
-
- // \83X\83L\83\93(\83t\83b\83^)
- SaveList.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
- doc.Write(SaveList.Text);
- finally
- SaveList.Free;
- doc.Close;
+ Inc(Pos);
+ end;
+ Result := Copy(Str, I, Pos - I);
+ while (Pos <= Len) and (Str[Pos] in sep) do begin// \82±\82ê\82Í\82¨\8dD\82Ý
+ Inc(Pos);
end;
+ end;
+ end;
+end;
+{!
+\brief \83t\83@\83C\83\8b\83T\83C\83Y\8eæ\93¾
+\param FileName \83t\83@\83C\83\8b\83T\83C\83Y\82ð\8eæ\93¾\82·\82é\83t\83@\83C\83\8b\83p\83X
+\return \83t\83@\83C\83\8b\83T\83C\83Y(bytes)
+}
+function TGikoSys.GetFileSize(FileName : string): longint;
+var
+ F : File;
+begin
+ try
+ if not FileExists(FileName) then begin
+ Result := 0;
Exit;
end;
+ Assign(F, FileName);
+ Reset(F, 1);
+ Result := FileSize(F);
+ CloseFile(F);
+ except
+ Result := 0;
end;
- ShortDayNames[1] := '\93ú'; ShortDayNames[2] := '\8c\8e';
- ShortDayNames[3] := '\89Î'; ShortDayNames[4] := '\90\85';
- ShortDayNames[5] := '\96Ø'; ShortDayNames[6] := '\8bà';
- ShortDayNames[7] := '\93y';
- BBSID := ThreadItem.ParentBoard.BBSID;
- NewReceiveNo := ThreadItem.NewReceive;
- ReadList := TStringList.Create;
+end;
+
+{!
+\brief \83e\83L\83X\83g\83t\83@\83C\83\8b\82Ì\8ds\90\94\82ð\8eæ\93¾
+\param FileName \8ds\90\94\82ð\8eæ\93¾\82·\82é\83t\83@\83C\83\8b\83p\83X
+\return \8ds\90\94
+\todo \83\81\83\82\83\8a\83}\83b\83v\83h\83t\83@\83C\83\8b\8ds\82«
+}
+function TGikoSys.GetFileLineCount(FileName : string): longint;
+var
+ sl: TStringList;
+begin
+ sl := TStringList.Create;
try
- if ThreadItem.IsLogFile then begin
- FileName := ThreadItem.GetThreadFileName;
- ReadList.LoadFromFile(FileName);
- FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
- FAbon.Execute(ReadList); // \82 \82Ú\81`\82ñ\82µ\82Ä
- FSelectResFilter.Execute(ReadList); //\83\8c\83X\82Ì\83t\83B\83\8b\83^\83\8a\83\93\83O\82ð\82·\82é
- Res := DivideStrLine(ReadList[0]);
- Res.FTitle := CustomStringReplace(Res.FTitle, '\81\97\81M', ',');
- sTitle := Res.FTitle;
- end else begin
- sTitle := CustomStringReplace(ThreadItem.Title, '\81\97\81M', ',');
- end;
- SaveList := TStringList.Create;
try
- doc.open;
- doc.charset := 'Shift_JIS';
-
- // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
- if Length( GikoSys.Setting.BrowserFontName ) > 0 then
- UserOptionalStyle := UserOptionalStyle +
- 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
- if GikoSys.Setting.BrowserFontSize <> 0 then
- UserOptionalStyle := UserOptionalStyle +
- 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
- if GikoSys.Setting.BrowserFontColor <> -1 then
- UserOptionalStyle := UserOptionalStyle +
- 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
- if GikoSys.Setting.BrowserBackColor <> -1 then
- UserOptionalStyle := UserOptionalStyle +
- 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
- case GikoSys.Setting.BrowserFontBold of
- -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
- 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
- end;
- case GikoSys.Setting.BrowserFontItalic of
- -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
- 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
- end;
-
- CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
- if GikoSys.Setting.UseSkin then begin
- // \83X\83L\83\93\8eg\97p
- // \83X\83L\83\93\82Ì\90Ý\92è
- try
- SkinHeader := LoadSkin( GetSkinHeaderFileName );
- if Length( UserOptionalStyle ) > 0 then
- SkinHeader := CustomStringReplace( SkinHeader, '</head>',
- '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
- SaveList.Add( SkinHeader );
- except
- end;
- try
- SkinNewRes := LoadSkin( GetSkinNewResFileName );
- except
- end;
- try
- SkinRes := LoadSkin( GetSkinResFileName );
- except
- end;
- SaveList.Add('<p id="idSearch"></p>');
- SaveList.Add('<a name="top"></a>');
-
- for i := 0 to ReadList.Count - 1 do begin
- // 1 \82Í\95K\82¸\95\\8e¦
- if i <> 0 then begin
- // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
- case ResRange of
- Ord( grrKoko ):
- if ThreadItem.Kokomade > (i + 1) then
- Continue;
- Ord( grrNew ):
- if NewReceiveNo > (i + 1) then
- Continue;
- 10..65535:
- if (threadItem.Count - i) > ResRange then
- Continue;
- end;
- end;
-
- // \90V\92\85\83}\81[\83N
- if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin
- try
- if FileExists( GetSkinNewmarkFileName ) then
- SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) )
- else
- SaveList.Add( '<a name="new"></a>' );
- except
- SaveList.Add( '<a name="new"></a>' );
- end;
- end;
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
-
- Res := DivideStrLine(ReadList[i]);
- if Res.FType = glt2chOld then begin
- Res.FMailTo := CustomStringReplace(Res.FMailTo, '\81\97\81M', ',');
- Res.FName := CustomStringReplace(Res.FName, '\81\97\81M', ',');
- Res.FBody := CustomStringReplace(Res.FBody, '\81\97\81M', ',');
- end;
-
- Res.FBody := AddAnchorTag(Res.FBody);
- Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
-
- try
- if NewReceiveNo <= (i + 1) then
- // \90V\92\85\83\8c\83X
- strTmp := ReplaceRes( SkinNewRes )
- else
- // \92Ê\8fí\82Ì\83\8c\83X
- strTmp := ReplaceRes( SkinRes );
-
- SaveList.Add( strTmp );
- except
- end;
- end;
-
- if ThreadItem.Kokomade = (i + 1) then begin
- // \82±\82±\82Ü\82Å\93Ç\82ñ\82¾
- try
- if FileExists( GetSkinBookmarkFileName ) then
- SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) )
- else
- SaveList.Add( '<a name="koko"></a>' );
- except
- SaveList.Add( '<a name="koko"></a>' );
- end;
- end;
- doc.Write(SaveList.Text);
- SaveList.Clear;
- end;
- SaveList.Add('<a name="bottom"></a>');
- // \83X\83L\83\93(\83t\83b\83^)
- try
- SaveList.Add( LoadSkin( GetSkinFooterFileName ) );
- except
- end;
- doc.Write(SaveList.Text);
- end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
- //CSS\8eg\97p
- //CSSFileName := GetAppDir + CSS_FILE_NAME;
-// SaveList.Add('<html lang="ja"><head>');
- SaveList.Add('<html><head>');
- SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
- SaveList.Add('<title>' + sTitle + '</title>');
- SaveList.Add('<link rel="stylesheet" href="'+CSSFileName+'" type="text/css">');
- if Length( UserOptionalStyle ) > 0 then
- SaveList.Add('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
- SaveList.Add('</head>');
- SaveList.Add('<body>');
- SaveList.Add('<a name="top"></a>');
- SaveList.Add('<p id="idSearch"></p>');
- SaveList.Add('<div class="title">' + sTitle + '</div>');
- doc.Write(SaveList.Text);
- SaveList.Clear;
- //Application.ProcessMessages;
- for i := 0 to ReadList.Count - 1 do begin
- // 1 \82Í\95K\82¸\95\\8e¦
- if i <> 0 then begin
- // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
- case ResRange of
- Ord( grrKoko ):
- if ThreadItem.Kokomade > (i + 1) then
- Continue;
- Ord( grrNew ):
- if NewReceiveNo > (i + 1) then
- Continue;
- 10..65535:
- if (threadItem.Count - i) > ResRange then
- Continue;
- end;
- end;
-
- if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
- SaveList.Add('<a name="new"></a><div class="new">\90V\92\85\83\8c\83X <span class="newdate">' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</span></div>');
- end;
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
- Res := DivideStrLine(ReadList[i]);
- Res.FBody := AddAnchorTag(Res.FBody);
- Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
- if Res.FMailTo = '' then
- SaveList.Add('<a name="' + No + '"></a>'
- + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
- + '<span class="name_label">\96¼\91O\81F</span> '
- + '<span class="name"><b>' + Res.FName + '</b></span> '
- + '<span class="date_label">\93\8a\8de\93ú\81F</span> '
- + '<span class="date">' + Res.FDateTime+ '</span></div>'
- + '<div class="mes">' + Res.FBody + ' </div>')
- else if GikoSys.Setting.ShowMail then
- SaveList.Add('<a name="' + No + '"></a>'
- + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
- + '<span class="name_label"> \96¼\91O\81F </span>'
- + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
- + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
- + '<span class="date_label"> \93\8a\8de\93ú\81F</span>'
- + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
- + '<div class="mes">' + Res.FBody + ' </div>')
- else
- SaveList.Add('<a name="' + No + '"></a>'
- + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
- + '<span class="name_label"> \96¼\91O\81F </span>'
- + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
- + '<b>' + Res.FName + '</b></a>'
- + '<span class="date_label"> \93\8a\8de\93ú\81F</span>'
- + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
- + '<div class="mes">' + Res.FBody + ' </div>');
- end;
- if ThreadItem.Kokomade = (i + 1) then begin
- SaveList.Add('<a name="koko"></a><div class="koko">\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</div>');
- end;
-
- doc.Write(SaveList.Text);
- SaveList.Clear;
- end;
- SaveList.Add('<a name="bottom"></a>');
- //SaveList.Add('</body></html>');
- SaveList.Add('<a name="last"></a>');
- SaveList.Add('</body></html>');
- doc.Write(SaveList.Text);
- end else begin
- //CSS\94ñ\8eg\97p
-// SaveList.Add('<html lang="ja"><head>');
- SaveList.Add('<html><head>');
- SaveList.Add('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
- SaveList.Add('<title>' + sTitle + '</title></head>');
- SaveList.Add('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
- SaveList.Add('<a name="top"></a>');
- SaveList.Add('<font size=+1 color="#FF0000">' + sTitle + '</font>');
- SaveList.Add('<dl>');
- SaveList.Add('<p id="idSearch"></p>');
- doc.Write(SaveList.Text);
- SaveList.Clear;
- //Application.ProcessMessages;
- for i := 0 to ReadList.Count - 1 do begin
- // 1 \82Í\95K\82¸\95\\8e¦
- if i <> 0 then begin
- // \95\\8e¦\94Í\88Í\82ð\8cÀ\92è
- case ResRange of
- Ord( grrKoko ):
- if ThreadItem.Kokomade > (i + 1) then
- Continue;
- Ord( grrNew ):
- if NewReceiveNo > (i + 1) then
- Continue;
- 10..65535:
- if (threadItem.Count - i) > ResRange then
- Continue;
- end;
- end;
-
- if (NewReceiveNo = (i + 1)) or ((NewReceiveNo = 0) and (i = 0)) then begin
- SaveList.Add('</dl>');
- SaveList.Add('<a name="new"></a>');
- SaveList.Add('<table width="100%" bgcolor="#3333CC" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#6666FF" valign="middle"><font size="-1" color="#ffffff"><b>\90V\92\85\83\8c\83X ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '</b></font></td></tr></table>');
- SaveList.Add('<dl>');
- end;
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
- Res := DivideStrLine(ReadList[i]);
- if Res.FType = glt2chOld then begin
- Res.FMailTo := CustomStringReplace(Res.FMailTo, '\81\97\81M', ',');
- Res.FName := CustomStringReplace(Res.FName, '\81\97\81M', ',');
- Res.FBody := CustomStringReplace(Res.FBody, '\81\97\81M', ',');
- end;
- Res.FBody := AddAnchorTag(Res.FBody);
- Res.FBody := ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true');
- if Res.FMailTo = '' then
- SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<font color="forestgreen"><b> ' + Res.FName + ' </b></font> \93\8a\8de\93ú\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>')
- else if GikoSys.Setting.ShowMail then
- SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> [' + Res.FMailTo + '] \93\8a\8de\93ú\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>')
- else
- SaveList.Add('<a name="' + No + '"></a><dt><a href="menu:' + No + '">' + No + '</a> \96¼\91O\81F<a href="mailto:' + Res.FMailTo + '"><b> ' + Res.FName + ' </B></a> \93\8a\8de\93ú\81F <span class="date">' + Res.FDateTime+ '</span><br><dd>' + Res.Fbody + ' <br><br><br>');
- end;
- if ThreadItem.Kokomade = (i + 1) then begin
- SaveList.Add('</dl>');
- SaveList.Add('<a name="koko"></a><table width="100%" bgcolor="#55AA55" cellpadding="0" cellspacing="1"><tr><td align="center" bgcolor="#77CC77" valign="middle"><font size="-1" color="#ffffff"><b>\83R\83R\82Ü\82Å\93Ç\82ñ\82¾</b></font></td></tr></table>');
- SaveList.Add('<dl>');
- end;
- doc.Write(SaveList.Text);
- SaveList.Clear;
- end;
- SaveList.Add('</dl>');
- SaveList.Add('<a name="bottom"></a>');
- SaveList.Add('</body></html>');
- doc.Write(SaveList.Text);
- end;
- finally
- SaveList.Free;
- doc.Close;
- end;
- finally
- ReadList.Free;
- end;
-end;
-procedure TGikoSys.CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string);
-var
- i: integer;
- No: string;
- //bufList : TStringList;
- ReadList: TStringList;
-// SaveList: TStringList;
- CSSFileName: string;
- BBSID: string;
- FileName: string;
- Res: TResRec;
- boardPlugIn : TBoardPlugIn;
-
- UserOptionalStyle: string;
- SkinHeader: string;
- SkinRes: string;
- tmp, tmp1: string;
- function LoadSkin( fileName: string ): string;
- begin
- Result := LoadFromSkin( fileName, ThreadItem, ThreadItem.Size );
- end;
- function ReplaceRes( skin: string ): string;
- begin
- Result := SkinedRes( skin, Res, No );
- end;
-
-begin
- if ThreadItem <> nil then begin
- CSSFileName := GetStyleSheetDir + Setting.CSSFileName;
- html.Clear;
- html.BeginUpdate;
- if ThreadItem.IsBoardPlugInAvailable then begin
- //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
- boardPlugIn := ThreadItem.BoardPlugIn;
- // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
- if Length( GikoSys.Setting.BrowserFontName ) > 0 then
- UserOptionalStyle := UserOptionalStyle +
- 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
- if GikoSys.Setting.BrowserFontSize <> 0 then
- UserOptionalStyle := UserOptionalStyle +
- 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
- if GikoSys.Setting.BrowserFontColor <> -1 then
- UserOptionalStyle := UserOptionalStyle +
- 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
- if GikoSys.Setting.BrowserBackColor <> -1 then
- UserOptionalStyle := UserOptionalStyle +
- 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
- case GikoSys.Setting.BrowserFontBold of
- -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
- 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
- end;
- case GikoSys.Setting.BrowserFontItalic of
- -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
- 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
- end;
-
- try
- // \95¶\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
- // \83w\83b\83_
- tmp := boardPlugIn.GetHeader( DWORD( threadItem ),
- '<style type="text/css">body {' + UserOptionalStyle + '}</style>' );
- //\90â\91Î\8eQ\8fÆ\82©\82ç\91\8a\91Î\8eQ\8fÆ\82Ö
- if Setting.UseSkin then begin
- tmp1 := './' +Setting.CSSFileName;
- tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
- tmp1 := CustomStringReplace(tmp1, '\', '/');
- tmp := CustomStringReplace(tmp, ExtractFilePath(Setting.CSSFileName), tmp1);
- end else if Setting.UseCSS then begin
- tmp1 := './' + CSSFileName;
- tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
- tmp1 := CustomStringReplace(tmp1, '\', '/');
- tmp := CustomStringReplace(tmp, CSSFileName, tmp1);
- end;
- html.Append( tmp );
-
- for i := 0 to threadItem.Count - 1 do begin
-
- // \83\8c\83X
- html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) );
-
- end;
- // \83X\83L\83\93(\83t\83b\83^)
- html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '<a name="bottom"></a>' ) );
- finally
- end;
- html.EndUpdate;
- Exit;
- end;
- end;
- ShortDayNames[1] := '\93ú'; ShortDayNames[2] := '\8c\8e';
- ShortDayNames[3] := '\89Î'; ShortDayNames[4] := '\90\85';
- ShortDayNames[5] := '\96Ø'; ShortDayNames[6] := '\8bà';
- ShortDayNames[7] := '\93y';
- BBSID := ThreadItem.ParentBoard.BBSID;
- ReadList := TStringList.Create;
- try
- if ThreadItem.IsLogFile then begin
- FileName := ThreadItem.GetThreadFileName;
- ReadList.LoadFromFile(FileName);
- FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG'));
- FAbon.Execute(ReadList); // \82 \82Ú\81`\82ñ\82µ\82Ä
- FSelectResFilter.Execute(ReadList); //\83\8c\83X\82Ì\83t\83B\83\8b\83^\83\8a\83\93\83O\82ð\82·\82é
- Res := DivideStrLine(ReadList[0]);
- Res.FTitle := CustomStringReplace(Res.FTitle, '\81\97\81M', ',');
- sTitle := Res.FTitle;
- end else begin
- sTitle := CustomStringReplace(ThreadItem.Title, '\81\97\81M', ',');
- end;
- try
- // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
- if Length( GikoSys.Setting.BrowserFontName ) > 0 then
- UserOptionalStyle := UserOptionalStyle +
- 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
- if GikoSys.Setting.BrowserFontSize <> 0 then
- UserOptionalStyle := UserOptionalStyle +
- 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
- if GikoSys.Setting.BrowserFontColor <> -1 then
- UserOptionalStyle := UserOptionalStyle +
- 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
- if GikoSys.Setting.BrowserBackColor <> -1 then
- UserOptionalStyle := UserOptionalStyle +
- 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
- case GikoSys.Setting.BrowserFontBold of
- -1: UserOptionalStyle := UserOptionalStyle + 'font-weight:normal;';
- 1: UserOptionalStyle := UserOptionalStyle + 'font-weight:bold;';
- end;
- case GikoSys.Setting.BrowserFontItalic of
- -1: UserOptionalStyle := UserOptionalStyle + 'font-style:normal;';
- 1: UserOptionalStyle := UserOptionalStyle + 'font-style:italic;';
- end;
-
-
- if GikoSys.Setting.UseSkin then begin
- // \83X\83L\83\93\8eg\97p
- // \83X\83L\83\93\82Ì\90Ý\92è
- try
- SkinHeader := LoadSkin( GetSkinHeaderFileName );
- if Length( UserOptionalStyle ) > 0 then
- SkinHeader := CustomStringReplace( SkinHeader, '</head>',
- '<style type="text/css">body {' + UserOptionalStyle + '}</style></head>');
- //\90â\91Î\8eQ\8fÆ\82©\82ç\91\8a\91Î\8eQ\8fÆ\82Ö
- tmp1 := './' +Setting.CSSFileName;
- tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
- tmp1 := CustomStringReplace(tmp1, '\', '/');
- SkinHeader := CustomStringReplace(SkinHeader, ExtractFilePath(Setting.CSSFileName), tmp1);
- html.Append( SkinHeader );
- except
- end;
- try
- SkinRes := LoadSkin( GetSkinResFileName );
- except
- end;
- html.Append('<a name="top"></a>');
- for i := 0 to ReadList.Count - 1 do begin
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
-
- Res := DivideStrLine(ReadList[i]);
- if Res.FType = glt2chOld then begin
- Res.FMailTo := CustomStringReplace(Res.FMailTo, '\81\97\81M', ',');
- Res.FName := CustomStringReplace(Res.FName, '\81\97\81M', ',');
- Res.FBody := CustomStringReplace(Res.FBody, '\81\97\81M', ',');
- end;
-
- Res.FBody := AddAnchorTag(Res.FBody);
- Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
-
- try
- html.Append( ReplaceRes( SkinRes ) );
- except
- end;
- end;
-
- end;
- html.Append('<a name="bottom"></a>');
- // \83X\83L\83\93(\83t\83b\83^)
- try
- html.Append( LoadSkin( GetSkinFooterFileName ) );
- except
- end;
- end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin
- //CSS\8eg\97p
- //CSSFileName := GetAppDir + CSS_FILE_NAME;
- html.Append('<html><head>');
- html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
- html.Append('<title>' + sTitle + '</title>');
- //\90â\91Î\8eQ\8fÆ\82©\82ç\91\8a\91Î\8eQ\8fÆ\82Ö
- tmp1 := './' + CSSFileName;
- tmp1 := CustomStringReplace(tmp1, GetConfigDir, '');
- tmp1 := CustomStringReplace(tmp1, '\', '/');
-
- html.Append('<link rel="stylesheet" href="'+tmp1+'" type="text/css">');
- if Length( UserOptionalStyle ) > 0 then
- html.Append('<style type="text/css">body {' + UserOptionalStyle + '}</style>');
- html.Append('</head>');
- html.Append('<body>');
- html.Append('<a name="top"></a>');
- html.Append('<div class="title">' + sTitle + '</div>');
- for i := 0 to ReadList.Count - 1 do begin
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
- Res := DivideStrLine(ReadList[i]);
- Res.FBody := AddAnchorTag(Res.FBody);
- Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
- if Res.FMailTo = '' then
- html.Append('<a name="' + No + '"></a>'
- + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span> '
- + '<span class="name_label">\96¼\91O\81F</span> '
- + '<span class="name"><b>' + Res.FName + '</b></span> '
- + '<span class="date_label">\93\8a\8de\93ú\81F</span> '
- + '<span class="date">' + Res.FDateTime+ '</span></div>'
- + '<div class="mes">' + Res.FBody + ' </div>')
- else if GikoSys.Setting.ShowMail then
- html.Append('<a name="' + No + '"></a>'
- + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
- + '<span class="name_label"> \96¼\91O\81F </span>'
- + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
- + '<b>' + Res.FName + '</b></a><span class="mail"> [' + Res.FMailTo + ']</span>'
- + '<span class="date_label"> \93\8a\8de\93ú\81F</span>'
- + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
- + '<div class="mes">' + Res.FBody + ' </div>')
- else
- html.Append('<a name="' + No + '"></a>'
- + '<div class="header"><span class="no"><a href="menu:' + No + '">' + No + '</a></span>'
- + '<span class="name_label"> \96¼\91O\81F </span>'
- + '<a class="name_mail" href="mailto:' + Res.FMailTo + '">'
- + '<b>' + Res.FName + '</b></a>'
- + '<span class="date_label"> \93\8a\8de\93ú\81F</span>'
- + '<span class="date"> ' + Res.FDateTime+ '</span></div>'
- + '<div class="mes">' + Res.FBody + ' </div>');
- end;
- end;
- html.Append('<a name="bottom"></a>');
- html.Append('</body></html>');
- html.Append('<a name="last"></a>');
- html.Append('</body></html>');
- end else begin
- //CSS\94ñ\8eg\97p
- html.Append('<html><head>');
- html.Append('<meta http-equiv="Content-type" content="text/html; charset=Shift_JIS">');
- html.Append('<title>' + sTitle + '</title></head>');
- html.Append('<body TEXT="#000000" BGCOLOR="#EFEFEF" link="#0000FF" alink="#FF0000" vlink="#660099">');
- html.Append('<a name="top"></a>');
- html.Append('<font size=+1 color="#FF0000">' + sTitle + '</font>');
- html.Append('<dl>');
- for i := 0 to ReadList.Count - 1 do begin
- if (Trim(ReadList[i]) <> '') then begin
- No := IntToStr(i + 1);
- Res := DivideStrLine(ReadList[i]);
- if Res.FType = glt2chOld then begin
- Res.FMailTo := CustomStringReplace(Res.FMailTo, '\81\97\81M', ',');
- Res.FName := CustomStringReplace(Res.FName, '\81\97\81M', ',');
- Res.FBody := CustomStringReplace(Res.FBody, '\81\97\81M', ',');
- end;
- Res.FBody := AddAnchorTag(Res.FBody);
- Res.FBody := ConvertResAnchor(ConvRes(Res.FBody, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', true));
- if Res.FMailTo = '' then
- 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>')
- else if GikoSys.Setting.ShowMail then
- 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>')
- else
- 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>');
- end;
- end;
- html.Append('</dl>');
- html.Append('<a name="bottom"></a>');
- html.Append('</body></html>');
- end;
- finally
- html.EndUpdate;
- end;
- finally
- ReadList.Free;
- end;
-end;
-function TGikoSys.ConvertResAnchor(res: string): string;
-const
- _HEAD : string = '<a href="../';
- _TAIL : string = ' target="_blank">';
- _ST: string = '&st=';
- _TO: string = '&to=';
- _STA: string = '&START=';
- _END: string = '&END=';
-var
- i, j, k: Integer;
- tmp: string;
-begin
- Result := '';
- i := AnsiPos(_HEAD, res);
- while i <> 0 do begin
- Result := Result + Copy(res, 1, i -1);
- Delete(res, 1, i - 1);
- j := AnsiPos(_TAIL, res);
- if j = 0 then begin
- Result := Result + res;
- Exit;
- end;
- tmp := Copy(res, 1, j - 1);
- Delete(res, 1, j + 16);
- if (AnsiPos(_ST, tmp) <> 0) and (AnsiPos(_TO, tmp) <> 0) then begin
- Delete(tmp, 1, AnsiPos(_ST, tmp) + 3);
- Delete(tmp, AnsiPos(_TO, tmp), Length(tmp));
- Result := Result + '<a href="#' + tmp + '">';
- end else if (AnsiPos(_STA, tmp) <> 0) and (AnsiPos(_END, tmp) <> 0) then begin
- Delete(tmp, 1, AnsiPos(_STA, tmp) + 6);
- Delete(tmp, AnsiPos(_END, tmp), Length(tmp));
- Result := Result + '<a href="#' + tmp + '">';
- end else begin
- k := LastDelimiter('/', tmp);
- Delete(tmp, 1, k);
- if AnsiPos('-', tmp) < AnsiPos('"', tmp) then
- Delete(tmp, AnsiPos('-', tmp), Length(tmp))
- else
- Delete(tmp, AnsiPos('"', tmp), Length(tmp));
-
- Result := Result + '<a href="#' + tmp + '">';
- end;
- i := AnsiPos(_HEAD, res);
- end;
- Result := Result + res;
-
-end;
-
-(*************************************************************************
- *http://\82Ì\95¶\8e\9a\97ñ\82ðanchor\83^\83O\95t\82«\82É\82·\82é\81B
- *************************************************************************)
-function TGikoSys.AddAnchorTag(s: string): string;
-const
- URL_CHAR: string = '0123456789'
- + 'abcdefghijklmnopqrstuvwxyz'
- + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
- + '#$%&()*+,-./:;=?@[]^_`{|}~!''\';
- ANCHOR_REF = 'href=';
- RES_REF = '>>';
-var
- wkIdx: array[0..9] of Integer;
- url: string;
- href: string;
- i, b: Integer;
- idx: Integer;
- anchorLen : Integer;
-begin
- Result := '';
- // + 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ß
- anchorLen := Length( ANCHOR_REF ) + 3;
-
- while True do begin
- wkIdx[0] := AnsiPos('http://', s);
- wkIdx[1] := AnsiPos('ttp://', s);
- wkIdx[2] := AnsiPos('tp://', s);
- wkIdx[3] := AnsiPos('ms-help://', s);
- wkIdx[4] := AnsiPos('p://', s);
- wkIdx[5] := AnsiPos('https://', s);
- wkIdx[6] := AnsiPos('www.', s);
- wkIdx[7] := AnsiPos('ftp://', s);
- wkIdx[8] := AnsiPos('news://', s);
- wkIdx[9] := AnsiPos('rtsp://', s);
-
- idx := MaxInt;
- for i := 0 to 9 do
- if wkIdx[i] <> 0 then idx := Min(wkIdx[i], idx);
-
- if idx = MaxInt then begin
- //\83\8a\83\93\83N\82ª\96³\82¢\82æ\81B
- Result := Result + s;
- Break;
- end;
-
- if (idx > 1) and
- (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin
- //\8aù\82É\83\8a\83\93\83N\83^\83O\82ª\82Â\82¢\82Ä\82¢\82é\82Á\82Û\82¢\82Æ\82«\82Í\83\80\83V
- href := Copy( s, idx, Length( s ) );
- Result := Result + Copy( s, 1, idx + Pos( '</a>', href ) + Length( '</a>' ) - 2 );
- s := href;
- s := Copy( s, Pos( '</a>', s ) + Length( '</a>' ), Length( s ) );
-
- Continue;
- end;
-
- Result := Result + Copy(s, 0, idx - 1);
-
- s := Copy(s, idx, length(s));
-
- b := Length( s ) + 1;
- for i := 1 to b do begin
- if i = b then
- idx := 0
- else
- idx := AnsiPos(s[i], URL_CHAR);
- if idx = 0 then begin
- //URL\82¶\82á\82È\82¢\95¶\8e\9a\94\8c©\81I\82Æ\82©\81A\95¶\8e\9a\82ª\82È\82\82È\82Á\82½\81B
- url := Copy(s, 0, i - 1);
-
- if AnsiPos('ttp://', url) = 1 then
- href := 'h' + url
- else if AnsiPos('tp://', url) = 1 then
- href := 'ht' + url
- else if AnsiPos('p://', url) = 1 then
- href := 'htt' + url
- else if AnsiPos('www.', url) = 1 then
- href := 'http://' + url
- else
- href := url;
- Result := Result + '<a href="' + href + '" target="_blank">' + url + '</a>';
- s := Copy(s, i, MaxInt);
- Break;
- end;
- end;
- end;
-end;
-
-(*************************************************************************
- *\83T\83u\83W\83F\83N\83g\88ê\8ds\82ð\95ª\8a\84
- *************************************************************************)
-function TGikoSys.DivideSubject(Line: string): TSubjectRec;
-var
- i: integer;
- ws: WideString;
- Delim: string;
- LeftK: string;
- RightK: string;
-begin
- Result.FCount := 0;
-
- if AnsiPos('<>', Line) = 0 then
- Delim := ','
- else
- Delim := '<>';
- Result.FFileName := RemoveToken(Line, Delim);
- Result.FTitle := RemoveToken(Line, Delim);
-
- ws := Trim(Result.FTitle);
-
- if Copy(ws, Length(ws), 1) = ')' then begin
- LeftK := '(';
- RightK := ')';
- end else if Copy(ws, Length(ws), 1) = '\81j' then begin
- LeftK := '\81i';
- RightK := '\81j';
- end else if Copy(ws, Length(ws), 1) = '<' then begin
- LeftK := '<';
- RightK := '>';
- end;
-
- for i := Length(ws) - 1 downto 1 do begin
- if ws[i] = LeftK then begin
- ws := Copy(ws, i + 1, Length(ws) - i - 1);
- if IsNumeric(ws) then
- Result.FCount := StrToInt(ws);
- Result.FTitle := Trim(CustomStringReplace(Result.FTitle, LeftK + ws + RightK, ''));
- break;
- end;
- end;
-end;
-
-(*************************************************************************
- * dat\83t\83@\83C\83\8b\82Ì\88ê\83\89\83C\83\93\82ð\95ª\89ð
- *************************************************************************)
-function TGikoSys.DivideStrLine(Line: string): TResRec;
-var
- Delim: string;
- bufbody : String;
-begin
- if AnsiPos('<>', Line) = 0 then begin
- Delim := ',';
- Result.FType := glt2chOld;
- end else begin
- Delim := '<>';
- Result.FType := glt2chNew;
- end;
- Result.FName := Trim(RemoveToken(Line, Delim));
- Result.FMailTo := Trim(RemoveToken(Line, Delim));
- Result.FDateTime := Trim(RemoveToken(Line, Delim));
- bufBody := Trim(RemoveToken(Line, Delim));
-
- if bufbody = '' then begin
- Insert(' ',bufbody, 1);
- end;
- Result.FBody := bufBody;
- Result.FTitle := Trim(RemoveToken(Line, Delim));
-
-end;
-
-(*************************************************************************
- * URL\82©\82çBBSID\82ð\8eæ\93¾
- *************************************************************************)
-function TGikoSys.UrlToID(url: string): string;
-var
- i: integer;
-begin
- Result := '';
- url := Trim(url);
-
- if url = '' then Exit;
-
- url := Copy(url, 0, Length(url) - 1);
- for i := Length(url) downto 0 do begin
- if url[i] = '/' then begin
- Result := Copy(url, i + 1, Length(url));
- Break;
- end;
- end;
-end;
-
-(*************************************************************************
- *URL\82©\82çBBSID\88È\8aO\82Ì\95\94\95ª(http://teri.2ch.net/)\82ð\8eæ\93¾
- *************************************************************************)
-function TGikoSys.UrlToServer(url: string): string;
-var
- i: integer;
- wsURL: WideString;
-begin
- Result := '';
- wsURL := url;
- wsURL := Trim(wsURL);
-
- if wsURL = '' then exit;
-
- if Copy(wsURL, Length(wsURL), 1) = '/' then
- wsURL := Copy(wsURL, 0, Length(wsURL) - 1);
-
- for i := Length(wsURL) downto 0 do begin
- if wsURL[i] = '/' then begin
- Result := Copy(wsURL, 0, i);
- break;
- end;
- end;
-end;
-
-(*************************************************************************
- *\83f\83B\83\8c\83N\83g\83\8a\82ª\91¶\8dÝ\82·\82é\82©\83`\83F\83b\83N
- *************************************************************************)
-function TGikoSys.DirectoryExistsEx(const Name: string): Boolean;
-var
- Code: Integer;
-begin
- Code := GetFileAttributes(PChar(Name));
- Result := (Code <> -1) and (FILE_ATTRIBUTE_DIRECTORY and Code <> 0);
-end;
-
-(*************************************************************************
- *\83f\83B\83\8c\83N\83g\83\8a\8dì\90¬\81i\95¡\90\94\8aK\91w\91Î\89\9e\81j
- *************************************************************************)
-function TGikoSys.ForceDirectoriesEx(Dir: string): Boolean;
-begin
- Result := True;
- if Length(Dir) = 0 then
- raise Exception.Create('\83t\83H\83\8b\83_\82ª\8dì\90¬\8fo\97\88\82Ü\82¹\82ñ');
- Dir := ExcludeTrailingPathDelimiter(Dir);
- if (Length(Dir) < 3) or DirectoryExistsEx(Dir)
- or (ExtractFilePath(Dir) = Dir) then Exit; // avoid 'xyz:\' problem.
- Result := ForceDirectoriesEx(ExtractFilePath(Dir)) and CreateDir(Dir);
-end;
-
-(*************************************************************************
- *\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
- *FDelphi\82©\82ç\82Ì\83p\83N\83\8a
- *************************************************************************)
-function TGikoSys.StrTokFirst(const s:string; const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
-begin
- Rec.Str := s;
- Rec.Pos := 1;
- Result := StrTokNext(sep, Rec);
-end;
-
-(*************************************************************************
- *\95¶\8e\9a\97ñ\82©\82ç\83g\81[\83N\83\93\82Ì\90Ø\82è\8fo\82µ
- *FDelphi\82©\82ç\82Ì\83p\83N\83\8a
- *************************************************************************)
-function TGikoSys.StrTokNext(const sep: TStrTokSeparator; var Rec: TStrTokRec): string;
-var
- Len, I: Integer;
-begin
- with Rec do begin
- Len := Length(Str);
- Result := '';
- if Len >= Pos then begin
- while (Pos <= Len) and (Str[Pos] in sep) do begin
- Inc(Pos);
- end;
- I := Pos;
- while (Pos<= Len) and not (Str[Pos] in sep) do begin
- if IsDBCSLeadByte(Byte(Str[Pos])) then begin
- Inc(Pos);
- end;
- Inc(Pos);
- end;
- Result := Copy(Str, I, Pos - I);
- while (Pos <= Len) and (Str[Pos] in sep) do begin// \82±\82ê\82Í\82¨\8dD\82Ý
- Inc(Pos);
- end;
- end;
- end;
-end;
-
-(*************************************************************************
- *\83t\83@\83C\83\8b\83T\83C\83Y\8eæ\93¾
- *************************************************************************)
-function TGikoSys.GetFileSize(FileName : string): longint;
-var
- F : File;
-begin
- try
- if not FileExists(FileName) then begin
- Result := 0;
- Exit;
- end;
- Assign(F, FileName);
- Reset(F, 1);
- Result := FileSize(F);
- CloseFile(F);
- except
- Result := 0;
- end;
-end;
-
-(*************************************************************************
- *\83t\83@\83C\83\8b\8ds\90\94\8eæ\93¾
- *************************************************************************)
-function TGikoSys.GetFileLineCount(FileName : string): longint;
-var
- sl: TStringList;
-begin
- sl := TStringList.Create;
- try
- try
- sl.LoadFromFile(FileName);
- Result := sl.Count;
- except
- Result := 0;
- end;
- finally
- sl.Free;
- end;
+ sl.LoadFromFile(FileName);
+ Result := sl.Count;
+ except
+ Result := 0;
+ end;
+ finally
+ sl.Free;
+ end;
end;
-(*************************************************************************
- *\83X\83\8c\83b\83h\83t\83@\83C\83\8b\82©\82ç\8ew\92è\8ds\82ð\8eæ\93¾
- *************************************************************************)
+{!
+\brief \83t\83@\83C\83\8b\82©\82ç\8ew\92è\8ds\82ð\8eæ\93¾
+\param FileName \83t\83@\83C\83\8b\82Ì\83p\83X
+\param Line \8ew\92è\8ds
+\return \8ew\92è\82³\82ê\82½ 1 \8ds
+\todo \83\81\83\82\83\8a\83}\83b\83v\83h\83t\83@\83C\83\8b\8ds\82«
+}
function TGikoSys.ReadThreadFile(FileName: string; Line: Integer): string;
var
fileTmp : TStringList;
end;
end;
-(*************************************************************************
- *\83V\83X\83e\83\80\83\81\83j\83\85\81[\83t\83H\83\93\83g\82Ì\91®\90«\82ð\8eæ\93¾
- *************************************************************************)
+{!
+\brief \83V\83X\83e\83\80\83\81\83j\83\85\81[\83t\83H\83\93\83g\82Ì\91®\90«\82ð\8eæ\93¾
+\param Font OUT:\8eæ\93¾\82µ\82½\83t\83H\83\93\83g\91®\90«\82ª\95Ô\82é
+}
procedure TGikoSys.MenuFont(Font: TFont);
var
lf: LOGFONT;
nm: NONCLIENTMETRICS;
begin
nm.cbSize := sizeof(NONCLIENTMETRICS);
-
- SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
- lf := nm.lfMenuFont;
-
- Font.Name := lf.lfFaceName;
- Font.Height := lf.lfHeight;
- Font.Style := [];
- if lf.lfWeight >= 700 then
- Font.Style := Font.Style + [fsBold];
- if lf.lfItalic = 1 then
- Font.Style := Font.Style + [fsItalic];
-end;
-
-(*************************************************************************
- *
- *\82Ç\82±\82©\82Ì\83T\83C\83g\82©\82ç\82Ì\83p\83N\83\8a
- *************************************************************************)
-function TGikoSys.RemoveToken(var s: string;const delimiter: string): string;
+ SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, @nm, 0);
+ lf := nm.lfMenuFont;
+ Font.Name := lf.lfFaceName;
+ Font.Height := lf.lfHeight;
+ Font.Style := [];
+ if lf.lfWeight >= 700 then
+ Font.Style := Font.Style + [fsBold];
+ if lf.lfItalic = 1 then
+ Font.Style := Font.Style + [fsItalic];
+end;
+
+{!
+\brief \90æ\93ª\82Ì\83g\81[\83N\83\93\82ð\90Ø\82è\8fo\82µ
+\param s IN/OUT:\8c³\82É\82È\82é\95¶\8e\9a\97ñ\81A\90Ø\82è\8fo\82µ\82½\8cã\82Ì\8ec\82è\82Ì\95¶\8e\9a\97ñ
+\param delimiter \8bæ\90Ø\82è\82É\82È\82é\95¶\8e\9a\97ñ
+\return \90Ø\82è\8fo\82µ\82½\95¶\8e\9a\97ñ
+
+\82Ç\82±\82©\82Ì\83T\83C\83g\82©\82ç\82Ì\83p\83N\83\8a
+}
+{function TGikoSys.RemoveToken(var s: string;const delimiter: string): string;
var
p: Integer;
begin
Result := s
else
Result := Copy(s, 1, p - 1);
- s := Copy(s, Length(Result) + Length(delimiter) + 1, Length(s));
+ Delete(s, 1, Length(Result) + Length(delimiter));
end;
+}
-(*************************************************************************
- *
- *\82Ç\82±\82©\82Ì\83T\83C\83g\82©\82ç\82Ì\83p\83N\83\8a
- *************************************************************************)
+{!
+\brief n \8cÂ\96Ú\82Ì\83g\81[\83N\83\93\82ð\90Ø\82è\8fo\82µ
+\param s \8c³\82É\82È\82é\95¶\8e\9a\97ñ
+\param index 0 \82©\82ç\8en\82Ü\82é\83C\83\93\83f\83b\83N\83X(n \8cÂ\96Ú\82Ì n)
+\return \90Ø\82è\8fo\82µ\82½\83g\81[\83N\83\93
+
+\82Ç\82±\82©\82Ì\83T\83C\83g\82©\82ç\82Ì\83p\83N\83\8a
+}
function TGikoSys.GetTokenIndex(s: string; delimiter: string; index: Integer): string;
var
i: Integer;
begin
Result := '';
for i := 0 to index do
- Result := RemoveToken(s, delimiter);
+ Result := MojuUtils.RemoveToken(s, delimiter);
end;
-(*************************************************************************
- *
- *************************************************************************)
-function TGikoSys.DeleteLink(const s: string): string;
-var
- s1: string;
- s2: string;
- idx: Integer;
- i: Integer;
-begin
- i := 0;
- Result := '';
- while True do begin
- s1 := GetTokenIndex(s, '<a href="', i);
- s2 := GetTokenIndex(s, '<a href="', i + 1);
-
- idx := Pos('">', s1);
- if idx <> 0 then
- Delete(s1, 1, idx + 1);
- idx := Pos('">', s2);
- if idx <> 0 then
- Delete(s2, 1, idx + 1);
-
- Result := Result + s1 + s2;
-
- if s2 = '' then
- Break;
-
- inc(i, 2);
- end;
-end;
//\83C\83\93\83f\83b\83N\83X\96¢\8dX\90V\83o\83b\83t\83@\82ð\83t\83\89\83b\83V\83\85\81I
{procedure TGikoSys.FlashExitWrite;
FExitWrite.Clear;
end;}
-(*************************************************************************
- *\83X\83\8c\96¼\82È\82Ç\82ð\92Z\82¢\96¼\91O\82É\95Ï\8a·\82·\82é
- *from HotZonu
- *************************************************************************)
+{!
+\brief \83X\83\8c\96¼\82È\82Ç\82ð\92Z\82¢\96¼\91O\82É\95Ï\8a·\82·\82é
+\param LongName \8c³\82É\82È\82é\95¶\8e\9a\97ñ
+\param ALength \8eû\82ß\82é\95¶\8e\9a\97ñ\92·(bytes)
+\return \95Ï\8a·\82³\82ê\82½\95¶\8e\9a\97ñ
+
+from HotZonu
+}
function TGikoSys.GetShortName(const LongName: string; ALength: integer): string;
const
ERASECHAR : array [1..39] of string =
end;
end;
-(*************************************************************************
- *
- * from HotZonu
- *************************************************************************)
-function TGikoSys.ConvRes(const Body, Bbs, Key,
- ParamBBS, ParamKey, ParamStart, ParamTo, ParamNoFirst, ParamTrue : string;
- DatToHTML: boolean = false): string;
-type
- PIndex = ^TIndex;
- TIndex = record
- FIndexFrom : integer;
- FIndexTo : integer;
- FNo : string;
- end;
-const
- GT = '>';
- SN = '0123456789-';
- ZN = '\82O\82P\82Q\82R\82S\82T\82U\82V\82W\82X\81|';
-var
- i : integer;
- s,r : string;
- b : TMbcsByteType;
- sw: boolean;
- sp: integer;
- No: string;
- sx: string;
- List: TList;
- oc : string;
- st, et: string;
- chk : boolean;
- al : boolean;
- procedure Add(IndexFrom, IndexTo: integer; const No: string);
- var
- FIndex : PIndex;
- begin
- New(FIndex);
- FIndex.FIndexFrom := IndexFrom;
- FIndex.FIndexTo := IndexTo;
- FIndex.FNo := No;
- List.Add(FIndex);
- end;
- function ChooseString(const Text, Separator: string; Index: integer): string;
- var
- S : string;
- i, p : integer;
- begin
- S := Text;
- for i := 0 to Index - 1 do begin
- if (AnsiPos(Separator, S) = 0) then S := ''
- else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
- end;
- p := AnsiPos(Separator, S);
- if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
- end;
-begin
- { v1.0 b2 - 03 }
- s := Body;
- r := Body;
- i := 1;
- sw := False;
- No := '';
- List:= TList.Create;
- oc := '';
- sp := 0;
- chk := False;
- al := False;
- while true do begin
- b := ByteType(s, i);
- case b of
- mbSingleByte : begin
- if (not sw) and (Copy(s,i,8) = GT + GT) then begin
- if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
- sw := True;
- sp := i;
- i := i + 7;
- oc:='';
- chk := True;
- end;
- end else
- if (not sw) and (Copy(s,i,8) = GT + GT) then begin
- if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
- i := i + 7;
- oc:='';
- chk := True;
- end;
- end else
- if (not sw) and (Copy(s,i,4) = GT) then begin
- if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
- sw := True;
- sp := i;
- i := i + 3;
- oc:='';
- chk := True;
- end;
- end else
- if ((not sw) and (Copy(s,i,1) = ',')) or
- ((not sw) and (Copy(s,i,1) = '=')) then begin
- if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
- ((Chk) and (oc = '')) or
- ((not Chk) and (al)) then
- begin
- sw := True;
- sp := i;
- //i := i + 1;
- oc:='';
- end;
- end else
- if (sw) then begin
- sx := Copy(s,i,1);
- if (AnsiPos(sx, SN) > 0) then begin
- No := No + sx;
- end else begin
- if (No <> '') and (No <> '-') then begin
- Add(sp, i, No);
- al := True;
- end;
- sw := False;
- //
- i := i - 1;
- //
- No := '';
- oc:='';
- //chk := False;
- end;
- end else begin
- if Copy(s,i,1) = '<' then oc := '';
- oc := oc + Copy(s,i,1);
- chk := False;
- al := False;
- end;
- end;
- mbLeadByte : begin
- if (not sw) and (Copy(s,i,4) = '\81\84\81\84') then begin
- sw := True;
- sp := i;
- i := i + 3;
- chk := True;
- end else
- if (not sw) and (Copy(s,i,2) = '\81\84') then begin
- sw := True;
- sp := i;
- i := i + 1;
- chk := True;
- end else
- if (sw) then begin
- sx := Copy(s,i,2);
- if (AnsiPos(sx, ZN) > 0) then begin
- No := No + ZenToHan(sx);
- end else begin
- if (No <> '') and (No <> '-') and (No <> '\81|') then begin
- Add(sp, i, No);
- end;
- sw := False;
- i := i - 1;
- No := '';
- end;
- end else begin
- oc := '';
- chk := False;
- end;
- al := False;
- end;
- end;
- inc(i);
- if (i > Length(Body)) then begin
- if (sw) then begin
- if (No <> '') then Add(sp, i, No);
- end;
- Break;
- end;
- end;
- for i := List.Count - 1 downto 0 do begin
- if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
- st := ChooseString(PIndex(List[i]).FNo, '-', 0);
- et := ChooseString(PIndex(List[i]).FNo, '-', 1);
- end else begin
- st := PIndex(List[i]).FNo;
- et := PIndex(List[i]).FNo;
- end;
- if not DatToHTML then
- r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
- Format('<a href="../test/read.cgi?%s=%s&%s=%s&%s=%s&%s=%s&%s=%s" target="_blank">',
- [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
- Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
- Copy(r,PIndex(List[i]).FIndexTo,Length(r))
- else
- r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
- Format('<a href="#%s">', [st]) +
- Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
- Copy(r,PIndex(List[i]).FIndexTo,Length(r));
-
- Dispose(PIndex(List[i]));
- end;
- List.Free;
- Result := r;
-end;
-
-function TGikoSys.ConvRes(
- const Body, Bbs, Key, ParamBBS, ParamKey,
- ParamStart, ParamTo, ParamNoFirst,
- ParamTrue, FullURL : string
-): string;
-type
- PIndex = ^TIndex;
- TIndex = record
- FIndexFrom : integer;
- FIndexTo : integer;
- FNo : string;
- end;
-const
- GT = '>';
- SN = '0123456789-';
- ZN = '\82O\82P\82Q\82R\82S\82T\82U\82V\82W\82X\81|';
-var
- i : integer;
- s,r : string;
- b : TMbcsByteType;
- sw: boolean;
- sp: integer;
- No: string;
- sx: string;
- List: TList;
- oc : string;
- st, et: string;
- chk : boolean;
- al : boolean;
- procedure Add(IndexFrom, IndexTo: integer; const No: string);
- var
- FIndex : PIndex;
- begin
- New(FIndex);
- FIndex.FIndexFrom := IndexFrom;
- FIndex.FIndexTo := IndexTo;
- FIndex.FNo := No;
- List.Add(FIndex);
- end;
- function ChooseString(const Text, Separator: string; Index: integer): string;
- var
- S : string;
- i, p : integer;
- begin
- S := Text;
- for i := 0 to Index - 1 do begin
- if (AnsiPos(Separator, S) = 0) then S := ''
- else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
- end;
- p := AnsiPos(Separator, S);
- if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
- end;
-begin
- { v1.0 b2 - 03 }
- s := Body;
- r := Body;
- i := 1;
- sw := False;
- No := '';
- List:= TList.Create;
- oc := '';
- sp := 0;
- chk := False;
- al := False;
- while true do begin
- b := ByteType(s, i);
- case b of
- mbSingleByte : begin
- if (not sw) and (Copy(s,i,8) = GT + GT) then begin
- if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
- sw := True;
- sp := i;
- i := i + 7;
- oc:='';
- chk := True;
- end;
- end else
- if (not sw) and (Copy(s,i,8) = GT + GT) then begin
- if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 1) then begin
- i := i + 7;
- oc:='';
- chk := True;
- end;
- end else
- if (not sw) and (Copy(s,i,4) = GT) then begin
- if (AnsiPos('<A HREF', AnsiUpperCase(oc)) = 0) then begin
- sw := True;
- sp := i;
- i := i + 3;
- oc:='';
- chk := True;
- end;
- end else
- if ((not sw) and (Copy(s,i,1) = ',')) or
- ((not sw) and (Copy(s,i,1) = '=')) then begin
- if ((not Chk) and (AnsiLowerCase(oc) = '</a>')) or
- ((Chk) and (oc = '')) or
- ((not Chk) and (al)) then
- begin
- sw := True;
- sp := i;
- //i := i + 1;
- oc:='';
- end;
- end else
- if (sw) then begin
- sx := Copy(s,i,1);
- if (AnsiPos(sx, SN) > 0) then begin
- No := No + sx;
- end else begin
- if (No <> '') and (No <> '-') then begin
- Add(sp, i, No);
- al := True;
- end;
- sw := False;
- //
- i := i - 1;
- //
- No := '';
- oc:='';
- //chk := False;
- end;
- end else begin
- if Copy(s,i,1) = '<' then oc := '';
- oc := oc + Copy(s,i,1);
- chk := False;
- al := False;
- end;
- end;
- mbLeadByte : begin
- if (not sw) and (Copy(s,i,4) = '\81\84\81\84') then begin
- sw := True;
- sp := i;
- i := i + 3;
- chk := True;
- end else
- if (not sw) and (Copy(s,i,2) = '\81\84') then begin
- sw := True;
- sp := i;
- i := i + 1;
- chk := True;
- end else
- if (sw) then begin
- sx := Copy(s,i,2);
- if (AnsiPos(sx, ZN) > 0) then begin
- No := No + ZenToHan(sx);
- end else begin
- if (No <> '') and (No <> '-') and (No <> '\81|') then begin
- Add(sp, i, No);
- end;
- sw := False;
- i := i - 1;
- No := '';
- end;
- end else begin
- oc := '';
- chk := False;
- end;
- al := False;
- end;
- end;
- inc(i);
- if (i > Length(Body)) then begin
- if (sw) then begin
- if (No <> '') then Add(sp, i, No);
- end;
- Break;
- end;
- end;
- for i := List.Count - 1 downto 0 do begin
- //plName := Copy(PluginName, LastDelimiter('\',PluginName) + 1, Length(PluginName) - LastDelimiter('/',PluginName) -1 );
- if (AnsiPos('-', PIndex(List[i]).FNo) > 0) then begin
- st := ChooseString(PIndex(List[i]).FNo, '-', 0);
- et := ChooseString(PIndex(List[i]).FNo, '-', 1);
- end else begin
- st := PIndex(List[i]).FNo;
- et := PIndex(List[i]).FNo;
- end;
- r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) +
- Format('<a href="%s&%s=%s&%s=%s&%s=%s" target="_blank">',
- [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) +
- Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '</A>' +
- Copy(r,PIndex(List[i]).FIndexTo,Length(r));
- Dispose(PIndex(List[i]));
- end;
- List.Free;
- Result := r;
-end;
-
-
+{!
+\brief Boolean \82ð Integer \82É\95Ï\8a·
+\return False..0, True..1
+}
function TGikoSys.BoolToInt(b: Boolean): Integer;
begin
Result := IfThen(b, 1, 0);
end;
+{!
+\brief Integer \82ð Boolean \82É\95Ï\8a·
+\return 1..True, other..False
+\todo 0..False, other..True \82Ì\95û\82ª\82¢\82¢\82Ì\82Å\82Í?
+ (\82±\82Ì\8ed\97l\82É\88Ë\91¶\82µ\82Ä\82¢\82é\82©\82à\82µ\82ê\82È\82¢\82Ì\82Å\96¢\8fC\90³)
+}
function TGikoSys.IntToBool(i: Integer): Boolean;
begin
Result := i = 1;
end;
-//gzip\82Å\88³\8fk\82³\82ê\82½\82Ì\82ð\96ß\82·
+{!
+\brief gzip\82Å\88³\8fk\82³\82ê\82½\82Ì\82ð\96ß\82·
+\param ResStream \93Ç\82Ý\8d\9e\82Þ\83X\83g\83\8a\81[\83\80
+\param ContentEncoding \83G\83\93\83R\81[\83f\83B\83\93\83O
+\return \93W\8aJ\82³\82ê\82½\95¶\8e\9a\97ñ
+}
function TGikoSys.GzipDecompress(ResStream: TStream; ContentEncoding: string): string;
const
BUF_SIZE = 4096;
buf: array[0..BUF_SIZE - 1] of Byte;
cnt: Integer;
s: string;
- i: Integer;
+ i, ln: Integer;
begin
Result := '';
TextStream := TStringStream.Create('');
//NULL\95¶\8e\9a\82ð"*"\82É\82·\82é
s := TextStream.DataString;
i := Length(s);
+ ln := i;
while (i > 0) and (s[i] = #0) do
Dec(i);
- s := Copy(s, 1, i);
+ Delete(s, i + 1, ln - i);
i := Pos(#0, s);
while i <> 0 do begin
s[i] := '*';
i := Pos(#0, s);
end;
+
Result := s;
finally
TextStream.Free;
end;
end;
-procedure TGikoSys.LoadKeySetting(ActionList: TActionList);
+{!
+\brief \83A\83N\83V\83\87\83\93\82É\83V\83\87\81[\83g\83J\83b\83g\83L\81[\82ð\90Ý\92è
+\param ActionList \90Ý\92è\82·\82é\83A\83N\83V\83\87\83\93\88ê\97\97
+\param FileName Ini\83t\83@\83C\83\8b\82Ì\96¼\91O
+}
+procedure TGikoSys.LoadKeySetting(ActionList: TActionList; FileName: String);
const
STD_SEC = 'KeySetting';
var
SecList: TStringList;
Component: TComponent;
begin
- if not FileExists(GetConfigDir + KEY_SETTING_FILE_NAME) then
+ if not FileExists(fileName) then
Exit;
SecList := TStringList.Create;
- ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
+ ini := TMemIniFile.Create(fileName);
try
ini.ReadSection(STD_SEC, SecList);
for i := 0 to SecList.Count - 1 do begin
end;
end;
-procedure TGikoSys.SaveKeySetting(ActionList: TActionList);
-const
- STD_SEC = 'KeySetting';
-var
- i: Integer;
- ini: TMemIniFile;
-begin
- ini := TMemIniFile.Create(GetConfigDir + KEY_SETTING_FILE_NAME);
- try
- for i := 0 to ActionList.ActionCount - 1 do begin
- if ActionList.Actions[i].Tag = -1 then
- Continue;
- ini.WriteInteger(STD_SEC, ActionList.Actions[i].Name, TAction(ActionList.Actions[i]).ShortCut);
- end;
- ini.UpdateFile;
- finally
- ini.Free;
- end;
-end;
-
-procedure TGikoSys.LoadEditorKeySetting(ActionList: TActionList);
-const
- STD_SEC = 'KeySetting';
-var
- i: Integer;
- ini: TMemIniFile;
- ActionName: string;
- ActionKey: Integer;
- SecList: TStringList;
- Component: TComponent;
-begin
- if not FileExists(GetConfigDir + EKEY_SETTING_FILE_NAME) then
- Exit;
- SecList := TStringList.Create;
- ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
- try
- ini.ReadSection(STD_SEC, SecList);
- for i := 0 to SecList.Count - 1 do begin
- ActionName := SecList[i];
- ActionKey := ini.ReadInteger(STD_SEC, ActionName, -1);
- if ActionKey <> -1 then begin
- Component := ActionList.Owner.FindComponent(ActionName);
- if TObject(Component) is TAction then begin
- TAction(Component).ShortCut := ActionKey;
- end;
- end;
- end;
- finally
- ini.Free;
- SecList.Free;
- end;
-end;
+{!
+\brief \83A\83N\83V\83\87\83\93\82É\90Ý\92è\82³\82ê\82Ä\82¢\82é\83V\83\87\81[\83g\83J\83b\83g\83L\81[\82ð\83t\83@\83C\83\8b\82É\95Û\91¶
+\param ActionList \95Û\91¶\82·\82é\83A\83N\83V\83\87\83\93\88ê\97\97
+\param FileName Ini\83t\83@\83C\83\8b\96¼
-procedure TGikoSys.SaveEditorKeySetting(ActionList: TActionList);
+ActionList \82É\90Ý\92è\82³\82ê\82Ä\82¢\82é\83V\83\87\81[\83g\83J\83b\83g\83L\81[\82ð FileName \82É\95Û\91¶\82µ\82Ü\82·\81B
+}
+procedure TGikoSys.SaveKeySetting(ActionList: TActionList; FileName: String);
const
STD_SEC = 'KeySetting';
var
i: Integer;
ini: TMemIniFile;
begin
- ini := TMemIniFile.Create(GetConfigDir + EKEY_SETTING_FILE_NAME);
+ ini := TMemIniFile.Create(GetConfigDir + FileName);
try
for i := 0 to ActionList.ActionCount - 1 do begin
if ActionList.Actions[i].Tag = -1 then
end;
end;
-//
+
+{!
+\brief \83v\83\8d\83Z\83X\82Ì\90¶\90¬
+\param AppPath \8bN\93®\82·\82é\83v\83\8d\83Z\83X\82Ì\83t\83@\83C\83\8b\83p\83X
+\param Param AppPath \82É\93n\82·\88ø\90\94
+}
procedure TGikoSys.CreateProcess(const AppPath: string; const Param: string);
var
PI: TProcessInformation;
SI.cbReserved2 := 0;
SI.lpReserved2 := nil;
SI.dwysize := 0;
- Windows.CreateProcess(nil,
+ if Windows.CreateProcess(nil,
PChar(Path),
nil,
nil,
nil,
nil,
SI,
- PI);
+ PI) then
+ begin
+ CloseHandle(PI.hProcess);
+ end;
+
end;
+{!
+\brief Web \83u\83\89\83E\83U\82ð\8bN\93®
+\param URL Web \83u\83\89\83E\83U\82Å\95\\8e¦\82·\82é URL
+\param BrowserType \83u\83\89\83E\83U\82Ì\83^\83C\83v(IE \82©\82Ç\82¤\82©)
+}
procedure TGikoSys.OpenBrowser(URL: string; BrowserType: TGikoBrowserType);
+var
+ i, j : Integer;
+ path, arg : String;
+ params : TStringList;
begin
case BrowserType of
gbtIE:
HlinkNavigateString(nil, PWideChar(WideString(URL)));
gbtUserApp, gbtAuto:
- if (Setting.URLApp) and (FileExists(Setting.URLAppFile)) then
- GikoSys.CreateProcess(Setting.URLAppFile, URL)
- else
+ if (Setting.URLApp) then begin
+ if (FileExists(Setting.URLAppFile)) then begin
+ GikoSys.CreateProcess(Setting.URLAppFile, URL)
+ end else begin
+ // \8bN\93®\83p\83\89\83\81\81[\83^\95t\82«\91Î\8dô
+ path := '';
+ params := TStringList.Create;
+ try
+ params.Delimiter := ' ';
+ params.DelimitedText := Setting.URLAppFile;
+ for i := 0 to params.Count - 1 do begin
+ path := TrimLeft(path + ' ' + params[i]);
+ if (FileExists(path)) then begin
+ arg := '';
+ for j := i + 1 to params.Count - 1 do begin
+ arg := arg + ' ' + params[j];
+ end;
+ break;
+ end;
+ end;
+ if i < params.Count then begin
+ GikoSys.CreateProcess(path, arg + ' ' + URL);
+ end else begin
+ HlinkNavigateString(nil, PWideChar(WideString(URL)));
+ end;
+ finally
+ params.Free;
+ end;
+ end;
+ end else
HlinkNavigateString(nil, PWideChar(WideString(URL)));
end;
end;
+{!
+\brief \95¶\8e\9a\8eÀ\91Ì\8eQ\8fÆ\82ð\83f\83R\81[\83h
+\param AStr \83f\83R\81[\83h\82·\82é\95¶\8e\9a\97ñ
+\return \83f\83R\81[\83h\82³\82ê\82½\95¶\8e\9a\97ñ
+}
function TGikoSys.HTMLDecode(const AStr: String): String;
var
Sp, Rp, Cp, Tp: PChar;
SetLength(Result, Rp - PChar(Result));
end;
+{!
+\brief HTML \82Ì\83A\83\93\83J\81[\83^\83O\82©\82ç URL \82ð\8eæ\93¾
+\param s URL \82ð\8eæ\93¾\82·\82é HTML
+\return \8eæ\93¾\82µ\82½ URL
+}
function TGikoSys.GetHRefText(s: string): string;
var
Index: Integer;
Result := Trim(s);
end;
-//\83z\83X\83g\96¼\82ª\82Q\82\83\82\88\82©\82Ç\82¤\82©\83`\83F\83b\83N\82·\82é
+{!
+\brief \83z\83X\83g\96¼\82ª\82Q\82\83\82\88\82©\82Ç\82¤\82©\83`\83F\83b\83N\82·\82é
+\param Host \83`\83F\83b\83N\82·\82é\83z\83X\83g\96¼
+\return 2\82¿\82á\82ñ\82Ë\82é\82Ì\83z\83X\83g\96¼\82È\82ç True
+}
function TGikoSys.Is2chHost(Host: string): Boolean;
const
HOST_NAME: array[0..1] of string = ('2ch.net', 'bbspink.com');
end;
end;
+{!
+\brief 2\82¿\82á\82ñ\82Ë\82é\8c`\8e®\82Ì URL \82ð\95ª\89ð
+\param url 2\82¿\82á\82ñ\82Ë\82é\8c`\8e®\82Ì URL
+\param path test/read.cgi \82È\82Ç\82Ì\92\86\8aÔ\83p\83X(ParseURI \82©\82ç\93¾\82é)
+\param document index.html \82È\82Ç\82Ì\83h\83L\83\85\83\81\83\93\83g\96¼(ParseURI \82©\82ç\93¾\82é)
+\param BBSID OUT:BBSID \82ª\95Ô\82é(ex. giko)
+\param BBSKey OUT:\83X\83\8c\83b\83h\83L\81[\82ª\95Ô\82é(ex. 10000000000)
+\return 2\82¿\82á\82ñ\82Ë\82é\82Ì URL \82Æ\82µ\82Ä\95ª\89ð\82Å\82«\82½\82È\82ç True
+}
function TGikoSys.Parse2chURL(const url: string; const path: string; const document: string; var BBSID: string; var BBSKey: string): Boolean;
var
Index: Integer;
Index := AnsiPos(READ_PATH, path);
if Index <> 0 then begin
s := Copy(path, Index + Length(READ_PATH), Length(path));
- if s[1] = '/' then
+ end else begin
+ Index := AnsiPos(HTML_READ_PATH, path);
+ if Index <> 0 then begin
+ s := Copy(path, Index + Length(HTML_READ_PATH), Length(path));
+ end;
+ end;
+ if Index <> 0 then begin
+ if (Length(s) > 0) and (s[1] = '/') then
Delete(s, 1, 1);
BBSID := GetTokenIndex(s, '/', 0);
BBSKey := GetTokenIndex(s, '/', 1);
end;
end;
end;
+
+{!
+\brief 2ch \8c`\8e®\82Ì URL \82©\82ç\83\8c\83X\94Ô\82ð\8eæ\93¾
+\param URL 2\82¿\82á\82ñ\82Ë\82é\8c`\8e®\82Ì URL
+\param stRes OUT:\8aJ\8en\83\8c\83X\94Ô\82ª\95Ô\82é
+\param endRes OUT:\8fI\97¹\83\8c\83X\94Ô\82ª\95Ô\82é
+
+http://2ch.net/\92\86\97ª/32-50 \n
+\82Ì\8fê\8d\87 stRef = 32, endRes = 50 \82É\82È\82é
+}
procedure TGikoSys.GetPopupResNumber(URL : string; var stRes, endRes : Int64);
+const
+ START_NAME : array[0..1] of String = ('st=', 'start=');
+ END_NAME : array[0..1] of String = ('to=', 'end=');
+ RES_NAME : array[0..0] of String = ('res=');
var
buf : String;
convBuf : String;
ps : Int64;
pch : PChar;
+ bufList : TStringList;
+ i, j, idx : Integer;
begin
URL := Trim(LowerCase(URL));
- if (AnsiPos('&st=', URL ) <> 0) and ( AnsiPos( '&to=',URL) <> 0 ) then begin
- stRes := 0;
- endRes := 0;
- try
- buf := Copy( URL, AnsiPos('&st=', URL ) + 4, AnsiPos( '&to=',URL) - AnsiPos('&st=', URL ) - 4 );
- if buf <> '' then
- stRes := StrToInt64( buf );
- if AnsiPos( '&nofirst=',URL) <> 0 then begin
- buf := Copy( URL, AnsiPos('&to=', URL ) + 4, AnsiPos( '&nofirst=',URL) - AnsiPos('&to=', URL ) - 4);
- end else begin
- buf := Copy( URL, AnsiPos('&to=', URL ) + 4, Length( URL ) - AnsiPos('&to=', URL ) - 4 + 1 );
- ps := 0;
- pch := PChar(buf);
- while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
- buf := Copy( buf, 1, ps );
- end;
- try
- if buf <> '' then
- endRes := StrToInt64(buf)
- except
- endRes := 0;
- end;
- except
- stRes := 0;
- end;
- if (stRes <> 0) and (endRes = 0) then
- endRes := stRes + MAX_POPUP_RES
- else if (stRes = 0) and (endRes <> 0) then begin
- stRes := endRes - MAX_POPUP_RES;
- if stRes < 1 then
- stRes := 1;
- end;
- GikoSys.GetBrowsableThreadURL( URL );
- end else if( AnsiPos('&res=', URL ) <> 0 ) then begin
- endRes := 0;
- buf := Copy( URL, AnsiPos('&res=', URL ) + 5, Length( URL ) - AnsiPos('&res=', URL ) - 5 + 1 );
- ps := 0;
- pch := PChar(buf);
- while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
- buf := Copy( buf, 1, ps );
- try
- if buf <> '' then
- stRes := StrToInt(buf)
- else begin
- stRes := 0;
- end;
- except
- stRes := 0;
- end;
- end else if (AnsiPos('&start=', URL ) <> 0) and ( AnsiPos( '&end=',URL) <> 0 ) then begin
- try
- stRes := StrToInt64( Copy( URL, AnsiPos('&start=', URL ) + 7, AnsiPos( '&end=',URL) - AnsiPos('&start=', URL ) - 7 ) );
- if AnsiPos( '&nofirst=',URL) <> 0 then begin
- buf := Copy( URL, AnsiPos('&end=', URL ) + 5, AnsiPos( '&nofirst=',URL) - AnsiPos('&end=', URL ) - 5);
- end else begin
- buf := Copy( URL, AnsiPos('&end=', URL ) + 5, Length( URL ) - AnsiPos('&to=', URL ) - 5 + 1 );
- ps := 0;
- pch := PChar(buf);
- while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
- buf := Copy( buf, 1, ps );
- end;
- try
- if buf <> '' then
- endRes := StrToInt64(buf);
- except
- endRes := 0;
- end;
- except
- stRes := 0;
- end;
- end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
+ for i := 0 to Length(START_NAME) -1 do begin
+ idx := AnsiPos(START_NAME[i], URL);
+ if (idx <> 0) then begin
+ break;
+ end;
+ idx := AnsiPos(END_NAME[i], URL);
+ if (idx <> 0) then begin
+ break;
+ end;
+
+ end;
+
+ if (idx <> 0) then begin
+ idx := AnsiPos('?', URL);
+ if (idx = 0) then begin
+ idx := LastDelimiter('/', URL);
+ end;
+ stRes := 0;
+ endRes := 0;
+ bufList := TStringList.Create();
+ try
+ bufList.Delimiter := '&';
+ bufList.DelimitedText := Copy(URL, idx + 1, Length(URL));
+ for i := 0 to bufList.Count - 1 do begin
+ convBuf := '';
+ // \8aJ\8en\83\8c\83X\94Ô\82Ì\8c\9f\8dõ
+ if (stRes = 0) then begin
+ for j := 0 to Length(START_NAME) - 1 do begin
+ idx := AnsiPos(START_NAME[j], bufList[i]);
+ if (idx = 1) then begin
+ convBuf := Copy(bufList[i], idx + Length(START_NAME[j]), Length(bufList[i]));
+ stRes := StrToInt64Def( convBuf, 0 );
+ break;
+ end;
+ end;
+ end;
+ // \8fI\97¹\83\8c\83X\94Ô\82Ì\8c\9f\8dõ
+ if (convBuf = '') and (endRes = 0) then begin
+ for j := 0 to Length(END_NAME) - 1 do begin
+ idx := AnsiPos(END_NAME[j], bufList[i]);
+ if (idx = 1) then begin
+ convBuf := Copy(bufList[i], idx + Length(END_NAME[j]), Length(bufList[i]));
+ endRes := StrToInt64Def( convBuf, 0 );
+ break;
+ end;
+ end;
+ end;
+ // \83\8c\83X\94Ô\82Ì\8c\9f\8dõ
+ if ((stRes = 0) and (endRes = 0) and (convBuf = '')) then begin
+ for j := 0 to Length(RES_NAME) - 1 do begin
+ idx := AnsiPos(RES_NAME[j], bufList[i]);
+ if (idx = 1) then begin
+ convBuf := Copy(bufList[i], idx + Length(RES_NAME[j]), Length(bufList[i]));
+ stRes := StrToInt64Def( convBuf, 0 );
+ endRes := stRes;
+ break;
+ end;
+ end;
+ end;
+ end;
+
+ if (stRes <> 0) and (endRes = 0) then begin
+ endRes := stRes + MAX_POPUP_RES;
+ end else if (stRes = 0) and (endRes <> 0) then begin
+ stRes := endRes - MAX_POPUP_RES;
+ if stRes < 1 then begin
+ stRes := 1;
+ end;
+ end;
+ finally
+ bufList.clear;
+ bufList.free;
+ end;
+ end else if ( AnsiPos('.html',URL) <> Length(URL) -4 ) and ( AnsiPos('.htm',URL) <> Length(URL) -3 ) then begin
buf := Copy(URL, LastDelimiter('/',URL)+1,Length(URL)-LastDelimiter('/',URL)+1);
if Length(buf) > 0 then begin
if AnsiPos('-', buf) = 1 then begin
ps := 0;
pch := PChar(buf);
while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
- try
- convBuf := Copy( buf, 1, ps );
- if convBuf <> '' then
- endRes := StrToInt64(convBuf)
- else
- endRes := 0;
- except
- endRes := 0;
- end;
+ convBuf := Copy( buf, 1, ps );
+ if convBuf <> '' then begin
+ endRes := StrToInt64Def(convBuf, 0);
+ end;
if endRes <> 0 then begin
stRes := endRes - MAX_POPUP_RES;
if stRes < 1 then
ps := 0;
pch := PChar(buf);
while ( ps < Length(buf) )and ( pch[ps] >= '0' ) and ( pch[ps] <= '9' ) do Inc(ps);
- try
- convBuf := Copy( buf, 1, ps );
- if convBuf <> '' then
- endRes := StrToInt64(convBuf)
- else
- endRes := 0;
- except
- endRes := 0;
- end;
+ convBuf := Copy( buf, 1, ps );
+ if convBuf <> '' then begin
+ endRes := StrToInt64Def(convBuf, 0);
+ end;
end else begin
stRes := 0;
end;
end;
end;
end;
- end else begin
- //stRes := 0;
- //endRes := 0;
end;
end;
+{!
+\brief 2\82¿\82á\82ñ\82Ë\82é\8c`\8e®\82Ì URL \82ð\95ª\89ð
+\param URL 2\82¿\82á\82ñ\82Ë\82é\8c`\8e®\82Ì URL
+\return \95ª\89ð\82³\82ê\82½\97v\91f
+}
function TGikoSys.Parse2chURL2(URL: string): TPathRec;
var
i: Integer;
//\95W\8f\80\8f\91\8e®
//\8dÅ\8cã\82Íl50, 10, 10-20, 10n, 10-20n, -10, 10-, 10n- \82È\82Ç
//http://xxx.2ch.net/test/read.cgi/bbsid/1000000000/
- FAWKStr.RegExp := '/test/read.cgi/.+/[0-9]+/?.*';
+ FAWKStr.RegExp := '/test/read.(cgi|html)/.+/[0-9]+/?.*';
if FAWKStr.Match(FAWKStr.ProcessEscSeq(s), RStart, RLength) > 0 then begin
s := Copy(s, 15, Length(s));
end;
end;
+{!
+\brief URI \82ð\95ª\89ð
+\param URL \95ª\89ð\82·\82é URI
+\param Protocol OUT:\83v\83\8d\83g\83R\83\8b\82ª\95Ô\82é(ex. http)
+\param Host OUT:\83z\83X\83g\82ª\95Ô\82é(ex. hoge.com)
+\param Path OUT:\92\86\8aÔ\83p\83X\82ª\95Ô\82é(ex. test/read.cgi)
+\param Document OUT:\83h\83L\83\85\83\81\83\93\83g\96¼\82ª\95Ô\82é(ex. index.html)
+\param Port OUT:\83|\81[\83g\82ª\95Ô\82é(ex. 8080)
+\param Bookmark OUT:\83u\83b\83N\83}\81[\83N(?)\82ª\95Ô\82é
+}
procedure TGikoSys.ParseURI(const URL : string; var Protocol, Host, Path, Document, Port, Bookmark: string);
var
URI: TIdURI;
end;
end;
+{!
+\brief \83M\83R\83i\83r\82Ì\83o\81[\83W\83\87\83\93\82ð\8eæ\93¾
+\return \83o\81[\83W\83\87\83\93\82Ì\89º 2 \8c\85(dwFileVersionLS)
+}
function TGikoSys.GetVersionBuild: Integer;
var
FixedFileInfo: PVSFixedFileInfo;
end;
end;
+{!
+\brief \83X\83\8c\83b\83h URL \82Ì\90³\8bK\89»
+\param inURL \90³\8bK\89»\82·\82é\83X\83\8c\83b\83h URL
+\return \90³\8bK\89»\82³\82ê\82½\83X\83\8c\83b\83h URL
+
+\83X\83\8c\83b\83h URL \82ð\83M\83R\83i\83r\82Ì\92\86\82Å\88ê\88Ó\82È\82à\82Ì\82É\90³\8bK\89»\82µ\82Ü\82·\81B
+\88ê\88Ó\82È URL \82É\82·\82é\8e\96\82Å\81AURL \82©\82ç\83X\83\8c\83b\83h\82ð\93±\82«\8fo\82·\8dì\8bÆ\82ð\8dÅ\93K\89»\82µ\82Ü\82·\81B\n
+\90³\8bK\89»\82Ì\95û\90j\82Æ\82µ\82Ä\81A\83T\83C\83g\82ª\90\84\8f§\82·\82é\83f\83t\83H\83\8b\83g\82Ì URL \82É\82È\82é\82æ\82¤\82É\90S\82ª\82¯\82Ü\82·\81B
+(1-1000 \82Ì\82æ\82¤\82È\95\89\89×\82ð\82©\82¯\82é\82à\82Ì\82É\82Í\82µ\82È\82¢\82±\82Æ)
+
+\97á(\90³\8bK\89»\91O):\n
+http://\92\86\97ª/ \n
+http://\92\86\97ª/20-100
+
+(\90³\8bK\89»\8cã):\n
+http://\92\86\97ª/l50
+}
function TGikoSys.GetBrowsableThreadURL(
inURL : string
) : string;
var
threadItem : TThreadItem;
boardPlugIn : TBoardPlugIn;
+ board : TBoard;
i : Integer;
begin
//===== \83v\83\89\83O\83C\83\93
try
- for i := Length( BoardPlugIns ) - 1 downto 0 do begin
- if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
- if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
- boardPlugIn := BoardPlugIns[ i ];
- threadItem := TThreadItem.Create( boardPlugIn, inURL );
- Result := threadItem.URL;
- threadItem.Free;
+ for i := Length( BoardGroups ) - 1 downto 1 do begin
+ if Assigned( Pointer( BoardGroups[i].BoardPlugIn.Module ) ) then begin
+ if BoardGroups[i].BoardPlugIn.AcceptURL( inURL ) = atThread then begin
+ board := BBSsFindBoardFromURL( BoardGroups[i].BoardPlugIn.ExtractBoardURL(inURL) );
+ if board <> nil then begin
+ boardPlugIn := BoardGroups[i].BoardPlugIn;
+ threadItem := TThreadItem.Create( boardPlugIn, board, inURL );
+ Result := threadItem.URL;
+ threadItem.Free;
- Break;
+ end;
+ Exit;
end;
end;
end;
end;
+{!
+\brief \83X\83\8c\83b\83h URL \82ð\94Â URL \82É\95Ï\8a·
+\param inURL \83X\83\8c\83b\83h URL
+\return \94Â URL
+}
function TGikoSys.GetThreadURL2BoardURL(
inURL : string
) : string;
var
threadItem : TThreadItem;
boardPlugIn : TBoardPlugIn;
+ board : TBoard;
i : Integer;
begin
//===== \83v\83\89\83O\83C\83\93
try
- for i := Length( BoardPlugIns ) - 1 downto 0 do begin
- if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
- if BoardPlugIns[ i ].AcceptURL( inURL ) = atThread then begin
- boardPlugIn := BoardPlugIns[ i ];
- threadItem := TThreadItem.Create( boardPlugIn, inURL );
- Result := BoardPlugIns[ i ].GetBoardURL( Longword( threadItem ) );
+ for i := Length( BoardGroups ) - 1 downto 1 do begin
+ if Assigned( Pointer( BoardGroups[i].BoardPlugIn.Module ) ) then begin
+ if BoardGroups[i].BoardPlugIn.AcceptURL( inURL ) = atThread then begin
+ board := BBSsFindBoardFromURL(BoardGroups[i].BoardPlugIn.ExtractBoardURL(inURL));
+ boardPlugIn := BoardGroups[i].BoardPlugIn;
+ threadItem := TThreadItem.Create( boardPlugIn, board, inURL );
+ Result := BoardGroups[i].BoardPlugIn.GetBoardURL( Longword( threadItem ) );
threadItem.Free;
Break;
end;
+{!
+\brief 2ch\97p:\83X\83\8c\83b\83h URL \82ð\94Â URL \82É\95Ï\8a·
+\param inURL \83X\83\8c\83b\83h URL
+\return \94Â URL
+\see TGikoSys.GetThreadURL2BoardURL
+}
function TGikoSys.Get2chThreadURL2BoardURL(
inURL : string
) : string;
end;
+{!
+\brief 2ch\97p:\83X\83\8c\83b\83h URL \82Ì\90³\8bK\89»
+\param inURL \90³\8bK\89»\82·\82é\83X\83\8c\83b\83h URL
+\return \90³\8bK\89»\82³\82ê\82½\83X\83\8c\83b\83h URL
+\see TGikoSys.GetBrowsableThreadURL
+}
function TGikoSys.Get2chBrowsableThreadURL(
inURL : string
) : string;
end;
+{!
+\brief 2ch\97p:\94Â URL \82©\82ç\83X\83\8c\83b\83h URL \82ð\8dì\90¬
+\param inBoard \94Â URL
+\param inKey \83X\83\8c\83b\83h\83L\81[(ex. 1000000000)
+\return \83X\83\8c\83b\83h URL
+}
function TGikoSys.Get2chBoard2ThreadURL(
inBoard : TBoard;
inKey : string
begin
server := UrlToServer( inBoard.URL );
- if Is2chHost( server ) then
+ //if Is2chHost( server ) then
+ if inBoard.Is2ch then
Result := server + 'test/read.cgi/' + inBoard.BBSID + '/' + inKey + '/l50'
else
Result := server + 'test/read.cgi?bbs=' + inBoard.BBSID + '&key=' + inKey + '&ls=50';
end;
-(*************************************************************************
- *\8b@\94\\96¼\81@\81@\81F\83{\81[\83h\83t\83@\83C\83\8b\97ñ\8b\93
- *\89Â\8e\8b\81@\81@\81@\81FPublic
- *************************************************************************)
-procedure TGikoSys.ListBoardFile;
-var
- boardFileList : TStringList;
- i, l, k : Integer;
-begin
-
- // BBS \82Ì\8aJ\95ú
- try
- for i := 0 to Length( BBSs ) - 1 do
- BBSs[ i ].Free;
- except
- end;
- SetLength( BBSs, 0 );
-
- l := 0;
- // \94Â\83\8a\83X\83g\82Ì\97ñ\8b\93
- if FileExists( GikoSys.GetBoardFileName ) then begin
- SetLength( BBSs, l + 1 );
- BBSs[ l ] := TBBS.Create( GikoSys.GetBoardFileName );
- BBSs[ l ].Title := '\82Q\82¿\82á\82ñ\82Ë\82é';
- Inc( l );
- end;
-
- if FileExists( GikoSys.GetCustomBoardFileName ) then begin
- SetLength( BBSs, l + 1 );
- BBSs[ l ] := TBBS.Create( GikoSys.GetCustomBoardFileName );
- BBSs[ l ].Title := '\82»\82Ì\91¼';
- Inc( l );
- end;
+{!
+\brief \83{\81[\83h\83t\83@\83C\83\8b\97ñ\8b\93
- // Board \83t\83H\83\8b\83_
- if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
- BoardFileList := TStringList.Create;
+\97ñ\8b\93\82³\82ê\82½ BBS(\83{\81[\83h) \82Í BBSs \82É\93ü\82è\82Ü\82·\81B
+}
+procedure TGikoSys.ListBoardFile;
+var
+ boardFileList : TStringList;
+ i, l : Integer;
+ sCategory : TCategory;
+begin
+ // BBS \82Ì\8aJ\95ú
try
- GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*', BoardFileList, True, True );
- for k := BoardFileList.Count - 1 downto 0 do begin
- if AnsiCompareText(ExtractFileExt(BoardFileList[ k ]), '.bak') = 0 then
- BoardFileList.Delete(k);
- end;
- SetLength( BBSs, l + BoardFileList.Count );
- for i := BoardFileList.Count - 1 downto 0 do begin
- BBSs[ l ] := TBBS.Create( BoardFileList[ i ] );
- BBSs[ l ].Title := ChangeFileExt( ExtractFileName( BoardFileList[ i ] ), '' );
-
- Inc( l );
+ for i := 0 to Length( BBSs ) - 1 do
+ BBSs[ i ].Free;
+ except
+ end;
+ SetLength( BBSs, 0 );
+
+ l := 0;
+ // \94Â\83\8a\83X\83g\82Ì\97ñ\8b\93
+ if FileExists( GikoSys.GetBoardFileName ) then begin
+ SetLength( BBSs, l + 1 );
+ BBSs[ l ] := TBBS.Create( GikoSys.GetBoardFileName );
+ BBSs[ l ].Title := '\82Q\82¿\82á\82ñ\82Ë\82é';
+ Inc( l );
+ end;
+
+ if FileExists( GikoSys.GetCustomBoardFileName ) then begin
+ SetLength( BBSs, l + 1 );
+ BBSs[ l ] := TBBS.Create( GikoSys.GetCustomBoardFileName );
+ BBSs[ l ].Title := '\82»\82Ì\91¼';
+ Inc( l );
+ end;
+
+ // Board \83t\83H\83\8b\83_
+ if DirectoryExists( GikoSys.Setting.GetBoardDir ) then begin
+ BoardFileList := TStringList.Create;
+ try
+ BoardFileList.BeginUpdate;
+ GikoSys.GetFileList( GikoSys.Setting.GetBoardDir, '*.txt', BoardFileList, True, True );
+ BoardFileList.EndUpdate;
+ SetLength( BBSs, l + BoardFileList.Count );
+ for i := BoardFileList.Count - 1 downto 0 do begin
+ BBSs[ l ] := TBBS.Create( BoardFileList[ i ] );
+ BBSs[ l ].Title := ChangeFileExt( ExtractFileName( BoardFileList[ i ] ), '' );
+ Inc( l );
+ end;
+ finally
+ BoardFileList.Free;
end;
- finally
- BoardFileList.Free;
end;
- end;
-
-end;
-(*************************************************************************
- *\8b@\94\\96¼\81@\81@\81F\83{\81[\83h\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
- *\89Â\8e\8b\81@\81@\81@\81FPublic
- *************************************************************************)
+ // \93Á\8eê\97p\93rBBS\90¶\90¬
+ // \8aù\82É\91¶\8dÝ\82·\82é\8fê\8d\87\82Í\8dí\8f\9c\82·\82é
+ DestorySpecialBBS(BoardGroup.SpecialBBS);
+ SpecialBBS := TBBS.Create('');
+ SpecialBBS.Title := '\93Á\8eê\97p\93r(\94ñ\95\\8e¦)';
+ sCategory := TCategory.Create;
+ sCategory.No := 1;
+ sCategory.Title := '\93Á\8eê\97p\93r(\94ñ\95\\8e¦)';
+ SpecialBBS.Add(sCategory);
+ BoardGroup.SpecialBoard := TSpecialBoard.Create(nil, 'http://localhost/gikonavi/special/index.html');
+ BoardGroup.SpecialBoard.Title := '\83^\83u\88ê\97\97';
+ BoardGroup.SpecialBoard.IsThreadDatRead := True;
+ sCategory.Add(BoardGroup.SpecialBoard);
+end;
+
+{!
+\brief \83{\81[\83h\83t\83@\83C\83\8b\93Ç\82Ý\8d\9e\82Ý
+\param bbs \83{\81[\83h\83t\83@\83C\83\8b\82ð\93Ç\82Ý\8d\9e\82Þ BBS
+}
procedure TGikoSys.ReadBoardFile( bbs : TBBS );
var
- idx : Integer;
+// idx : Integer;
ini : TMemIniFile;
-
+ p : Integer;
boardFile : TStringList;
CategoryList : TStringList;
BoardList : TStringList;
Category : TCategory;
Board : TBoard;
inistr : string;
- RoundItem : TRoundItem;
+ tmpstring : string;
+// RoundItem : TRoundItem;
i, iBound : Integer;
j, jBound : Integer;
k, kBound : Integer;
begin
- if not FileExists( bbs.FilePath ) then
- Exit;
+ if not FileExists( bbs.FilePath ) then
+ Exit;
bbs.Clear;
- ini := TMemIniFile.Create('');
- boardFile := TStringList.Create;
- try
- boardFile.LoadFromFile( bbs.FilePath );
-
- ini.SetStrings( boardFile );
- CategoryList := TStringList.Create;
- BoardList := TStringList.Create;
- try
- ini.ReadSections( CategoryList );
-
- iBound := CategoryList.Count - 1;
- for i := 0 to iBound do begin
- ini.ReadSection( CategoryList[i], BoardList );
- Category := TCategory.Create;
- Category.No := i + 1;
- Category.Title := CategoryList[i];
-
- jBound := BoardList.Count - 1;
- for j := 0 to jBound do begin
- Board := nil;
- inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
-
- //===== \83v\83\89\83O\83C\83\93
- try
- kBound := Length( BoardPlugIns ) - 1;
- for k := 0 to kBound do begin
- if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin
- if BoardPlugIns[ k ].AcceptURL( inistr ) = atBoard then begin
- Board := TBoard.Create( BoardPlugIns[ k ], inistr );
-
- Break;
- end;
- end;
- end;
- except
- // 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¢
- end;
-
- if Board = nil then
- Board := TBoard.Create( nil, inistr );
- Board.BeginUpdate;
- Board.No := j + 1;
- Board.Title := BoardList[j];
- Board.RoundDate := ZERO_DATE;
-
- idx := RoundList.Find(Board);
- if idx <> -1 then begin
- RoundItem := RoundList.Items[idx, grtBoard];
- Board.Round := True;
- Board.RoundName := RoundItem.RoundName;
- end;
-
- Category.Add(Board);
- Board.LoadSettings;
- Board.EndUpdate;
- end;
+ ini := TMemIniFile.Create('');
+ boardFile := TStringList.Create;
- bbs.Add( Category );
- end;
- bbs.IsBoardFileRead := True;
- finally
- BoardList.Free;
- CategoryList.Free;
- end;
+ try
+ boardFile.LoadFromFile( bbs.FilePath );
+
+ ini.SetStrings( boardFile );
+ CategoryList := TStringList.Create;
+ BoardList := TStringList.Create;
+ try
+ ini.ReadSections( CategoryList );
+
+ iBound := CategoryList.Count - 1;
+ for i := 0 to iBound do begin
+ ini.ReadSection( CategoryList[i], BoardList );
+ Category := TCategory.Create;
+ Category.No := i + 1;
+ Category.Title := CategoryList[i];
+
+ jBound := BoardList.Count - 1;
+ for j := 0 to jBound do begin
+ Board := nil;
+ inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
+ //'http://'\82ð\8aÜ\82Ü\82È\82¢\95¶\8e\9a\97ñ\82Ì\8e\9e\82Í\96³\8e\8b\82·\82é
+ if (AnsiPos('http://', AnsiLowerCase(inistr)) = 0) then Continue;
+ //===== \83v\83\89\83O\83C\83\93
+ try
+ kBound := Length(BoardGroups) - 1;
+ for k := 1 to kBound do begin //0\82Í\81A2\82¿\82á\82ñ
+ if Assigned( Pointer( BoardGroups[k].BoardPlugIn.Module ) ) then begin
+ if BoardGroups[k].BoardPlugIn.AcceptURL( inistr ) = atBoard then begin
+ if not BoardGroups[k].Find(inistr, p) then begin
+ tmpstring := BoardGroups[k].BoardPlugIn.ExtractBoardURL( inistr );
+ if AnsiCompareStr(tmpString, inistr) <> 0 then begin
+ if not BoardGroups[k].Find(tmpstring, p) then begin
+ try
+ Board := TBoard.Create( BoardGroups[k].BoardPlugIn, tmpstring );
+ BoardGroups[k].AddObject(tmpstring, Board);
+ Category.Add(Board);
+ except
+ //\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é
+ Board := nil;
+ end;
+ end else begin
+ Board := TBoard(BoardGroups[k].Objects[p]);
+ if Board.ParentCategory <> Category then
+ Category.Add(Board);
+ end;
+ end else begin
+ try
+ Board := TBoard.Create( BoardGroups[k].BoardPlugIn, tmpstring );
+ BoardGroups[k].AddObject(tmpstring, Board);
+ Category.Add(Board);
+ except
+ //\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é
+ Board := nil;
+ end;
+ end;
+ end else begin
+ Board := TBoard(BoardGroups[k].Objects[p]);
+ if Board.ParentCategory <> Category then
+ Category.Add(Board);
+ end;
+ Break;
+ end;
+ end;
+ end;
+ except
+ // 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¢
+ end;
+ try
+ if (Board = nil) then begin
+ if not BoardGroups[0].Find(inistr,p) then begin
+ Board := TBoard.Create( nil, inistr );
+ BoardGroups[0].AddObject(inistr, Board);
+ Category.Add(Board);
+ end else begin
+ Board := TBoard(BoardGroups[0].Objects[p]);
+ if Board.ParentCategory <> Category then
+ Category.Add(Board);
+ end;
+ end;
+
+ if (Board.Multiplicity = 0) then begin
+ Board.BeginUpdate;
+ Board.No := j + 1;
+ Board.Multiplicity := 1;
+ Board.Title := BoardList[j];
+ Board.RoundDate := ZERO_DATE;
+ Board.LoadSettings;
+ Board.EndUpdate;
+ end else begin
+ Board.No := j + 1;
+ Board.Multiplicity := Board.Multiplicity + 1;
+ end;
+ except
+ end;
+ end;
+ bbs.Add( Category );
+ end;
+
+
+ //end;
+ bbs.IsBoardFileRead := True;
+ finally
+ BoardList.Free;
+ CategoryList.Free;
+ end;
finally
- boardFile.Free;
- ini.Free;
+ boardFile.Free;
+ ini.Free;
end;
end;
+{!
+\brief \96¼\8fÌ\82ª\95s\96¾\82È\83J\83e\83S\83\8a\82Ì\90¶\90¬
+\return \90¶\90¬\82³\82ê\82½\83J\83e\83S\83\8a
+}
function TGikoSys.GetUnknownCategory : TCategory;
const
UNKNOWN_CATEGORY = '(\96¼\8fÌ\95s\96¾)';
end;
+{!
+\brief \96¼\8fÌ\82ª\95s\96¾\82È BBS \82Ì\90¶\90¬
+\return \90¶\90¬\82³\82ê\82½ BBS
+}
function TGikoSys.GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard;
var
category : TCategory;
end;
end;
+
+//! Samba.ini
function TGikoSys.GetSambaFileName : string;
begin
Result := Setting.GetSambaFileName;
end;
-procedure TGikoSys.SambaFileExists();
-var
- sambaTmp: string;
- sambaStrList: TStringList;
-begin
- if not FileExists(GikoSys.GetSambaFileName) then begin
- sambaTmp := ChangeFileExt(GikoSys.GetSambaFileName, '.default');
- sambaStrList := TStringList.Create;
- try
- if FileExists(sambaTmp) then begin
- sambaStrList.LoadFromFile(sambaTmp);
- sambaStrList.SaveToFile(GikoSys.GetSambaFileName);
- end;
- finally
- sambaStrList.Free;
- end;
- end;
-end;
-function TGikoSys.GetSameIDResAnchor(const AID : string; ThreadItem: TThreadItem):string;
+{!
+\brief \97ñ\8b\93\82³\82ê\82½\83\8c\83X\94Ô\8d\86\82Ö\82Ì\83A\83\93\83J\81[\97pHTML\8dì\90¬
+\param Numbers \97ñ\8b\93\82³\82ê\82½\83\8c\83X\94Ô\8d\86
+\param ThreadItem \97ñ\8b\93\82·\82é\83X\83\8c\83b\83h
+\param limited \97ñ\8b\93\82·\82é\90\94\82ð\90§\8cÀ\82·\82é\82È\82ç1\88È\8fã
+\return \97ñ\8b\93\82³\82ê\82½\83\8c\83X\83A\83\93\83J\81[
+}
+function TGikoSys.CreateResAnchor(
+ var Numbers: TStringList; ThreadItem: TThreadItem;
+ limited: Integer):string;
var
i: integer;
- body: TStringList;
+ Res: TResRec;
+ ResLink : TResLinkRec;
begin
+ // body\88È\8aO\82Í\8eg\97p\82µ\82È\82¢\82Ì\82Å\8f\89\8aú\89»\82µ\82È\82¢
+ Res.FBody := '';
+ Res.FType := glt2chNew;
+
Result := '';
- if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
- body := TStringList.Create;
- try
- GetSameIDRes(AID, ThreadItem, body);
- for i := 0 to body.Count - 1 do begin
- Result := Result + '>' + body[i] + ' ';
- end;
- finally
- body.Free;
- end;
- Result := ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
- end;
+ if (Numbers <> nil) and (Numbers.Count > 0) then begin
+ if (limited > 0) and (Numbers.Count > limited) then begin
+ for i := Numbers.Count - limited to Numbers.Count - 1 do begin
+ Res.FBody := Res.FBody + '>' + Numbers[i] + ' ';
+ end;
+ end else begin
+ for i := 0 to Numbers.Count - 1 do begin
+ Res.FBody := Res.FBody + '>' + Numbers[i] + ' ';
+ end;
+ end;
+ ResLink.FBbs := ThreadItem.ParentBoard.BBSID;
+ ResLink.FKey := ChangeFileExt(ThreadItem.FileName, '');
+ HTMLCreater.ConvRes(@Res, @ResLink, false);
+ Result := Res.FBody;
+ end;
end;
+
+{!
+\brief \93¯\82¶\93\8a\8de ID \82ð\8e\9d\82Â\83\8c\83X\82ð\97ñ\8b\93
+\param AID \8cÂ\90l\82ð\93Á\92è\82·\82é\93\8a\8de ID
+\param ThreadItem \97ñ\8b\93\82·\82é\83X\83\8c\83b\83h
+\param body OUT:\97ñ\8b\93\82³\82ê\82½\83\8c\83X\94Ô\8d\86\82ª\95Ô\82é
+}
procedure TGikoSys.GetSameIDRes(const AID : string; ThreadItem: TThreadItem;var body: TStringList);
var
i: integer;
ReadList: TStringList;
Res: TResRec;
boardPlugIn : TBoardPlugIn;
+
+ procedure CheckSameID(const AID:String; const Target: String; no: Integer);
+ var
+ pos: Integer;
+ begin
+ pos := AnsiPos('id:', LowerCase(Target));
+ if (pos > 0) then begin
+ if(AnsiPos(AID, Copy(Target, pos-1, Length(Target))) > 0) then begin
+ body.Add(IntToStr(no));
+ end;
+ end else begin
+ if(AnsiPos(AID, Target) > 0) then begin
+ body.Add(IntToStr(no));
+ end;
+ end;
+ end;
begin
- if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
- if ThreadItem.IsBoardPlugInAvailable then begin
+ if (not IsNoValidID(AID)) and
+ (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
+ //if ThreadItem.IsBoardPlugInAvailable then begin
+ if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
//===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
- boardPlugIn := ThreadItem.BoardPlugIn;
+ //boardPlugIn := ThreadItem.BoardPlugIn;
+ boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
for i := 0 to threadItem.Count - 1 do begin
// \83\8c\83X
- Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), i + 1));
- if(AnsiPos(AID, Res.FDateTime) > 0) then begin
- body.Add(IntToStr(i+1));
- end;
+ THTMLCreate.DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), i + 1), @Res);
+ CheckSameID(AID, Res.FDateTime, i+1);
end;
end else begin
ReadList := TStringList.Create;
try
ReadList.LoadFromFile(ThreadItem.GetThreadFileName);
for i := 0 to ReadList.Count - 1 do begin
- Res := DivideStrLine(ReadList[i]);
- if AnsiPos(AID, Res.FDateTime) > 0 then begin
- body.Add(IntToStr(i+1));
- end;
+ THTMLCreate.DivideStrLine(ReadList[i], @Res);
+ CheckSameID(AID, Res.FDateTime, i+1);
end;
finally
ReadList.Free;
end;
end;
end;
-function TGikoSys.GetSameIDResAnchor(AIDNum : Integer; ThreadItem: TThreadItem):string;
+
+{!
+\brief \93¯\82¶\93\8a\8de ID \82ð\8e\9d\82Â\83\8c\83X\82ð\97ñ\8b\93
+\param AIDNum \8cÂ\90l\82ð\93Á\92è\82·\82é\93\8a\8de ID
+\param ThreadItem \97ñ\8b\93\82·\82é\83X\83\8c\83b\83h
+\param body OUT:\97ñ\8b\93\82³\82ê\82½\83\8c\83X\94Ô\8d\86\82ª\95Ô\82é
+}
+procedure TGikoSys.GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList);
var
- i: integer;
- body: TStringList;
+ AID : String;
begin
- Result := '';
- if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
- body := TStringList.Create;
- try
- GetSameIDRes(AIDNum, ThreadItem, body);
- for i := 0 to body.Count - 1 do begin
- Result := Result + '>' + body[i] + ' ';
- end;
- finally
- body.Free;
- end;
- Result := ConvRes(Result, ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true', false);
+ AID := GetResID(AIDNum, ThreadItem);
+ if not IsNoValidID(AID) then begin
+ GetSameIDRes(AID, ThreadItem, body);
end;
end;
-
-procedure TGikoSys.GetSameIDRes(AIDNum : Integer; ThreadItem: TThreadItem;var body: TStringList);
+{!
+\brief \93\8a\8de ID \8eæ\93¾
+\param AIDNum \93\8a\8de \83\8c\83X\94Ô\8d\86
+\param ThreadItem \93\8a\8de\83X\83\8c\83b\83h
+\param body OUT:\93\8a\8deID
+}
+function TGikoSys.GetResID(AIDNum: Integer; ThreadItem: TThreadItem): String;
var
Res: TResRec;
boardPlugIn : TBoardPlugIn;
- AID : String;
- stList: TStringList;
- i : Integer;
begin
+ Result := '';
if (ThreadItem <> nil) and (ThreadItem.IsLogFile)
and (AIDNum > 0) and (AIDNum <= ThreadItem.Count) then begin
- if ThreadItem.IsBoardPlugInAvailable then begin
+ //if ThreadItem.IsBoardPlugInAvailable then begin
+ if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin
//===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
- boardPlugIn := ThreadItem.BoardPlugIn;
- Res := DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), AIDNum));
+ //boardPlugIn := ThreadItem.BoardPlugIn;
+ boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn;
+ THTMLCreate.DivideStrLine(boardPlugIn.GetDat(DWORD( threadItem ), AIDNum), @Res);
end else begin
- Res := DivideStrLine( ReadThreadFile(ThreadItem.GetThreadFileName, AIDNum));
- end;
- AID := Res.FDateTime;
- if AnsiPos('id', AnsiLowerCase(AID)) > 0 then
- AID := Copy(AID, AnsiPos('id', AnsiLowerCase(AID)) - 1, 11)
- else begin
- stlist := TStringList.Create;
- try
- stList.DelimitedText := AID;
- for i := 0 to stList.Count - 1 do
- if Length(WideString(stList[i])) = 8 then begin
- if NotDateorTimeString(stList[i]) then begin
- AID := stList[i];
- break;
- end;
- end;
- finally
- stList.Free;
- end;
+ THTMLCreate.DivideStrLine( ReadThreadFile(ThreadItem.GetThreadFileName, AIDNum), @Res);
end;
-
- GetSameIDRes(AID, ThreadItem, body);
+ Result := ExtructResID(Res.FDateTime);
end;
end;
-function TGikoSys.NotDateorTimeString(const AStr : string): boolean;
+{!
+\brief \83\8c\83X\82Ì\8e\9e\8d\8f\95\94\82©\82çID\82ð\92\8a\8fo\82·\82é
+\param ADateStr \8e\9e\8d\8f\95\94\82Ì\95¶\8e\9a\97ñ
+\return ID(ID\82Æ\82Ý\82È\82¹\82é\95\94\95ª\82ª\82È\82¢\82Æ\82«\82Í\8bó\95¶\8e\9a\97ñ)
+}
+function TGikoSys.ExtructResID(ADateStr: String): String;
+var
+ stlist : TStringList;
begin
- Result := false;
- try
- StrToDate(AStr);
- except
- try
- StrToTime(AStr);
- Result := false;
- except
- Result := true;
- end;
- end;
-
+ Result := '';
+ if AnsiPos('id', AnsiLowerCase(ADateStr)) > 0 then begin
+ Result := Copy(ADateStr, AnsiPos('id', AnsiLowerCase(ADateStr)), Length(ADateStr));
+ if AnsiPos(' ', Result) > 0 then begin
+ Result := Copy(Result, 1, AnsiPos(' ', Result) - 1);
+ end;
+ Result := ' ' + Result;
+ end else begin
+ stlist := TStringList.Create;
+ try
+ stList.Delimiter := ' ';
+ stList.DelimitedText := ADateStr;
+ // \93ú\95t \8e\9e\8d\8f ID \91¼\81@\82Æ\8cÅ\92è\82Å\8dl\82¦\82é
+ if (stList.Count >= 3) then begin
+ if Length(stList[3 - 1]) >= 7 then begin
+ Result := stList[3 - 1];
+ end;
+ end;
+ finally
+ stList.Free;
+ end;
+ end;
end;
+{!
+\brief \83X\83p\83\80:\8cê\90\94\82ð\83J\83E\83\93\83g
+\param text \8c³\82É\82È\82é\95¶\8fÍ
+\param wordCount OUT:\83J\83E\83\93\83g\82³\82ê\82½\92P\8cê\82Ì\88ê\97\97\82ª\95Ô\82é
+}
procedure TGikoSys.SpamCountWord( const text : string; wordCount : TWordCount );
begin
end;
+{!
+\brief \83X\83p\83\80:\8aw\8fK\8c\8b\89Ê\82ð\95ú\8aü
+\param wordCount \95ú\8aü\82·\82é\92P\8cê\82Ì\88ê\97\97
+\param isSpam wordCount \82ª\83X\83p\83\80\82Æ\82µ\82Ä\8aw\8fK\82³\82ê\82Ä\82¢\82½\82È\82ç True
+\warning \8aw\8fK\8dÏ\82Ý\82Ì\95¶\8fÍ\82©\82Ç\82¤\82©\82Í\8am\94F\8fo\97\88\82Ü\82¹\82ñ\81B\n
+ Learn \82µ\82Ä\82¢\82È\82¢\95¶\8fÍ\82â isSpam \82ð\8aÔ\88á\82¦\82Ä\8ew\92è\82·\82é\82Æ
+ \83f\81[\83^\83x\81[\83X\82ª\94j\91¹\82µ\82Ü\82·\81B\n
+ \8aw\8fK\8dÏ\82Ý\82©\82Ç\82¤\82©\82Í\93Æ\8e©\82É\8aÇ\97\9d\82µ\82Ä\82\82¾\82³\82¢\81B
+
+\91S\82Ä\82Ì\8aw\8fK\8c\8b\89Ê\82ð\83N\83\8a\83A\82·\82é\82í\82¯\82Å\82Í\82 \82è\82Ü\82¹\82ñ\81B\n
+wordCount \82ð\93¾\82½\95¶\8fÍ\82Ì\8aw\8fK\8c\8b\89Ê\82Ì\82Ý\83N\83\8a\83A\82µ\82Ü\82·\81B
+
+\8eå\82É\83X\83p\83\80\82Æ\83n\83\80\82ð\90Ø\82è\91Ö\82¦\82é\82½\82ß\82É Forget -> Learn \82Ì\8f\87\82Å\8eg\97p\82µ\82Ü\82·\81B
+}
procedure TGikoSys.SpamForget( wordCount : TWordCount; isSpam : Boolean );
begin
end;
+{!
+\brief \83X\83p\83\80:\8aw\8fK
+\param wordCount \8aw\8fK\82·\82é\92P\8cê\82Ì\88ê\97\97
+\param isSpam \83X\83p\83\80\82Æ\82µ\82Ä\8aw\8fK\82·\82é\82È\82ç True
+}
procedure TGikoSys.SpamLearn( wordCount : TWordCount; isSpam : Boolean );
begin
end;
+{!
+\brief \83X\83p\83\80:\95¶\8fÍ\82ð\89ð\90Í\82µ\81A\83X\83p\83\80\93x\90\94\82ð\93¾\82é
+\param text \8c³\82É\82È\82é\95¶\8fÍ
+\param wordCount OUT:\83J\83E\83\93\83g\82³\82ê\82½\92P\8cê\82Ì\88ê\97\97\82ª\95Ô\82é(SpamCountWord \82Æ\93¯\93\99)
+\return 0\81`1 \82Ì\83X\83p\83\80\93x\90\94
+}
function TGikoSys.SpamParse( const text : string; wordCount : TWordCount ) : Extended;
begin
end;
+{!
+\brief \83\86\81[\83U\90Ý\92è\82Ì CSS \82ð\90¶\90¬
+\return \90¶\90¬\82³\82ê\82½ CSS
+
+[\83c\81[\83\8b]\83\81\83j\83\85\81[-[\83I\83v\83V\83\87\83\93]-[CSS \82Æ\83X\83L\83\93]\83^\83u\82Ì
+[\83t\83H\83\93\83g\82ð\8ew\92è], [\94w\8ci\90F\82ð\8ew\92è] \82É\89\88\82Á\82½ CSS \82ð\90¶\90¬\82µ\82Ü\82·\81B
+}
+function TGikoSys.SetUserOptionalStyle(): string;
+begin
+ Result := '';
+ if Length( GikoSys.Setting.BrowserFontName ) > 0 then
+ Result := 'font-family:"' + GikoSys.Setting.BrowserFontName + '";';
+ if GikoSys.Setting.BrowserFontSize <> 0 then
+ Result := Result + 'font-size:' + IntToStr( GikoSys.Setting.BrowserFontSize ) + 'pt;';
+ if GikoSys.Setting.BrowserFontColor <> -1 then
+ Result := Result + 'color:#' + IntToHex( GikoSys.Setting.BrowserFontColor, 6 ) + ';';
+ if GikoSys.Setting.BrowserBackColor <> -1 then
+ Result := Result + 'background-color:#' + IntToHex( GikoSys.Setting.BrowserBackColor, 6 ) + ';';
+ case GikoSys.Setting.BrowserFontBold of
+ -1: Result := Result + 'font-weight:normal;';
+ 1: Result := Result + 'font-weight:bold;';
+ end;
+ case GikoSys.Setting.BrowserFontItalic of
+ -1: Result := Result + 'font-style:normal;';
+ 1: Result := Result + 'font-style:italic;';
+ end;
+end;
+
+{!
+\brief Be \83v\83\8d\83t\83@\83C\83\8b\82Ö\82Ì\83A\83\93\83J\81[\83^\83O\82ð\90¶\90¬
+\param AID \91Î\8fÛ\82Æ\82È\82é\93ú\95tID\95¶\8e\9a\97ñ
+\param ANum \83\8c\83X\94Ô
+\param AURL \82»\82Ì\83X\83\8c\83b\83h\82ÌURL
+\return \90¶\90¬\82³\82ê\82½\83A\83\93\83J\81[\83^\83O
+}
+function TGikoSys.AddBeProfileLink(AID : string; ANum: Integer):string ;
+var
+ p : integer;
+ BNum, BMark : string;
+begin
+ p := AnsiPos('BE:', AnsiUpperCase(AID));
+ if p > 0 then begin
+ BNum := Copy(AID, p, Length(AID));
+ AID := Copy(AID, 1, p - 1);
+ p := AnsiPos('-', BNum);
+ if p > 0 then begin
+ BMark := '?' + Trim(Copy(BNum, p + 1, Length(BNum)));
+ BNum := Copy(BNum, 1, p - 1);
+ end;
+ BNum := Trim(BNum);
+ Result := AID + ' <a href="' + BNum + '/' + IntToStr(ANum)
+ + '" target=_blank>' + BMark + '</a>';
+ end else
+ Result := AID;
+end;
+
+{!
+\brief \83o\81[\83W\83\87\83\93\8fî\95ñ\82ð\8eæ\93¾
+\param KeyWord \8eæ\93¾\82·\82é\8d\80\96Ú
+\return \83o\81[\83W\83\87\83\93\95¶\8e\9a\97ñ
+}
+function TGikoSys.GetVersionInfo(KeyWord: TVerResourceKey): string;
+const
+ Translation = '\VarFileInfo\Translation';
+ FileInfo = '\StringFileInfo\%0.4s%0.4s\';
+var
+ BufSize, HWnd: DWORD;
+ VerInfoBuf: Pointer;
+ VerData: Pointer;
+ VerDataLen: Longword;
+ PathLocale: String;
+begin
+ // \95K\97v\82È\83o\83b\83t\83@\82Ì\83T\83C\83Y\82ð\8eæ\93¾
+ BufSize := GetFileVersionInfoSize(PChar(Application.ExeName), HWnd);
+ if BufSize <> 0 then begin
+ // \83\81\83\82\83\8a\82ð\8am\95Û
+ GetMem(VerInfoBuf, BufSize);
+ try
+ GetFileVersionInfo(PChar(Application.ExeName), 0, BufSize, VerInfoBuf);
+ // \95Ï\90\94\8fî\95ñ\83u\83\8d\83b\83N\93à\82Ì\95Ï\8a·\83e\81[\83u\83\8b\82ð\8ew\92è
+ VerQueryValue(VerInfoBuf, PChar(Translation), VerData, VerDataLen);
+
+ if not (VerDataLen > 0) then
+ raise Exception.Create('\8fî\95ñ\82Ì\8eæ\93¾\82É\8e¸\94s\82µ\82Ü\82µ\82½');
+
+ // 8\8c\85\82Ì\82P\82U\90i\90\94\82É\95Ï\8a·
+ // \81¨'\StringFileInfo\027382\FileDescription'
+ PathLocale := Format(FileInfo + KeyWordStr[KeyWord],
+ [IntToHex(Integer(VerData^) and $FFFF, 4),
+ IntToHex((Integer(VerData^) shr 16) and $FFFF, 4)]);
+ VerQueryValue(VerInfoBuf, PChar(PathLocale), VerData, VerDataLen);
+
+ if VerDataLen > 0 then begin
+ // VerData\82Í\83[\83\8d\82Å\8fI\82í\82é\95¶\8e\9a\97ñ\82Å\82Í\82È\82¢\82±\82Æ\82É\92\8d\88Ó
+ result := '';
+ SetLength(result, VerDataLen);
+ StrLCopy(PChar(result), VerData, VerDataLen);
+ end;
+ finally
+ // \89ð\95ú
+ FreeMem(VerInfoBuf);
+ end;
+ end;
+end;
+
+{!
+\brief Load \82³\82ê\82Ä\82¢\82é\83v\83\89\83O\83C\83\93\82Ì\83o\81[\83W\83\87\83\93\82ð\97ñ\8b\93
+\return 1\8ds1plugin
+}
+function TGikoSys.GetPluginsInfo(): String;
+var
+ i : Integer;
+ major, minor, revision : Cardinal;
+ agent, release : String;
+begin
+ //\8c\8b\89Ê\82ð\83N\83\8a\83A\82µ\82Ä\82¨\82
+ Result := '';
+
+ //BoardGroups\8co\97R\82ÅPlugin\82É\83A\83N\83Z\83X\82·\82é
+ for i := 0 to Length(BoardGroups) - 1 do begin
+ //BoardGroups\82Ì\92\86\82É\82Í\81APlugin\82ð\8e\9d\82Á\82Ä\82¢\82È\82¢\82Ì\81i2\82¿\82á\82ñ\81j\82ª
+ //\82¢\82é\82Ì\82Å\82»\82ê\82ð\8f\9c\82
+ if BoardGroups[i].BoardPlugIn <> nil then begin
+ BoardGroups[i].BoardPlugIn.VersionInfo(agent, major, minor, release, revision);
+
+
+ //"Plugin\82Ì\96¼\91O(major.minor.revision)"
+ Result := Result +
+ Format('%s(%d.%d.%d)', [agent, major, minor, revision]) + #13#10;
+ end;
+ end;
+end;
+
+
+//! IE\82Ì\83o\81[\83W\83\87\83\93\82ð\8eæ\93¾\82·\82é
+function TGikoSys.GetIEVersion: string;
+var
+ R: TRegistry;
+begin
+ R := TRegistry.Create;
+ try
+ //\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¢
+ R.Access := KEY_EXECUTE;
+ R.RootKey := HKEY_LOCAL_MACHINE;
+ R.OpenKey('Software\Microsoft\Internet Explorer', False);
+ try
+ Result := R.ReadString('version');
+ except
+ Result := '\83o\81[\83W\83\87\83\93\82Ì\8eæ\93¾\82É\8e¸\94s\82µ\82Ü\82µ\82½\81B';
+ end;
+ R.CloseKey;
+ finally
+ R.Free;
+ end;
+end;
+//! main\83t\83H\81[\83\80\82Ì\83V\83\87\81[\83g\83J\83b\83g\83L\81[\82ÌIni\83t\83@\83C\83\8b\96¼
+function TGikoSys.GetMainKeyFileName : String;
+begin
+ Result := Setting.GetMainKeyFileName;
+end;
+//! Editor\83t\83H\81[\83\80\82Ì\83V\83\87\81[\83g\83J\83b\83g\83L\81[\82ÌIni\83t\83@\83C\83\8b\96¼
+function TGikoSys.GetEditorKeyFileName: String;
+begin
+ Result := Setting.GetEditorKeyFileName;
+end;
+//! \93ü\97Í\83A\83V\83X\83g\82Ì\90Ý\92è\83t\83@\83C\83\8b\96¼
+function TGikoSys.GetInputAssistFileName: String;
+begin
+ Result := Setting.GetInputAssistFileName;
+end;
+//! \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\82ð\90Ý\92è\82·\82é
+procedure TGikoSys.SetGikoMessage;
+begin
+ if FGikoMessage = nil then begin
+ FGikoMessage := TGikoMessage.Create;
+ end else begin
+ FGikoMessage.Clear;
+ end;
+
+ if (Setting.GengoSupport) then begin
+ try
+ if (FileExists(Setting.GetLanguageFileName)) then begin
+ FGikoMessage.LoadFromFile(Setting.GetLanguageFileName);
+ end;
+ except
+ FGikoMessage.Clear;
+ end;
+ end;
+end;
+//! \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\82ð\8eæ\93¾\82·\82é
+function TGikoSys.GetGikoMessage(MesType: TGikoMessageListType): String;
+begin
+ Result := '';
+ if FGikoMessage <> nil then begin
+ Result := FGikoMessage.GetMessage(MesType);
+ end;
+end;
+
+//Tue, 17 Dec 2002 12:18:07 GMT \81¨ TDateTime\82Ö
+//MonaUtils\82©\82ç\88Ú\93®
+function TGikoSys.DateStrToDateTime(const DateStr: string): TDateTime;
+ function StrMonthToMonth(const s: string): integer;
+ const
+ m: array[1..12] of string = ('Jan','Feb','Mar','Apr','May','Jun', 'Jul','Aug','Sep','Oct','Nov','Dec');
+ var
+ i: integer;
+ begin
+ Result := -1;
+ for i := Low(m) to High(m) do begin
+ if (SameText(s, m[i])) then begin
+ Result := i;
+ Break;
+ end;
+ end;
+ end;
+var
+ wDay, wMonth, wYear: word;
+ wHour, wMinute, wSecond: word;
+ sTime: string;
+ d: TDateTime;
+begin
+ wDay := StrToIntDef(ChooseString(DateStr, ' ', 1), 0);
+ wMonth := StrMonthToMonth(ChooseString(DateStr, ' ', 2));
+ wYear := StrToIntDef(ChooseString(DateStr, ' ', 3), 0);
+ sTime := ChooseString(DateStr, ' ', 4);
+ wHour := StrToIntDef(ChooseString(sTime, ':', 0), 0);
+ wMinute := StrToIntDef(ChooseString(sTime, ':', 1), 0);
+ wSecond := StrToIntDef(ChooseString(sTime, ':', 2), 0);
+ d := EncodeDateTime(wYear, wMonth, wDay, wHour, wMinute, wSecond, 0);
+ Result := d;
+end;
+//MonaUtils\82©\82ç\88Ú\93®
+//! \82 \82é\83Z\83p\83\8c\81[\83^\82Å\8bæ\90Ø\82ç\82ê\82½\95¶\8e\9a\97ñ\82©\82ç\82\8e\94Ô\96Ú\82Ì\95¶\8e\9a\97ñ\82ð\8eæ\82è\8fo\82·
+function TGikoSys.ChooseString(const Text, Separator: string; Index: integer): string;
+var
+ S : string;
+ i, p : integer;
+begin
+ S := Text;
+ for i := 0 to Index - 1 do begin
+ if (AnsiPos(Separator, S) = 0) then S := ''
+ else S := Copy(S, AnsiPos(Separator, S) + Length(Separator), Length(S));
+ end;
+ p := AnsiPos(Separator, S);
+ if (p > 0) then Result := Copy(S, 1, p - 1) else Result := S;
+end;
+//! \88ê\8e\9e\83t\83@\83C\83\8b\82©\82ç\82Ì\95\9c\8b\8c
+procedure TGikoSys.RestoreThreadData(Board : TBoard);
+const
+ SECTION = 'Setting';
+var
+ TmpFileList : TStringList;
+ i : Integer;
+ ini : TMemIniFile;
+ ThreadItem : TThreadItem;
+ Boardpath, tmpStr : string;
+begin
+ Boardpath := ExtractFilePath(Board.GetFolderIndexFileName);
+
+ TmpFileList := TStringList.Create;
+ TmpFileList.Sorted := True;
+ TmpFileList.BeginUpdate;
+ try
+ //\91O\89ñ\88Ù\8fí\8fI\97¹\8e\9e\97pTmp\83t\83@\83C\83\8b\83\8a\83X\83g
+ GetFileList(Boardpath, '*.tmp', TmpFileList, False);
+ TmpFileList.EndUpdate;
+ //\91O\89ñ\88Ù\8fí\8fI\97¹\8e\9e\83`\83F\83b\83N
+ for i := TmpFileList.Count - 1 downto 0 do begin
+ ThreadItem := Board.FindThreadFromFileName(ChangeFileExt(TmpFileList[i], '.dat'));
+ if ThreadItem <> nil then begin
+ ini := TMemIniFile.Create(Boardpath + TmpFileList[i]);
+ try
+ tmpStr := ini.ReadString(SECTION, 'RoundDate', DateTimeToStr(ZERO_DATE));
+ ThreadItem.RoundDate := ConvertDateTimeString(tmpStr);
+
+ tmpStr := ini.ReadString(SECTION, 'LastModified', DateTimeToStr(ZERO_DATE));
+ ThreadItem.LastModified := ConvertDateTimeString(tmpStr);
+ ThreadItem.Count := ini.ReadInteger(SECTION, 'Count', 0);
+ ThreadItem.NewReceive := ini.ReadInteger(SECTION, 'NewReceive', 0);
+
+ ThreadItem.Size := ini.ReadInteger(SECTION, 'Size', 0);
+ ThreadItem.IsLogFile := FileExists(ThreadItem.GetThreadFileName);
+ if(ThreadItem.Size = 0) and (ThreadItem.IsLogFile) then begin
+ try
+ ThreadItem.Size := GetFileSize(ThreadItem.GetThreadFileName) - ThreadItem.Count;
+ except
+ end;
+ end;
+
+ //\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ã
+ //ThreadItem.Round := ini.ReadBool('Setting', 'Round', False);
+ //ThreadItem.RoundName := ini.ReadString('Setting', 'RoundName', ThreadItem.RoundName);
+ ThreadItem.UnRead := False;//ini.ReadBool('Setting', 'UnRead', False);
+ ThreadItem.ScrollTop := ini.ReadInteger(SECTION, 'ScrollTop', 0);
+ ThreadItem.AllResCount := ini.ReadInteger(SECTION, 'AllResCount', ThreadItem.Count);
+ ThreadItem.NewResCount := ini.ReadInteger(SECTION, 'NewResCount', 0);
+ ThreadItem.AgeSage := TGikoAgeSage(ini.ReadInteger(SECTION, 'AgeSage', Ord(gasNone)));
+ finally
+ ini.Free;
+ end;
+ DeleteFile(Boardpath + TmpFileList[i]);
+ end;
+ end;
+ finally
+ TmpFileList.Clear;
+ TmpFileList.Free;
+ end;
+end;
+{
+\brief User32.dll\82ª\97\98\97p\82Å\82«\82é\82©
+\return Boolean \97\98\97p\82Å\82«\82é\8fê\8d\87\82ÍTrue
+}
+function TGikoSys.CanUser32DLL: Boolean;
+var
+ hUser32 : HINST;
+begin
+ Result := False;
+ hUser32 := 0;
+ try
+ try
+ hUser32 := LoadLibrary('User32.dll');
+ if hUser32 <> 0 then begin
+ Result := True;
+ end;
+ except
+ Result := false;
+ end;
+ finally
+ FreeLibrary(hUser32);
+ end;
+end;
+{
+\brief OE\88ø\97p\95\84\8eæ\93¾
+\return OE\82Ì\88ø\97p\95\84\81i\90Ý\92è\82³\82ê\82Ä\82¢\82È\82¢\8fê\8d\87\82Í'>')
+}
+function TGikoSys.GetOEIndentChar : string;
+var
+ regKey : TRegistry;
+ Identities : string;
+ IndentChar : DWORD;
+const
+ DEFAULT_CHAR = '> ';
+ OE_MAIL_PATH = '\Software\Microsoft\Outlook Express\5.0\Mail';
+ INDENT_CHAR = 'Indent Char';
+begin
+
+ Result := DEFAULT_CHAR;
+ regKey := TRegistry.Create;
+ try
+ try
+ regKey.RootKey := HKEY_CURRENT_USER;
+ if not regKey.OpenKey( 'Identities', False ) then
+ Exit;
+ Identities := regKey.ReadString( 'Default User ID' );
+ if Identities = '' then
+ Exit;
+ if not regKey.OpenKey( Identities + OE_MAIL_PATH, False ) then
+ Exit;
+ IndentChar := regKey.ReadInteger( INDENT_CHAR );
+ Result := Char( IndentChar ) + ' ';
+ except
+ end;
+ finally
+ regKey.Free;
+ end;
+
+end;
+//! \92u\8a·\90Ý\92è\83t\83@\83C\83\8b\8eæ\93¾
+function TGikoSys.GetReplaceFileName: String;
+begin
+ Result := Setting.GetReplaceFileName;
+end;
+//! \83v\83\8c\83r\83\85\81[\8ag\92£\82Ì\90Ý\92è\83t\83@\83C\83\8b\8eæ\93¾
+function TGikoSys.GetExtpreviewFileName: String;
+begin
+ Result := Setting.GetExtprevieFileName;
+end;
+
+//! \83t\83@\83C\83\8b\96¼\82©\82ç\82Ì\83X\83\8c\83b\83h\8dì\90¬\93ú\82Ì\8eæ\93¾
+function TGikoSys.GetCreateDateFromName(FileName: String): TDateTime;
+var
+ tmp : String;
+ unixtime: Int64;
+begin
+ // \83\8d\83O\83t\83@\83C\83\8b\82Ì\8ag\92£\8eq\82ð\82Í\82¸\82µ\82½\82à\82Ì\82ª\83X\83\8c\8dì\90¬\93ú\8e\9e
+ tmp := ChangeFileExt(FileName, '');
+ if AnsiPos('_', tmp) <> 0 then
+ if AnsiPos('_', tmp) > 9 then
+ tmp := Copy(tmp, 1, AnsiPos('_', tmp)-1)
+ else
+ Delete(tmp, AnsiPos('_', tmp), 1);
+
+ if ( Length(tmp) = 9) and ( tmp[1] = '0' ) then
+ Insert('1', tmp, 1);
+
+ unixtime := StrToInt64Def(tmp, ZERO_DATE);
+ Result := UnixToDateTime(unixtime) + OffsetFromUTC;
+end;
+
+procedure TGikoSys.ShowRefCount(msg: String; unk: IUnknown);
+{$IFDEF DEBUG}
+var
+ count : integer;
+{$ENDIF}
+begin
+ if not Assigned(unk) then
+ Exit;
+
+{$IFDEF DEBUG}
+ try
+ unk._AddRef;
+ count := unk._Release;
+
+ Writeln(msg + ' RefCount=' + IntToStr(count));
+ except
+ Writeln(msg + ' RefCount=exception!!');
+ end;
+{$ENDIF}
+end;
+function TGikoSys.GetBoukenCookie(AURL: String): String;
+var
+ Protocol, Host, Path, Document, Port,Bookmark : String;
+begin
+ Result := '';
+ GikoSys.ParseURI(AURL, Protocol, Host, Path, Document, Port,Bookmark);
+ if ( Length(Host) > 0 ) then begin
+ Result := Setting.GetBoukenCookie(Host);
+ end;
+end;
+procedure TGikoSys.SetBoukenCookie(ACookieValue, ADomain: String);
+begin
+ if ( Length(ADomain) > 0 ) then begin
+ Setting.SetBoukenCookie(ACookieValue, ADomain);
+ end;
+end;
+//! \96`\8c¯\82Ì\8f\91Domain\88ê\97\97\8eæ\93¾
+procedure TGikoSys.GetBoukenDomain(var ADomain: TStringList);
+var
+ i : Integer;
+begin
+ ADomain.Clear;
+ for i := 0 to Setting.BoukenCookieList.Count - 1 do begin
+ ADomain.Add( Setting.BoukenCookieList.Names[i] );
+ end;
+end;
+//! \96`\8c¯\82Ì\8f\91Cookie\8dí\8f\9c
+procedure TGikoSys.DelBoukenCookie(ADomain: String);
+var
+ i : Integer;
+begin
+ for i := 0 to Setting.BoukenCookieList.Count - 1 do begin
+ if ( Setting.BoukenCookieList.Names[i] = ADomain ) then begin
+ Setting.BoukenCookieList.Delete(i);
+ Break;
+ end;
+ end;
+end;
+function TGikoSys.GetBouken(AURL: String; var Domain: String): String;
+var
+ Protocol, Host, Path, Document, Port,Bookmark : String;
+ Cookie : String;
+begin
+ Domain := '';
+ Cookie := '';
+ GikoSys.ParseURI(AURL, Protocol, Host, Path, Document, Port,Bookmark);
+ if ( Length(Host) > 0 ) then begin
+ Setting.GetBouken(Host, Domain, Cookie);
+ Result := Cookie;
+ end;
+end;
+
initialization
GikoSys := TGikoSys.Create;
finalization
if GikoSys <> nil then begin
- GikoSys.Free;
- GikoSys := nil;
+ FreeAndNil(GikoSys);
end;
end.