From d2acb52bcaf091ef211bc0b6a0ed4aee7ac97113 Mon Sep 17 00:00:00 2001 From: genyakun Date: Mon, 24 Oct 2005 02:29:58 +0000 Subject: [PATCH] =?utf8?q?Release3=E3=82=92=E3=83=9E=E3=83=BC=E3=82=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Editor.pas | 46 +- GikoSystem.pas | 1344 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 1365 insertions(+), 25 deletions(-) diff --git a/Editor.pas b/Editor.pas index d7f78d6..fc96d08 100644 --- a/Editor.pas +++ b/Editor.pas @@ -108,22 +108,22 @@ type SETTINGTXT2: TMenuItem; GetTitlePictureAction: TAction; OP1: TMenuItem; - GetHeadTXTAction: TAction; - HeadTXT1: TMenuItem; - RocalRuleTab: TTabSheet; - WebBrowser1: TWebBrowser; - CalcCapacityAction: TAction; - N4: TMenuItem; - N5: TMenuItem; - LocalRule: TMenuItem; - LocalEdit: TMemo; - N6: TMenuItem; - LocalRuleBrowse: TMenuItem; - ToolButton4: TToolButton; - ToolButton6: TToolButton; - SaveNameMailAction: TAction; - ToolButton7: TToolButton; - BeLogInOutEAction: TAction; + GetHeadTXTAction: TAction; + HeadTXT1: TMenuItem; + RocalRuleTab: TTabSheet; + WebBrowser1: TWebBrowser; + CalcCapacityAction: TAction; + N4: TMenuItem; + N5: TMenuItem; + LocalRule: TMenuItem; + LocalEdit: TMemo; + N6: TMenuItem; + LocalRuleBrowse: TMenuItem; + ToolButton4: TToolButton; + ToolButton6: TToolButton; + SaveNameMailAction: TAction; + ToolButton7: TToolButton; + BeLogInOutEAction: TAction; procedure EditorPageChange(Sender: TObject); procedure FormCreate(Sender: TObject); @@ -168,14 +168,14 @@ type procedure GetSETTINGTXTActionExecute(Sender: TObject); procedure GetTitlePictureActionUpdate(Sender: TObject); procedure GetTitlePictureActionExecute(Sender: TObject); - procedure GetHeadTXTActionExecute(Sender: TObject); + procedure GetHeadTXTActionExecute(Sender: TObject); procedure CalcCapacityActionExecute(Sender: TObject); - procedure LocalRuleClick(Sender: TObject); - procedure FormDeactivate(Sender: TObject); - procedure LocalRuleBrowseClick(Sender: TObject); - procedure SaveNameMailActionExecute(Sender: TObject); - procedure BeLogInOutEActionExecute(Sender: TObject); - procedure BeLogInOutEActionUpdate(Sender: TObject); + procedure LocalRuleClick(Sender: TObject); + procedure FormDeactivate(Sender: TObject); + procedure LocalRuleBrowseClick(Sender: TObject); + procedure SaveNameMailActionExecute(Sender: TObject); + procedure BeLogInOutEActionExecute(Sender: TObject); + procedure BeLogInOutEActionUpdate(Sender: TObject); private FThreadItem: TThreadItem; FBoard: TBoard; diff --git a/GikoSystem.pas b/GikoSystem.pas index e4adbb5..25c2739 100644 --- a/GikoSystem.pas +++ b/GikoSystem.pas @@ -161,8 +161,12 @@ type procedure GetFileList(Path: string; Mask: string; var List: TStringList; IsPathAdd: Boolean); overload;//ƒTƒuƒtƒHƒ‹ƒ_‚ÍŒŸõ‚µ‚È‚¢ procedure GetDirectoryList(Path: string; Mask: string; List: TStringList; SubDir: Boolean); -// procedure CreateHTML3(var html: TStringList; ThreadItem: TThreadItem; var sTitle: string); + 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; @@ -183,10 +187,14 @@ type procedure MenuFont(Font: TFont); + 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; @@ -216,6 +224,12 @@ type function GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard; procedure GetPopupResNumber(URL : string; var stRes, endRes : Int64); + + // ƒXƒLƒ“‚ð“ǂݍž‚݁A’l‚ð’uŠ·‚·‚é + function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string; + // ƒŒƒX‚Ì’l‚ð’uŠ·‚·‚é + function SkinedRes( skin: string; Res: TResRec; No: string ): string; + //Samba24‚̃tƒ@ƒCƒ‹‚ª‘¶Ý‚·‚é‚©B‘¶Ý‚µ‚È‚¢ê‡Adefaultƒtƒ@ƒCƒ‹‚ðrename‚·‚é procedure SambaFileExists(); @@ -239,7 +253,7 @@ type function NotDateorTimeString(const AStr : string): boolean; //ˆø”‚É‘—‚ç‚ê‚Ä‚«‚½“ú•t/ID•”‚ÉBE‚Ì•¶Žš—ñ‚ª‚ ‚Á‚½‚çAƒvƒƒtƒ@ƒCƒ‹‚ւ̃Šƒ“ƒN‚ð’ljÁ -// function AddBeProfileLink(AID : string; ANum: Integer): string; + function AddBeProfileLink(AID : string; ANum: Integer): string; //ƒo[ƒWƒ‡ƒ“î•ñ‚̎擾 function GetVersionInfo(KeyWord: TVerResourceKey): string; //Plugin‚̏î•ñ‚̎擾 @@ -1027,7 +1041,879 @@ begin end; end; +// ƒXƒLƒ“‚ð“ǂݍž‚݁A’l‚ð’uŠ·‚·‚é +function TGikoSys.LoadFromSkin( + fileName: string; + ThreadItem: TThreadItem; + SizeByte: Integer +): string; +var + Skin: TStringList; +begin + + Skin := TStringList.Create; + try + if FileExists( fileName ) then begin + Skin.LoadFromFile( fileName ); + + // ‚â‚è‚©‚½‚ª‹ê‚µ‚¢‚¯‚ǁAƒIƒvƒVƒ‡ƒ“ƒ_ƒCƒAƒƒO‚̃vƒŒƒrƒ…[—p try + try + if ThreadItem.ParentBoard <> nil then + if ThreadItem.ParentBoard.ParentCategory <> nil then + CustomStringReplace( Skin, '', ThreadItem.ParentBoard.ParentCategory.ParenTBBS.Title); + CustomStringReplace( Skin, '', ThreadItem.URL); + except end; + CustomStringReplace( Skin, '', ThreadItem.ParentBoard.Title); + CustomStringReplace( Skin, '', ThreadItem.ParentBoard.URL); + CustomStringReplace( Skin, '', ThreadItem.Title); + CustomStringReplace( Skin, '', Setting.CSSFileName); + CustomStringReplace( Skin, '', IntToStr( ThreadItem.Count - ThreadItem.NewResCount )); + CustomStringReplace( Skin, '', IntToStr( ThreadItem.NewResCount )); + CustomStringReplace( Skin, '', IntToStr( ThreadItem.Count )); + + CustomStringReplace( Skin, '',FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate)); + CustomStringReplace( Skin, '', IntToStr( Floor( SizeByte / 1024 ) )); + CustomStringReplace( Skin, '', IntToStr( SizeByte )); + + //----- ‚Æ‚è‚ ‚¦‚¸‚©‚¿‚ã`‚µ‚áŒÝŠ·—pBƒRƒƒ“ƒgƒAƒEƒg‚µ‚Ä‚à‚悵 + // ‚â‚è‚©‚½‚ª‹ê‚µ‚¢‚¯‚ǁAƒIƒvƒVƒ‡ƒ“ƒ_ƒCƒAƒƒO‚̃vƒŒƒrƒ…[—p 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 )); + //----- ‚±‚±‚Ü‚Å + end; + Result := Skin.Text; + finally + Skin.Free; + end; +end; + +// ƒŒƒX‚Ì’l‚ð’uŠ·‚·‚é +function TGikoSys.SkinedRes( + skin: string; + Res: TResRec; + No: string +): string; +var + spamminess : Extended; + wordCount : TWordCount; +begin + + wordCount := TWordCount.Create; + try + spamminess := Floor( SpamParse( + Res.FName + '<>' + Res.FMailTo + '<>' + Res.FBody, wordCount ) * 100 ); + + Skin := CustomStringReplace( Skin, '', + '' + No + ''); + Skin := CustomStringReplace( Skin, '', No); + Skin := CustomStringReplace( Skin, '', '' + Res.FName + ''); + Skin := CustomStringReplace( Skin, '', + '' + Res.FName + ''); + Skin := CustomStringReplace( Skin, '', Res.FMailTo); + Skin := CustomStringReplace( Skin, '', Res.FDateTime); + Skin := CustomStringReplace( Skin, '', Res.FBody); + Skin := CustomStringReplace( Skin, '', FloatToStr( spamminess ) ); + Skin := CustomStringReplace( Skin, '', FloatToStr( 100 - spamminess ) ); + + //----- ‚©‚¿‚ã`‚µ‚áŒÝŠ·—pBƒRƒƒ“ƒgƒAƒEƒg‚µ‚Ä‚à‚悵 + Skin := CustomStringReplace( Skin, '&NUMBER', + '' + No + ''); + Skin := CustomStringReplace( Skin, '&PLAINNUMBER', No); + Skin := CustomStringReplace( Skin, '&NAME', '' + Res.FName + ''); + Skin := CustomStringReplace( Skin, '&MAILNAME', + '' + Res.FName + ''); + 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 ) ); + //----- ‚±‚±‚Ü‚Å + + Result := Skin; + finally + wordCount.Free; + end; + +end; + +procedure TGikoSys.CreateHTML2(doc: Variant; ThreadItem: TThreadItem; var sTitle: string); +var + i: integer; + No: string; + //bufList : TStringList; + ReadList: TStringList; + SaveList: TStringList; + CSSFileName: string; + BBSID: string; + FileName: string; + NewReceiveNo: Integer; + Res: TResRec; + boardPlugIn : TBoardPlugIn; + + UserOptionalStyle: string; + SkinHeader: string; + SkinNewRes: string; + SkinRes: string; + + strTmp : string; +// threadURL : 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 + //if ThreadItem.IsBoardPlugInAvailable then begin + if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin + //===== ƒvƒ‰ƒOƒCƒ“‚É‚æ‚é•\Ž¦ + //boardPlugIn := ThreadItem.BoardPlugIn; + boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn; + NewReceiveNo := ThreadItem.NewReceive; + // ƒtƒHƒ“ƒg‚âƒTƒCƒY‚̐ݒè + UserOptionalStyle := SetUserOptionalStyle; + SaveList := TStringList.Create; + try + doc.open; + // •¶ŽšƒR[ƒh‚̓vƒ‰ƒOƒCƒ“‚É”C‚¹‚é + // doc.charset := 'Shift_JIS'; + + // ƒwƒbƒ_ + SaveList.Add( boardPlugIn.GetHeader( DWORD( threadItem ), + '' ) ); + + SaveList.Add('

'); + for i := 0 to threadItem.Count - 1 do begin + // 1 ‚Í•K‚¸•\Ž¦ + if i <> 0 then begin + // •\Ž¦”͈͂ðŒÀ’è + 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; + + // V’…ƒ}[ƒN + 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( '' ); + end else if GikoSys.Setting.UseCSS then begin + SaveList.Add('
V’…ƒŒƒX ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '
'); + end else begin + SaveList.Add(''); + SaveList.Add(''); + SaveList.Add('
V’…ƒŒƒX ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '
'); + SaveList.Add('
'); + end; + except + SaveList.Add( '' ); + end; + end; + + // ƒŒƒX + SaveList.Add( boardPlugIn.GetRes( DWORD( threadItem ), i + 1 ) ); + + if ThreadItem.Kokomade = (i + 1) then begin + // ‚±‚±‚Ü‚Å“Ç‚ñ‚¾ + try + if GikoSys.Setting.UseSkin then begin + if FileExists( GetSkinBookmarkFileName ) then + SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) ) + else + SaveList.Add( '' ); + end else if GikoSys.Setting.UseCSS then begin + SaveList.Add('
ƒRƒR‚Ü‚Å“Ç‚ñ‚¾
'); + end else begin + SaveList.Add('
'); + SaveList.Add('
ƒRƒR‚Ü‚Å“Ç‚ñ‚¾
'); + SaveList.Add('
'); + end; + except + SaveList.Add( '' ); + end; + end; + + doc.Write(SaveList.Text); + SaveList.Clear; + end; + + + // ƒXƒLƒ“(ƒtƒbƒ^) + SaveList.Add( boardPlugIn.GetFooter( DWORD( threadItem ), '' ) ); + doc.Write(SaveList.Text); + finally + SaveList.Free; + doc.Close; + end; + + // Exit; + //end; + end else begin + ShortDayNames[1] := '“ú'; ShortDayNames[2] := 'ŒŽ'; + ShortDayNames[3] := '‰Î'; ShortDayNames[4] := '…'; + ShortDayNames[5] := '–Ø'; ShortDayNames[6] := '‹à'; + ShortDayNames[7] := '“y'; + BBSID := ThreadItem.ParentBoard.BBSID; + NewReceiveNo := ThreadItem.NewReceive; + ReadList := TStringList.Create; + + try + if ThreadItem.IsLogFile then begin + FileName := ThreadItem.GetThreadFileName; + ReadList.LoadFromFile(FileName); + FAbon.IndividualAbon(ReadList, ChangeFileExt(FileName,'.NG')); + FAbon.Execute(ReadList); // ‚ ‚ځ`‚ñ‚µ‚Ä + FSelectResFilter.Execute(ReadList); //ƒŒƒX‚̃tƒBƒ‹ƒ^ƒŠƒ“ƒO‚ð‚·‚é + if ThreadItem.Title = '' then begin + Res := DivideStrLine(ReadList[0]); + sTitle := Res.FTitle; + end else + sTitle := ThreadItem.Title + end else begin + sTitle := CustomStringReplace(ThreadItem.Title, '—M', ','); + end; + SaveList := TStringList.Create; + //threadURL := CustomStringReplace(ThreadItem.URL, 'l50', ''); + try + doc.open; + doc.charset := 'Shift_JIS'; + + // ƒtƒHƒ“ƒg‚âƒTƒCƒY‚̐ݒè + UserOptionalStyle := SetUserOptionalStyle; + CSSFileName := GetStyleSheetDir + Setting.CSSFileName; + if GikoSys.Setting.UseSkin then begin + // ƒXƒLƒ“Žg—p + // ƒXƒLƒ“‚̐ݒè + try + SkinHeader := LoadSkin( GetSkinHeaderFileName ); + if Length( UserOptionalStyle ) > 0 then + SkinHeader := CustomStringReplace( SkinHeader, '', + ''); + SaveList.Add( SkinHeader ); + except + end; + try + SkinNewRes := LoadSkin( GetSkinNewResFileName ); + except + end; + try + SkinRes := LoadSkin( GetSkinResFileName ); + except + end; + SaveList.Add('

'); + SaveList.Add(''); + + for i := 0 to ReadList.Count - 1 do begin + // 1 ‚Í•K‚¸•\Ž¦ + if i <> 0 then begin + // •\Ž¦”͈͂ðŒÀ’è + 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; + + // V’…ƒ}[ƒN + if (NewReceiveNo = i + 1) or ((NewReceiveNo = 0) and (i = 0)) then begin + try + if FileExists( GetSkinNewmarkFileName ) then + SaveList.Add( LoadSkin( GetSkinNewmarkFileName ) ) + else + SaveList.Add( '' ); + except + SaveList.Add( '' ); + end; + end; + if (Trim(ReadList[i]) <> '') then begin + No := IntToStr(i + 1); + + Res := DivideStrLine(ReadList[i]); + Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true'); + Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1); + try + if NewReceiveNo <= (i + 1) then + // V’…ƒŒƒX + strTmp := ReplaceRes( SkinNewRes ) + else + // ’ʏí‚̃ŒƒX + strTmp := ReplaceRes( SkinRes ); + + SaveList.Add( strTmp ); + except + end; + end; + + if ThreadItem.Kokomade = (i + 1) then begin + // ‚±‚±‚Ü‚Å“Ç‚ñ‚¾ + try + if FileExists( GetSkinBookmarkFileName ) then + SaveList.Add( LoadSkin( GetSkinBookmarkFileName ) ) + else + SaveList.Add( '' ); + except + SaveList.Add( '' ); + end; + end; + doc.Write(SaveList.Text); + SaveList.Clear; + end; + SaveList.Add(''); + // ƒXƒLƒ“(ƒtƒbƒ^) + try + SaveList.Add( LoadSkin( GetSkinFooterFileName ) ); + except + end; + doc.Write(SaveList.Text); + end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin + //CSSŽg—p + //CSSFileName := GetAppDir + CSS_FILE_NAME; + // SaveList.Add(''); + SaveList.Add(''); + SaveList.Add(''); + SaveList.Add('' + sTitle + ''); + SaveList.Add(''); + if Length( UserOptionalStyle ) > 0 then + SaveList.Add(''); + SaveList.Add(''); + SaveList.Add(''); + SaveList.Add(''); + SaveList.Add('

'); + SaveList.Add('
' + sTitle + '
'); + doc.Write(SaveList.Text); + SaveList.Clear; + //Application.ProcessMessages; + for i := 0 to ReadList.Count - 1 do begin + // 1 ‚Í•K‚¸•\Ž¦ + if i <> 0 then begin + // •\Ž¦”͈͂ðŒÀ’è + 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('
V’…ƒŒƒX ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '
'); + end; + if (Trim(ReadList[i]) <> '') then begin + No := IntToStr(i + 1); + Res := DivideStrLine(ReadList[i]); + Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true'); + Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1); + if Res.FMailTo = '' then + SaveList.Add('' + + '
' + No + ' ' + + '–¼‘OF ' + + '' + Res.FName + ' ' + + '“Še“úF ' + + '' + Res.FDateTime+ '
' + + '
' + Res.FBody + '
') + else if GikoSys.Setting.ShowMail then + SaveList.Add('' + + '
' + No + '' + + ' –¼‘OF ' + + '' + + '' + Res.FName + ' [' + Res.FMailTo + ']' + + ' “Še“úF' + + ' ' + Res.FDateTime+ '
' + + '
' + Res.FBody + '
') + else + SaveList.Add('' + + '
' + No + '' + + ' –¼‘OF ' + + '' + + '' + Res.FName + '' + + ' “Še“úF' + + ' ' + Res.FDateTime+ '
' + + '
' + Res.FBody + '
'); + end; + if ThreadItem.Kokomade = (i + 1) then begin + SaveList.Add('
ƒRƒR‚Ü‚Å“Ç‚ñ‚¾
'); + end; + + doc.Write(SaveList.Text); + SaveList.Clear; + end; + SaveList.Add(''); + //SaveList.Add(''); + SaveList.Add(''); + SaveList.Add(''); + doc.Write(SaveList.Text); + end else begin + //CSS”ñŽg—p + // SaveList.Add(''); + SaveList.Add(''); + SaveList.Add(''); + SaveList.Add('' + sTitle + ''); + SaveList.Add(''); + SaveList.Add(''); + SaveList.Add('' + sTitle + ''); + SaveList.Add('
'); + SaveList.Add('

'); + doc.Write(SaveList.Text); + SaveList.Clear; + //Application.ProcessMessages; + for i := 0 to ReadList.Count - 1 do begin + // 1 ‚Í•K‚¸•\Ž¦ + if i <> 0 then begin + // •\Ž¦”͈͂ðŒÀ’è + 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('
'); + SaveList.Add(''); + SaveList.Add('
V’…ƒŒƒX ' + FormatDateTime('yyyy/mm/dd(ddd) hh:mm', ThreadItem.RoundDate) + '
'); + SaveList.Add('
'); + end; + if (Trim(ReadList[i]) <> '') then begin + No := IntToStr(i + 1); + Res := DivideStrLine(ReadList[i]); + Res.FBody := ConvRes(AddAnchorTag(Res.FBody), ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), 'bbs', 'key', 'st', 'to', 'nofirst', 'true'); + Res.FDateTime := AddBeProfileLink(Res.FDateTime, i + 1); + if Res.FMailTo = '' then + SaveList.Add('
' + No + ' –¼‘OF ' + Res.FName + ' “Še“úF ' + Res.FDateTime+ '
' + Res.Fbody + '


') + else if GikoSys.Setting.ShowMail then + SaveList.Add('
' + No + ' –¼‘OF ' + Res.FName + ' [' + Res.FMailTo + '] “Še“úF ' + Res.FDateTime+ '
' + Res.Fbody + '


') + else + SaveList.Add('
' + No + ' –¼‘OF ' + Res.FName + ' “Še“úF ' + Res.FDateTime+ '
' + Res.Fbody + '


'); + end; + if ThreadItem.Kokomade = (i + 1) then begin + SaveList.Add('
'); + SaveList.Add('
ƒRƒR‚Ü‚Å“Ç‚ñ‚¾
'); + SaveList.Add('
'); + end; + doc.Write(SaveList.Text); + SaveList.Clear; + end; + SaveList.Add('
'); + SaveList.Add(''); + SaveList.Add(''); + doc.Write(SaveList.Text); + end; + finally + SaveList.Free; + doc.Close; + end; + finally + ReadList.Free; + end; + end; + 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 + if ThreadItem.ParentBoard.IsBoardPlugInAvailable then begin + //===== ƒvƒ‰ƒOƒCƒ“‚É‚æ‚é•\Ž¦ + //boardPlugIn := ThreadItem.BoardPlugIn; + boardPlugIn := ThreadItem.ParentBoard.BoardPlugIn; + // ƒtƒHƒ“ƒg‚âƒTƒCƒY‚̐ݒè + UserOptionalStyle := SetUserOptionalStyle; + try + // •¶ŽšƒR[ƒh‚̓vƒ‰ƒOƒCƒ“‚É”C‚¹‚é + // ƒwƒbƒ_ + tmp := boardPlugIn.GetHeader( DWORD( threadItem ), + '' ); + //â‘ÎŽQÆ‚©‚ç‘Š‘ÎŽQÆ‚Ö + 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 + + // ƒŒƒX + html.Append( ConvertResAnchor(boardPlugIn.GetRes( DWORD( threadItem ), i + 1 )) ); + + end; + // ƒXƒLƒ“(ƒtƒbƒ^) + html.Append( boardPlugIn.GetFooter( DWORD( threadItem ), '' ) ); + finally + end; + html.EndUpdate; + //Exit; + end else begin + ShortDayNames[1] := '“ú'; ShortDayNames[2] := 'ŒŽ'; + ShortDayNames[3] := '‰Î'; ShortDayNames[4] := '…'; + ShortDayNames[5] := '–Ø'; ShortDayNames[6] := '‹à'; + ShortDayNames[7] := '“y'; + 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); // ‚ ‚ځ`‚ñ‚µ‚Ä + FSelectResFilter.Execute(ReadList); //ƒŒƒX‚̃tƒBƒ‹ƒ^ƒŠƒ“ƒO‚ð‚·‚é + Res := DivideStrLine(ReadList[0]); + //Res.FTitle := CustomStringReplace(Res.FTitle, '—M', ','); + sTitle := Res.FTitle; + end else begin + sTitle := CustomStringReplace(ThreadItem.Title, '—M', ','); + end; + try + // ƒtƒHƒ“ƒg‚âƒTƒCƒY‚̐ݒè + UserOptionalStyle := SetUserOptionalStyle; + + if GikoSys.Setting.UseSkin then begin + // ƒXƒLƒ“Žg—p + // ƒXƒLƒ“‚̐ݒè + try + SkinHeader := LoadSkin( GetSkinHeaderFileName ); + if Length( UserOptionalStyle ) > 0 then + SkinHeader := CustomStringReplace( SkinHeader, '', + ''); + //â‘ÎŽQÆ‚©‚ç‘Š‘ÎŽQÆ‚Ö + 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(''); + 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)); + + try + html.Append( ReplaceRes( SkinRes ) ); + except + end; + end; + + end; + html.Append(''); + // ƒXƒLƒ“(ƒtƒbƒ^) + try + html.Append( LoadSkin( GetSkinFooterFileName ) ); + except + end; + end else if GikoSys.Setting.UseCSS and FileExists(CSSFileName) then begin + //CSSŽg—p + //CSSFileName := GetAppDir + CSS_FILE_NAME; + html.Append(''); + html.Append(''); + html.Append('' + sTitle + ''); + //â‘ÎŽQÆ‚©‚ç‘Š‘ÎŽQÆ‚Ö + tmp1 := './' + CSSFileName; + tmp1 := CustomStringReplace(tmp1, GetConfigDir, ''); + tmp1 := CustomStringReplace(tmp1, '\', '/'); + + html.Append(''); + if Length( UserOptionalStyle ) > 0 then + html.Append(''); + html.Append(''); + html.Append(''); + html.Append(''); + html.Append('
' + sTitle + '
'); + 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('' + + '
' + No + ' ' + + '–¼‘OF ' + + '' + Res.FName + ' ' + + '“Še“úF ' + + '' + Res.FDateTime+ '
' + + '
' + Res.FBody + '
') + else if GikoSys.Setting.ShowMail then + html.Append('' + + '
' + No + '' + + ' –¼‘OF ' + + '' + + '' + Res.FName + ' [' + Res.FMailTo + ']' + + ' “Še“úF' + + ' ' + Res.FDateTime+ '
' + + '
' + Res.FBody + '
') + else + html.Append('' + + '
' + No + '' + + ' –¼‘OF ' + + '' + + '' + Res.FName + '' + + ' “Še“úF' + + ' ' + Res.FDateTime+ '
' + + '
' + Res.FBody + '
'); + end; + end; + html.Append(''); + html.Append(''); + html.Append(''); + end else begin + //CSS”ñŽg—p + html.Append(''); + html.Append(''); + html.Append('' + sTitle + ''); + html.Append(''); + html.Append(''); + html.Append('' + sTitle + ''); + html.Append('
'); + 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('
' + No + ' –¼‘OF ' + Res.FName + ' “Še“úF ' + Res.FDateTime+ '
' + Res.Fbody + '


') + else if GikoSys.Setting.ShowMail then + html.Append('
' + No + ' –¼‘OF ' + Res.FName + ' [' + Res.FMailTo + '] “Še“úF ' + Res.FDateTime+ '
' + Res.Fbody + '


') + else + html.Append('
' + No + ' –¼‘OF ' + Res.FName + ' “Še“úF ' + Res.FDateTime+ '
' + Res.Fbody + '


'); + end; + end; + html.Append('
'); + html.Append(''); + html.Append(''); + end; + finally + html.EndUpdate; + end; + finally + ReadList.Free; + end; + end; + end; +end; +function TGikoSys.ConvertResAnchor(res: string): string; +const + _HEAD : string = ''; + _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 + ''; + 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 + ''; + 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 + ''; + end; + i := AnsiPos(_HEAD, res); + end; + Result := Result + res; +end; + +(************************************************************************* + *http://‚Ì•¶Žš—ñ‚ðanchorƒ^ƒO•t‚«‚É‚·‚éB + *************************************************************************) +function TGikoSys.AddAnchorTag(s: string): string; +const + URL_CHAR: string = '0123456789' + + 'abcdefghijklmnopqrstuvwxyz' + + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' + + '#$%&()*+,-./:;=?@[]^_`{|}~!''\'; + ANCHOR_REF = 'href='; + RES_REF = '>>'; + REF_MARK: array[0..9] of string = ('http://', 'ttp://', 'tp://', + 'ms-help://','p://', 'https://', + 'www.', 'ftp://','news://','rtsp://'); + +var +// wkIdx: array[0..9] of Integer; + url: string; + href: string; + i, j, b: Integer; + tmp: Integer; + idx, idx2: Integer; + anchorLen : Integer; + pp, pe : PChar; + pURLCHARs : PChar; + pURLCHARe : PChar; +begin + Result := ''; + // + 3 ‚Í 'href="' ('"'‚‚«)‚Ȃǂ̃oƒŠƒG[ƒVƒ‡ƒ“‚É—]—T‚ðŽ‚½‚¹‚邽‚ß + anchorLen := Length( ANCHOR_REF ) + 3; + pURLCHARs := PChar(URL_CHAR); + pURLCHARe := pURLCHARs + Length(URL_CHAR); + while True do begin + idx := MaxInt; + idx2 := MaxInt; + for j := 0 to 9 do begin + tmp := AnsiPos(REF_MARK[j], s); + if tmp <> 0 then idx := Min(tmp, idx); + if idx = tmp then idx2 := j; //‚ǂ̃}[ƒN‚ňø‚Á‚©‚©‚Á‚½‚©‚ð•Û‘¶ + end; + if idx = MaxInt then begin + //ƒŠƒ“ƒN‚ª–³‚¢‚æB + Result := Result + s; + Break; + end; + + if (idx > 1) and + (Pos( ANCHOR_REF, Copy(s, idx - anchorLen, anchorLen ) ) > 0) then begin + //Šù‚ɃŠƒ“ƒNƒ^ƒO‚ª‚‚¢‚Ä‚¢‚é‚Á‚Û‚¢‚Æ‚«‚̓€ƒV + href := Copy( s, idx, Length( s ) ); + Result := Result + Copy( s, 1, idx + Pos( '', href ) + Length( '' ) - 2 ); + s := href; + s := Copy( s, Pos( '', s ) + Length( '' ), Length( s ) ); + + Continue; + end; + + Result := Result + Copy(s, 1, idx - 1); + + Delete(s, 1, idx - 1); + b := Length( s ) + 1; + pp := PChar(s); + for i := 1 to b do begin + pe := AnsiStrPosEx(pURLCHARs, pURLCHARe, pp, pp + 1); + + if pe = nil then begin + //URL‚¶‚á‚È‚¢•¶Žš”­Œ©I‚Æ‚©A•¶Žš‚ª‚È‚­‚È‚Á‚½B + url := Copy(s, 1, i - 1); + case idx2 of + 1 : href := 'h' + url; + 2 : href := 'ht' + url; + 4 : href := 'htt' + url; + 6 : href := 'http://' + url; + else + href := url; + end; + + Result := Result + '' + url + ''; + Delete(s, 1, i - 1); + Break; + end; + //ˆê•¶Žši‚ß‚éB + Inc(pp); + end; + end; +end; (************************************************************************* *ƒTƒuƒWƒFƒNƒgˆês‚𕪊„ @@ -1072,6 +1958,39 @@ begin end; end; +(************************************************************************* + * datƒtƒ@ƒCƒ‹‚̈ꃉƒCƒ“‚𕪉ð + *************************************************************************) +function TGikoSys.DivideStrLine(Line: string): TResRec; +var + Delim: string; +begin + if AnsiPos('<>', Line) = 0 then begin + //Delim := ','; + //Result.FType := glt2chOld; + Line := CustomStringReplace(Line, '<>', '<>'); + Line := CustomStringReplace(Line, ',', '<>'); + Line := CustomStringReplace(Line, '—M', ','); + end; + Delim := '<>'; + Result.FType := glt2chNew; + //Trim‚µ‚Ä‚Í‚¢‚¯‚È‚¢‹C‚ª‚·‚é@by‚à‚¶‚ã + Result.FName := RemoveToken(Line, Delim); + Result.FMailTo := RemoveToken(Line, Delim); + Result.FDateTime := RemoveToken(Line, Delim); + Result.FBody := RemoveToken(Line, Delim); + //‹ó‚¾‚Æ–â‘肪‹N‚«‚é‚©‚çA‹ó”’‚ðÝ’è‚·‚é + if Result.FBody = '' then begin + Result.FBody := ' '; + end else if ( Result.FBody[1] = ' ' ) then begin + //‚Q‚¿‚á‚ñ‚Ë‚é‚Æ‚©‚¾‚ƁA–{•¶‚̐擪‚É‚P‚”¼Šp‹ó”’‚ª“ü‚Á‚Ä‚¢‚é‚̂ō폜‚·‚é + //‘¼‚ÌŒfŽ¦”‚ŁAƒŒƒXŽ©‘Ì‚Ì‹ó”’‚©‚à‚µ‚ê‚È‚¢‚¯‚Ç‚»‚ê‚Í’ú‚ß‚é + Delete(Result.FBody, 1, 1); + end; + //Result.FTitle := Trim(RemoveToken(Line, Delim)); + Result.FTitle := RemoveToken(Line, Delim); + +end; (************************************************************************* * URL‚©‚çBBSID‚ðŽæ“¾ @@ -1277,6 +2196,21 @@ begin Font.Style := Font.Style + [fsItalic]; end; +(************************************************************************* + * + *‚Ç‚±‚©‚̃TƒCƒg‚©‚ç‚̃pƒNƒŠ + *************************************************************************) +function TGikoSys.RemoveToken(var s: string;const delimiter: string): string; +var + p: Integer; +begin + p := AnsiPos(delimiter, s); + if p = 0 then + Result := s + else + Result := Copy(s, 1, p - 1); + Delete(s, 1, Length(Result) + Length(delimiter)); +end; (************************************************************************* * @@ -1383,6 +2317,391 @@ begin 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 = '‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚X|'; +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(' 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) = '„„') then begin + sw := True; + sp := i; + i := i + 3; + chk := True; + end else + if (not sw) and (Copy(s,i,2) = '„') 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 <> '|') 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('', + [ParamBBS, Bbs, ParamKey, Key, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) + + Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '' + + Copy(r,PIndex(List[i]).FIndexTo,Length(r)) + else + r := Copy(r,0, PIndex(List[i]).FIndexFrom - 1) + + Format('', [st]) + + Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '' + + 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 = '‚O‚P‚Q‚R‚S‚T‚U‚V‚W‚X|'; +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(' 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) = '„„') then begin + sw := True; + sp := i; + i := i + 3; + chk := True; + end else + if (not sw) and (Copy(s,i,2) = '„') 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 <> '|') 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('', + [FullURL, ParamStart, st, ParamTo, et, ParamNoFirst, ParamTrue]) + + Copy(r,PIndex(List[i]).FIndexFrom, PIndex(List[i]).FIndexTo - PIndex(List[i]).FIndexFrom) + '' + + Copy(r,PIndex(List[i]).FIndexTo,Length(r)); + Dispose(PIndex(List[i])); + end; + List.Free; + Result := r; +end; function TGikoSys.BoolToInt(b: Boolean): Integer; @@ -2840,6 +4159,27 @@ begin 1: Result := Result + 'font-style:italic;'; end; end; +//ˆø”AAIDF‘ΏۂƂȂé“ú•tID•¶Žš—ñAANum:ƒŒƒX”Ô AURLF‚»‚̃XƒŒƒbƒh‚ÌURL +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 + ' ' + BMark + ''; + end else + Result := AID; +end; // ƒo[ƒWƒ‡ƒ“î•ñ‚ðŽæ“¾ function TGikoSys.GetVersionInfo(KeyWord: TVerResourceKey): string; const -- 2.11.0