コード例 #1
0
 public void Load(MonoDocument document)
 {
     undo_manager.FreezeUndo();
     DocumentBufferArchiver.Deserialize(this, document.Xml);
     document_loaded = true;
     undo_manager.ThrawUndo();
 }
コード例 #2
0
        public void TestDeserializePerformance()
        {
            foreach (string file in files)
            {
                DocumentEditor editor = new DocumentEditor();
                DocumentBuffer buffer = (DocumentBuffer)editor.Buffer;

                MonoDocument document = new MonoDocument(file);
                string       filename = Path.GetFileName(file);

                buffer.Undoer.FreezeUndo();
                DateTime startTime = DateTime.Now;
                DocumentBufferArchiver.Deserialize(buffer, document.Xml);
                DateTime stopTime = DateTime.Now;
                buffer.Undoer.ThrawUndo();

                TimeSpan duration = stopTime - startTime;
                Assert.Less(duration.TotalMilliseconds, 1000, "SP:" + filename);
            }
        }
コード例 #3
0
        public void TestSerialize()
        {
            string originalXml, newXml, filename;

            foreach (string file in files)
            {
                DocumentEditor editor = new DocumentEditor();
                DocumentBuffer buffer = (DocumentBuffer)editor.Buffer;

                MonoDocument document = new MonoDocument(file);
                filename    = Path.GetFileName(file);
                originalXml = document.Xml;

                buffer.Undoer.FreezeUndo();
                DocumentBufferArchiver.Deserialize(buffer, originalXml);
                buffer.Undoer.ThrawUndo();
                newXml = DocumentBufferArchiver.Serialize(buffer);

                Assert.AreEqual(originalXml, newXml, "SR:" + filename);
            }
        }