public string GetLauncherTemplatePath() { var launcherTemplate = new StorageFile(ResourceManager.Instance.LauncherTemplatesFolder.RelativePathParts.Merge(SlideSettings.LauncherTemplateName)); if (!launcherTemplate.ExistsLocal()) throw new FileNotFoundException(String.Format("There is no {0} found", launcherTemplate.Name)); return launcherTemplate.LocalPath; }
public void LoadSolutions(StorageFile solutionsConfigurationFile) { Solutions.Clear(); if(!solutionsConfigurationFile.ExistsLocal()) return; var document = new XmlDocument(); document.Load(solutionsConfigurationFile.LocalPath); foreach (var solutionNode in document.SelectNodes(@"//Root/Solution").OfType<XmlNode>()) { var solution = BaseSolutionInfo.CreateFromConfig(solutionNode); Solutions.Add(solution); } Solutions.Sort((x,y)=>x.Order.CompareTo(y.Order)); }
private void LoadSettings() { Hide = false; var settingsFile = new StorageFile(_sourceFolder.RelativePathParts.Merge("Settings.xml")); if (!settingsFile.ExistsLocal()) return; var document = new XmlDocument(); try { document.Load(settingsFile.LocalPath); var node = document.SelectSingleNode(@"/settings/hide"); if (node != null) { bool tempBool = false; if (bool.TryParse(node.InnerText, out tempBool)) Hide = tempBool; } } catch { } }
public void Load() { Items.Clear(); _contentFile = new StorageFile(ResourceManager.Instance.UserListsFolder.RelativePathParts.Merge(DecisionMakersFileName)); _contentFile.AllocateParentFolder(); if (!_contentFile.ExistsLocal()) return; var document = new XmlDocument(); document.Load(_contentFile.LocalPath); var node = document.SelectSingleNode(@"/DecisionMakers"); if (node == null) return; foreach (XmlNode childeNode in node.ChildNodes) { if (!Items.Contains(childeNode.InnerText)) Items.Add(childeNode.InnerText); } }
private void Init(StorageFile settingsFile) { if (!settingsFile.ExistsLocal()) return; var settingsDoc = XDocument.Load(settingsFile.LocalPath); foreach (var element in settingsDoc.Descendants("SourceUrl")) { var name = element.Attribute("Name") != null ? element.Attribute("Name").Value : String.Empty; var url = element.Attribute("Url") != null ? element.Attribute("Url").Value : String.Empty; var groupId = element.Attribute("GroupId") != null ? element.Attribute("GroupId").Value : String.Empty; if (!url.EndsWith("/")) url += "/"; var sourceUrl = new SourceUrl { Url = url, Name = name, GroupId = groupId }; SourceUrls.Add(sourceUrl); } var node = settingsDoc.Descendants("AutoLoad").FirstOrDefault(); bool temp; AutoLoad = node != null && Boolean.TryParse(node.Value, out temp) && temp; if (!SourceUrls.Any()) return; _isConfigured = true; }
private void LoadImages() { Images.Clear(); var defaultGroup = new ImageSourceGroup( new StorageDirectory( Asa.Common.Core.Configuration.ResourceManager.Instance.ArtworkFolder.RelativePathParts.Merge(String.Format("{0}", MediaMetaData.Instance.DataTypeString.ToUpper())))) { Name = "Gallery", Order = -1 }; defaultGroup.LoadImages(); if (defaultGroup.Images.Any()) Images.Add(defaultGroup); var additionalImageFolder = new StorageDirectory( Asa.Common.Core.Configuration.ResourceManager.Instance.ArtworkFolder.RelativePathParts.Merge(String.Format( "{0}_2", MediaMetaData.Instance.DataTypeString.ToUpper()))); if (additionalImageFolder.ExistsLocal()) { var contentDescriptionFile = new StorageFile(additionalImageFolder.RelativePathParts.Merge("order.txt")); if (contentDescriptionFile.ExistsLocal()) { var groupNames = File.ReadAllLines(contentDescriptionFile.LocalPath); var groupIndex = 0; foreach (var groupName in groupNames) { if (String.IsNullOrEmpty(groupName)) continue; var groupFolder = new StorageDirectory(additionalImageFolder.RelativePathParts.Merge(groupName)); if (!groupFolder.ExistsLocal()) continue; var imageGroup = new ImageSourceGroup(groupFolder); imageGroup.LoadImages(); imageGroup.Name = groupName; imageGroup.Order = groupIndex; if (!imageGroup.Images.Any()) continue; Images.Add(imageGroup); groupIndex++; } } } }
private void LoadApprovedThemes(StorageDirectory root) { var contentFile = new StorageFile(root.RelativePathParts.Merge("ApprovedThemes.xml")); ApprovedThemes.Clear(); if (!contentFile.ExistsLocal()) return; var document = new XmlDocument(); document.Load(contentFile.LocalPath); foreach (var slideNode in document.SelectNodes(@"//Root/Slide").OfType<XmlNode>()) { var slideAttribute = slideNode.Attributes["Name"]; if (slideAttribute == null) continue; var slideType = SlideType.None; switch (slideAttribute.Value) { #region Dashboard case "Cleanslate": slideType = SlideType.Cleanslate; break; case "Cover": slideType = SlideType.Cover; break; case "Intro": slideType = SlideType.LeadoffStatement; break; case "NeedsAnalysis": slideType = SlideType.ClientGoals; break; case "TargetCustomers": slideType = SlideType.TargetCustomers; break; case "ClosingSummary": slideType = SlideType.SimpleSummary; break; #endregion #region TV Schedule case "TVScheduleTV": slideType = SlideType.TVSchedulePrograms; break; case "TVScheduleDigital": slideType = SlideType.TVScheduleDigital; break; case "TVScheduleSummary": slideType = SlideType.TVScheduleSummary; break; case "TVOptionsTV": slideType = SlideType.TVOptionsPrograms; break; case "TVOptionsDigital": slideType = SlideType.TVOptionsDigital; break; case "TVOptionsTVSummary": slideType = SlideType.TVOptionstSummary; break; case "TVSnapTV": slideType = SlideType.TVSnapshotPrograms; break; case "TVSnapDigital": slideType = SlideType.TVSnapshotDigital; break; case "TVSnapTVSummary": slideType = SlideType.TVSnapshotSummary; break; #endregion #region Radio Schedule case "RadioScheduleRadio": slideType = SlideType.RadioSchedulePrograms; break; case "RadioScheduleDigital": slideType = SlideType.RadioScheduleDigital; break; case "RadioScheduleSummary": slideType = SlideType.RadioScheduleSummary; break; case "RadioOptionsRadio": slideType = SlideType.RadioOptionsPrograms; break; case "RadioOptionsDigital": slideType = SlideType.RadioOptionsDigital; break; case "RadioOptionsRadioSummary": slideType = SlideType.RadioOptionstSummary; break; case "RadioSnapRadio": slideType = SlideType.RadioSnapshotPrograms; break; case "RadioSnapDigital": slideType = SlideType.RadioSnapshotDigital; break; case "RadioSnapRadioSummary": slideType = SlideType.RadioSnapshotSummary; break; #endregion #region Digital case "DigitalPlanner": slideType = SlideType.DigitalProducts; break; case "DigitalWrapup": slideType = SlideType.DigitalSummary; break; case "DigitalPkgA": slideType = SlideType.DigitalProductPackage; break; case "DigitalPkgB": slideType = SlideType.DigitalStandalonePackage; break; #endregion } if (slideType == SlideType.None) continue; foreach (var themeNode in slideNode.SelectNodes("Theme").OfType<XmlNode>()) { if (!ApprovedThemes.ContainsKey(slideType)) ApprovedThemes.Add(slideType, new List<SlideApprovedThemeInfo>()); var defaultAttribute = themeNode.Attributes["Default"]; ApprovedThemes[slideType].Add(new SlideApprovedThemeInfo { ThemName = themeNode.InnerText, IsDefault = defaultAttribute != null }); } } }
private void LoadOnlineStrategy(StorageFile listsSourceFile) { SlideHeaders.Clear(); Websites.Clear(); Strengths.Clear(); Categories.Clear(); ProductSources.Clear(); if (!listsSourceFile.ExistsLocal()) return; var document = new XmlDocument(); document.Load(listsSourceFile.LocalPath); var node = document.SelectSingleNode(@"/OnlineStrategy"); if (node == null) return; foreach (XmlNode childeNode in node.ChildNodes) { switch (childeNode.Name) { case "Header": foreach (XmlAttribute attribute in childeNode.Attributes) { switch (attribute.Name) { case "Value": if (!string.IsNullOrEmpty(attribute.Value) && !SlideHeaders.Contains(attribute.Value)) SlideHeaders.Add(attribute.Value); break; } } break; case "Site": foreach (XmlAttribute attribute in childeNode.Attributes) { switch (attribute.Name) { case "Value": if (!string.IsNullOrEmpty(attribute.Value) && !Websites.Contains(attribute.Value)) Websites.Add(attribute.Value); break; } } break; case "Strength": foreach (XmlAttribute attribute in childeNode.Attributes) { switch (attribute.Name) { case "Value": if (!string.IsNullOrEmpty(attribute.Value) && !Strengths.Contains(attribute.Value)) Strengths.Add(attribute.Value); break; } } break; case "PricingStrategy": foreach (XmlAttribute attribute in childeNode.Attributes) { switch (attribute.Name) { case "Value": if (!string.IsNullOrEmpty(attribute.Value) && !PricingStrategies.Contains(attribute.Value)) PricingStrategies.Add(attribute.Value); break; } } break; case "PositionColumn": foreach (XmlAttribute attribute in childeNode.Attributes) { switch (attribute.Name) { case "Value": if (!string.IsNullOrEmpty(attribute.Value) && !ColumnPositions.Contains(attribute.Value)) ColumnPositions.Add(attribute.Value); break; } } break; case "DefaultFormula": switch (childeNode.InnerText.ToLower().Trim()) { case "cpm": DefaultFormula = FormulaType.CPM; break; case "investment": DefaultFormula = FormulaType.Investment; break; case "impressions": DefaultFormula = FormulaType.Impressions; break; } break; case "LockedMode": { bool temp; if (Boolean.TryParse(childeNode.InnerText, out temp)) LockedMode = temp; } break; case "SpecialLinksEnable": { bool temp; if (Boolean.TryParse(childeNode.InnerText, out temp)) SpecialLinksEnable = temp; } break; case "SpecialButtonsGroupName": SpecialLinksGroupName = childeNode.InnerText; break; case "SpecialButtonsGroupLogo": if (string.IsNullOrEmpty(childeNode.InnerText)) SpecialLinksGroupLogo = null; else SpecialLinksGroupLogo = new Bitmap(new MemoryStream(Convert.FromBase64String(childeNode.InnerText))); break; case "Browser": SpecialLinkBrowsers.Add(childeNode.InnerText); break; case "SpecialButton": var specialLinkButton = new SpecialLinkButton(); GetSpecialButton(childeNode, ref specialLinkButton); if (!String.IsNullOrEmpty(specialLinkButton.Name) && !String.IsNullOrEmpty(specialLinkButton.Type) && specialLinkButton.Paths.Any()) SpecialLinkButtons.Add(specialLinkButton); break; case "Targeting": { var productInfo = new ProductInfo { Type = ProductInfoType.Targeting }; productInfo.Deserialize(childeNode); TargetingRecods.Add(productInfo); } break; case "RichMedia": { var productInfo = new ProductInfo { Type = ProductInfoType.RichMedia }; productInfo.Deserialize(childeNode); RichMediaRecods.Add(productInfo); } break; case "Category": var category = new Category(); GetCategories(childeNode, ref category); if (!string.IsNullOrEmpty(category.Name)) Categories.Add(category); break; case "Product": var productSource = new ProductSource(); GetProductProperties(childeNode, ref productSource); if (!string.IsNullOrEmpty(productSource.Name)) ProductSources.Add(productSource); break; case "Status": foreach (XmlAttribute attribute in childeNode.Attributes) switch (attribute.Name) { case "Value": if (!Statuses.Contains(attribute.Value)) Statuses.Add(attribute.Value); break; } break; case "DefaultHomeViewSettings": DefaultHomeViewSettings.Deserialize(childeNode); break; case "DefaultDigitalProductSettings": DefaultDigitalProductSettings.Deserialize(childeNode); break; case "DefaultDigitalProductPackageSettings": DefaultDigitalProductPackageSettings.Deserialize(childeNode); break; case "DefaultDigitalStandalonePackageSettings": DefaultDigitalStandalonePackageSettings.Deserialize(childeNode); break; case "DigitalControlsConfiguration": DefaultControlsConfiguration = JsonConvert.DeserializeObject<DigitalControlsConfiguration>(Encoding.Unicode.GetString(Convert.FromBase64String(childeNode.InnerText)), new JsonImageConverter()); break; } } }