private Entry ConvertEntry(DictEntry dictEntry) { var rv = new Entry { orth = dictEntry.Key, infl = string.Join(string.Empty, dictEntry.AlternativeKeys.Select(key => string.Format(_config.iformFormat, key.EscapeForXml()))), word = dictEntry.Key, phonetic = dictEntry.Attributes.ContainsKey("Phonetic") ? dictEntry.Attributes["Phonetic"] : null, description = dictEntry.Attributes.ContainsKey("Description") ? dictEntry.Attributes["Description"] : null, }; return rv; }
private static string FormatEntry(string template, Entry entry) { var rv = template; var properties = typeof(Entry).GetProperties(); foreach (var property in properties) { var value = property.GetGetMethod().Invoke(entry, new object[] { }) as string; rv = rv.Replace($"@{property.Name}", value); } return rv; }