Map

Добавлена сериализация (только вывод) информации о поселении. Добавлена

3/30/2019 9:43:04 AM

Details

diff --git a/ModelData/BusinessModel/BaseAndInterface/BaseOntologyEntity.cs b/ModelData/BusinessModel/BaseAndInterface/BaseOntologyEntity.cs
index a419e19..0968529 100644
--- a/ModelData/BusinessModel/BaseAndInterface/BaseOntologyEntity.cs
+++ b/ModelData/BusinessModel/BaseAndInterface/BaseOntologyEntity.cs
@@ -4,12 +4,173 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
+using Tools;
+
 namespace ModelData.BusinessModel.BaseAndInterface
 {
-    public abstract class BaseOntologyEntity : I_URLcs
+
+    /*!
+	\brief Родительский класс, не несущий никакой смысловой нагрузки
+
+	Данный класс имеет только одну простую цель: проиллюстрировать то,
+	как Doxygen документирует наследование 
+    */
+
+    /// \class  BaseOntologyEntity
+    ///
+    /// \brief  A base ontology entity. - краткое описание
+    /// полное описание
+    /// \author Deniska
+    /// \date   30.03.2019
+    ///         
+    ///         
+    /// \authors	
+    /// \version 
+    /// \date 
+    /// \bug 
+    /// \warning
+    /// \todo
+
+    public abstract class BaseOntologyEntity : I_URLcs, I_MySerializable
     {
-        public string URL { set; get; }
-        public string Title { set; get; }
+        [IndexAttrib(0)] public string URL { set; get; }
+        [IndexAttrib(1)] public string Title { set; get; }
+        public abstract Dictionary<string, string> Serialize();
+
+        /// \fn protected string Concat(List<string> l)
+        ///
+        /// \brief  Concatenates the given l
+        ///
+        /// \author Deniska
+        /// \date   30.03.2019
+        ///
+        /// \param  l   A List&lt;string&gt; to process.
+        ///
+        /// \returns    A string.
+        ///  
+        ///  
+        /// \param [<направление>] <имя_параметра> {описание_параметра}
+        /// Копирует содержимое из исходной области памяти в целевую область память
+        /// \param[out] dest Целевая область памяти
+        /// \param[in] src Исходная область памяти
+        /// \param[in] n Количество байтов, которые необходимо скопировать
+        /// \return {описание_возвращаемого_значения}
+        /// \throw std::bad_alloc В случае возникновения ошибки при выделении памяти
+
+        protected string Concat(List<string> l)
+        {
+            string r = "";
+            if (l != null)
+                foreach (string s in l)
+                    if (s != null && s != "")
+                        r += s;
+            return r;
+        }
+
+        protected string Concat(Dictionary<string, string> l)
+        {
+            string r = "";
+            if (l != null)
+                foreach (var s in l)
+                    if (s.Value != null && s.Value != "")
+                        r += s.Key + " : " + s.Value + "\n";
+            return r;
+        }
+
+        /*
+         /// Набор возможных состояний объекта
+         enum States {
+         Disabled, ///< Указывает, что элемент недоступен для использования
+         Undefined, ///< Указывает, что состояние элемента неопределенно
+         Enabled, ///< Указывает, что элемент доступен для использования
+                     }
+         */
+
+        /*
+         
+         \defgroup <идентификатор> (заголовок модуля)
+         \defgroup maze_generation Генерация лабиринтов
+         \brief Данный модуль, предназначен для генерации лабиринтов.
+    
+         На данный момент он поддерживает следующие алгоритмы генерации лабиринтов: Eller's algorithm, randomized Kruskal's algorithm, cellular automaton algorithm, randomized Prim's algorithm.
+        
+         .......
+
+         \ingroup <идентификатор> (заголовок модуля) - это для добавления каждого блока в группу
+
+         .......
+
+         \addtogroup <идентификатор> [(заголовок модуля)]
+         \addtogroup FooGroup 
+         \{ @{
+
+         Summon a goat
+        
+         \param name The name of the goat;
+         \return The summoned goat;
+        
+         Goat summon_goat(const char* name);
+        
+        ...
+        ...
+
+         \} @}
+
+         */
+
+        /*! \defgroup main_module Главный модуль */
+
+        /*! \defgroup second_module Вложенный модуль 
+             \ingroup main_module
+        */
+
+
+        /*
+         \brief Алгоритм Евклида
+         \param a,b Два числа, чей наибольший делитель мы хотим найти
+
+         Данная функция реализует алгоритм Евклида, при помощи которого
+         находится наибольшее общее кратное у двух чисел.
+
+         Код функции выглядит следующим образом:
+         \code
+         int gcd(int a, int b) {
+                int r;
+                while (b) {
+                      r = a % b;
+                      a = b;
+                      b = r;
+                }
+                return r;
+         }
+         \endcode
+
+        int gcd(int a, int b);
+        */
+
+        /*
+         \callgraph
+         \callergraph
+         */
 
+        /*! \file
+        Компоновщик (англ. Composite pattern) — структурный шаблон проектирования, объединяющий объекты в древовидную структуру для представления иерархии от частного к целому. Компоновщик позволяет клиентам обращаться к отдельным объектам и к группам объектов одинаково. Ниже представлена иллюстрация данного шаблона при помощи UML:
+        \startuml
+            interface Component {
+               +doThis()
+            }
+            class Composite {
+               -elements
+               +addElement()
+               +doThis()
+            }
+            class Leaf {
+               +doThis()
+            }
+            Component <|-- Leaf
+            Component<|-- Composite 
+            Composite  o-- Component 
+        \enduml
+        */
     }
 }
diff --git a/ModelData/BusinessModel/BaseAndInterface/I_URLcs.cs b/ModelData/BusinessModel/BaseAndInterface/I_URLcs.cs
index d152010..f676384 100644
--- a/ModelData/BusinessModel/BaseAndInterface/I_URLcs.cs
+++ b/ModelData/BusinessModel/BaseAndInterface/I_URLcs.cs
@@ -4,12 +4,14 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
+using Tools;
+
 namespace ModelData.BusinessModel.BaseAndInterface
 {
     interface I_URLcs
     {
-        string Title { get; }
+        [IndexAttrib(1)] string Title { get; }
 
-        string URL { set;  get; }
+        [IndexAttrib(0)] string URL { set;  get; }
     }
 }
diff --git a/ModelData/BusinessModel/ExtraEntities/Founder.cs b/ModelData/BusinessModel/ExtraEntities/Founder.cs
index b73d5b0..241aea2 100644
--- a/ModelData/BusinessModel/ExtraEntities/Founder.cs
+++ b/ModelData/BusinessModel/ExtraEntities/Founder.cs
@@ -5,13 +5,30 @@ using System.Text;
 using System.Threading.Tasks;
 
 using ModelData.BusinessModel.BaseAndInterface;
+using Tools;
+
 
 namespace ModelData.BusinessModel.ExtraEntities
 {
     public class Founder : BaseOntologyEntity
     {
+        [IndexAttrib(2)]
         public string Name { set; get; }
+        [IndexAttrib(3)]
         public string FounderRegion { set; get; }
+        [IndexAttrib(4)]
         public string Nationality { set; get; }
+
+        public override Dictionary<string, string> Serialize()
+        {
+            return new Dictionary<string, string>()
+            {
+                ["URL"] = this.URL ?? "",
+                ["Название"] = this.Title ?? "",
+                ["Имя"] = this.Name ?? "",
+                ["Регион основателя"] = this.FounderRegion ?? "",
+                ["Национальность"] = this.Nationality ?? ""
+            };
+        }
     }
 }
diff --git a/ModelData/BusinessModel/ExtraEntities/Region.cs b/ModelData/BusinessModel/ExtraEntities/Region.cs
index 8a9e379..640be97 100644
--- a/ModelData/BusinessModel/ExtraEntities/Region.cs
+++ b/ModelData/BusinessModel/ExtraEntities/Region.cs
@@ -5,6 +5,8 @@ using System.Text;
 using System.Threading.Tasks;
 
 using ModelData.BusinessModel.BaseAndInterface;
+using Tools;
+
 
 namespace ModelData.BusinessModel.ExtraEntities
 {
@@ -17,6 +19,15 @@ namespace ModelData.BusinessModel.ExtraEntities
 
     public class Region : BaseOntologyEntity
     {
-        public Region partOfRegion { set; get; }
+        [IndexAttrib(2)] public Region partOfRegion { set; get; }
+        public override Dictionary<string, string> Serialize()
+        {
+            return new Dictionary<string, string>()
+            {
+                ["URL"] = this.URL ?? "",
+                ["Название"] = this.Title ?? "",               
+                ["Является частью региона"] = this.partOfRegion?.Title ?? ""
+            };
+        }
     }
 }
diff --git a/ModelData/BusinessModel/ExtraEntities/SettlementType.cs b/ModelData/BusinessModel/ExtraEntities/SettlementType.cs
index 6a669f3..c932eb8 100644
--- a/ModelData/BusinessModel/ExtraEntities/SettlementType.cs
+++ b/ModelData/BusinessModel/ExtraEntities/SettlementType.cs
@@ -5,12 +5,23 @@ using System.Text;
 using System.Threading.Tasks;
 
 using ModelData.BusinessModel.BaseAndInterface;
+using Tools;
 
 namespace ModelData.BusinessModel.ExtraEntities
 {
-    public class SettlementType:BaseOntologyEntity
+    public class SettlementType:BaseOntologyEntity 
     {
-        public string Description { set; get; }
-        public Dictionary<string,string> AlternativeName { set; get; }
+        [IndexAttrib(2)] public string Description { set; get; }
+        [IndexAttrib(3)] public List<string> AlternativeName { set; get; }
+        public override Dictionary<string,string> Serialize()
+        {
+            return new Dictionary<string, string>()
+            {
+                ["URL"] = this.URL ?? "",
+                ["Название"] = this.Title ?? "",
+                ["Описание"] = this.Description ?? "",
+                ["Другое название"] = Concat(this.AlternativeName)
+            };
+        }
     }
 }
diff --git a/ModelData/BusinessModel/MainEntities/EditedSettlement.cs b/ModelData/BusinessModel/MainEntities/EditedSettlement.cs
index 2fa9ec4..9bd15f8 100644
--- a/ModelData/BusinessModel/MainEntities/EditedSettlement.cs
+++ b/ModelData/BusinessModel/MainEntities/EditedSettlement.cs
@@ -8,6 +8,8 @@ using ModelData.BusinessModel.Tools;
 using ModelData.BusinessModel.BaseAndInterface;
 using ModelData.BusinessModel.ExtraEntities;
 
+using Tools;
+
 namespace ModelData.BusinessModel.MainEntities
 {
     public class EditedSettlement : BaseOntologyEntity
@@ -16,9 +18,9 @@ namespace ModelData.BusinessModel.MainEntities
 
         //  URL
 
-        public Settlement before { set; get; }
-        public InstantTime hasBeginning { set; get; }
-        public string Source { set; get; }
+        [IndexAttrib(2)] public Settlement before { set; get; }
+        [IndexAttrib(3)] public InstantTime hasBeginning { set; get; }
+        [IndexAttrib(4)] public string Source { set; get; }
 
         #endregion
 
@@ -26,13 +28,13 @@ namespace ModelData.BusinessModel.MainEntities
 
         //  Title
         
-        public SettlementType Type { set; get; }
-        public Region Region { set; get; }
-        public int? PopulationAll { set; get; }
-        public int? PopulationMales { set; get; }
-        public int? PopulationFemales { set; get; }
-        public List<string> AlternativeName { set; get; }
-        public Dictionary<string, string> Others { set; get; }
+        [IndexAttrib(5)] public SettlementType Type { set; get; }
+        [IndexAttrib(6)] public Region Region { set; get; }
+        [IndexAttrib(7)] public int? PopulationAll { set; get; }
+        [IndexAttrib(8)] public int? PopulationMales { set; get; }
+        [IndexAttrib(9)] public int? PopulationFemales { set; get; }
+        [IndexAttrib(10)] public List<string> AlternativeName { set; get; }
+        [IndexAttrib(11)] public Dictionary<string, string> Others { set; get; }
 
         #endregion
 
@@ -59,6 +61,21 @@ namespace ModelData.BusinessModel.MainEntities
             Others = new Dictionary<string, string>();
         }
 
+        public override Dictionary<string, string> Serialize()
+        {
+            return new Dictionary<string, string>()
+            {
+                ["URL"] = this.URL ?? "",
+                ["Соответствующий год"] = this.hasBeginning.ToString() ?? "",
+                ["В составе региона"] = Concat(this.Region?.Serialize()) ?? "",
+                ["Тип поселения"] = Concat(this.Type?.Serialize()) ?? "",
+                ["Всего населения"] = PopulationAll?.ToString() ?? "",
+                ["Мужского населения"] = PopulationMales?.ToString() ?? "",
+                ["Женского населения"] = PopulationFemales?.ToString() ?? "",
+                ["Другое название"] = Concat(this.AlternativeName) ?? ""
+            };
+        }
+
         #endregion
     }
 }
diff --git a/ModelData/BusinessModel/MainEntities/MapPoint.cs b/ModelData/BusinessModel/MainEntities/MapPoint.cs
index b8fe348..3283a81 100644
--- a/ModelData/BusinessModel/MainEntities/MapPoint.cs
+++ b/ModelData/BusinessModel/MainEntities/MapPoint.cs
@@ -4,15 +4,17 @@ using System.Linq;
 using System.Text;
 using System.Threading.Tasks;
 
+using Tools;
+
 
 namespace ModelData.BusinessModel.MainEntities
 {
     public class MapPoint : BaseAndInterface.BaseOntologyEntity
     {
-        public string Position { set; get; }
-        public string Population { set; get; }
-        public List<string> Type { set; get; }
-        public List<string> Region { set; get; }
+        [IndexAttrib(2)] public string Position { set; get; }
+        [IndexAttrib(3)] public string Population { set; get; }
+        [IndexAttrib(4)] public List<string> Type { set; get; }
+        [IndexAttrib(5)] public List<string> Region { set; get; }
 
         public MapPoint()
         {
@@ -20,5 +22,18 @@ namespace ModelData.BusinessModel.MainEntities
             Region = new List<string>();
         }
 
+        public override Dictionary<string, string> Serialize()
+        {
+            return new Dictionary<string, string>()
+            {
+                ["URL"] = this.URL ?? "",
+                ["Название"] = this.Title ?? "",
+                ["Координаты"] = this.Position ?? "",
+                ["Количество населения"] = this.Population,
+                ["Тип поселения"] = Concat(this.Type),
+                ["В составе региона"] = Concat(this.Region)
+            };
+        }
+
     }
 }
diff --git a/ModelData/BusinessModel/MainEntities/Settlement.cs b/ModelData/BusinessModel/MainEntities/Settlement.cs
index 4ff76e4..772aeb6 100644
--- a/ModelData/BusinessModel/MainEntities/Settlement.cs
+++ b/ModelData/BusinessModel/MainEntities/Settlement.cs
@@ -8,6 +8,8 @@ using ModelData.BusinessModel.Tools;
 using ModelData.BusinessModel.ExtraEntities;
 using ModelData.BusinessModel.BaseAndInterface;
 
+using Tools;
+
 namespace ModelData.BusinessModel.MainEntities
 {
     public class Settlement : BaseOntologyEntity
@@ -18,22 +20,22 @@ namespace ModelData.BusinessModel.MainEntities
 
         //  Title
 
-        public Coordinate Coordinate { set; get; }
+        [IndexAttrib(2)] public Coordinate Coordinate { set; get; }
 
         #endregion
 
         #region Необязательные данные
 
-        public InstantTime hasBeginning { set; get; }
-        public Founder Founder { set; get; }
-        public string Legend { set; get; }
-        public Dictionary<string, string> Others { set; get; }
+        [IndexAttrib(3)] public InstantTime hasBeginning { set; get; }
+        [IndexAttrib(4)] public Founder Founder { set; get; }
+        [IndexAttrib(5)] public string Legend { set; get; }
+        [IndexAttrib(6)] public Dictionary<string, string> Others { set; get; }
 
         #endregion
 
         #region Служебные данные
 
-        public List<EditedSettlement> EditedSettlements { set; get; }
+        [IndexAttrib(7)] public List<EditedSettlement> EditedSettlements { set; get; }
 
         #endregion
 
@@ -59,6 +61,23 @@ namespace ModelData.BusinessModel.MainEntities
             EditedSettlements = new List<EditedSettlement>();
         }
 
+        public override Dictionary<string, string> Serialize()
+        {
+            List<string> edited = new List<string>();
+            foreach (var edit in EditedSettlements)
+                edited.Add(Concat(edit.Serialize()));
+            
+            return new Dictionary<string, string>()
+            {
+                ["URL"] = this.URL ?? "",
+                ["Название"] = this.Title ?? "",
+                ["Год основания"] = this.hasBeginning?.ToString() ?? "",
+                ["Основатель"] = Concat(this.Founder?.Serialize()) ?? "",
+                ["История основания"] = this.Legend ?? "",
+                ["Дополнительно"] = Concat(edited) ?? ""
+            };
+        }
+
         #endregion       
     }
 }
diff --git a/ModelData/BusinessModel/Tools/Period.cs b/ModelData/BusinessModel/Tools/Period.cs
index 6c6dbfa..9deaeba 100644
--- a/ModelData/BusinessModel/Tools/Period.cs
+++ b/ModelData/BusinessModel/Tools/Period.cs
@@ -10,5 +10,10 @@ namespace ModelData.BusinessModel.Tools
     {
         public InstantTime Begin { set; get; }
         public InstantTime End { set; get; }
+
+        public override string ToString()
+        {
+            return Begin + " : " + End;
+        }
     }
 }
diff --git a/Tools/Interfaces/I_MySerializable.cs b/Tools/Interfaces/I_MySerializable.cs
new file mode 100644
index 0000000..f4546d7
--- /dev/null
+++ b/Tools/Interfaces/I_MySerializable.cs
@@ -0,0 +1,13 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace Tools
+{
+    public interface I_MySerializable
+    {
+        Dictionary<string, string> Serialize();
+    }
+}
diff --git a/Tools/Main/SerializeService.cs b/Tools/Main/SerializeService.cs
new file mode 100644
index 0000000..c300e83
--- /dev/null
+++ b/Tools/Main/SerializeService.cs
@@ -0,0 +1,109 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+
+namespace Tools
+{
+    public class SerializeService
+    {
+        List<object> used = new List<object>();
+        public SerializeService()
+        {
+            used = new List<object>();
+        }       
+
+        public void RecursiveSerialize(object obj, Type _base, System.IO.Stream stream, string prefix = "")
+        {
+            if (used.Contains(obj))
+                return;
+            used.Add(obj);
+            string str;
+            System.IO.StreamWriter file = new System.IO.StreamWriter(stream);
+            var allPropertiesOfObj = obj.GetType().GetProperties().OrderBy(e => (e.GetCustomAttributes(typeof(IndexAttrib), true).FirstOrDefault() as IndexAttrib).Index);
+
+            foreach (var singleProperty in allPropertiesOfObj)
+            {                
+                var type = singleProperty.PropertyType;
+
+                if (type.IsSubclassOf(_base) && singleProperty.GetValue(obj) != null)
+                {
+                    RecursiveSerialize(singleProperty.GetValue(obj), _base, stream, prefix + "\t\t");
+                    continue;
+                }
+
+                //  https://stackoverflow.com/questions/16981070/c-sharp-reflection-to-match-type-listt-where-t-issubclassfoo
+                if (
+                   type.IsGenericType
+                   && type.GetGenericTypeDefinition() == typeof(List<>)
+                   )
+                {
+                    if (singleProperty.GetValue(obj) is IEnumerable<object> t)
+                        foreach (var u in t)
+                        {
+                            RecursiveSerialize(u, _base, stream, prefix + "\t\t");
+                        }
+
+                    continue;
+                }
+
+                if (
+                   type.IsGenericType
+                   && type.GetGenericTypeDefinition() == typeof(Dictionary<,>)
+                   && typeof(string).Equals(type.GetGenericArguments()[0])
+                   && typeof(string).Equals(type.GetGenericArguments()[1])
+                   )
+                {                  
+                    if (
+                        typeof(string).Equals(type.GetGenericArguments()[0])
+                        && typeof(string).Equals(type.GetGenericArguments()[1])
+                        )
+                    {
+                        var t = singleProperty.GetValue(obj) as Dictionary<string, string>;
+                        foreach (var u in t)
+                        {
+                            file.WriteLine(u.Key + " : " + u.Value);
+                        }
+                        continue;
+                    }
+                }
+                str = singleProperty.GetValue(obj)?.ToString();
+                if (str != null && str != "")
+                    file.WriteLine(prefix + "{0} : {1}", singleProperty.Name, str);
+
+                /*
+                var obj = properties_sort[0].GetValue(a);
+                var t = obj.GetType();
+
+                dynamic d2 = Convert.ChangeType(obj, t);
+
+
+                foreach (var elem in d2)
+                {
+                    Console.WriteLine(elem.Key);
+                    Console.WriteLine(elem.Value);
+                }    
+                */
+
+            }
+           
+        }
+
+        public static void Serialize(I_MySerializable obj, System.IO.Stream stream)
+        {
+            System.IO.StreamWriter file = new System.IO.StreamWriter(stream);
+            var serialize = obj.Serialize();
+            foreach (var elem in serialize)
+                if (elem.Value != null && elem.Value != "")
+                    file.WriteLine(elem.Key + " : " + elem.Value);
+        }
+
+        public static void Serialize(List<I_MySerializable> info, System.IO.Stream stream)
+        {
+            foreach (var elem in info)
+                Serialize(elem, stream);
+        }       
+    }
+}
diff --git a/Tools/packages.config b/Tools/packages.config
new file mode 100644
index 0000000..03660bd
--- /dev/null
+++ b/Tools/packages.config
@@ -0,0 +1,5 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+  <package id="DocX" version="1.3.0" targetFramework="net47" />
+  <package id="EPPlus" version="4.5.3.1" targetFramework="net47" />
+</packages>
\ No newline at end of file

Tools/Tools.csproj 16(+15 -1)

diff --git a/Tools/Tools.csproj b/Tools/Tools.csproj
index 70da0d2..eadc274 100644
--- a/Tools/Tools.csproj
+++ b/Tools/Tools.csproj
@@ -50,22 +50,36 @@
     <StartupObject />
   </PropertyGroup>
   <ItemGroup>
+    <Reference Include="EPPlus, Version=4.5.3.1, Culture=neutral, PublicKeyToken=ea159fdaa78159a1, processorArchitecture=MSIL">
+      <HintPath>..\packages\EPPlus.4.5.3.1\lib\net40\EPPlus.dll</HintPath>
+    </Reference>
+    <Reference Include="PresentationCore" />
     <Reference Include="System" />
+    <Reference Include="System.configuration" />
     <Reference Include="System.Core" />
+    <Reference Include="System.Drawing" />
+    <Reference Include="System.Security" />
     <Reference Include="System.Xml.Linq" />
     <Reference Include="System.Data.DataSetExtensions" />
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="System.Data" />
     <Reference Include="System.Net.Http" />
     <Reference Include="System.Xml" />
+    <Reference Include="Xceed.Words.NET, Version=1.3.0.0, Culture=neutral, PublicKeyToken=3e4669d2f30244f4, processorArchitecture=MSIL">
+      <HintPath>..\packages\DocX.1.3.0\lib\net40\Xceed.Words.NET.dll</HintPath>
+    </Reference>
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="Main\IndexAttribute.cs" />
     <Compile Include="Config\ConfigManager.cs" />
+    <Compile Include="Interfaces\I_MySerializable.cs" />
     <Compile Include="Properties\AssemblyInfo.cs" />
-    <Compile Include="Word\test.cs" />
+    <Compile Include="Main\SerializeService.cs" />
+    <Compile Include="Word\DocXWrite.cs" />
   </ItemGroup>
   <ItemGroup>
     <None Include="App.config" />
+    <None Include="packages.config" />
   </ItemGroup>
   <ItemGroup>
     <Folder Include="Excel\" />
diff --git a/Tools/Word/DocXWrite.cs b/Tools/Word/DocXWrite.cs
new file mode 100644
index 0000000..a9b53e2
--- /dev/null
+++ b/Tools/Word/DocXWrite.cs
@@ -0,0 +1,46 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+//using OfficeOpenXml;
+using Xceed.Words.NET;
+
+namespace Tools.Word
+{
+    public class DocXWrite
+    {
+        public System.IO.Stream EntitysToDocx(IEnumerable<object> d)
+        {
+            return new System.IO.MemoryStream();
+        }
+
+        public static void Test(List<I_MySerializable> list, out System.IO.Stream wr, string path = "")
+        {
+            wr = new System.IO.MemoryStream();
+            DocX doc = DocX.Create(wr);
+            foreach (var elem in list)
+                Serialize(elem, doc);
+            if (path != "")
+                doc.SaveAs(path);           
+        }
+
+        public static void Test(I_MySerializable elem, out System.IO.Stream wr, string path = "")
+        {
+            wr = new System.IO.MemoryStream();
+            DocX doc = DocX.Create(wr);
+            Serialize(elem, doc);
+            if (path != "")
+                doc.SaveAs(path);
+        }
+
+        private static void Serialize(I_MySerializable obj, DocX doc)
+        {
+            var serialize = obj.Serialize();
+            foreach (var elem in serialize)
+                if (elem.Value != null && elem.Value != "")
+                    doc.InsertParagraph(elem.Key + " : " + elem.Value);
+        }
+    }
+}