topmostfriend/TopMostFriend/Languages/Language.cs

23 lines
641 B
C#
Raw Normal View History

2022-08-26 00:01:04 +00:00
using System;
using System.Linq;
using System.Xml;
using System.Xml.Serialization;
namespace TopMostFriend.Languages {
[XmlRoot(@"Language")]
public class Language {
[XmlElement(@"Info")]
public LanguageInfo Info { get; set; }
[XmlArray(@"Strings")]
[XmlArrayItem(@"String", Type = typeof(LanguageString))]
public LanguageString[] Strings { get; set; }
public LanguageString GetString(string name) {
if(name == null)
throw new ArgumentNullException(nameof(name));
return Strings.FirstOrDefault(s => name.Equals(s.Name));
}
}
}