private static LocalizedValue LocalizedValueGetFromDataRow(DataRow row) { LocalizedValue item = new LocalizedValue(); if (!row.IsNull("Id")) { item.Id = new Guid(row["Id"].ToString()); } if (!row.IsNull("Key")) { item.Key = row["Key"].ToString(); } if (!row.IsNull("Value")) { item.Value = row["Value"].ToString(); } if (!row.IsNull("Language")) { item.Language = row["Language"].ToString(); } if (!row.IsNull("JavaScript")) { item.JavaScript = bool.Parse(row["JavaScript"].ToString()); } return(item); }
public void DeleteLocalizedValue(Guid id) { try { ResourcesCommonDataProvider provider = new ResourcesCommonDataProvider(); LocalizedValue localizedValue = provider.GetLocalizedValue(id); provider.Delete(localizedValue.Id); List <LocalizedValue> items = provider.GetLocalizationByKeyAndLanguageAndType(null, localizedValue.Language, localizedValue.JavaScript); string cacheKey = localizedValue.Language.ToUpper() + (localizedValue.JavaScript ? "_js" : ""); object toMemory = items; if (localizedValue.JavaScript) { toMemory = GetJavaScriptFromList(items); } CurrentCache.AddResourceItemsToCache(cacheKey, toMemory); } catch (Exception ex) { log.Error(ex); throw; } }
public async Task <Result <LocalizedValuesErrorCodes> > DeleteAsync(string locale, string key) { await using var context = _contextFactory.CreateDataContext(); var value = new LocalizedValue() { Locale = locale, Key = key, }; context.Attach(value); context.LocalizedValues.Remove(value); try { await context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException e) { if (e.Message.Contains(DoesNotExistException)) { return(new Result <LocalizedValuesErrorCodes>(LocalizedValuesErrorCodes.DoesNotExist)); } throw; } _cacheProvider.ClearAllCachedEntries(); return(new Result <LocalizedValuesErrorCodes>()); }
public async Task <Result <LocalizedValuesErrorCodes> > UpdateAsync(LocalizedValue value, string userName, string correlationId) { if (!await _localesRepository.ExistsAsync(value.Locale)) { return(new Result <LocalizedValuesErrorCodes>(LocalizedValuesErrorCodes.LocaleDoesNotExist)); } var existing = await _localizedValuesRepository.GetAsync(value.Locale, value.Key); if (existing.IsSuccess) { var result = await _localizedValuesRepository.UpdateAsync(value); if (result.IsSuccess) { await _auditService.TryAudit(correlationId, userName, GetId(value), AuditDataType.LocalizedValue, value.ToJson(), existing.Value.ToJson()); } return(result); } return(existing.ToResultWithoutValue()); }
public async Task <Result <LocalizedValuesErrorCodes> > UpsertByKey(string key, Dictionary <string, string> valuesByLocale, string userName, string correlationId) { var existing = await _localizedValuesRepository.GetAllByKey(key); var locales = await _localesRepository.GetAllAsync(); var results = new List <Result <LocalizedValuesErrorCodes> >(); var localesWithError = new List <string>(); // validation // we run validation in its own foreach to avoid partial updates foreach (var valueByLocale in valuesByLocale) { var locale = locales.Value.FirstOrDefault(l => l.Id == valueByLocale.Key); if (locale == null) { return(new Result <LocalizedValuesErrorCodes>(LocalizedValuesErrorCodes.LocaleDoesNotExist)); } if (locale.IsDefault && string.IsNullOrEmpty(valueByLocale.Value)) { return(new Result <LocalizedValuesErrorCodes>(LocalizedValuesErrorCodes.LocalizedValueMustNotBeEmpty)); } } // upsert foreach (var valueByLocale in valuesByLocale) { var localizedValue = new LocalizedValue() { Key = key, Locale = valueByLocale.Key, Value = valueByLocale.Value, }; var result = existing.Exists(v => v.Locale == valueByLocale.Key) ? await UpdateAsync(localizedValue, userName, correlationId) : await AddAsync(localizedValue, userName, correlationId); results.Add(result); if (result.IsFailed) { localesWithError.Add(localizedValue.Locale); } } if (results.All(r => r.IsFailed)) { return(new Result <LocalizedValuesErrorCodes>(LocalizedValuesErrorCodes.UpsertFailed)); } if (results.Any(r => r.IsFailed)) { return(new ErrorResult <LocalizedValuesErrorCodes>(LocalizedValuesErrorCodes.UpsertPartiallyFailed, $"Upsert partially failed for locales: {string.Join(", ", localesWithError)}")); } return(new Result <LocalizedValuesErrorCodes>()); }
public void GetSetValue() { LocalizedValue lv = new LocalizedValue(); lv.Value = "hello"; Assert.AreEqual("hello", lv.Value); lv.Value = null; Assert.AreEqual(string.Empty, lv.Value); }
public void GetSetComment() { LocalizedValue lv = new LocalizedValue(); lv.Comment = "hello"; Assert.AreEqual("hello", lv.Comment); lv.Comment = null; Assert.AreEqual(string.Empty, lv.Comment); }
private T GetDefaultValue <T>(T value, LocalizedValue <T>?values) { if (values != null && values.TryGetValue(partition, out var @default)) { return(@default); } return(value); }
public static IHtmlString LanguageAttributes <T>(this HtmlHelper html, LocalizedValue <T> localizedValue) { if (localizedValue == null || !localizedValue.BidiOverride) { return(MvcHtmlString.Empty); } return(LanguageAttributes(html, localizedValue.CurrentLanguage, false)); }
public void AddEntry(LocalizedValue text, Buttons gamePadButton, Keys keyboardKey) { AddChildElement(new BarEntry { Text = text, GamePadButton = gamePadButton, KeyboardKey = keyboardKey, Index = _currentIndex++ }); }
public static IHtmlString LanguageAttributes <T>(this HtmlHelper html, LocalizedValue <T> localizedValue) { Guard.NotNull(localizedValue, nameof(localizedValue)); if (!localizedValue.BidiOverride) { return(MvcHtmlString.Empty); } return(LanguageAttributes(html, localizedValue.CurrentLanguage, false)); }
public static void SaveLocalizedValue(LocalizedValue localizedValue) { try { ResourceProvider provider = new ResourceProvider(); provider.SaveLocalizedValue(localizedValue); } catch (Exception ex) { log.Error(ex); } }
public void IsNullOrEmpty() { Assert.IsTrue(LocalizedValue.IsNullOrEmpty(null)); LocalizedValue lv = new LocalizedValue(); Assert.IsTrue(LocalizedValue.IsNullOrEmpty(lv)); lv.Value = "value"; Assert.IsFalse(LocalizedValue.IsNullOrEmpty(lv)); lv.Comment = "comment"; Assert.IsFalse(LocalizedValue.IsNullOrEmpty(lv)); lv.Value = null; Assert.IsFalse(LocalizedValue.IsNullOrEmpty(lv)); lv.Comment = null; Assert.IsTrue(LocalizedValue.IsNullOrEmpty(lv)); }
public void Create(LocalizedValue localizedValue) { try { SqlCommand command = new SqlCommand(); command.CommandType = CommandType.StoredProcedure; command.CommandText = "loc.LocalizationCreate"; command.Connection = this.Connection; SqlParameter parameter = null; parameter = new SqlParameter(); parameter.Direction = ParameterDirection.Input; parameter.SqlDbType = SqlDbType.NVarChar; parameter.ParameterName = "@Key"; parameter.Value = localizedValue.Key; command.Parameters.Add(parameter); parameter = new SqlParameter(); parameter.Direction = ParameterDirection.Input; parameter.SqlDbType = SqlDbType.NVarChar; parameter.ParameterName = "@Value"; parameter.Value = localizedValue.Value; command.Parameters.Add(parameter); parameter = new SqlParameter(); parameter.Direction = ParameterDirection.Input; parameter.SqlDbType = SqlDbType.NVarChar; parameter.ParameterName = "@Language"; parameter.Value = localizedValue.Language; command.Parameters.Add(parameter); parameter = new SqlParameter(); parameter.Direction = ParameterDirection.Input; parameter.SqlDbType = SqlDbType.Bit; parameter.ParameterName = "@JavaScript"; parameter.Value = localizedValue.JavaScript; command.Parameters.Add(parameter); command.ExecuteNonQuery(); } catch (Exception ex) { log.Error(ex); } finally { _connection.Close(); } }
public SelectionDialog(LocalizedValue title, LocalizedValue text, LeftSideButton[] buttons) { foreach (var leftSideButton in buttons) { AddChildElement(leftSideButton); } _titleFont = GameProvider.GameInstance.Content.Load<SpriteFont>(ResourceNames.Fonts.BigFont); _textFont = GameProvider.GameInstance.Content.Load<SpriteFont>(ResourceNames.Fonts.NormalFont); _title = title; _text = text; SetupLayout(); GameProvider.GameInstance.WindowSizeChanged += HandleWindowSizeChanged; }
public SelectionDialog(LocalizedValue title, LocalizedValue text, LeftSideButton[] buttons) { foreach (var leftSideButton in buttons) { AddChildElement(leftSideButton); } _titleFont = GameProvider.GameInstance.Content.Load <SpriteFont>(ResourceNames.Fonts.BigFont); _textFont = GameProvider.GameInstance.Content.Load <SpriteFont>(ResourceNames.Fonts.NormalFont); _title = title; _text = text; SetupLayout(); GameProvider.GameInstance.WindowSizeChanged += HandleWindowSizeChanged; }
private async Task CreateDefaultTranslation(ProductCategoryChangedEvent e) { var defaultLocaleResult = await _localesService.GetDefaultLocale(); if (defaultLocaleResult.IsFailed) { // cannot create localized values if default locale does not exist throw new DefaultLocaleDoesNotExistException("Default locale must exist before trying to create currency translations"); } var value = new LocalizedValue() { Locale = defaultLocaleResult.Value.Id, Key = e.NewValue.LocalizationToken, Value = e.OriginalCategoryName ?? e.NewValue.Id, }; await _localizedValuesService.AddAsync(value, e.Username, e.CorrelationId); }
private async Task CreateDefaultTranslation(CurrencyChangedEvent e) { var defaultLocaleResult = await _localesService.GetDefaultLocale(); if (defaultLocaleResult.IsFailed) { // cannot create localized values if default locale does not exist throw new DefaultLocaleDoesNotExistException("Default locale must exist before trying to create currency translations"); } var value = new LocalizedValue() { Locale = defaultLocaleResult.Value.Id, Key = GetKey(e.NewValue.Id), Value = e.NewValue.InterestRateMdsCode, }; await _localizedValuesService.AddAsync(value, e.Username, e.CorrelationId); }
public LeftSideButton(LocalizedValue text, Vector2 position, Action<LeftSideButton> onClick) { _font = GameProvider.GameInstance.Content.Load<SpriteFont>(ResourceNames.Fonts.NormalFont); _texture = GameProvider.GameInstance.Content.Load<Texture2D>(ResourceNames.Textures.UI.Common.Button_Blank); Text = text; var bounds = Bounds; bounds.X = (int) position.X; bounds.Y = (int) position.Y; bounds.Width = 200; bounds.Height = 38; Bounds = bounds; _onClick = onClick; FocusedAnimation = new UiMultiAnimation(new UiAnimation[] { new UiColorAnimation(0.3f, new Color(255, 255, 255), new Color(100, 193, 238)), new UiOffsetAnimation(0.3f, Vector2.Zero, new Vector2(50,0)) }); }
public LeftSideButton(LocalizedValue text, Vector2 position, Action <LeftSideButton> onClick) { _font = GameProvider.GameInstance.Content.Load <SpriteFont>(ResourceNames.Fonts.NormalFont); _texture = GameProvider.GameInstance.Content.Load <Texture2D>(ResourceNames.Textures.UI.Common.Button_Blank); Text = text; var bounds = Bounds; bounds.X = (int)position.X; bounds.Y = (int)position.Y; bounds.Width = 200; bounds.Height = 38; Bounds = bounds; _onClick = onClick; FocusedAnimation = new UiMultiAnimation(new UiAnimation[] { new UiColorAnimation(0.3f, new Color(255, 255, 255), new Color(100, 193, 238)), new UiOffsetAnimation(0.3f, Vector2.Zero, new Vector2(50, 0)) }); }
public string GetResourceValue(string key, string language) { try { List <LocalizedValue> items = new List <LocalizedValue>(); items = GetLocalization(language); LocalizedValue item = null; foreach (LocalizedValue value in items) { if (value.Key.Trim().Equals(key.Trim(), StringComparison.InvariantCultureIgnoreCase)) { item = value; break; } } if (item == null) { log.Error(string.Format("Cannot find localization item with key='{0}' for language='{1}'", key, language)); return(string.Empty); } if (string.IsNullOrEmpty(item.Value)) { log.Error(string.Format("Localization value for key='{0}' and language='{1}' is empty", key, language)); return(string.Empty); } return(item.Value); } catch (Exception ex) { log.Error(key); log.Error(ex); throw; } }
public async Task <Result <LocalizedValuesErrorCodes> > AddAsync(LocalizedValue value) { await using var context = _contextFactory.CreateDataContext(); await context.AddAsync(value); try { await context.SaveChangesAsync(); } catch (DbUpdateException e) { if (e.ValueAlreadyExistsException()) { return(new Result <LocalizedValuesErrorCodes>(LocalizedValuesErrorCodes.AlreadyExists)); } throw; } _cacheProvider.ClearAllCachedEntries(); return(new Result <LocalizedValuesErrorCodes>()); }
public async Task <Result <LocalizedValuesErrorCodes> > UpdateAsync(LocalizedValue value) { await using var context = _contextFactory.CreateDataContext(); context.Update(value); try { await context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException e) { if (e.Message.Contains(DoesNotExistException)) { return(new Result <LocalizedValuesErrorCodes>(LocalizedValuesErrorCodes.DoesNotExist)); } throw; } _cacheProvider.ClearAllCachedEntries(); return(new Result <LocalizedValuesErrorCodes>()); }
private static string GetId(LocalizedValue value) { return(GetId(value.Locale, value.Key)); }
public void CreateWithParams() { LocalizedValue lv = new LocalizedValue("value", "comment"); Assert.AreEqual("value", lv.Value); Assert.AreEqual("comment", lv.Comment); }
public static string Truncate(this LocalizedValue <string> value, int maxLength, string suffix = "") { return(value.Value.Truncate(maxLength, suffix)); }
public static bool IsEmpty(this LocalizedValue <string> value) { return(value.Value.IsEmpty()); }
public static bool HasValue(this LocalizedValue <string> value) { return(value.Value.HasValue()); }
public void CreateNullParams() { LocalizedValue lv = new LocalizedValue(null, null); Assert.AreEqual(string.Empty, lv.Value); Assert.AreEqual(string.Empty, lv.Comment); }
public static bool IsEmpty(this LocalizedValue <string> value) { return(value?.Value?.IsEmpty() == false); }
public static List <BaseArtefactInfo> ParseDataStructureResponse(XmlDocument doc, string returnDetails) { List <BaseArtefactInfo> dataStructures = new List <BaseArtefactInfo>(); XDocument xDoc2 = RetrievingUtility.ToXDocument(doc); XNamespace ns = RetrievingUtility.NS_SDMX_STRUCTURE; switch (returnDetails) { case "Stub": XmlDocument docWithoutNSa = RetrievingUtility.RemoveXmlns(doc); XmlNodeList nodeList = docWithoutNSa.SelectNodes("//DataStructure"); foreach (XmlNode xmlNd in nodeList) { BaseArtefactInfo tmpBaseArtefact = new BaseArtefactInfo(); tmpBaseArtefact.sdmxId = xmlNd.Attributes["id"].Value; tmpBaseArtefact.sdmxAgency = xmlNd.Attributes["agencyID"].Value; tmpBaseArtefact.sdmxVersion = xmlNd.Attributes["version"].Value; tmpBaseArtefact.dataSource = "SUM"; tmpBaseArtefact.vtlId = String.Concat(new String[] { tmpBaseArtefact.sdmxId, RetrievingUtility.VTLID_SEPARATOR, tmpBaseArtefact.sdmxAgency, RetrievingUtility.VTLID_SEPARATOR, tmpBaseArtefact.sdmxVersion }); XmlNodeList nodeLocalizedListxml = xmlNd.SelectNodes("./Name"); tmpBaseArtefact.name = new List <LocalizedValue>(); foreach (XmlNode localString in nodeLocalizedListxml) { LocalizedValue tmpLocalized = new LocalizedValue(); tmpLocalized.lang = localString.Attributes["xml:lang"].Value; tmpLocalized.value = localString.InnerText; tmpBaseArtefact.name.Add(tmpLocalized); } XmlNodeList nodeLocalizedDescListxml = xmlNd.SelectNodes("./Description"); foreach (XmlNode localString in nodeLocalizedDescListxml) { LocalizedValue tmpLocalized = new LocalizedValue(); tmpBaseArtefact.name = new List <LocalizedValue>(); tmpLocalized.lang = localString.Attributes["xml:lang"].Value; tmpLocalized.value = localString.InnerText; tmpBaseArtefact.description.Add(tmpLocalized); } dataStructures.Add(tmpBaseArtefact); } //var dataStructs2 = (from x in xDoc2.Root.Descendants(ns + "DataStructure") // select // new BaseArtefactInfo // { // vtlId = String.Concat(new String[] { (string)x.Attribute("id"), VTLID_SEPARATOR, (string)x.Attribute("agencyID"), VTLID_SEPARATOR, (string)x.Attribute("version") }), // name = x.Elements("Name") // .Select(r => new LocalizedValue // { // lang = (string)r.Attribute("lang").Value, // value = (string)r.Value // }).ToList(), // description = x.Elements("Description") // .Select(r => new LocalizedValue // { // lang = (string)r.Attribute("lang").Value, // value = (string)r.Value // }).ToList(), // sdmxId = (string)x.Attribute("id"), // sdmxAgency = (string)x.Attribute("agencyID"), // sdmxVersion = (string)x.Attribute("version"), // dataSource = "SUM" // } // ).ToList(); //foreach (BaseArtefactInfo x in dataStructs2) //{ // dataStructures.Add(x); //} break; case "Full": goto case "CompleteStub"; case "CompleteStub": XmlDocument docWithoutNS = RetrievingUtility.RemoveXmlns(doc); //List DataStructure's Components XmlNodeList itemNodes = docWithoutNS.SelectNodes("//DataStructures"); BaseArtefactInfo baInfo = new BaseArtefactInfo(); foreach (XmlNode itemNode in itemNodes) { baInfo.sdmxId = itemNode.SelectSingleNode("DataStructure/@id").Value; baInfo.sdmxAgency = itemNode.SelectSingleNode("DataStructure/@agencyID").Value; baInfo.sdmxVersion = itemNode.SelectSingleNode("DataStructure/@version").Value; XmlNodeList listNames = itemNode.SelectNodes(".//Name"); List <LocalizedValue> names = new List <LocalizedValue>(); foreach (XmlNode i in listNames) { names.Add(new LocalizedValue() { lang = i.Attributes["xml:lang"].Value, value = i.InnerText }); } baInfo.name = names; //Add Dimensions XmlNodeList listDims = itemNode.SelectNodes("//DimensionList/Dimension"); List <BaseComponentInfo> compon = new List <BaseComponentInfo>(); int compCounter = 2; foreach (XmlNode dim in listDims) { compon.Add(new DataStructureComponentInfo() { vtlId = dim.Attributes["id"].Value, valuedomain_id = String.Format(RetrievingUtility.SDMX_ID_FORMAT, (string)dim.SelectSingleNode("LocalRepresentation/Enumeration/Ref/@id").Value, (string)dim.SelectSingleNode("LocalRepresentation/Enumeration/Ref/@agencyID").Value, (string)dim.SelectSingleNode("LocalRepresentation/Enumeration/Ref/@version").Value), role = "Dimension" }); compon.Last().name = new List <LocalizedValue>(); LocalizedValue tmpName = new LocalizedValue("EN", (string)dim.Attributes["id"].Value); compon.Last().name.Add(tmpName); //try{ // tmpcomp.name.Add(baInfo.name[compCounter]); // tmpcomp.name.Add(baInfo.name[compCounter + 1]); //}catch (Exception ex){} //compCounter+=2; } //Add TimeDimension XmlNode timeDim = itemNode.SelectSingleNode("//DimensionList/TimeDimension"); compon.Add(new DataStructureComponentInfo() { vtlId = timeDim.Attributes["id"].Value, role = "TimeDimension" }); //Add PrimaryMeasure XmlNode primaryDim = itemNode.SelectSingleNode("//MeasureList/PrimaryMeasure"); compon.Add(new DataStructureComponentInfo() { vtlId = primaryDim.Attributes["id"].Value, role = "PrimaryMeasure" }); //Add Attributes XmlNodeList listAttr = itemNode.SelectNodes("//DimensionList/Attribute"); foreach (XmlNode attr in listAttr) { compon.Add(new DataStructureComponentInfo() { vtlId = attr.Attributes["id"].Value, valuedomain_id = String.Format(RetrievingUtility.SDMX_ID_FORMAT, (string)attr.SelectSingleNode("LocalRepresentation/Enumeration/Ref/@id").Value, (string)attr.SelectSingleNode("LocalRepresentation/Enumeration/Ref/@agencyID").Value, (string)attr.SelectSingleNode("LocalRepresentation/Enumeration/Ref/@version").Value), role = "Attribute" }); } baInfo.DataStructureDetails.Components = compon; } dataStructures.Add(baInfo); break; } return(dataStructures); }
public static List <BaseArtefactInfo> ParseValueDomainResponse(XmlDocument doc, string returnDetails) { List <BaseArtefactInfo> codeLists = new List <BaseArtefactInfo>(); XDocument xDoc2 = RetrievingUtility.ToXDocument(doc); XNamespace ns = RetrievingUtility.NS_SDMX_STRUCTURE; XNamespace nsCommon = RetrievingUtility.NS_SDMX_21_COMMON; switch (returnDetails) { case "Stub": XmlDocument docWithoutNSa = RetrievingUtility.RemoveXmlns(doc); XmlNodeList nodeList = docWithoutNSa.SelectNodes("//Codelist"); foreach (XmlNode xmlNd in nodeList) { BaseArtefactInfo tmpBaseArtefact = new BaseArtefactInfo(); tmpBaseArtefact.sdmxId = xmlNd.Attributes["id"].Value; tmpBaseArtefact.sdmxAgency = xmlNd.Attributes["agencyID"].Value; tmpBaseArtefact.sdmxVersion = xmlNd.Attributes["version"].Value; tmpBaseArtefact.dataSource = "SUM"; tmpBaseArtefact.vtlId = String.Concat(new String[] { tmpBaseArtefact.sdmxId, RetrievingUtility.VTLID_SEPARATOR, tmpBaseArtefact.sdmxAgency, RetrievingUtility.VTLID_SEPARATOR, tmpBaseArtefact.sdmxVersion }); XmlNodeList nodeLocalizedListxml = xmlNd.SelectNodes("./Name"); tmpBaseArtefact.name = new List <LocalizedValue>(); foreach (XmlNode localString in nodeLocalizedListxml) { LocalizedValue tmpLocalized = new LocalizedValue(); tmpLocalized.lang = localString.Attributes["xml:lang"].Value; tmpLocalized.value = localString.InnerText; tmpBaseArtefact.name.Add(tmpLocalized); } XmlNodeList nodeLocalizedDescListxml = xmlNd.SelectNodes("./Description"); foreach (XmlNode localString in nodeLocalizedDescListxml) { LocalizedValue tmpLocalized = new LocalizedValue(); tmpBaseArtefact.name = new List <LocalizedValue>(); tmpLocalized.lang = localString.Attributes["xml:lang"].Value; tmpLocalized.value = localString.InnerText; tmpBaseArtefact.description.Add(tmpLocalized); } codeLists.Add(tmpBaseArtefact); } break; case "Full": goto case "CompleteStub"; case "CompleteStub": XmlDocument docWithoutNS = RetrievingUtility.RemoveXmlns(doc); //List DataStructure's Components XmlNodeList itemNodes = docWithoutNS.SelectNodes("//Codelist"); BaseArtefactInfo baInfo; foreach (XmlNode itemNode in itemNodes) { //baInfo.sdmxId = itemNode.SelectSingleNode("Codelist/@id").Value; //baInfo.sdmxAgency = itemNode.SelectSingleNode("Codelist/@agencyID").Value; //baInfo.sdmxVersion = itemNode.SelectSingleNode("Codelist/@version").Value; baInfo = new BaseArtefactInfo(); baInfo.sdmxId = itemNode.Attributes["id"].Value; baInfo.sdmxAgency = itemNode.Attributes["agencyID"].Value; baInfo.sdmxVersion = itemNode.Attributes["version"].Value; XmlNodeList listNames = itemNode.SelectNodes("Name"); List <LocalizedValue> names = new List <LocalizedValue>(); //foreach (XmlNode i in listNames) //{ for (int l = 0; l < listNames.Count; l++) { XmlNode i = listNames[l]; names.Add(new LocalizedValue() { lang = i.Attributes["xml:lang"].Value, value = i.InnerText }); } //} baInfo.name = names; //Add Dimensions XmlNodeList listCodes = itemNode.SelectNodes("Code"); List <BaseComponentInfo> compon = new List <BaseComponentInfo>(); baInfo.DataStructureDetails = new BaseArtefactInfo.DataStructureInformation(); foreach (XmlNode code in listCodes) { XmlNodeList lCodeNames = code.SelectNodes("./Name"); List <LocalizedValue> codenames = new List <LocalizedValue>(); foreach (XmlNode nodeCode in lCodeNames) { codenames.Add(new LocalizedValue() { lang = nodeCode.Attributes["xml:lang"].Value, value = nodeCode.InnerText }); } compon.Add(new BaseComponentInfo() { vtlId = code.Attributes["id"].Value, name = codenames }); } baInfo.DataStructureDetails.Components = compon; codeLists.Add(baInfo); } break; } return(codeLists); }
public StaticText(SpriteFont spriteFont, LocalizedValue text) { _font = spriteFont; Text = text; MeasureBounds(); }
public void Create() { LocalizedValue lv = new LocalizedValue(); Assert.AreEqual(string.Empty, lv.Value); Assert.AreEqual(string.Empty, lv.Comment); }