internal static ILiveHeaderElement GetLiveHeaderElement(LiveAssetReader reader, string stringId) { if (stringId == "Live.Shared.GlobalSettings.Header.Tabs.Link.Separator") { return(LiveHeaderElementFactory.CreateNewSeparator()); } if (stringId == "Live.Shared.GlobalSettings.Header.Tabs.Link.Messenger") { return(null); } string @string = reader.GetString(stringId); string[] array = LiveHeaderElementFactory.SplitString(@string); ILiveHeaderElement result; if (array.Length <= 1 && @string.Contains("Separator")) { result = LiveHeaderElementFactory.CreateNewSeparator(); } else if (@string.Contains(".Link")) { result = LiveHeaderElementFactory.CreateNewList(reader, array); } else if (@string.Contains(".Menu") || @string.Contains(".Items") || @string.EndsWith(".Group", StringComparison.Ordinal)) { result = LiveHeaderElementFactory.CreateNewMenu(reader, array); } else { result = LiveHeaderElementFactory.CreateNewLink(reader, array); } return(result); }
private static LiveHeaderMenu CreateNewMenu(LiveAssetReader reader, string[] value) { LiveHeaderMenu liveHeaderMenu = new LiveHeaderMenu(); liveHeaderMenu.Link = LiveHeaderElementFactory.CreateNewLink(reader, value); if (liveHeaderMenu.Link == null) { return(null); } foreach (string text in value) { if (text.Contains("Menu") || text.Contains(".Items") || text.EndsWith("Group", StringComparison.Ordinal)) { string @string = reader.GetString(text); if (!string.IsNullOrEmpty(@string)) { liveHeaderMenu.List = LiveHeaderElementFactory.CreateNewList(reader, LiveHeaderElementFactory.SplitString(@string)); if (LiveHeaderElementFactory.IsCobrandMenu(text) && reader.IsPropertySet(LiveAssetKey.OpenCustomLinksInNewWindow)) { foreach (ILiveHeaderElement liveHeaderElement in liveHeaderMenu.List) { LiveHeaderLink liveHeaderLink = liveHeaderElement as LiveHeaderLink; if (liveHeaderLink != null) { liveHeaderLink.OpenInNewWindow = true; } } } } } } if (liveHeaderMenu.List == null || liveHeaderMenu.List.Count == 0) { return(null); } return(liveHeaderMenu); }