private void ParseCustomCharsFile(string filename)
{
var ci = CultureInfo.CreateSpecificCulture("en-US");
m_comment = String.Format("[SIL-Corp] {0} User Added {1}", filename, DateTime.Now.ToString("F", ci));
m_chars = new List<PUACharacter>();
var xd = XDocument.Load(filename, LoadOptions.None);
foreach (var xe in xd.Descendants("CharDef"))
{
var xaCode = xe.Attribute("code");
if (xaCode == null || String.IsNullOrEmpty(xaCode.Value))
continue;
var xaData = xe.Attribute("data");
if (xaData == null || String.IsNullOrEmpty(xaData.Value))
continue;
int code;
if (Int32.TryParse(xaCode.Value, NumberStyles.HexNumber, CultureInfo.InvariantCulture, out code) &&
!m_dictCustomChars.ContainsKey(code))
{
var spec = new PUACharacter(xaCode.Value, xaData.Value);
m_dictCustomChars.Add(code, spec);
m_chars.Add(spec);
}
}
}