Test1_ReadWrite.cs

41 lines | 1.233 kB Blame History Raw Download
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using System.Diagnostics;

using yEd.XGML.IO;
using yEd.XGML.DocumentEntities;

namespace YED.Console.Test
{
    /// <summary>
    /// Проверка чтения записи yed XGML файла.
    /// TestFile_Dst файл должен открываться в yed и должен быть схожим(одинаковым) с Src.
    /// </summary>
    public class Test1_ReadWrite
    {
        public void Test(bool OpenSrc = false, bool OpenDst = false)
        {
            string TestFile_Src = @"Documents\Document1.xgml";
            string TestFile_Dst = @"Documents\Document1_Copy.xgml";

            ////Котыль
            //XGML_Reader.DropEncodingAttribute(TestFile_Src);

            //var xgml_model = new XGML_Reader().Read(TestFile_Src);
            //new XGML_Writer().Write(xgml_model, TestFile_Dst);

            Document xgml_model = Document.Load(TestFile_Src);//new XGML_Reader().Read(TestFile_Src);
            xgml_model.SaveAs(TestFile_Dst);

            if (OpenSrc)
                Process.Start(TestFile_Src);
            if (OpenDst)
                Process.Start(TestFile_Dst);
        }
    }
}