@@ -35,6 +35,7 @@ using namespace ZenLib;
3535
3636// ---------------------------------------------------------------------------
3737Preferences* Prefs=new Preferences;
38+ const Ztring Empty_Ztring_Ref=__T(" " );
3839int ExplorerShell_Edit (const AnsiString &Name, bool ShellExtension, bool &IsChanged);
3940// ---------------------------------------------------------------------------
4041
@@ -71,6 +72,8 @@ Preferences::Preferences()
7172 Sponsored=false ;
7273 SponsorMessage=__T (" " );
7374 SponsorUrl=__T (" " );
75+ SponsorBanner=__T (" " );
76+ SponsorBannerClickUrl=__T (" " );
7477
7578 // Plugins
7679 GraphPluginURL=__T (" " );
@@ -218,6 +221,14 @@ int Preferences::Config_Load()
218221 Saved=Config (__T (" SponsorUrl" ));
219222 Saved.FindAndReplace (__T (" \\ r\\ n" ), __T (" \r\n " ), 0 , Ztring_Recursive);
220223 SponsorUrl.Write (Saved);
224+
225+ Saved=Config (__T (" SponsorBanner" ));
226+ Saved.FindAndReplace (__T (" \\ r\\ n" ), __T (" \r\n " ), 0 , Ztring_Recursive);
227+ SponsorBanner.Write (Saved);
228+
229+ Saved=Config (__T (" SponsorBannerClickUrl" ));
230+ Saved.FindAndReplace (__T (" \\ r\\ n" ), __T (" \r\n " ), 0 , Ztring_Recursive);
231+ SponsorBannerClickUrl.Write (Saved);
221232 }
222233
223234 if (!Config (__T (" GraphPlugin64URL" )).empty ())
@@ -522,14 +533,17 @@ void __fastcall ThreadInternetCheck::Execute()
522533 Prefs->Config (__T (" Sponsored" ))=__T (" 0" );
523534 Prefs->Config (__T (" SponsorMessage" ))=__T (" " );
524535 Prefs->Config (__T (" SponsorUrl" ))=__T (" " );
525-
536+ Prefs->Config (__T (" SponsorBanner" ))=__T (" " );
537+ Prefs->Config (__T (" SponsorBannerClickUrl" ))=__T (" " );
526538 ZtringListList Sponsor=Download.SubSheet (__T (" ShowSponsor" ));
527539 unsigned int En=Sponsor.Find (__T (" en" ), 1 );
528- if (En!=(unsigned int )-1 && Sponsor[En]( 2 )!= __T ( " " ) && Sponsor[En]( 3 )!= __T ( " " ) )
540+ if (En!=(unsigned int )-1 )
529541 {
530542 Prefs->Config (__T (" Sponsored" ))=__T (" 1" );
531543 Ztring Message;
532544 Ztring Url;
545+ Ztring Banner;
546+ Ztring BannerClickUrl;
533547 for (size_t Pos=0 ; Pos<Sponsor.size (); Pos++)
534548 {
535549 if (Sponsor[Pos](1 )!=__T (" " ))
@@ -538,13 +552,34 @@ void __fastcall ThreadInternetCheck::Execute()
538552 Message+=(Message.empty ()?__T (" " ):__T (" \\ r\\ n" ))+Sponsor[Pos](1 )+__T (" ;" )+Sponsor[Pos](2 );
539553 if (Sponsor[Pos](3 )!=__T (" " ))
540554 Url+=(Url.empty ()?__T (" " ):__T (" \\ r\\ n" ))+Sponsor[Pos](1 )+__T (" ;" )+Sponsor[Pos](3 );
555+ if (Sponsor[Pos](4 )!=__T (" " ))
556+ Banner+=(Banner.empty ()?__T (" " ):__T (" \\ r\\ n" ))+Sponsor[Pos](1 )+__T (" ;" )+Sponsor[Pos](4 );
557+ if (Sponsor[Pos](5 )!=__T (" " ))
558+ BannerClickUrl+=(BannerClickUrl.empty ()?__T (" " ):__T (" \\ r\\ n" ))+Sponsor[Pos](1 )+__T (" ;" )+Sponsor[Pos](5 );
541559 }
542560 }
543561 Prefs->Config (__T (" SponsorMessage" ))=Message.Quote ();
544562 Prefs->Config (__T (" SponsorUrl" ))=Url.Quote ();
563+ Prefs->Config (__T (" SponsorBanner" ))=Banner.Quote ();
564+ Prefs->Config (__T (" SponsorBannerClickUrl" ))=BannerClickUrl.Quote ();
545565 }
566+
546567 Prefs->Config_Save ();
547568
569+ Ztring SponsorBannerInstallGracePeriod=Download (__T (" SponsorBannerInstallGracePeriod" ));
570+ if (!SponsorBannerInstallGracePeriod.empty ())
571+ {
572+ Prefs->Config (__T (" SponsorBannerInstallGracePeriod" ))=SponsorBannerInstallGracePeriod;
573+ Prefs->Config_Save ();
574+ }
575+
576+ Ztring SponsorBannerCloseGracePeriod=Download (__T (" SponsorBannerCloseGracePeriod" ));
577+ if (!SponsorBannerCloseGracePeriod.empty ())
578+ {
579+ Prefs->Config (__T (" SponsorBannerCloseGracePeriod" ))=SponsorBannerCloseGracePeriod;
580+ Prefs->Config_Save ();
581+ }
582+
548583 // Plugins
549584 Ztring GraphPlugin64URL=Download (__T (" GraphPlugin64URL" ));
550585 if (!GraphPlugin64URL.empty ())
@@ -559,7 +594,6 @@ void __fastcall ThreadInternetCheck::Execute()
559594 Prefs->Config (__T (" GraphPluginURL" ))=GraphPluginURL;
560595 Prefs->Config_Save ();
561596 }
562-
563597 Ztring GraphPluginVersion=Download (__T (" GraphPluginVersion" ));
564598 if (!GraphPluginVersion.empty ())
565599 {
@@ -1604,9 +1638,9 @@ int Preferences::ShellToolTip()
16041638// ***************************************************************************
16051639
16061640// ---------------------------------------------------------------------------
1607- ZenLib::Ztring &Preferences::Translate (ZenLib::Ztring Name)
1641+ const ZenLib::Ztring &Preferences::Translate (ZenLib::Ztring Name)
16081642{
1609- if (Name==__T (" SponsorMessage" ) || Name==__T (" SponsorUrl" ))
1643+ if (Name==__T (" SponsorMessage" ) || Name==__T (" SponsorUrl" ) || Name== __T ( " SponsorBanner " ) || Name== __T ( " SponsorBannerClickUrl " ) )
16101644 {
16111645 Ztring Language=Translate (__T (" Language_ISO639" ));
16121646 if (Name==__T (" SponsorMessage" ))
@@ -1615,6 +1649,9 @@ ZenLib::Ztring &Preferences::Translate(ZenLib::Ztring Name)
16151649 if (Index==-1 || SponsorMessage (Index)(1 )==__T (" " ))
16161650 Index=SponsorMessage.Find (__T (" en" ), 0 );
16171651
1652+ if (Index==-1 || SponsorMessage (Index).empty ())
1653+ return Empty_Ztring_Ref;
1654+
16181655 return SponsorMessage (Index)(1 );
16191656 }
16201657 else if (Name==__T (" SponsorUrl" ))
@@ -1623,8 +1660,33 @@ ZenLib::Ztring &Preferences::Translate(ZenLib::Ztring Name)
16231660 if (Index==-1 || SponsorUrl (Index)(1 )==__T (" " ))
16241661 Index=SponsorUrl.Find (__T (" en" ), 0 );
16251662
1663+ if (Index==-1 || SponsorUrl (Index).empty ())
1664+ return Empty_Ztring_Ref;
1665+
16261666 return SponsorUrl (Index)(1 );
16271667 }
1668+ else if (Name==__T (" SponsorBanner" ))
1669+ {
1670+ int Index=SponsorBanner.Find (Language, 0 );
1671+ if (Index==-1 || SponsorBanner (Index)(1 )==__T (" " ))
1672+ Index=SponsorBanner.Find (__T (" en" ), 0 );
1673+
1674+ if (Index==-1 || SponsorBanner (Index).empty ())
1675+ return Empty_Ztring_Ref;
1676+
1677+ return SponsorBanner (Index)(1 );
1678+ }
1679+ else if (Name==__T (" SponsorBannerClickUrl" ))
1680+ {
1681+ int Index=SponsorBannerClickUrl.Find (Language, 0 );
1682+ if (Index==-1 || SponsorBannerClickUrl (Index)(1 )==__T (" " ))
1683+ Index=SponsorBannerClickUrl.Find (__T (" en" ), 0 );
1684+
1685+ if (Index==-1 || SponsorBannerClickUrl (Index).empty ())
1686+ return Empty_Ztring_Ref;
1687+
1688+ return SponsorBannerClickUrl (Index)(1 );
1689+ }
16281690 }
16291691
16301692 size_t Pos=Details[Prefs_Language].Find (Name, 0 , 0 , __T (" ==" ), Ztring_CaseSensitive);
0 commit comments