/// ------------------------------------------------------------------------------------
 /// <summary>
 /// Gets the value for the specified field name.
 /// </summary>
 /// ------------------------------------------------------------------------------------
 public string this[string field]
 {
     get { return(WordCacheEntry.GetField(field)); }
 }
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Reads all the data for a lex. entry that get written to word cache entries (e.g.
        /// phonetic, audio file info., etc.)
        /// </summary>
        /// ------------------------------------------------------------------------------------
        private bool ReadWordEntryFieldsFromLexEntry(IPaLexEntry lxEntry, RecordCacheEntry recCacheEntry)
        {
            if (m_fwDsInfo.PhoneticStorageMethod == FwDBUtils.PhoneticStorageMethod.AllPronunciationFields)
            {
                return(CreateWordEntriesFromPronunciations(lxEntry, recCacheEntry));
            }

            recCacheEntry.Guid = new Guid(lxEntry.Guid.ToString());

            var pro = (!lxEntry.Pronunciations.Any() ? null : lxEntry.Pronunciations.ElementAt(0));

            string eticValue = null;

            if (m_fwDsInfo.PhoneticStorageMethod == FwDBUtils.PhoneticStorageMethod.LexemeForm)
            {
                if (m_vernCustom)
                {
                    var customvalues = m_customfield.CustomValues.FindAll(m => m.Guid == lxEntry.Guid.ToString());
                    foreach (var nm in customvalues.Select(m => m.CustomFields).Select(value => value.SingleOrDefault(m => m.Name == m_vernPhonetic.Name)).Where(nm => nm != null))
                    {
                        eticValue = nm.Value;
                        break;
                    }
                }
                else
                {
                    switch (m_vernPhonetic != null ? m_vernPhonetic.Name : "LexemeForm")
                    {
                    case "LexemeForm": eticValue = GetMultiStringValue(lxEntry.LexemeForm, m_phoneticWsId); break;

                    case "Variants":
                        eticValue = lxEntry.Variants.Where(v => v.VariantForm != null).Select(v => v.VariantForm.GetString(m_phoneticWsId)).FirstOrDefault();
                        break;

                    case "ComplexForms":
                        eticValue = GetCommaDelimitedList(lxEntry.ComplexForms.Select(c => c.GetString(m_phoneticWsId)));
                        break;

                    case "Components":
                        eticValue = lxEntry.ComplexFormInfo.Select(ci => GetCommaDelimitedList(ci.Components)).FirstOrDefault();
                        break;

                    case "Allomorphs":
                        return(CreateWordEntriesFromAllomorphs(lxEntry, recCacheEntry));

                    case "CitationForm":
                        eticValue = GetMultiStringValue(lxEntry.CitationForm, m_phoneticWsId);
                        break;
                    }
                }
                //if (lxEntry.LexemeForm != null)
                //    eticValue = lxEntry.LexemeForm.GetString(m_phoneticWsId);
            }
            else
            {
                if (pro != null && pro.Form != null)
                {
                    eticValue = pro.Form.GetString(m_phoneticWsId);
                }
            }

            if (eticValue == null)
            {
                return(false);
            }

            var wentry = new WordCacheEntry(recCacheEntry, m_phoneticFieldName);

            wentry.SetValue(m_phoneticFieldName, eticValue);

            if (pro != null)
            {
                ReadSinglePronunciation(pro, wentry);
            }

            if (wentry.GetField("AudioFile", false) == null)
            {
                SearchForAudioWritingSystems(wentry, lxEntry, pro);
            }

            recCacheEntry.WordEntries.Add(wentry);
            return(true);
        }