Example #1
0
        public ContextDescriptor GenerateContextDescriptor(string mergeElement, string filePath)
        {
            var doc = new XmlDocument();

            doc.LoadXml(mergeElement);
            var label = doc.SelectTextPortion("entry/lexical-unit/form/text");

            return(new ContextDescriptor(label, LiftUtils.GetUrl(doc.FirstChild, Path.GetFileName(filePath), label)));
        }
Example #2
0
        private void ProcessEntry(XmlNode child)
        {
            string  id     = LiftUtils.GetId(child);
            XmlNode parent = null;          // = LiftUtils.FindEntryById(_parentDom, id);

            _parentIdToNodeIndex.TryGetValue(id, out parent);

            string path = string.Empty;

            if (_childFileInRevision != null && !string.IsNullOrEmpty(_childFileInRevision.FullPath))
            {
                path = Path.GetFileName(_childFileInRevision.FullPath);
            }
            string url = LiftUtils.GetUrl(child, path);

            if (parent == null)             //it's new
            {
                //it's possible to create and entry, delete it, then checkin, leave us with this
                //spurious deletion messages
                if (string.IsNullOrEmpty(XmlUtilities.GetOptionalAttributeString(child, "dateDeleted")))
                {
                    EventListener.ChangeOccurred(new XmlAdditionChangeReport(_childFileInRevision, child, url));
                }
            }
            else if (LiftUtils.AreTheSame(child, parent))            //unchanged or both made same change
            {
            }
            else             //one or both changed
            {
                if (!string.IsNullOrEmpty(XmlUtilities.GetOptionalAttributeString(child, "dateDeleted")))
                {
                    EventListener.ChangeOccurred(new XmlDeletionChangeReport(_parentFileInRevision, parent, child));
                }
                else
                {
                    //enhance... we are only using this because it will conveniently find the differences
                    //and fire them off for us

                    //enhance: we can skip this and just say "something changed in this entry",
                    //until we really *need* the details (if ever), and have a way to call this then
                    //_mergingStrategy.MakeMergedEntry(this.EventListener, child, parent, parent);
                    EventListener.ChangeOccurred(new XmlChangedRecordReport(_parentFileInRevision, _childFileInRevision, parent, child, url));
                }
            }
            _processedIds.Add(id);
        }