Beispiel #1
0
        /// ------------------------------------------------------------------------------------
        private IEnumerable <FieldMapping> CreateDefaultFw7Mappings(IEnumerable <PaField> projectFields)
        {
            var prjFields         = projectFields.ToArray();
            var writingSystems    = FwDataSourceInfo.GetWritingSystems().ToArray();
            var defaultFieldNames = Properties.Settings.Default.DefaultMappedFw7Fields.Cast <string>()
                                    .Where(n => n != PaField.kAudioFileFieldName).ToList();

            // Add a mapping for the phonetic field.
            //yield return new FieldMapping(prjFields.First(f => f.Type == FieldType.Phonetic), true)
            //	{ FwWsId = FwDBUtils.GetDefaultPhoneticWritingSystem(writingSystems).Id };

            // Add a mapping for the audio file field.
            var    audioWs   = FwDBUtils.GetDefaultAudioWritingSystem(writingSystems);
            string audioWsId = audioWs != null ? audioWs.Id : null;

            yield return(new FieldMapping(prjFields.Single(f => f.Type == FieldType.AudioFilePath), false)
            {
                FwWsId = audioWsId
            });

            // Add mappings for all the other fields.
            foreach (var mapping in prjFields.Where(f => defaultFieldNames.Contains(f.Name))
                     .Select(field => new FieldMapping(field, Properties.Settings.Default.ParsedFw7Fields.Cast <string>())))
            {
                FieldMapping.CheckMappingsFw7WritingSystem(mapping, writingSystems);
                yield return(mapping);
            }
        }
Beispiel #2
0
        /// ------------------------------------------------------------------------------------
        private IEnumerable <FieldMapping> CreateDefaultFw6Mappings(IEnumerable <PaField> projectFields)
        {
            var writingSystems    = FwDataSourceInfo.GetWritingSystems();
            var defaultFieldNames = Properties.Settings.Default.DefaultMappedFw6Fields.Cast <string>();

            // Add mappings for all the other fields.
            return(from field in projectFields.Where(f => defaultFieldNames.Contains(f.Name))
                   let wsId = (field.Type == FieldType.Phonetic ?
                               FwDBUtils.GetDefaultPhoneticWritingSystem(writingSystems).Hvo.ToString() :
                               FieldMapping.GetDefaultFw6WsIdForField(field, writingSystems))
                              select new FieldMapping(field, field.Type == FieldType.Phonetic)
            {
                FwWsId = wsId
            });
        }