Example #1
0
 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;
 }
Example #2
0
        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;
        }