From adfec9839851debb62bc3ca2434496a736c651fc Mon Sep 17 00:00:00 2001 From: Megalon Date: Fri, 7 May 2021 18:15:29 -0700 Subject: [PATCH] Logic for new promo handling --- ModAssistant/Pages/Mods.xaml.cs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/ModAssistant/Pages/Mods.xaml.cs b/ModAssistant/Pages/Mods.xaml.cs index 827dc3c..2499ab8 100644 --- a/ModAssistant/Pages/Mods.xaml.cs +++ b/ModAssistant/Pages/Mods.xaml.cs @@ -285,8 +285,17 @@ namespace ModAssistant.Pages { if (mod.name == promo.ModName) { - ListItem.PromotionText = promo.Text; - ListItem.PromotionLink = promo.Link; + ListItem.PromotionTexts = new string[promo.Links.Count]; + ListItem.PromotionLinks = new string[promo.Links.Count]; + ListItem.PromotionTextAfterLinks = new string[promo.Links.Count]; + + for (int i = 0; i < promo.Links.Count; ++i) + { + PromotionLink link = promo.Links[i]; + ListItem.PromotionTexts[i] = link.Text; + ListItem.PromotionLinks[i] = link.Link; + ListItem.PromotionTextAfterLinks[i] = link.TextAfterLink; + } } } @@ -609,13 +618,14 @@ namespace ModAssistant.Pages } } - public string PromotionText { get; set; } - public string PromotionLink { get; set; } + public string[] PromotionTexts { get; set; } + public string[] PromotionLinks { get; set; } + public string[] PromotionTextAfterLinks { get; set; } public string PromotionMargin { get { - if (string.IsNullOrEmpty(PromotionText)) return "0"; + if (PromotionTexts == null || string.IsNullOrEmpty(PromotionTexts[0])) return "0"; return "0,0,5,0"; } }