Beispiel #1
0
        public void Process(Stream ASource, Stream ATarget, HttpContext AContext)
        {
            DilxDocument LDocument = new DilxDocument();

            LDocument.Read(ASource);

            // Prepare ancestors
            XmlDocument LMergedAncestors = DilxUtility.MergeAncestors(null, LDocument.Ancestors, AContext);

            // Prepare current
            XmlDocument LCurrent = new XmlDocument();

            LCurrent.Load(LDocument.Content);

            //Perform the diff
            LDocument.Content.SetLength(0);
            Inheritance.Diff(LMergedAncestors, LCurrent).Save(LDocument.Content);
            LDocument.Write(ATarget);
        }
        protected override void RequestSave(DesignService service, DesignBuffer buffer)
        {
            var document = new DilxDocument();

            if (_ancestors != null)
            {
                document.Ancestors = _ancestors;
            }

            var        content    = new XDocument();
            Serializer serializer = FrontendSession.CreateSerializer();

            serializer.Serialize(content, DesignHost.Children[0]);
            Dataphoria.Warnings.AppendErrors(this, serializer.Errors, true);

            if (_ancestors != null)
            {
                content = Inheritance.Diff(MergeAncestors(document.Ancestors), content);
            }
            document.Content = content.Root.ToString(); // only the document node

            buffer.SaveData(document.Write());
            UpdateHostsDocument(buffer);
        }