@@ -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 {
@@ -1614,9 +1648,9 @@ int Preferences::ShellToolTip()
16141648// ***************************************************************************
16151649
16161650// ---------------------------------------------------------------------------
1617- ZenLib::Ztring &Preferences::Translate (ZenLib::Ztring Name)
1651+ const ZenLib::Ztring &Preferences::Translate (ZenLib::Ztring Name)
16181652{
1619- if (Name==__T (" SponsorMessage" ) || Name==__T (" SponsorUrl" ))
1653+ if (Name==__T (" SponsorMessage" ) || Name==__T (" SponsorUrl" ) || Name== __T ( " SponsorBanner " ) || Name== __T ( " SponsorBannerClickUrl " ) )
16201654 {
16211655 Ztring Language=Translate (__T (" Language_ISO639" ));
16221656 if (Name==__T (" SponsorMessage" ))
@@ -1625,6 +1659,9 @@ ZenLib::Ztring &Preferences::Translate(ZenLib::Ztring Name)
16251659 if (Index==-1 || SponsorMessage (Index)(1 )==__T (" " ))
16261660 Index=SponsorMessage.Find (__T (" en" ), 0 );
16271661
1662+ if (Index==-1 || SponsorMessage (Index).empty ())
1663+ return Empty_Ztring_Ref;
1664+
16281665 return SponsorMessage (Index)(1 );
16291666 }
16301667 else if (Name==__T (" SponsorUrl" ))
@@ -1633,8 +1670,33 @@ ZenLib::Ztring &Preferences::Translate(ZenLib::Ztring Name)
16331670 if (Index==-1 || SponsorUrl (Index)(1 )==__T (" " ))
16341671 Index=SponsorUrl.Find (__T (" en" ), 0 );
16351672
1673+ if (Index==-1 || SponsorUrl (Index).empty ())
1674+ return Empty_Ztring_Ref;
1675+
16361676 return SponsorUrl (Index)(1 );
16371677 }
1678+ else if (Name==__T (" SponsorBanner" ))
1679+ {
1680+ int Index=SponsorBanner.Find (Language, 0 );
1681+ if (Index==-1 || SponsorBanner (Index)(1 )==__T (" " ))
1682+ Index=SponsorBanner.Find (__T (" en" ), 0 );
1683+
1684+ if (Index==-1 || SponsorBanner (Index).empty ())
1685+ return Empty_Ztring_Ref;
1686+
1687+ return SponsorBanner (Index)(1 );
1688+ }
1689+ else if (Name==__T (" SponsorBannerClickUrl" ))
1690+ {
1691+ int Index=SponsorBannerClickUrl.Find (Language, 0 );
1692+ if (Index==-1 || SponsorBannerClickUrl (Index)(1 )==__T (" " ))
1693+ Index=SponsorBannerClickUrl.Find (__T (" en" ), 0 );
1694+
1695+ if (Index==-1 || SponsorBannerClickUrl (Index).empty ())
1696+ return Empty_Ztring_Ref;
1697+
1698+ return SponsorBannerClickUrl (Index)(1 );
1699+ }
16381700 }
16391701
16401702 size_t Pos=Details[Prefs_Language].Find (Name, 0 , 0 , __T (" ==" ), Ztring_CaseSensitive);
0 commit comments