Beispiel #1
0
        public static bool Serialize(XmlTextWriter writer, IScrScriptureNote ann,
                                     string languageInFocus)
        {
            if (writer == null || ann == null)
            {
                return(false);
            }

            try
            {
                FdoCache cache = ann.Cache;
                ILgWritingSystemFactory lgwsf = cache.LanguageWritingSystemFactoryAccessor;
                XmlScrNote xmlNote            = new XmlScrNote(ann, cache.DefaultAnalWs, lgwsf);

                if (!string.IsNullOrEmpty(xmlNote.Type))
                {
                    if (!string.IsNullOrEmpty(languageInFocus))
                    {
                        xmlNote.LanguageInFocus = languageInFocus;
                    }

                    xmlNote.m_serializingForOxes = true;
                    return(XmlSerializationHelper.SerializeDataAndWriteAsNode(writer, xmlNote));
                }
            }
            catch
            {
                // TODO: Report something useful.
            }

            return(false);
        }
Beispiel #2
0
        /// ------------------------------------------------------------------------------------
        private void WriteRoot()
        {
            ProcessHelper.WriteStartElementWithAttrib(_writer, "inventory", "version", kVersion);
            WriteRootAttributes();

            ProcessHelper.WriteMetadata(_writer, _project, true);

            XmlSerializationHelper.SerializeDataAndWriteAsNode(_writer, _project.TranscriptionChanges);
            XmlSerializationHelper.SerializeDataAndWriteAsNode(_writer, _project.AmbiguousSequences);

            if (_project.IgnoredSymbolsInCVCharts.Count > 0)
            {
                ProcessHelper.WriteStartElementWithAttrib(_writer, "symbols", "class", "ignoredInChart");
                foreach (var symbol in _project.IgnoredSymbolsInCVCharts)
                {
                    ProcessHelper.WriteStartElementWithAttribAndEmptyValue(_writer, "symbol", "literal", symbol);
                }

                _writer.WriteEndElement();
            }
            else
            {
                if (!File.Exists(_project.CssFileName.Replace(".css", ".PhoneticInventory.xml")))
                {
                    ProcessHelper.WriteStartElementWithAttrib(_writer, "symbols", "class", "ignoredInChart");
                    ProcessHelper.WriteStartElementWithAttribAndEmptyValue(_writer, "symbol", "literal", "̩");
                    _writer.WriteEndElement();

                    _project.IgnoredSymbolsInCVCharts = new List <string> {
                        "̩"
                    };
                    _project.Save();
                    ProjectInventoryBuilder.Process(_project);
                }
            }

            _writer.WriteStartElement("segments");
            WritePhones();
            _writer.WriteEndElement();

            // Close inventory
            _writer.WriteEndElement();
        }