Przeglądaj źródła

Merge branch 'develop' of http://52.130.252.100:10000/TEAMMODEL/TEAMModelOS into develop

upon 11 miesięcy temu
rodzic
commit
3a03327294
100 zmienionych plików z 11226 dodań i 97 usunięć
  1. 0 2
      TEAMModelBI/Controllers/BICommon/BINoticeController.cs
  2. 0 1
      TEAMModelBI/Controllers/BICommon/StatsNoticeController.cs
  3. 1 2
      TEAMModelBI/Controllers/BINormal/AbilityMgmtController.cs
  4. 1 1
      TEAMModelBI/Controllers/BINormal/AbilityTaskMgmtController.cs
  5. 0 2
      TEAMModelBI/Controllers/BINormal/BatchAreaController.cs
  6. 0 6
      TEAMModelBI/Controllers/BISchool/BatchSchoolController.cs
  7. 0 1
      TEAMModelBI/Controllers/BISchool/SchoolController.cs
  8. 0 1
      TEAMModelBI/Controllers/BIServer/BiServersController.cs
  9. 0 1
      TEAMModelBI/Controllers/BITable/IES5OAuthController.cs
  10. 0 2
      TEAMModelBI/Controllers/BITable/TableDingDingInfoController.cs
  11. 0 4
      TEAMModelBI/Controllers/BITest/TestController.cs
  12. 0 1
      TEAMModelBI/Controllers/BITmid/TmidController.cs
  13. 0 1
      TEAMModelBI/Controllers/Census/ItemSticsController.cs
  14. 0 2
      TEAMModelBI/Controllers/Census/PaperController.cs
  15. 0 1
      TEAMModelBI/Controllers/LoginController.cs
  16. 0 3
      TEAMModelBI/Controllers/RepairApi/InitialAreaController.cs
  17. 0 2
      TEAMModelBI/Controllers/RepairApi/SchoolRepController.cs
  18. 0 2
      TEAMModelBI/Filter/RequestAuditFilter.cs
  19. 1 2
      TEAMModelBI/Models/ItemInfo.cs
  20. 3 3
      TEAMModelBI/TEAMModelBI.csproj
  21. 0 2
      TEAMModelBI/Tool/CommonFind.cs
  22. 1 2
      TEAMModelBI/Tool/TimeHelper1.cs
  23. 12 12
      TEAMModelContest/contest.client/src/locale/lang/en-US.js
  24. 11 11
      TEAMModelContest/contest.client/src/locale/lang/zh-TW.js
  25. 1 1
      TEAMModelOS.Function/.gitignore
  26. 0 1
      TEAMModelOS.Function/CosmosDBTriggers/TriggerArt.cs
  27. 1 1
      TEAMModelOS.Function/CosmosDBTriggers/TriggerCorrect.cs
  28. 3 9
      TEAMModelOS.Function/CosmosDBTriggers/TriggerExam.cs
  29. 0 1
      TEAMModelOS.Function/CosmosDBTriggers/TriggerExamImport.cs
  30. 0 1
      TEAMModelOS.Function/CosmosDBTriggers/TriggerExamLite.cs
  31. 0 1
      TEAMModelOS.Function/CosmosDBTriggers/TriggerHomework.cs
  32. 0 2
      TEAMModelOS.Function/CosmosDBTriggers/TriggerQuotaImport.cs
  33. 1 6
      TEAMModelOS.Function/CosmosDBTriggers/TriggerStudy.cs
  34. 0 1
      TEAMModelOS.Function/CosmosDBTriggers/TriggerSurvey.cs
  35. 2 3
      TEAMModelOS.Function/CosmosDBTriggers/TriggerVote.cs
  36. 2 1
      TEAMModelOS.Function/IESCosmosDBTrigger.cs
  37. 0 1
      TEAMModelOS.Function/IESHttpTrigger.cs
  38. 0 1
      TEAMModelOS.Function/IESServiceBusTrigger.cs
  39. 174 0
      TEAMModelOS.Function/Properties/ServiceDependencies/TEAMModelOSFunction - Zip Deploy/profile.arm.json
  40. 9 0
      TEAMModelOS.Function/TEAMModelOS.Function.csproj
  41. 51 0
      TEAMModelOS.HTEXLib/COMM/Globals.cs
  42. 43 0
      TEAMModelOS.HTEXLib/COMM/Helpers/CollectionHelper.cs
  43. 395 0
      TEAMModelOS.HTEXLib/COMM/Helpers/ContentTypeDict.cs
  44. 73 0
      TEAMModelOS.HTEXLib/COMM/Helpers/CustomXmlResolver.cs
  45. 85 0
      TEAMModelOS.HTEXLib/COMM/Helpers/HtmlHelper.cs
  46. 230 0
      TEAMModelOS.HTEXLib/COMM/Helpers/StringHelper.cs
  47. 17 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/BrushDIBColorsEnum.cs
  48. 24 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/BrushEnum.cs
  49. 21 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/BrushHSEnum.cs
  50. 34 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/FontCharsetEnum.cs
  51. 22 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/FontClipPrecisEnum.cs
  52. 21 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/FontFFEnum.cs
  53. 30 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/FontFWEnum.cs
  54. 25 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/FontOutPrecisEnum.cs
  55. 18 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/FontPitchEnum.cs
  56. 22 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/FontQualityEnum.cs
  57. 103 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/GdiEnum.cs
  58. 187 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/GdiUtils.cs
  59. 657 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdi.cs
  60. 36 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdiBrush.cs
  61. 102 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdiFont.cs
  62. 15 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdiObject.cs
  63. 30 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdiPalette.cs
  64. 24 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdiPatternBrush.cs
  65. 33 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdiPen.cs
  66. 16 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdiRegion.cs
  67. 22 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/PenEnum.cs
  68. 90 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/Point.cs
  69. 19 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/RegionEnum.cs
  70. 90 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/Size.cs
  71. 228 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/IO/DataInput.cs
  72. 132 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/Properties.cs
  73. 271 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgBrush.cs
  74. 976 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgDc.cs
  75. 532 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgFont.cs
  76. 2292 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgGdi.cs
  77. 77 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgObject.cs
  78. 67 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgPalette.cs
  79. 50 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgPatternBrush.cs
  80. 205 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgPen.cs
  81. 149 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgRectRegion.cs
  82. 38 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgRegion.cs
  83. 84 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Util/Base64.cs
  84. 15 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Util/ImageUtil.cs
  85. 74 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfBrush.cs
  86. 85 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfConstants.cs
  87. 250 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfFont.cs
  88. 1647 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfGdi.cs
  89. 49 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfObject.cs
  90. 65 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfPalette.cs
  91. 30 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfParseException.cs
  92. 821 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfParser.cs
  93. 52 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfPatternBrush.cs
  94. 75 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfPen.cs
  95. 92 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfRectRegion.cs
  96. 27 0
      TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfRegion.cs
  97. 23 0
      TEAMModelOS.HTEXLib/COMM/TransException.cs
  98. 24 0
      TEAMModelOS.HTEXLib/DOCX/Models/ItemInfo.cs
  99. 38 0
      TEAMModelOS.HTEXLib/DOCX/Models/LangConfig.cs
  100. 0 0
      TEAMModelOS.HTEXLib/DOCX/Models/ReplaceDto.cs

+ 0 - 2
TEAMModelBI/Controllers/BICommon/BINoticeController.cs

@@ -23,8 +23,6 @@ using TEAMModelOS.SDK.Models.Service.BI;
 using TEAMModelOS.SDK.Models.Cosmos.BI.BISchool;
 using TEAMModelBI.Tool.Extension;
 using TEAMModelOS.SDK.Models;
-using DocumentFormat.OpenXml.Spreadsheet;
-using System.Net.Http.Json;
 
 namespace TEAMModelBI.Controllers.BICommon
 {

+ 0 - 1
TEAMModelBI/Controllers/BICommon/StatsNoticeController.cs

@@ -16,7 +16,6 @@ using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models.Cosmos.BI.BICommon;
 using System.Collections.Generic;
 using System.Text;
-using DocumentFormat.OpenXml.Office2010.Excel;
 
 namespace TEAMModelBI.Controllers.BICommon
 {

+ 1 - 2
TEAMModelBI/Controllers/BINormal/AbilityMgmtController.cs

@@ -11,13 +11,12 @@ using TEAMModelOS.Models;
 using Microsoft.Extensions.Options;
 using System.Text.Json;
 using Azure.Cosmos;
-using HTEXLib.COMM.Helpers;
 using System.Text;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelBI.Filter;
 using TEAMModelBI.Tool.Extension;
 using TEAMModelOS.SDK.Context.BI;
-
+using TEAMModelOS.SDK;
 namespace TEAMModelBI.Controllers.BINormal
 {
     [Route("biabilitymgmt")]

+ 1 - 1
TEAMModelBI/Controllers/BINormal/AbilityTaskMgmtController.cs

@@ -11,7 +11,6 @@ using Microsoft.Extensions.Options;
 using System.Text.Json;
 using TEAMModelOS.SDK.Models;
 using Azure.Cosmos;
-using HTEXLib.COMM.Helpers;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
 using System.Text;
 using TEAMModelBI.Filter;
@@ -19,6 +18,7 @@ using TEAMModelOS.SDK.Services;
 using TEAMModelBI.Tool.Extension;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Context.BI;
+using TEAMModelOS.SDK;
 
 namespace TEAMModelBI.Controllers.BINormal
 {

+ 0 - 2
TEAMModelBI/Controllers/BINormal/BatchAreaController.cs

@@ -11,7 +11,6 @@ using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Models;
 using Azure.Cosmos;
 using System.Text.Json;
-using HTEXLib.COMM.Helpers;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
 using TEAMModelOS.SDK.Models.Cosmos.BI;
 using Azure.Messaging.ServiceBus;
@@ -28,7 +27,6 @@ using System.Net;
 using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.Context.BI;
 using System.Text;
-using DocumentFormat.OpenXml.Bibliography;
 using Microsoft.Extensions.Hosting;
 using Microsoft.AspNetCore.Hosting;
 using TEAMModelOS.SDK.Context.Constant;

+ 0 - 6
TEAMModelBI/Controllers/BISchool/BatchSchoolController.cs

@@ -1,5 +1,4 @@
 using Azure.Cosmos;
-using HTEXLib.COMM.Helpers;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.Options;
@@ -32,13 +31,8 @@ using TEAMModelOS.SDK.Context.Constant;
 using Pipelines.Sockets.Unofficial.Arenas;
 using Microsoft.Identity.Client;
 using TEAMModelOS.SDK.Models.Dtos;
-using DocumentFormat.OpenXml.Spreadsheet;
-using DocumentFormat.OpenXml.Wordprocessing;
-using DocumentFormat.OpenXml.Bibliography;
-using HTEXLib;
 using TEAMModelOS.SDK.Models.Service.BI;
 using TEAMModelOS.SDK.Models.Cosmos.BI.BISchool;
-using DocumentFormat.OpenXml.Vml.Office;
 using System.Net.Http.Headers;
 using System.Text.Encodings.Web;
 using System.ComponentModel.DataAnnotations;

+ 0 - 1
TEAMModelBI/Controllers/BISchool/SchoolController.cs

@@ -1,5 +1,4 @@
 using Azure.Cosmos;
-using HTEXLib.COMM.Helpers;
 using MathNet.Numerics.LinearAlgebra.Double;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Http;

+ 0 - 1
TEAMModelBI/Controllers/BIServer/BiServersController.cs

@@ -13,7 +13,6 @@ using System.Net.Http;
 using TEAMModelOS.SDK.Extension;
 using System.Text;
 using System.Net;
-using HTEXLib.COMM.Helpers;
 using System.Net.Http.Json;
 using TEAMModelOS.SDK;
 using TEAMModelBI.Filter;

+ 0 - 1
TEAMModelBI/Controllers/BITable/IES5OAuthController.cs

@@ -1,6 +1,5 @@
 using Azure.Cosmos;
 using Azure.Storage.Blobs;
-using DocumentFormat.OpenXml.Spreadsheet;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.Options;

+ 0 - 2
TEAMModelBI/Controllers/BITable/TableDingDingInfoController.cs

@@ -17,7 +17,6 @@ using System.Net.Http.Json;
 using TEAMModelOS.SDK.Models.Cosmos.BI;
 using System.Net;
 using TEAMModelOS.SDK.Extension;
-using OpenXmlPowerTools;
 using System.Text;
 using Azure.Cosmos;
 using Microsoft.Azure.Cosmos.Table;
@@ -30,7 +29,6 @@ using TEAMModelOS.SDK.Context.BI;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Context.Constant;
 using TEAMModelOS.SDK.Models.Dtos;
-using DocumentFormat.OpenXml.Bibliography;
 using TEAMModelOS.SDK.Models.Cosmos.BI.BISchool;
 
 namespace TEAMModelBI.Controllers.BITable

+ 0 - 4
TEAMModelBI/Controllers/BITest/TestController.cs

@@ -2,7 +2,6 @@
 using DingTalk.Api;
 using DingTalk.Api.Request;
 using DingTalk.Api.Response;
-using HTEXLib.COMM.Helpers;
 using Microsoft.AspNetCore.Hosting;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
@@ -53,12 +52,9 @@ using Azure.Storage.Blobs;
 using Azure.Storage.Blobs.Specialized;
 using System.Web;
 using Azure.Storage.Sas;
-using DocumentFormat.OpenXml.Drawing.Diagrams;
-using DocumentFormat.OpenXml.Bibliography;
 using TEAMModelOS.SDK.Models.Service.BIStatsWay;
 using MathNet.Numerics.LinearAlgebra.Double;
 using TEAMModelOS.SDK.Models.Cosmos.BI.BISchool;
-using DocumentFormat.OpenXml.Drawing;
 using Microsoft.OData.Edm;
 using TEAMModelOS.SDK.Models.Cosmos.OpenEntity;
 using TEAMModelOS.SDK.Models.Cosmos.BI.BICommon;

+ 0 - 1
TEAMModelBI/Controllers/BITmid/TmidController.cs

@@ -1,5 +1,4 @@
 using Azure.Cosmos;
-using DocumentFormat.OpenXml.Office2010.Excel;
 using Microsoft.AspNetCore.Authorization;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.Azure.Cosmos.Table;

+ 0 - 1
TEAMModelBI/Controllers/Census/ItemSticsController.cs

@@ -16,7 +16,6 @@ using TEAMModelOS.SDK.Context.BI;
 using Azure.Core;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Context.Constant;
-using DocumentFormat.OpenXml.Wordprocessing;
 using TEAMModelOS.SDK.Models.Service.BI;
 
 namespace TEAMModelBI.Controllers.Census

+ 0 - 2
TEAMModelBI/Controllers/Census/PaperController.cs

@@ -2,7 +2,6 @@
 using Azure.Storage.Blobs;
 using Azure.Storage.Blobs.Models;
 using Azure.Storage.Sas;
-using DocumentFormat.OpenXml.Drawing.Diagrams;
 using Microsoft.AspNetCore.Http;
 using Microsoft.AspNetCore.Mvc;
 using Microsoft.Extensions.Options;
@@ -23,7 +22,6 @@ using TEAMModelOS.Models;
 using TEAMModelOS.SDK.Context.BI;
 using TEAMModelOS.SDK.Context.Constant;
 using TEAMModelOS.SDK.DI;
-using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Cosmos.BI;

+ 0 - 1
TEAMModelBI/Controllers/LoginController.cs

@@ -12,7 +12,6 @@ using System.Text.Json;
 using System.Threading.Tasks;
 using TEAMModelOS.SDK.DI;
 using TEAMModelOS.SDK.Models;
-using HTEXLib.COMM.Helpers;
 using TEAMModelOS.Models;
 using Microsoft.Extensions.Options;
 using TEAMModelOS.SDK.Extension;

+ 0 - 3
TEAMModelBI/Controllers/RepairApi/InitialAreaController.cs

@@ -20,9 +20,6 @@ using System.Collections.Generic;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
 using System.Linq;
 using Pipelines.Sockets.Unofficial.Arenas;
-using TEAMModelOS.SDK.Models.Cosmos.BI;
-using TEAMModelBI.Filter;
-using HTEXLib.COMM.Helpers;
 using TEAMModelBI.Models;
 
 namespace TEAMModelBI.Controllers.RepairApi

+ 0 - 2
TEAMModelBI/Controllers/RepairApi/SchoolRepController.cs

@@ -23,9 +23,7 @@ using Pipelines.Sockets.Unofficial.Arenas;
 using TEAMModelBI.Tool;
 using TEAMModelOS.SDK.Models.Cosmos.BI.BISchool;
 using TEAMModelOS.SDK.Models.Cosmos.BI;
-using DocumentFormat.OpenXml.Math;
 using TEAMModelOS.SDK.Models.Service.BI;
-using TEAMModelBI.Tool.CosmosBank;
 using TEAMModelOS.SDK.Models.Service.BIStatsWay;
 using StackExchange.Redis;
 using System.Text.RegularExpressions;

+ 0 - 2
TEAMModelBI/Filter/RequestAuditFilter.cs

@@ -11,14 +11,12 @@ using System.Linq;
 using Azure.Core;
 using TEAMModelOS.SDK.DI;
 using Microsoft.Extensions.Primitives;
-using HTEXLib.Helpers.ShapeHelpers;
 using System.Net.Http;
 using System.ServiceModel.Channels;
 using System.Net;
 using System.Net.Http.Json;
 using Microsoft.Extensions.Options;
 using TEAMModelOS.Models;
-using OpenXmlPowerTools;
 
 namespace TEAMModelOS.Filter
 {

+ 1 - 2
TEAMModelBI/Models/ItemInfo.cs

@@ -1,5 +1,4 @@
-using DocumentFormat.OpenXml.Office2010.ExcelAc;
-using System.Collections.Generic;
+using System.Collections.Generic;
 using TEAMModelOS.SDK.Models;
 
 namespace TEAMModelBI.Models

+ 3 - 3
TEAMModelBI/TEAMModelBI.csproj

@@ -65,9 +65,9 @@
 		<SpaRoot>ClientApp\</SpaRoot>
 		<DefaultItemExcludes>$(DefaultItemExcludes);$(SpaRoot)node_modules\**</DefaultItemExcludes>
 		<UserSecretsId>078b5d89-7d90-4f6a-88fc-7d96025990a8</UserSecretsId>
-		<Version>5.2406.26</Version>
-		<AssemblyVersion>5.2406.26.1</AssemblyVersion>
-		<FileVersion>5.2406.26.1</FileVersion>
+		<Version>5.2407.3</Version>
+		<AssemblyVersion>5.2407.3.1</AssemblyVersion>
+		<FileVersion>5.2407.3.1</FileVersion>
 		<Description>TEAMModelBI(BI)</Description>
 		<PackageReleaseNotes>BI版本说明版本切换标记2022000908</PackageReleaseNotes>
 		<PackageId>TEAMModelBI</PackageId>

+ 0 - 2
TEAMModelBI/Tool/CommonFind.cs

@@ -1,5 +1,4 @@
 using Azure.Cosmos;
-using DocumentFormat.OpenXml.Spreadsheet;
 using System;
 using System.Collections.Generic;
 using System.Text;
@@ -7,7 +6,6 @@ using System.Text.Json;
 using System.Threading.Tasks;
 using TEAMModelBI.Models;
 using TEAMModelOS.SDK.Models;
-using TEAMModelOS.SDK.Models.Cosmos.Common;
 
 namespace TEAMModelBI.Tool
 {

+ 1 - 2
TEAMModelBI/Tool/TimeHelper1.cs

@@ -1,5 +1,4 @@
-using DocumentFormat.OpenXml.Bibliography;
-using System;
+using System;
 using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;

+ 12 - 12
TEAMModelContest/contest.client/src/locale/lang/en-US.js

@@ -135,22 +135,22 @@ const enUS = {
         scoring: "Please rate",
     },
     elMessage: {
-        logout: "已退出登录",
-        noRoute: "未匹配分站",
+        logout: "Logged out",
+        noRoute: "No matching station",
         noAct: "No activity yet",
-        teamTips: "本次活动为团队赛,请创建团队或加入团队",
+        teamTips: "This event is a team competition, please create a team or join a team",
         videomsg: "Your browser does not support the video tag",
         audiomsg: "Your browser does not support the audio element",
         completeInfo: "Please complete the information",
-        signcompInfo: "报名信息未完善",
-        schoolJoin: "请以学校教师身份参加本次活动",
-        diffTeam: "参加组别不一致",
-        notAct: "活动不存在",
-        notFindTeam: "未找到相关团队信息",
-        noTeam: "队伍未组建或不存在",
-        schoolDiff: "报名学校与组队学校不一致",
-        signOvertime: "已过报名时间",
-        uploadOverTime: "上传作品时间已过",
+        signcompInfo: "Registration is not complete",
+        schoolJoin: "Please participate in this event as a school teacher",
+        diffTeam: "Participating groups are inconsistent",
+        notAct: "The event does not exist",
+        notFindTeam: "No relevant team information found",
+        noTeam: "The team has not been formed or does not exist",
+        schoolDiff: "The registered school is inconsistent with the team forming school",
+        signOvertime: "The registration time has passed",
+        uploadOverTime: "The time for uploading works has passed",
         joinSuccess: "报名成功",
         joinError: "报名失败",
         joinAct: "已经报名该活动",

+ 11 - 11
TEAMModelContest/contest.client/src/locale/lang/zh-TW.js

@@ -135,22 +135,22 @@ const zhTW = {
         scoring: "請打分數",
     },
     elMessage: {
-        logout: "已退出登录",
+        logout: "已登出",
         noRoute: "未匹配分站",
         noAct: "暫無活動",
-        teamTips: "本次活动为团队赛,请创建团队或加入团队",
+        teamTips: "本次活動為團隊賽,請建立或加入團隊",
         videomsg: "您的瀏覽器不支援 video 標籤。",
         audiomsg: "您的瀏覽器不支援 audio 元素。",
         completeInfo: "請完善資訊",
-        signcompInfo: "报名信息未完善",
-        schoolJoin: "请以学校教师身份参加本次活动",
-        diffTeam: "参加组别不一致",
-        notAct: "活不存在",
-        notFindTeam: "未找到相关团队信息",
-        noTeam: "队伍未组建或不存在",
-        schoolDiff: "报名学校与组队学校不一致",
-        signOvertime: "已过报名时间",
-        uploadOverTime: "上传作品时间已过",
+        signcompInfo: "報名資料未完善",
+        schoolJoin: "請以學校教師身份參加本次活動",
+        diffTeam: "參加組別不一致",
+        notAct: "活不存在",
+        notFindTeam: "未找到相關團隊資訊",
+        noTeam: "隊伍未組成或不存在",
+        schoolDiff: "報名的學校與組隊學校不一致",
+        signOvertime: "已過了報名時間",
+        uploadOverTime: "上傳作品時間已過",
         joinSuccess: "报名成功",
         joinError: "报名失败",
         joinAct: "已经报名该活动",

+ 1 - 1
TEAMModelOS.Function/.gitignore

@@ -2,7 +2,7 @@
 ## files generated by popular Visual Studio add-ons.
 
 # Azure Functions localsettings file
-local.settings.json
+#local.settings.json
 
 # User-specific files
 *.suo

+ 0 - 1
TEAMModelOS.Function/CosmosDBTriggers/TriggerArt.cs

@@ -1,5 +1,4 @@
 using Azure.Messaging.ServiceBus;
-using HTEXLib.COMM.Helpers;
 using Microsoft.Extensions.Configuration;
 using System;
 using System.Collections.Generic;

+ 1 - 1
TEAMModelOS.Function/CosmosDBTriggers/TriggerCorrect.cs

@@ -7,7 +7,7 @@ using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Cosmos;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
-using HTEXLib.COMM.Helpers;
+ 
 using TEAMModelOS.Function;
 
 

+ 3 - 9
TEAMModelOS.Function/CosmosDBTriggers/TriggerExam.cs

@@ -5,7 +5,6 @@ using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Models.Service;
-using HTEXLib.COMM.Helpers;
 using ClouDASLibx;
 using System.Text.Json;
 using System.Collections.Generic;
@@ -19,18 +18,13 @@ using System.Text;
 using System.Text.Json.Nodes;
 using Newtonsoft.Json.Linq;
 using TEAMModelOS.SDK.Models.Cosmos.Student;
-using HTEXLib.Helpers.ShapeHelpers;
 using TEAMModelOS.Models.Dto;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
-using DocumentFormat.OpenXml.Office2010.Excel;
-using DocumentFormat.OpenXml.Drawing.Charts;
-using DocumentFormat.OpenXml.Vml;
 using System.Net.Http;
 using Newtonsoft.Json;
 using System.Net;
 using System.Security.Policy;
 using Microsoft.Extensions.Configuration;
-using DocumentFormat.OpenXml.EMMA;
 using Microsoft.Extensions.Options;
 using TEAMModelOS.Models;
 using Microsoft.AspNetCore.Razor.TagHelpers;
@@ -201,7 +195,7 @@ namespace TEAMModelOS.CosmosDBTriggers
                                         foreach (ExamSubject subject in info.subjects)
                                         {
                                             string classCode = string.Empty;
-                                            string cname = string.Empty;
+                                            string? cname = string.Empty;
                                             if (string.IsNullOrEmpty(info.school) || !info.scope.Equals("school", StringComparison.OrdinalIgnoreCase))
                                             {
                                                 classCode = "ExamClassResult-" + info.creatorId;
@@ -1089,8 +1083,8 @@ namespace TEAMModelOS.CosmosDBTriggers
                 //确定高分组 最低分数
                 //var srowallorder = scores.EnumerateIndexed().OrderByDescending(g => g.Item2); //各生總分排序   
                 //var srowallorder =  scores.OrderByDescending(g => g);
-                double[] point = StringHelper.ListTodouble(er.paper.point);
-                double[,] result = StringHelper.ListToDouble(er.studentScores);
+                double[] point = TEAMModelOS.SDK.Helper.Common.StringHelper.StringHelper.ListTodouble(er.paper.point);
+                double[,] result = TEAMModelOS.SDK.Helper.Common.StringHelper. StringHelper.ListToDouble(er.studentScores);
                 var cdm = new ClouDASMatrix(result, point);
 
                 scores.Sort((s1, s2) => { return s2.CompareTo(s1); });

+ 0 - 1
TEAMModelOS.Function/CosmosDBTriggers/TriggerExamImport.cs

@@ -12,7 +12,6 @@ using System.Net.Http;
 using TEAMModelOS.SDK.Models.Cosmos.School;
 using TEAMModelOS.SDK.Extension;
 using TEAMModelOS.SDK.Models;
-using HTEXLib.COMM.Helpers;
 using TEAMModelOS.Function;
 namespace TEAMModelOS.CosmosDBTriggers
 {

+ 0 - 1
TEAMModelOS.Function/CosmosDBTriggers/TriggerExamLite.cs

@@ -1,6 +1,5 @@
 using Azure.Cosmos;
 using Azure.Messaging.ServiceBus;
-using HTEXLib.COMM.Helpers;
 using Microsoft.Azure.Documents;
 using Microsoft.Extensions.Configuration;
 using System;

+ 0 - 1
TEAMModelOS.Function/CosmosDBTriggers/TriggerHomework.cs

@@ -1,6 +1,5 @@
 using Azure.Cosmos;
 using Azure.Messaging.ServiceBus;
-using HTEXLib.COMM.Helpers;
 using Microsoft.Azure.Documents;
 using Microsoft.Extensions.Configuration;
 using System;

+ 0 - 2
TEAMModelOS.Function/CosmosDBTriggers/TriggerQuotaImport.cs

@@ -12,8 +12,6 @@ using Azure.Cosmos;
 using TEAMModelOS.SDK.Models.Cosmos.School;
 using TEAMModelOS.SDK.Models;
 using TEAMModelOS.SDK.Extension;
-using HTEXLib.COMM.Helpers;
-using OpenXmlPowerTools;
 using Microsoft.OData.Edm;
 using TEAMModelOS.Function;
 namespace TEAMModelOS.CosmosDBTriggers

+ 1 - 6
TEAMModelOS.Function/CosmosDBTriggers/TriggerStudy.cs

@@ -1,11 +1,6 @@
 using Azure.Cosmos;
 using Azure.Messaging.ServiceBus;
-using DocumentFormat.OpenXml.Bibliography;
-using DocumentFormat.OpenXml.Office2013.Excel;
-using DocumentFormat.OpenXml.Spreadsheet;
-using DocumentFormat.OpenXml.VariantTypes;
-using DocumentFormat.OpenXml.Vml;
-using HTEXLib.COMM.Helpers;
+ 
 using Microsoft.Azure.Documents;
 using Microsoft.Extensions.Configuration;
 using System;

+ 0 - 1
TEAMModelOS.Function/CosmosDBTriggers/TriggerSurvey.cs

@@ -18,7 +18,6 @@ using TEAMModelOS.SDK.Models.Cosmos.Common;
 using TEAMModelOS.SDK.Models.Cosmos.Common.Inner;
 using TEAMModelOS.SDK.Module.AzureBlob.Configuration;
 using TEAMModelOS.SDK.Models.Service;
-using HTEXLib.COMM.Helpers;
 using Microsoft.Extensions.Configuration;
 using System.Linq;
 using TEAMModelOS.SDK.Models.Service.BI;

+ 2 - 3
TEAMModelOS.Function/CosmosDBTriggers/TriggerVote.cs

@@ -15,10 +15,9 @@ using TEAMModelOS.SDK.Models.Cosmos;
 using TEAMModelOS.SDK.Models.Cosmos.Common;
 using TEAMModelOS.SDK.Models.Cosmos.Common.Inner;
 using TEAMModelOS.SDK.Models.Service;
-using HTEXLib.COMM.Helpers;
+ 
 using Microsoft.Extensions.Configuration;
-using DocumentFormat.OpenXml.Office2013.Excel;
-using DocumentFormat.OpenXml.Vml;
+ 
 using TEAMModelOS.SDK.Models.Service.BI;
 using TEAMModelOS.Function;
 namespace TEAMModelOS.CosmosDBTriggers

+ 2 - 1
TEAMModelOS.Function/IESCosmosDBTrigger.cs

@@ -45,7 +45,8 @@ namespace TEAMModelOS.Function
             databaseName: "TEAMModelOS",
             containerName: "Common",
             Connection = "Azure:Cosmos:ConnectionString",
-            LeaseContainerName = "leases",
+            LeaseDatabaseName ="Lease",
+            LeaseContainerName = "lease",
             LeaseContainerPrefix = "TEAMModelOS",
             CreateLeaseContainerIfNotExists = true,StartFromBeginning =false)] IReadOnlyList<JsonElement> input)
         {

+ 0 - 1
TEAMModelOS.Function/IESHttpTrigger.cs

@@ -11,7 +11,6 @@ using Microsoft.Extensions.Options;
 using System.Net;
 using System.Text.Json;
 using System.Reflection;
-using HTEXLib.COMM.Helpers;
 using StackExchange.Redis;
 using static TEAMModelOS.SDK.Services.BlobService;
 using TEAMModelOS.SDK.Models;

+ 0 - 1
TEAMModelOS.Function/IESServiceBusTrigger.cs

@@ -20,7 +20,6 @@ using TEAMModelOS.SDK.Models.Cosmos.Common;
 using StackExchange.Redis;
 using static TEAMModelOS.SDK.StatisticsService;
 using Azure;
-using HTEXLib.COMM.Helpers;
 using TEAMModelOS.SDK.Models.Dtos;
 using TEAMModelOS.SDK.Models.Service.BI;
 using TEAMModelOS.SDK.Models.Service;

+ 174 - 0
TEAMModelOS.Function/Properties/ServiceDependencies/TEAMModelOSFunction - Zip Deploy/profile.arm.json

@@ -0,0 +1,174 @@
+{
+  "$schema": "https://schema.management.azure.com/schemas/2018-05-01/subscriptionDeploymentTemplate.json#",
+  "contentVersion": "1.0.0.0",
+  "metadata": {
+    "_dependencyType": "compute.function.windows.appService"
+  },
+  "parameters": {
+    "resourceGroupName": {
+      "type": "string",
+      "defaultValue": "TEAMModelChengdu",
+      "metadata": {
+        "description": "Name of the resource group for the resource. It is recommended to put resources under same resource group for better tracking."
+      }
+    },
+    "resourceGroupLocation": {
+      "type": "string",
+      "defaultValue": "",
+      "metadata": {
+        "description": "Location of the resource group. Resource groups could have different location than resources, however by default we use API versions from latest hybrid profile which support all locations for resource types we support."
+      }
+    },
+    "resourceName": {
+      "type": "string",
+      "defaultValue": "TEAMModelOSFunction",
+      "metadata": {
+        "description": "Name of the main resource to be created by this template."
+      }
+    },
+    "resourceLocation": {
+      "type": "string",
+      "defaultValue": "[parameters('resourceGroupLocation')]",
+      "metadata": {
+        "description": "Location of the resource. By default use resource group's location, unless the resource provider is not supported there."
+      }
+    }
+  },
+  "resources": [
+    {
+      "type": "Microsoft.Resources/resourceGroups",
+      "name": "[parameters('resourceGroupName')]",
+      "location": "[parameters('resourceGroupLocation')]",
+      "apiVersion": "2019-10-01"
+    },
+    {
+      "type": "Microsoft.Resources/deployments",
+      "name": "[concat(parameters('resourceGroupName'), 'Deployment', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
+      "resourceGroup": "[parameters('resourceGroupName')]",
+      "apiVersion": "2019-10-01",
+      "dependsOn": [
+        "[parameters('resourceGroupName')]"
+      ],
+      "properties": {
+        "mode": "Incremental",
+        "expressionEvaluationOptions": {
+          "scope": "inner"
+        },
+        "parameters": {
+          "resourceGroupName": {
+            "value": "[parameters('resourceGroupName')]"
+          },
+          "resourceGroupLocation": {
+            "value": "[parameters('resourceGroupLocation')]"
+          },
+          "resourceName": {
+            "value": "[parameters('resourceName')]"
+          },
+          "resourceLocation": {
+            "value": "[parameters('resourceLocation')]"
+          }
+        },
+        "template": {
+          "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
+          "contentVersion": "1.0.0.0",
+          "parameters": {
+            "resourceGroupName": {
+              "type": "string"
+            },
+            "resourceGroupLocation": {
+              "type": "string"
+            },
+            "resourceName": {
+              "type": "string"
+            },
+            "resourceLocation": {
+              "type": "string"
+            }
+          },
+          "variables": {
+            "storage_name": "[toLower(concat('storage', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId))))]",
+            "appServicePlan_name": "[concat('Plan', uniqueString(concat(parameters('resourceName'), subscription().subscriptionId)))]",
+            "storage_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Storage/storageAccounts/', variables('storage_name'))]",
+            "appServicePlan_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/serverFarms/', variables('appServicePlan_name'))]",
+            "function_ResourceId": "[concat('/subscriptions/', subscription().subscriptionId, '/resourceGroups/', parameters('resourceGroupName'), '/providers/Microsoft.Web/sites/', parameters('resourceName'))]"
+          },
+          "resources": [
+            {
+              "location": "[parameters('resourceLocation')]",
+              "name": "[parameters('resourceName')]",
+              "type": "Microsoft.Web/sites",
+              "apiVersion": "2015-08-01",
+              "tags": {
+                "[concat('hidden-related:', variables('appServicePlan_ResourceId'))]": "empty"
+              },
+              "dependsOn": [
+                "[variables('appServicePlan_ResourceId')]",
+                "[variables('storage_ResourceId')]"
+              ],
+              "kind": "functionapp",
+              "properties": {
+                "name": "[parameters('resourceName')]",
+                "kind": "functionapp",
+                "httpsOnly": true,
+                "reserved": false,
+                "serverFarmId": "[variables('appServicePlan_ResourceId')]",
+                "siteConfig": {
+                  "alwaysOn": true
+                }
+              },
+              "identity": {
+                "type": "SystemAssigned"
+              },
+              "resources": [
+                {
+                  "name": "appsettings",
+                  "type": "config",
+                  "apiVersion": "2015-08-01",
+                  "dependsOn": [
+                    "[variables('function_ResourceId')]"
+                  ],
+                  "properties": {
+                    "AzureWebJobsStorage": "[concat('DefaultEndpointsProtocol=https;AccountName=', variables('storage_name'), ';AccountKey=', listKeys(variables('storage_ResourceId'), '2017-10-01').keys[0].value, ';EndpointSuffix=', 'core.windows.net')]",
+                    "FUNCTIONS_EXTENSION_VERSION": "~3",
+                    "FUNCTIONS_WORKER_RUNTIME": "dotnet"
+                  }
+                }
+              ]
+            },
+            {
+              "location": "[parameters('resourceGroupLocation')]",
+              "name": "[variables('storage_name')]",
+              "type": "Microsoft.Storage/storageAccounts",
+              "apiVersion": "2017-10-01",
+              "tags": {
+                "[concat('hidden-related:', concat('/providers/Microsoft.Web/sites/', parameters('resourceName')))]": "empty"
+              },
+              "properties": {
+                "supportsHttpsTrafficOnly": true
+              },
+              "sku": {
+                "name": "Standard_LRS"
+              },
+              "kind": "Storage"
+            },
+            {
+              "location": "[parameters('resourceGroupLocation')]",
+              "name": "[variables('appServicePlan_name')]",
+              "type": "Microsoft.Web/serverFarms",
+              "apiVersion": "2015-08-01",
+              "sku": {
+                "name": "S1",
+                "tier": "Standard",
+                "family": "S",
+                "size": "S1"
+              },
+              "properties": {
+                "name": "[variables('appServicePlan_name')]"
+              }
+            }
+          ]
+        }
+      }
+    }
+  ]
+}

+ 9 - 0
TEAMModelOS.Function/TEAMModelOS.Function.csproj

@@ -5,6 +5,15 @@
     <OutputType>Exe</OutputType>
     <ImplicitUsings>enable</ImplicitUsings>
     <Nullable>enable</Nullable>
+	<Version>5.2407.3</Version>
+	<AssemblyVersion>5.2407.3.1</AssemblyVersion>
+	<FileVersion>5.2407.3.1</FileVersion>
+	<PackageId>TEAMModelOS.FunctionV4</PackageId>
+	<Authors>teammodel</Authors>
+	<Company>醍摩豆(成都)信息技术有限公司</Company>
+	<Product>IES5</Product>
+	<Description>事件触发中心 </Description>
+	<PackageProjectUrl>https://www.teammodel.cn/</PackageProjectUrl>
   </PropertyGroup>
   <ItemGroup>
     <None Remove="Lang\en-us.json" />

Plik diff jest za duży
+ 51 - 0
TEAMModelOS.HTEXLib/COMM/Globals.cs


+ 43 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/CollectionHelper.cs

@@ -0,0 +1,43 @@
+using System;
+using System.Collections;
+using System.Collections.Generic;
+using System.Text;
+
+namespace HTEXLib.COMM.Helpers
+{
+    public static class CollectionHelper
+    {
+        /// <summary>
+        /// 判断集合是否为空
+        /// </summary>
+        /// <param name="collection"></param>
+        /// <returns></returns>
+        public static bool IsEmpty(this ICollection collection)
+        {
+            if (collection != null && collection.Count > 0)
+            {
+                return false;
+            }
+            else
+            {
+                return true;
+            }
+        }
+        /// <summary>
+        /// 判断集合是否不为空
+        /// </summary>
+        /// <param name="collection"></param>
+        /// <returns></returns>
+        public static bool IsNotEmpty(this ICollection collection)
+        {
+            if (collection != null && collection.Count > 0)
+            {
+                return true;
+            }
+            else
+            {
+                return false;
+            }
+        }
+    }
+}

+ 395 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/ContentTypeDict.cs

@@ -0,0 +1,395 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace HTEXLib.COMM.Helpers
+{
+    public static class ContentTypeDict
+    {
+        public static readonly Dictionary<string, string> extdict = new Dictionary<string, string> {
+            //{ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",".xlsx"},
+            { "audio/x-ms-wma",".wma"},
+            {"video/3gpp",".3g2"},
+{"audio/mp4",".aac"},
+{"audio/ac3",".ac3"},
+{"text/x-adasrc",".adb"},
+{"image/x-applix-graphics",".ag"},
+{"audio/amr",".amr"},
+{"audio/x-ape",".ape"},
+{"image/x-sony-arw",".arw"},
+{"text/plain",".asc"},
+{"video/x-ms-asf",".asf"},
+{"text/x-ssa",".ass"},
+{"video/x-msvideo",".avi"},
+{"text/x-bibtex",".bib"},
+{"image/bmp",".bmp"},
+{"text/x-csrc",".c"},
+{"text/x-c++src",".c++"},
+{"image/cgm",".cgm"},
+{"text/x-tex",".cls"},
+{"text/x-cmake",".cmake"},
+{"image/x-canon-cr2",".cr2"},
+{"image/x-canon-crw",".crw"},
+{"text/x-csharp",".cs"},
+{"text/css",".css"},
+{"text/csv",".csv"},
+{"image/x-win-bitmap",".cur"},
+{"text/x-dsrc",".d"},
+{"text/x-dcl",".dcl"},
+{"image/x-kodak-dcr",".dcr"},
+{"image/x-dds",".dds"},
+{"text/x-patch",".diff"},
+{"image/vnd.djvu",".djv"},
+{"image/x-adobe-dng",".dng"},
+{"text/vnd.graphviz",".dot"},
+{"text/x-dsl",".dsl"},
+{"image/vnd.dwg",".dwg"},
+{"image/vnd.dxf",".dxf"},
+{"text/x-eiffel",".e"},
+{"text/x-emacs-lisp",".el"},
+{"image/x-emf",".emf"},
+{"image/x-eps",".eps"},
+{"image/x-bzeps",".eps.bz2"},
+{"image/x-gzeps",".eps.gz"},
+{"text/x-erlang",".erl"},
+{"text/x-setext",".etx"},
+{"image/x-exr",".exr"},
+{"text/x-fortran",".f"},
+{"image/x-xfig",".fig"},
+{"image/fits",".fits"},
+{"video/x-flv",".flv"},
+{"text/x-xslfo",".fo"},
+{"image/fax-g3",".g3"},
+{"text/directory",".gcrd"},
+{"image/gif",".gif"},
+{"text/x-google-video-pointer",".gvp"},
+{"text/x-chdr",".h"},
+{"text/x-c++hdr",".h++"},
+{"text/x-haskell",".hs"},
+{"text/html",".htm"},
+{"image/x-tga",".icb"},
+{"image/x-icns",".icns"},
+{"image/x-icon",".ico"},
+{"text/calendar",".ics"},
+{"text/x-idl",".idl"},
+{"image/ief",".ief"},
+{"image/x-iff",".iff"},
+{"image/x-ilbm",".ilbm"},
+{"text/x-imelody",".ime"},
+{"text/x-iptables",".iptables"},
+{"image/jp2",".j2k"},
+{"text/vnd.sun.j2me.app-descriptor",".jad"},
+{"text/x-java",".java"},
+{"image/x-jng",".jng"},
+{"image/jpeg",".jpeg"},
+{"application/javascript",".js"},
+{"application/json",".json"},
+{"application/jsonp",".jsonp"},
+{"image/x-kodak-k25",".k25"},
+{"image/x-kodak-kdc",".kdc"},
+{"text/x-ldif",".ldif"},
+{"text/x-literate-haskell",".lhs"},
+{"text/x-log",".log"},
+{"text/x-lua",".lua"},
+{"image/x-lwo",".lwo"},
+{"image/x-lws",".lws"},
+{"text/x-lilypond",".ly"},
+{"text/x-matlab",".m"},
+{"video/mpeg",".m2t"},
+{"audio/x-mpegurl",".m3u"},
+{"application/vnd.apple.mpegurl",".m3u8"},
+{"text/x-troff-me",".me"},
+{"video/x-matroska",".mkv"},
+{"text/x-ocaml",".ml"},
+{"text/x-troff-mm",".mm"},
+{"text/mathml",".mml"},
+{"text/x-moc",".moc"},
+{"text/x-mof",".mof"},
+{"audio/mpeg",".mp3"},
+{"video/mp4",".mp4"},
+{"text/x-mrml",".mrl"},
+{"image/x-minolta-mrw",".mrw"},
+{"text/x-troff-ms",".ms"},
+{"image/x-msod",".msod"},
+{"text/x-mup",".mup"},
+{"image/x-nikon-nef",".nef"},
+{"text/x-nfo",".nfo"},
+{"text/x-ocl",".ocl"},
+{"text/x-opml+xml",".opml"},
+{"image/openraster",".ora"},
+{"image/x-olympus-orf",".orf"},
+{"text/x-pascal",".p"},
+{"image/x-portable-bitmap",".pbm"},
+{"image/x-photo-cd",".pcd"},
+{"image/x-pcx",".pcx"},
+{"application/pdf",".pdf"},
+{"image/x-pentax-pef",".pef"},
+{"image/x-portable-graymap",".pgm"},
+{"image/x-pict",".pict"},
+{"image/png",".png"},
+{"image/x-portable-anymap",".pnm"},
+{"image/x-macpaint",".pntg"},
+{"text/x-gettext-translation",".po"},
+{"text/x-gettext-translation-template",".pot"},
+{"text/x-python",".py"},
+{"image/x-quicktime",".qif"},
+{"image/x-fuji-raf",".raf"},
+{"image/x-cmu-raster",".ras"},
+{"image/x-panasonic-raw",".raw"},
+{"text/x-ms-regedit",".reg"},
+{"image/x-rgb",".rgb"},
+{"image/rle",".rle"},
+{"text/troff",".roff"},
+{"image/vnd.rn-realpix",".rp"},
+{"text/vnd.rn-realtext",".rt"},
+{"text/richtext",".rtx"},
+{"text/x-scheme",".scm"},
+{"image/x-sgi",".sgi"},
+{"text/sgml",".sgm"},
+{"image/x-skencil",".sk"},
+{"text/spreadsheet",".slk"},
+{"text/x-rpm-spec",".spec"},
+{"text/x-sql",".sql"},
+{"image/x-sony-sr2",".sr2"},
+{"image/x-sony-srf",".srf"},
+{"text/x-subviewer",".sub"},
+{"image/x-sun-raster",".sun"},
+{"image/svg+xml",".svg"},
+{"image/svg+xml-compressed",".svgz"},
+{"text/x-txt2tags",".t2t"},
+{"text/x-tcl",".tcl"},
+{"text/x-texinfo",".texi"},
+{"image/tiff",".tif"},
+{"audio/x-voc",".voc"},
+{"image/x-wmf",".wmf"},
+{"text/vnd.wap.wml",".wml"},
+{"text/vnd.wap.wmlscript",".wmls"},
+{"video/x-ms-wmv",".wmv"},
+{"application/xhtml+xml",".xhtml"},
+{"application/xml",".xml"}
+        };
+
+        public static readonly Dictionary<string, string> dict = new Dictionary<string, string> {
+            {".3g2", "video/3gpp"},
+            {".3ga", "video/3gpp"},
+            {".3gp", "video/3gpp"},
+            {".aac", "audio/mp4"},
+            {".ac3", "audio/ac3"},
+            {".adb", "text/x-adasrc"},
+            {".ads", "text/x-adasrc"},
+            {".ag", "image/x-applix-graphics"},
+            {".amr", "audio/amr"},
+            {".ape", "audio/x-ape"},
+            {".arw", "image/x-sony-arw"},
+            {".asc", "text/plain"},
+            {".asf", "video/x-ms-asf"},
+            {".ass", "text/x-ssa"},
+            {".avi", "video/x-msvideo"},
+            {".bib", "text/x-bibtex"},
+            {".bmp", "image/bmp"},
+            {".c", "text/x-csrc"},
+            {".c++", "text/x-c++src"},
+            {".cc", "text/x-c++src"},
+            {".cgm", "image/cgm"},
+            {".cls", "text/x-tex"},
+            {".cmake", "text/x-cmake"},
+            {".cpp", "text/x-c++src"},
+            {".cr2", "image/x-canon-cr2"},
+            {".crw", "image/x-canon-crw"},
+            {".cs", "text/x-csharp"},
+            {".css", "text/css"},
+            {".cssl", "text/css"},
+            {".csv", "text/csv"},
+            {".cur", "image/x-win-bitmap"},
+            {".cxx", "text/x-c++src"},
+            {".d", "text/x-dsrc"},
+            {".dcl", "text/x-dcl"},
+            {".dcr", "image/x-kodak-dcr"},
+            {".dds", "image/x-dds"},
+            {".diff", "text/x-patch"},
+            {".djv", "image/vnd.djvu"},
+            {".djvu", "image/vnd.djvu"},
+            {".dng", "image/x-adobe-dng"},
+            {".dot", "text/vnd.graphviz"},
+            {".dsl", "text/x-dsl"},
+            {".dtx", "text/x-tex"},
+            {".dwg", "image/vnd.dwg"},
+            {".dxf", "image/vnd.dxf"},
+            {".e", "text/x-eiffel"},
+            {".eif", "text/x-eiffel"},
+            {".el", "text/x-emacs-lisp"},
+            {".emf", "image/x-emf"},
+            {".eps", "image/x-eps"},
+            {".eps.bz2", "image/x-bzeps"},
+            {".eps.gz", "image/x-gzeps"},
+            {".epsf", "image/x-eps"},
+            {".epsf.bz2", "image/x-bzeps"},
+            {".epsf.gz", "image/x-gzeps"},
+            {".epsi", "image/x-eps"},
+            {".epsi.bz2", "image/x-bzeps"},
+            {".epsi.gz", "image/x-gzeps"},
+            {".erl", "text/x-erlang"},
+            {".etx", "text/x-setext"},
+            {".exr", "image/x-exr"},
+            {".f", "text/x-fortran"},
+            {".f90", "text/x-fortran"},
+            {".f95", "text/x-fortran"},
+            {".fig", "image/x-xfig"},
+            {".fits", "image/fits"},
+            {".flv", "video/x-flv"},
+            {".fo", "text/x-xslfo"},
+            {".for", "text/x-fortran"},
+            {".g3", "image/fax-g3"},
+            {".gcrd", "text/directory"},
+            {".gif", "image/gif"},
+            {".gv", "text/vnd.graphviz"},
+            {".gvp", "text/x-google-video-pointer"},
+            {".h", "text/x-chdr"},
+            {".h++", "text/x-c++hdr"},
+            {".hh", "text/x-c++hdr"},
+            {".hp", "text/x-c++hdr"},
+            {".hpp", "text/x-c++hdr"},
+            {".hs", "text/x-haskell"},
+            {".htm", "text/html"},
+            {".html", "text/html"},
+            {".hxx", "text/x-c++hdr"},
+            {".icb", "image/x-tga"},
+            {".icns", "image/x-icns"},
+            {".ico", "image/x-icon"},
+            {".ics", "text/calendar"},
+            {".idl", "text/x-idl"},
+            {".ief", "image/ief"},
+            {".iff", "image/x-iff"},
+            {".ilbm", "image/x-ilbm"},
+            {".ime", "text/x-imelody"},
+            {".imy", "text/x-imelody"},
+            {".ins", "text/x-tex"},
+            {".iptables", "text/x-iptables"},
+            {".j2k", "image/jp2"},
+            {".jad", "text/vnd.sun.j2me.app-descriptor"},
+            {".java", "text/x-java"},
+            {".jng", "image/x-jng"},
+            {".jp2", "image/jp2"},
+            {".jpc", "image/jp2"},
+            {".jpe", "image/jpeg"},
+            {".jpeg", "image/jpeg"},
+            {".jpf", "image/jp2"},
+            {".jpg", "image/jpeg"},
+            {".jpx", "image/jp2"},
+            {".js", "application/javascript"},
+            {".json", "application/json"},
+            {".jsonp", "application/jsonp"},
+            {".k25", "image/x-kodak-k25"},
+            {".kdc", "image/x-kodak-kdc"},
+            {".latex", "text/x-tex"},
+            {".ldif", "text/x-ldif"},
+            {".lhs", "text/x-literate-haskell"},
+            {".log", "text/x-log"},
+            {".ltx", "text/x-tex"},
+            {".lua", "text/x-lua"},
+            {".lwo", "image/x-lwo"},
+            {".lwob", "image/x-lwo"},
+            {".lws", "image/x-lws"},
+            {".ly", "text/x-lilypond"},
+            {".m", "text/x-matlab"},
+            {".m2t", "video/mpeg"},
+            {".m3u", "audio/x-mpegurl"},
+            {".m3u8", "application/vnd.apple.mpegurl"},
+            {".me", "text/x-troff-me"},
+            {".mkv", "video/x-matroska"},
+            {".ml", "text/x-ocaml"},
+            {".mli", "text/x-ocaml"},
+            {".mm", "text/x-troff-mm"},
+            {".mml", "text/mathml"},
+            {".moc", "text/x-moc"},
+            {".mof", "text/x-mof"},
+            {".mp2", "video/mpeg"},
+            {".mp3", "audio/mpeg"},
+            {".mp4", "video/mp4"},
+            {".mpe", "video/mpeg"},
+            {".mpeg", "video/mpeg"},
+            {".mpg", "video/mpeg"},
+            {".mrl", "text/x-mrml"},
+            {".mrml", "text/x-mrml"},
+            {".mrw", "image/x-minolta-mrw"},
+            {".ms", "text/x-troff-ms"},
+            {".msod", "image/x-msod"},
+            {".mup", "text/x-mup"},
+            {".nef", "image/x-nikon-nef"},
+            {".nfo", "text/x-nfo"},
+            {".not", "text/x-mup"},
+            {".ocl", "text/x-ocl"},
+            {".opml", "text/x-opml+xml"},
+            {".ora", "image/openraster"},
+            {".orf", "image/x-olympus-orf"},
+            {".p", "text/x-pascal"},
+            {".pas", "text/x-pascal"},
+            {".patch", "text/x-patch"},
+            {".pbm", "image/x-portable-bitmap"},
+            {".pcd", "image/x-photo-cd"},
+            {".pcx", "image/x-pcx"},
+            {".pdf", "application/pdf"},
+            {".pef", "image/x-pentax-pef"},
+            {".pgm", "image/x-portable-graymap"},
+            {".pict", "image/x-pict"},
+            {".pict1", "image/x-pict"},
+            {".pict2", "image/x-pict"},
+            {".png", "image/png"},
+            {".pnm", "image/x-portable-anymap"},
+            {".pntg", "image/x-macpaint"},
+            {".po", "text/x-gettext-translation"},
+            {".pot", "text/x-gettext-translation-template"},
+            {".py", "text/x-python"},
+            {".qif", "image/x-quicktime"},
+            {".qtif", "image/x-quicktime"},
+            {".raf", "image/x-fuji-raf"},
+            {".ras", "image/x-cmu-raster"},
+            {".raw", "image/x-panasonic-raw"},
+            {".reg", "text/x-ms-regedit"},
+            {".rgb", "image/x-rgb"},
+            {".rle", "image/rle"},
+            {".roff", "text/troff"},
+            {".rp", "image/vnd.rn-realpix"},
+            {".rt", "text/vnd.rn-realtext"},
+            {".rtx", "text/richtext"},
+            {".scm", "text/x-scheme"},
+            {".sgi", "image/x-sgi"},
+            {".sgm", "text/sgml"},
+            {".sgml", "text/sgml"},
+            {".sk", "image/x-skencil"},
+            {".sk1", "image/x-skencil"},
+            {".slk", "text/spreadsheet"},
+            {".spec", "text/x-rpm-spec"},
+            {".sql", "text/x-sql"},
+            {".sr2", "image/x-sony-sr2"},
+            {".srf", "image/x-sony-srf"},
+            {".ssa", "text/x-ssa"},
+            {".sty", "text/x-tex"},
+            {".sub", "text/x-subviewer"},
+            {".sun", "image/x-sun-raster"},
+            {".svg", "image/svg+xml"},
+            {".svgz", "image/svg+xml-compressed"},
+            {".sylk", "text/spreadsheet"},
+            {".t2t", "text/x-txt2tags"},
+            {".tcl", "text/x-tcl"},
+            {".tex", "text/x-tex"},
+            {".texi", "text/x-texinfo"},
+            {".texinfo", "text/x-texinfo"},
+            {".tga", "image/x-tga"},
+            {".tif", "image/tiff"},
+            {".tiff", "image/tiff"},
+            {".tk", "text/x-tcl"},
+            {".tpic", "image/x-tga"},
+            {".tr", "text/troff"},
+            {".txt", "text/plain"},
+            {".vob", "video/mpeg"},
+            {".voc", "audio/x-voc"},
+            {".wmf", "image/x-wmf"},
+            {".wml", "text/vnd.wap.wml"},
+            {".wmls", "text/vnd.wap.wmlscript"},
+            {".wmv", "video/x-ms-wmv"},
+            {".xhtml", "application/xhtml+xml"},
+            {".xml", "application/xml"}
+        };
+    }
+}

+ 73 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/CustomXmlResolver.cs

@@ -0,0 +1,73 @@
+using HTEXLib.Models.Inner;
+using System;
+using System.Collections.Generic;
+using System.IO;
+using System.Net;
+using System.Text;
+using System.Xml;
+
+namespace HTEXLib.COMM.Helpers
+{
+   public class CustomXmlResolver : XmlResolver
+    {
+        public CustomXmlResolver() { }
+
+
+
+        public override object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn)
+        {
+            MemoryStream entityStream = null;
+
+            switch (absoluteUri.Scheme)
+            {
+                case "custom-scheme":
+
+                    string absoluteUriOriginalString = absoluteUri.OriginalString;
+                    string ctgXsltEntityName = absoluteUriOriginalString.Substring(absoluteUriOriginalString.IndexOf(":") + 1);
+                    string entityXslt = "";
+                    // TODO: Replace the following with your own code to load data for referenced entities.
+                    switch (ctgXsltEntityName)
+                    {
+                        case "tokens.xsl":
+                            //entityXslt= System.IO.File.ReadAllText(@"D:\VSProjectCode\TEAMModelHTEX\HTEXMtahML\xslt\tokens.xsl");
+                            entityXslt = Globals.tokens;
+                            break;
+                        case "glayout.xsl":
+                            //entityXslt = System.IO.File.ReadAllText(@"D:\VSProjectCode\TEAMModelHTEX\HTEXMtahML\xslt\glayout.xsl");
+                            entityXslt = Globals.glayout;
+                            break;
+                        case "scripts.xsl":
+                            //entityXslt = System.IO.File.ReadAllText(@"D:\VSProjectCode\TEAMModelHTEX\HTEXMtahML\xslt\scripts.xsl");
+                            entityXslt = Globals.scripts; 
+                            break;
+                        case "tables.xsl":
+                            //entityXslt = System.IO.File.ReadAllText(@"D:\VSProjectCode\TEAMModelHTEX\HTEXMtahML\xslt\tables.xsl");
+                            entityXslt = Globals.tables;
+                            break;
+                        case "entities.xsl":
+                            //entityXslt = System.IO.File.ReadAllText(@"D:\VSProjectCode\TEAMModelHTEX\HTEXMtahML\xslt\entities.xsl");
+                            entityXslt = Globals.entities;
+                            break;
+                        case "cmarkup.xsl":
+                            //entityXslt = System.IO.File.ReadAllText(@"D:\VSProjectCode\TEAMModelHTEX\HTEXMtahML\xslt\cmarkup.xsl");
+                            entityXslt = Globals.cmarkup;
+                            break;
+                    }
+                    UTF8Encoding utf8Encoding = new UTF8Encoding();
+                    byte[] entityBytes = utf8Encoding.GetBytes(entityXslt);
+                    entityStream = new MemoryStream(entityBytes);
+                    break;
+            }
+            return entityStream;
+        }
+
+        public override Uri ResolveUri(Uri baseUri, string relativeUri)
+        {
+            // You might want to resolve all reference URIs using a custom scheme.
+            if (baseUri != null)
+                return base.ResolveUri(baseUri, relativeUri);
+            else
+                return new Uri("custom-scheme:" + relativeUri);
+        }
+    }
+}

+ 85 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/HtmlHelper.cs

@@ -0,0 +1,85 @@
+using HtmlAgilityPack;
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.RegularExpressions;
+
+namespace HTEXLib.COMM.Helpers
+{
+    public class HtmlHelper
+    {
+        public static string DoUselessTag(string str)
+        {
+            if (str.StartsWith("</p>"))
+            {
+                str = str.Substring(4);
+            }
+            if (str.EndsWith("<p>"))
+            {
+                str = str.Substring(0, str.Length - 1 - 2);
+            }
+            if (str.EndsWith("<p >"))
+            {
+                str = str.Substring(0, str.Length - 1 - 3);
+            }
+            if (str.EndsWith("<p  >"))
+            {
+                str = str.Substring(0, str.Length - 1 - 4);
+            }
+            if (str.StartsWith("<p >") && !str.Contains("</p>"))
+            {
+                str = str.Replace("<p >", "");
+            }
+            if (str.StartsWith("<p  >") && !str.Contains("</p>"))
+            {
+                str = str.Replace("<p  >", "");
+            }
+            if (str.StartsWith("<p>") && !str.Contains("</p>"))
+            {
+                str = str.Replace("<p>", "");
+            }
+            if (str.EndsWith("</p>") && !str.Contains("<p>") && !str.Contains("<p >") && !str.Contains("<p  >"))
+            {
+                str = str.Replace("</p>", "");
+            }
+            str = Regex.Replace(str, "<p([^>]{0,})>\\s*</p>", "");
+            return str;
+        }
+
+        /// <summary>
+        /// 从html获取文本及img的url  去掉其他标签的干扰,空格。以获取更准确的sha1校验值
+        /// </summary>
+        /// <param name="html"></param>
+        /// <returns></returns>
+        public static string DoTextImg(string html)
+        {
+            HtmlDocument doc = new HtmlDocument();
+            doc.LoadHtml(html);
+            List<string> urls = GetHtmlImageUrlList(html);
+            StringBuilder builder = new StringBuilder(doc.DocumentNode.InnerText.Replace("&nbsp;", ""));
+            if (urls.IsNotEmpty())
+            {
+                foreach (string url in urls)
+                {
+                    builder.Append(url);
+                }
+            }
+            return builder.ToString();
+        }
+
+        public static List<string> GetHtmlImageUrlList(string sHtmlText)
+        {
+            // 定义正则表达式用来匹配 img 标签   
+            Regex regImg = new Regex(@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<imgUrl>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>", RegexOptions.IgnoreCase);
+
+            // 搜索匹配的字符串   
+            MatchCollection matches = regImg.Matches(sHtmlText);
+            //string[] sUrlList = new string[matches.Count];
+            List<string> urls = new List<string>();
+            // 取得匹配项列表   
+            foreach (Match match in matches)
+                urls.Add(match.Groups["imgUrl"].Value);
+            return urls;
+        }
+    }
+}

+ 230 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/StringHelper.cs

@@ -0,0 +1,230 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Text.Json;
+
+namespace HTEXLib.COMM.Helpers
+{
+    public class StringHelper
+    {
+        #region 截取字符串
+        public static string GetSubString(string pSrcString, int pLength, string pTailString)
+        {
+            return GetSubString(pSrcString, 0, pLength, pTailString);
+        }
+        public static string GetSubString(string pSrcString, int pStartIndex, int pLength, string pTailString)
+        {
+            string str = pSrcString;
+            byte[] bytes = Encoding.UTF8.GetBytes(pSrcString);
+            foreach (char ch in Encoding.UTF8.GetChars(bytes))
+            {
+                if (((ch > 'ࠀ') && (ch < '一')) || ((ch > 0xac00) && (ch < 0xd7a3)))
+                {
+                    if (pStartIndex >= pSrcString.Length)
+                    {
+                        return "";
+                    }
+                    return pSrcString.Substring(pStartIndex, ((pLength + pStartIndex) > pSrcString.Length) ? (pSrcString.Length - pStartIndex) : pLength);
+                }
+            }
+            if (pLength < 0)
+            {
+                return str;
+            }
+            byte[] sourceArray = Encoding.Default.GetBytes(pSrcString);
+            if (sourceArray.Length <= pStartIndex)
+            {
+                return str;
+            }
+            int length = sourceArray.Length;
+            if (sourceArray.Length > (pStartIndex + pLength))
+            {
+                length = pLength + pStartIndex;
+            }
+            else
+            {
+                pLength = sourceArray.Length - pStartIndex;
+                pTailString = "";
+            }
+            int num2 = pLength;
+            int[] numArray = new int[pLength];
+            byte[] destinationArray = null;
+            int num3 = 0;
+            for (int i = pStartIndex; i < length; i++)
+            {
+                if (sourceArray[i] > 0x7f)
+                {
+                    num3++;
+                    if (num3 == 3)
+                    {
+                        num3 = 1;
+                    }
+                }
+                else
+                {
+                    num3 = 0;
+                }
+                numArray[i] = num3;
+            }
+            if ((sourceArray[length - 1] > 0x7f) && (numArray[pLength - 1] == 1))
+            {
+                num2 = pLength + 1;
+            }
+            destinationArray = new byte[num2];
+            Array.Copy(sourceArray, pStartIndex, destinationArray, 0, num2);
+            return (Encoding.Default.GetString(destinationArray) + pTailString);
+        }
+        #endregion
+
+        /// <summary>
+        /// 将字符串转换为int类型数组
+        /// </summary>
+        /// <param name="str">如1,2,3,4,5</param>
+        /// <returns></returns>
+        public static List<string> StrToListString(string str)
+        {
+            var list = new List<string>();
+            if (!str.Contains(","))
+            {
+                list.Add(str);
+                return list;
+            }
+            var slist = str.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries);
+            foreach (var item in slist)
+            {
+                list.Add(item);
+            }
+            return list;
+        }
+
+        /// <summary>
+        /// 截取两个字符串中间的字符串
+        /// </summary>
+        /// <param name="sourse"></param>
+        /// <param name="startstr"></param>
+        /// <param name="endstr"></param>
+        /// <returns></returns>
+        public static string SubMidString(string sourse, string startstr, string endstr)
+        {
+            string result = string.Empty;
+            int startindex, endindex;
+            startindex = sourse.IndexOf(startstr);
+            if (startindex == -1)
+                return result;
+            string tmpstr = sourse.Substring(startindex + startstr.Length);
+            endindex = tmpstr.IndexOf(endstr);
+            if (endindex == -1)
+                return result;
+            result = tmpstr.Remove(endindex);
+            return result;
+        }
+        public static double[] ListTodouble(List<double> list)
+        {
+            Double[] doubles = new Double[list.Count];
+            int k = 0;
+            foreach (double p in list)
+            {
+                doubles[k] = p;
+                k++;
+            }
+            //doubles = list;
+            if (doubles == null)
+            {
+                return null;
+            }
+            double[] result = new double[doubles.Length];
+            for (int i = 0; i < doubles.Length; i++)
+            {
+                result[i] = doubles[i];
+            }
+            return result;
+        }
+        public static double[,] ListToDouble(List<List<double>> list)
+        {
+            int itemCount = 0;
+            //int stuCount = list.Count;
+            foreach (List<double> p in list)
+            {
+                if (p.Count != 0)
+                {
+                    itemCount = p.Count;
+                    break;
+                }
+
+            }
+            for (int k = 0; k < list.Count; k++)
+            {
+                if (list[k].Count == 0)
+                {
+                    list.Remove(list[k]);
+                }
+            }
+            double[,] doubles = new double[list.Count, itemCount];
+            for (int i = 0; i < list.Count; i++)
+            {
+                for (int j = 0; j < itemCount; j++)
+                {
+                    doubles[i, j] = list[i][j];
+                }
+            }
+            return doubles;
+        }
+
+        public static int getKeyCount(JsonElement element)
+        {
+            int keys = 0;
+            var emobj = element.EnumerateObject();
+            while (emobj.MoveNext())
+            {
+                keys++;
+            }
+            return keys;
+        }
+        public static string getEduName(string key)
+        {
+            string name = "";
+            switch (key)
+            {
+                case "0":
+                    name = "知识";
+                    break;
+                case "1":
+                    name = "理解";
+                    break;
+                case "2":
+                    name = "应用";
+                    break;
+                case "3":
+                    name = "分析";
+                    break;
+                case "4":
+                    name = "综合";
+                    break;
+                case "5":
+                    name = "评鉴";
+                    break;
+            }
+            return name;
+        }
+        public static string getTypeName(string key)
+        {
+            string name = "";
+            switch (key)
+            {
+                case "0":
+                    name = "Single";
+                    break;
+                case "1":
+                    name = "Multiple";
+                    break;
+                case "2":
+                    name = "Judge";
+                    break;
+                case "3":
+                    name = "Complete";
+                    break;
+            }
+            return name;
+        }
+    }
+}

+ 17 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/BrushDIBColorsEnum.cs

@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// DIB-Colors enum.
+    /// </summary>
+    public enum BrushDIBColorsEnum
+    {
+        DIB_PAL_COLORS = 1,
+        DIB_RGB_COLORS = 0,
+    }
+}

+ 24 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/BrushEnum.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Brush enum.
+    /// </summary>
+    public enum BrushBSEnum
+    {
+        BS_DIBPATTERN = 5,
+        BS_DIBPATTERN8X8 = 8,
+        BS_DIBPATTERNPT = 6,
+        BS_HATCHED = 2,
+        BS_HOLLOW = 1,
+        BS_NULL = 1,
+        BS_PATTERN = 3,
+        BS_PATTERN8X8 = 7,
+        BS_SOLID = 0,
+    }
+}

+ 21 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/BrushHSEnum.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// HS Brush enum
+    /// </summary>
+    public enum BrushHSEnum
+    {
+        HS_HORIZONTAL = 0,
+        HS_VERTICAL = 1,
+        HS_FDIAGONAL = 2,
+        HS_BDIAGONAL = 3,
+        HS_CROSS = 4,
+        HS_DIAGCROSS = 5,
+    }
+}

+ 34 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/FontCharsetEnum.cs

@@ -0,0 +1,34 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Charset Enum
+    /// </summary>
+    public enum FontCharsetEnum
+    {
+        ANSI_CHARSET = 0,
+        DEFAULT_CHARSET = 1,
+        SYMBOL_CHARSET = 2,
+        MAC_CHARSET = 77,
+        SHIFTJIS_CHARSET = 128,
+        HANGUL_CHARSET = 129,
+        JOHAB_CHARSET = 130,
+        GB2312_CHARSET = 134,
+        CHINESEBIG5_CHARSET = 136,
+        GREEK_CHARSET = 161,
+        TURKISH_CHARSET = 162,
+        VIETNAMESE_CHARSET = 163,
+        ARABIC_CHARSET = 178,
+        HEBREW_CHARSET = 177,
+        BALTIC_CHARSET = 186,
+        RUSSIAN_CHARSET = 204,
+        THAI_CHARSET = 222,
+        EASTEUROPE_CHARSET = 238,
+        OEM_CHARSET = 255,
+    }
+}

+ 22 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/FontClipPrecisEnum.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Clip Precis Enum
+    /// </summary>
+    public enum FontClipPrecisEnum
+    {
+        CLIP_DEFAULT_PRECIS = 0,
+        CLIP_CHARACTER_PRECIS = 1,
+        CLIP_STROKE_PRECIS = 2,
+        CLIP_MASK = 15,
+        CLIP_LH_ANGLES = 16,
+        CLIP_TT_ALWAYS = 32,
+        CLIP_EMBEDDED = 128,
+    }
+}

+ 21 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/FontFFEnum.cs

@@ -0,0 +1,21 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Font Family Enum.
+    /// </summary>
+    public enum FontFFEnum
+    {
+        FF_DONTCARE = 0,
+        FF_ROMAN = 16,
+        FF_SWISS = 32,
+        FF_MODERN = 48,
+        FF_SCRIPT = 64,
+        FF_DECORATIVE = 80,
+    }
+}

+ 30 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/FontFWEnum.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Font Weight Enum.
+    /// </summary>
+    public enum FontFWEnum
+    {
+        FW_DONTCARE = 0,
+        FW_THIN = 100,
+        FW_EXTRALIGHT = 200,
+        FW_ULTRALIGHT = 200,
+        FW_LIGHT = 300,
+        FW_NORMAL = 400,
+        FW_REGULAR = 400,
+        FW_MEDIUM = 500,
+        FW_SEMIBOLD = 600,
+        FW_DEMIBOLD = 600,
+        FW_BOLD = 700,
+        FW_EXTRABOLD = 800,
+        FW_ULTRABOLD = 800,
+        FW_HEAVY = 900,
+        FW_BLACK = 900,
+    }
+}

+ 25 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/FontOutPrecisEnum.cs

@@ -0,0 +1,25 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Out Preciss Enum
+    /// </summary>
+    public enum FontOutPrecisEnum
+    {
+        OUT_DEFAULT_PRECIS = 0,
+        OUT_STRING_PRECIS = 1,
+        OUT_CHARACTER_PRECIS = 2,
+        OUT_STROKE_PRECIS = 3,
+        OUT_TT_PRECIS = 4,
+        OUT_DEVICE_PRECIS = 5,
+        OUT_RASTER_PRECIS = 6,
+        OUT_TT_ONLY_PRECIS = 7,
+        OUT_OUTLINE_PRECIS = 8,
+        OUT_SCREEN_OUTLINE_PRECIS = 9,
+    }
+}

+ 18 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/FontPitchEnum.cs

@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Pitch Enum.
+    /// </summary>
+    public enum FontPitchEnum
+    {
+        DEFAULT_PITCH = 0,
+        FIXED_PITCH = 1,
+        VARIABLE_PITCH = 2,
+    }
+}

+ 22 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/FontQualityEnum.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Quality Enum.
+    /// </summary>
+    public enum FontQualityEnum
+    {
+        DEFAULT_QUALITY = 0,
+        DRAFT_QUALITY = 1,
+        PROOF_QUALITY = 2,
+        NONANTIALIASED_QUALITY = 3,
+        ANTIALIASED_QUALITY = 4,
+        CLEARTYPE_QUALITY = 5, // Windows XP only
+    }
+
+}

+ 103 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/GdiEnum.cs

@@ -0,0 +1,103 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Graphics Device Interface Enum
+    /// </summary>
+    public enum GdiEnum
+    {
+        OPAQUE = 2,
+        TRANSPARENT = 1,
+
+        TA_BASELINE = 24,
+        TA_BOTTOM = 8,
+        TA_TOP = 0,
+        TA_CENTER = 6,
+        TA_LEFT = 0,
+        TA_RIGHT = 2,
+        TA_NOUPDATECP = 0,
+        TA_RTLREADING = 256,
+        TA_UPDATECP = 1,
+        VTA_BASELINE = 24,
+        VTA_CENTER = 6,
+
+        ETO_CLIPPED = 4,
+        ETO_NUMERICSLOCAL = 1024,
+        ETO_NUMERICSLATIN = 2048,
+        ETO_GLYPH_INDEX = 16,
+        ETO_OPAQUE = 2,
+        ETO_PDY = 8192,
+        ETO_RTLREADING = 128,
+        ETO_IGNORELANGUAGE = 4096,
+
+        MM_ANISOTROPIC = 8,
+        MM_HIENGLISH = 5,
+        MM_HIMETRIC = 3,
+        MM_ISOTROPIC = 7,
+        MM_LOENGLISH = 4,
+        MM_LOMETRIC = 2,
+        MM_TEXT = 1,
+        MM_TWIPS = 6,
+
+        STRETCH_ANDSCANS = 2,
+        STRETCH_DELETESCANS = 3,
+        STRETCH_HALFTONE = 4,
+        STRETCH_ORSCANS = 2,
+        BLACKONWHITE = 2,
+        COLORONCOLOR = 3,
+        HALFTONE = 4,
+        WHITEONBLACK = 2,
+
+        ALTERNATE = 1,
+        WINDING = 2,
+
+        R2_BLACK = 1,
+        R2_COPYPEN = 13,
+        R2_MASKNOTPEN = 3,
+        R2_MASKPEN = 9,
+        R2_MASKPENNOT = 5,
+        R2_MERGENOTPEN = 12,
+        R2_MERGEPEN = 15,
+        R2_MERGEPENNOT = 14,
+        R2_NOP = 11,
+        R2_NOT = 6,
+        R2_NOTCOPYPEN = 4,
+        R2_NOTMASKPEN = 8,
+        R2_NOTMERGEPEN = 2,
+        R2_NOTXORPEN = 10,
+        R2_WHITE = 16,
+        R2_XORPEN = 7,
+
+        BLACKNESS = 66,
+        DSTINVERT = 5570569,
+        MERGECOPY = 12583114,
+        MERGEPAINT = 12255782,
+        NOTSRCCOPY = 3342344,
+        NOTSRCERASE = 1114278,
+        PATCOPY = 15728673,
+        PATINVERT = 5898313,
+        PATPAINT = 16452105,
+        SRCAND = 8913094,
+        SRCCOPY = 13369376,
+        SRCERASE = 4457256,
+        SRCINVERT = 6684742,
+        SRCPAINT = 15597702,
+        WHITENESS = 16711778,
+
+        DIB_RGB_COLORS = 0,
+        DIB_PAL_COLORS = 1,
+
+        LAYOUT_BITMAPORIENTATIONPRESERVED = 8,
+        LAYOUT_RTL = 1,
+
+        ABSOLUTE = 1,
+        RELATIVE = 2,
+
+        ASPECT_FILTERING = 1,
+    }
+}

+ 187 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/GdiUtils.cs

@@ -0,0 +1,187 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Utils functions.
+    /// </summary>
+    public class GdiUtils
+    {
+        #region Local Variables
+
+        private static int[,] FBA_SHIFT_JIS = new int[,] { { 0x81, 0x9F }, { 0xE0, 0xFC } };
+        private static int[,] FBA_HANGUL_CHARSET = new int[,] { { 0x80, 0xFF } };
+        private static int[,] FBA_JOHAB_CHARSET = new int[,] { { 0x80, 0xFF } };
+        private static int[,] FBA_GB2312_CHARSET = new int[,] { { 0x80, 0xFF } };
+        private static int[,] FBA_CHINESEBIG5_CHARSET = new int[,] { { 0xA1, 0xFE } };
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// Convert byte array to string using specified charset.
+        /// </summary>
+        /// <param name="chars"></param>
+        /// <param name="charset"></param>
+        /// <returns></returns>
+        public static string ConvertString(byte[] chars, int charset)
+        {
+            string str = null;
+
+            int length = 0;
+            while (length < chars.Count() && chars[length] != 0)
+            {
+                length++;
+            }
+
+            try
+            {
+                str = System.Text.Encoding.GetEncoding(GetCharset(charset)).GetString(chars).Substring(0, length);
+            }
+            catch (Exception ex)
+            {
+                try
+                {
+                    str = System.Text.Encoding.GetEncoding("US-ASCII").GetString(chars).Substring(0, length);
+                }
+                catch (Exception ex2)
+                {
+                    throw new Exception(ex.Message+ex2.Message);
+                }
+            }
+            return str;
+        }
+
+        /// <summary>
+        /// Get specified charset.
+        /// </summary>
+        /// <param name="charset"></param>
+        /// <returns></returns>
+        public static string GetCharset(int charset)
+        {
+            switch (charset)
+            {
+                case (int)FontCharsetEnum.ANSI_CHARSET:
+                    return "Cp1252";
+                case (int)FontCharsetEnum.SYMBOL_CHARSET:
+                    return "Cp1252";
+                case (int)FontCharsetEnum.MAC_CHARSET:
+                    return "MacRoman";
+                case (int)FontCharsetEnum.SHIFTJIS_CHARSET:
+                    return "MS932";
+                case (int)FontCharsetEnum.HANGUL_CHARSET:
+                    return "MS949";
+                case (int)FontCharsetEnum.JOHAB_CHARSET:
+                    return "Johab";
+                case (int)FontCharsetEnum.GB2312_CHARSET:
+                    return "MS936";
+                case (int)FontCharsetEnum.CHINESEBIG5_CHARSET:
+                    return "MS950";
+                case (int)FontCharsetEnum.GREEK_CHARSET:
+                    return "Cp1253";
+                case (int)FontCharsetEnum.TURKISH_CHARSET:
+                    return "Cp1254";
+                case (int)FontCharsetEnum.VIETNAMESE_CHARSET:
+                    return "Cp1258";
+                case (int)FontCharsetEnum.HEBREW_CHARSET:
+                    return "Cp1255";
+                case (int)FontCharsetEnum.ARABIC_CHARSET:
+                    return "Cp1256";
+                case (int)FontCharsetEnum.BALTIC_CHARSET:
+                    return "Cp1257";
+                case (int)FontCharsetEnum.RUSSIAN_CHARSET:
+                    return "Cp1251";
+                case (int)FontCharsetEnum.THAI_CHARSET:
+                    return "MS874";
+                case (int)FontCharsetEnum.EASTEUROPE_CHARSET:
+                    return "Cp1250";
+                case (int)FontCharsetEnum.OEM_CHARSET:
+                    return "Cp1252";
+                default:
+                    return "Cp1252";
+            }
+        }
+
+        /// <summary>
+        /// Get language using specified charset.
+        /// </summary>
+        /// <param name="charset"></param>
+        /// <returns></returns>
+        public static string GetLanguage(int charset)
+        {
+            switch (charset)
+            {
+                case (int)FontCharsetEnum.ANSI_CHARSET:
+                    return "en";
+                case (int)FontCharsetEnum.SYMBOL_CHARSET:
+                    return "en";
+                case (int)FontCharsetEnum.MAC_CHARSET:
+                    return "en";
+                case (int)FontCharsetEnum.SHIFTJIS_CHARSET:
+                    return "ja";
+                case (int)FontCharsetEnum.HANGUL_CHARSET:
+                    return "ko";
+                case (int)FontCharsetEnum.JOHAB_CHARSET:
+                    return "ko";
+                case (int)FontCharsetEnum.GB2312_CHARSET:
+                    return "zh-CN";
+                case (int)FontCharsetEnum.CHINESEBIG5_CHARSET:
+                    return "zh-TW";
+                case (int)FontCharsetEnum.GREEK_CHARSET:
+                    return "el";
+                case (int)FontCharsetEnum.TURKISH_CHARSET:
+                    return "tr";
+                case (int)FontCharsetEnum.VIETNAMESE_CHARSET:
+                    return "vi";
+                case (int)FontCharsetEnum.HEBREW_CHARSET:
+                    return "iw";
+                case (int)FontCharsetEnum.ARABIC_CHARSET:
+                    return "ar";
+                case (int)FontCharsetEnum.BALTIC_CHARSET:
+                    return "bat";
+                case (int)FontCharsetEnum.RUSSIAN_CHARSET:
+                    return "ru";
+                case (int)FontCharsetEnum.THAI_CHARSET:
+                    return "th";
+                case (int)FontCharsetEnum.EASTEUROPE_CHARSET:
+                    return null;
+                case (int)FontCharsetEnum.OEM_CHARSET:
+                    return null;
+                default:
+                    return null;
+            }
+        }
+
+
+        /// <summary>
+        /// Get the first byte area specified charset.
+        /// </summary>
+        /// <param name="charset"></param>
+        /// <returns></returns>
+        public static int[,] GetFirstByteArea(int charset)
+        {
+            switch (charset)
+            {
+                case (int)FontCharsetEnum.SHIFTJIS_CHARSET:
+                    return FBA_SHIFT_JIS;
+                case (int)FontCharsetEnum.HANGUL_CHARSET:
+                    return FBA_HANGUL_CHARSET;
+                case (int)FontCharsetEnum.JOHAB_CHARSET:
+                    return FBA_JOHAB_CHARSET;
+                case (int)FontCharsetEnum.GB2312_CHARSET:
+                    return FBA_GB2312_CHARSET;
+                case (int)FontCharsetEnum.CHINESEBIG5_CHARSET:
+                    return FBA_CHINESEBIG5_CHARSET;
+                default:
+                    return null;
+            }
+        }
+
+        #endregion
+    }
+}

+ 657 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdi.cs

@@ -0,0 +1,657 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Graphics Device Interface - Represents graphics elements
+    /// </summary>
+    public interface IGdi
+    {
+        /// <summary>
+        /// Create header document.
+        /// </summary>
+        /// <param name="vsx"></param>
+        /// <param name="vsy"></param>
+        /// <param name="vex"></param>
+        /// <param name="vey"></param>
+        /// <param name="dpi"></param>
+        void PlaceableHeader(int vsx, int vsy, int vex, int vey, int dpi);
+
+        /// <summary>
+        /// Initialize Header document.
+        /// </summary>
+        void Header();
+
+        /// <summary>
+        /// Element is put inside a shape element and defines how an attribute of an element changes over the animation. 
+        /// The attribute will change from the initial value to the end value in the duration specified.
+        /// </summary>
+        /// <param name="palette"></param>
+        /// <param name="startIndex"></param>
+        /// <param name="entries"></param>
+        void AnimatePalette(IGdiPalette palette, int startIndex, int[] entries);
+
+        /// <summary>
+        /// Draws an elliptical arc.
+        /// </summary>
+        /// <param name="sxr"></param>
+        /// <param name="syr"></param>
+        /// <param name="exr"></param>
+        /// <param name="eyr"></param>
+        /// <param name="sxa"></param>
+        /// <param name="sya"></param>
+        /// <param name="exa"></param>
+        /// <param name="eya"></param>
+        void Arc(int sxr, int syr, int exr, int eyr,
+               int sxa, int sya, int exa, int eya);
+
+        /// <summary>
+        /// Execute a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context.
+        /// </summary>
+        /// <param name="image"></param>
+        /// <param name="dx"></param>
+        /// <param name="dy"></param>
+        /// <param name="dw"></param>
+        /// <param name="dh"></param>
+        /// <param name="sx"></param>
+        /// <param name="sy"></param>
+        /// <param name="rop"></param>
+        void BitBlt(byte[] image, int dx, int dy, int dw, int dh, int sx, int sy, long rop);
+
+        /// <summary>
+        /// Draws a chord (a region bounded by the intersection of an ellipse and a line segment, called a secant).
+        /// The chord is outlined by using the current pen and filled by using the current brush.
+        /// </summary>
+        /// <param name="sxr"></param>
+        /// <param name="syr"></param>
+        /// <param name="exr"></param>
+        /// <param name="eyr"></param>
+        /// <param name="sxa"></param>
+        /// <param name="sya"></param>
+        /// <param name="exa"></param>
+        /// <param name="eya"></param>
+        void Chord(int sxr, int syr, int exr, int eyr,
+                 int sxa, int sya, int exa, int eya);
+
+        /// <summary>
+        /// Creates a logical brush that has the specified style, color, and pattern.
+        /// </summary>
+        /// <param name="style"></param>
+        /// <param name="color"></param>
+        /// <param name="hatch"></param>
+        /// <returns></returns>
+        IGdiBrush CreateBrushIndirect(int style, int color, int hatch);
+
+        /// <summary>
+        /// Creates a logical font that has the specified characteristics. 
+        /// The font can subsequently be selected as the current font for any device context.
+        /// </summary>
+        /// <param name="height"></param>
+        /// <param name="width"></param>
+        /// <param name="escapement"></param>
+        /// <param name="orientation"></param>
+        /// <param name="weight"></param>
+        /// <param name="italic"></param>
+        /// <param name="underline"></param>
+        /// <param name="strikeout"></param>
+        /// <param name="charset"></param>
+        /// <param name="outPrecision"></param>
+        /// <param name="clipPrecision"></param>
+        /// <param name="quality"></param>
+        /// <param name="pitchAndFamily"></param>
+        /// <param name="faceName"></param>
+        /// <returns></returns>
+        IGdiFont CreateFontIndirect(int height, int width, int escapement,
+                         int orientation, int weight,
+                         bool italic, bool underline, bool strikeout,
+                         int charset, int outPrecision, int clipPrecision,
+                         int quality, int pitchAndFamily, byte[] faceName);
+
+        /// <summary>
+        /// Creates a logical palette.
+        /// </summary>
+        /// <param name="version"></param>
+        /// <param name="palEntry"></param>
+        /// <returns></returns>
+        IGdiPalette CreatePalette(int version, int[] palEntry);
+
+        /// <summary>
+        /// Creates a logical brush with the specified bitmap pattern.
+        /// The bitmap can be a DIB section bitmap, which is created by the CreateDIBSection function, or it can be a device-dependent bitmap.
+        /// </summary>
+        /// <param name="image"></param>
+        /// <returns></returns>
+        IGdiPatternBrush CreatePatternBrush(byte[] image);
+
+        /// <summary>
+        /// Creates a logical cosmetic pen that has the style, width, and color specified in a structure.
+        /// </summary>
+        /// <param name="style"></param>
+        /// <param name="width"></param>
+        /// <param name="color"></param>
+        /// <returns></returns>
+        IGdiPen CreatePenIndirect(int style, int width, int color);
+
+        /// <summary>
+        /// Creates a rectangular region.
+        /// </summary>
+        /// <param name="left"></param>
+        /// <param name="top"></param>
+        /// <param name="right"></param>
+        /// <param name="bottom"></param>
+        /// <returns></returns>
+        IGdiRegion CreateRectRgn(int left, int top, int right, int bottom);
+
+        /// <summary>
+        /// Deletes a logical pen, brush, font, bitmap, region, or palette, freeing all system resources associated with the object. 
+        /// After the object is deleted, the specified handle is no longer valid.
+        /// </summary>
+        /// <param name="obj"></param>
+        void DeleteObject(IGdiObject obj);
+
+        /// <summary>
+        /// Function performs a bit-block transfer of the color data corresponding to a rectangle of pixels from the specified source device context into a destination device context.
+        /// </summary>
+        /// <param name="image"></param>
+        /// <param name="dx"></param>
+        /// <param name="dy"></param>
+        /// <param name="dw"></param>
+        /// <param name="dh"></param>
+        /// <param name="sx"></param>
+        /// <param name="sy"></param>
+        /// <param name="rop"></param>
+        void DibBitBlt(byte[] image, int dx, int dy, int dw, int dh,
+               int sx, int sy, long rop);
+
+        /// <summary>
+        /// Create Dib Pattern Brush object instance.
+        /// </summary>
+        /// <param name="image"></param>
+        /// <param name="usage"></param>
+        /// <returns></returns>
+        IGdiPatternBrush DibCreatePatternBrush(byte[] image, int usage);
+
+        /// <summary>
+        /// Copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary. 
+        /// The system stretches or compresses the bitmap according to the stretching mode currently set in the destination device context.
+        /// </summary>
+        /// <param name="image"></param>
+        /// <param name="dx"></param>
+        /// <param name="dy"></param>
+        /// <param name="dw"></param>
+        /// <param name="dh"></param>
+        /// <param name="sx"></param>
+        /// <param name="sy"></param>
+        /// <param name="sw"></param>
+        /// <param name="sh"></param>
+        /// <param name="rop"></param>
+        void DibStretchBlt(byte[] image, int dx, int dy, int dw, int dh,
+               int sx, int sy, int sw, int sh, long rop);
+
+        /// <summary>
+        /// Draws an ellipse. 
+        /// The center of the ellipse is the center of the specified bounding rectangle.
+        /// The ellipse is outlined by using the current pen and is filled by using the current brush.
+        /// </summary>
+        /// <param name="sx"></param>
+        /// <param name="sy"></param>
+        /// <param name="ex"></param>
+        /// <param name="ey"></param>
+        void Ellipse(int sx, int sy, int ex, int ey);
+
+        /// <summary>
+        /// Enables an application to access the system-defined device capabilities that are not available through GDI. 
+        /// Escape calls made by an application are translated and sent to the driver.
+        /// </summary>
+        /// <param name="data"></param>
+        void Escape(byte[] data);
+
+        /// <summary>
+        ///  Creates a new clipping region that consists of the existing clipping region minus the specified rectangle.
+        /// </summary>
+        /// <param name="left"></param>
+        /// <param name="top"></param>
+        /// <param name="right"></param>
+        /// <param name="bottom"></param>
+        /// <returns></returns>
+        int ExcludeClipRect(int left, int top, int right, int bottom);
+
+        /// <summary>
+        /// Fills an area of the display surface with the current brush.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="color"></param>
+        /// <param name="type"></param>
+        void ExtFloodFill(int x, int y, int color, int type);
+
+        /// <summary>
+        /// Draws text using the currently selected font, background color, and text color. 
+        /// You can optionally provide dimensions to be used for clipping, opaquing, or both.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="options"></param>
+        /// <param name="rect"></param>
+        /// <param name="text"></param>
+        /// <param name="lpdx"></param>
+        void ExtTextOut(int x, int y, int options, int[] rect, byte[] text, int[] lpdx);
+
+        /// <summary>
+        /// Fills a region by using the specified brush.
+        /// </summary>
+        /// <param name="rgn"></param>
+        /// <param name="brush"></param>
+        void FillRgn(IGdiRegion rgn, IGdiBrush brush);
+
+        /// <summary>
+        /// Fills an area of the display surface with the current brush. 
+        /// The area is assumed to be bounded as specified by the crFill parameter.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="color"></param>
+        void FloodFill(int x, int y, int color);
+
+        /// <summary>
+        /// Draws a border around the specified region by using the specified brush.
+        /// </summary>
+        /// <param name="rgn"></param>
+        /// <param name="brush"></param>
+        /// <param name="w"></param>
+        /// <param name="h"></param>
+        void FrameRgn(IGdiRegion rgn, IGdiBrush brush, int w, int h);
+
+        /// <summary>
+        /// Creates a new clipping region from the intersection of the current clipping region and the specified rectangle.
+        /// </summary>
+        /// <param name="left"></param>
+        /// <param name="top"></param>
+        /// <param name="right"></param>
+        /// <param name="bottom"></param>
+        void IntersectClipRect(int left, int top, int right, int bottom);
+
+        /// <summary>
+        /// Inverts the colors in the specified region.
+        /// </summary>
+        /// <param name="rgn"></param>
+        void InvertRgn(IGdiRegion rgn);
+
+        /// <summary>
+        /// Draws a line from the current position up to, but not including, the specified point.
+        /// </summary>
+        /// <param name="ex"></param>
+        /// <param name="ey"></param>
+        void LineTo(int ex, int ey);
+
+        /// <summary>
+        /// Updates the current position to the specified point and optionally returns the previous position.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="old"></param>
+        void MoveToEx(int x, int y, Point old);
+
+        /// <summary>
+        /// Moves the clipping region of a device context by the specified offsets.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        void OffsetClipRgn(int x, int y);
+
+        /// <summary>
+        /// Modifies the viewport origin for a device context using the specified horizontal and vertical offsets.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="point"></param>
+        void OffsetViewportOrgEx(int x, int y, Point point);
+
+        /// <summary>
+        /// Modifies the window origin for a device context using the specified horizontal and vertical offsets.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="point"></param>
+        void OffsetWindowOrgEx(int x, int y, Point point);
+
+        /// <summary>
+        /// Paints the specified region by using the brush currently selected into the device context.
+        /// </summary>
+        /// <param name="rgn"></param>
+        void PaintRgn(IGdiRegion rgn);
+
+        /// <summary>
+        /// Paints the specified rectangle using the brush that is currently selected into the specified device context.
+        /// The brush color and the surface color or colors are combined by using the specified raster operation.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="width"></param>
+        /// <param name="height"></param>
+        /// <param name="rop"></param>
+        void PatBlt(int x, int y, int width, int height, long rop);
+
+        /// <summary>
+        /// Draws a pie-shaped wedge bounded by the intersection of an ellipse and two radials. 
+        /// The pie is outlined by using the current pen and filled by using the current brush.
+        /// </summary>
+        /// <param name="sx"></param>
+        /// <param name="sy"></param>
+        /// <param name="ex"></param>
+        /// <param name="ey"></param>
+        /// <param name="sxr"></param>
+        /// <param name="syr"></param>
+        /// <param name="exr"></param>
+        /// <param name="eyr"></param>
+        void Pie(int sx, int sy, int ex, int ey, int sxr, int syr, int exr, int eyr);
+
+        /// <summary>
+        /// Draws a polygon consisting of two or more vertices connected by straight lines. 
+        /// The polygon is outlined by using the current pen and filled by using the current brush and polygon fill mode.
+        /// </summary>
+        /// <param name="points"></param>
+        void Polygon(Point[] points);
+
+        /// <summary>
+        /// Element is an SVG basic shape that creates straight lines connecting several points. 
+        /// Typically a polyline is used to create open shapes as the last point doesn't have to be connected to the first point. 
+        /// </summary>
+        /// <param name="points"></param>
+        void Polyline(Point[] points);
+
+        /// <summary>
+        ///  Draws a series of closed polygons. 
+        ///  Each polygon is outlined by using the current pen and filled by using the current brush and polygon fill mode. 
+        ///  The polygons drawn by this function can overlap.
+        /// </summary>
+        /// <param name="points"></param>
+        void PolyPolygon(Point[][] points);
+
+        /// <summary>
+        /// Maps palette entries from the current logical palette to the system palette.
+        /// </summary>
+        void RealizePalette();
+
+        /// <summary>
+        /// Restores a device context (DC) to the specified state. 
+        /// The DC is restored by popping state information off a stack created by earlier calls to the SaveDC function.
+        /// </summary>
+        /// <param name="savedDC"></param>
+        void RestoreDC(int savedDC);
+
+        /// <summary>
+        /// Draws a rectangle. 
+        /// The rectangle is outlined by using the current pen and filled by using the current brush.
+        /// </summary>
+        /// <param name="sx"></param>
+        /// <param name="sy"></param>
+        /// <param name="ex"></param>
+        /// <param name="ey"></param>
+        void Rectangle(int sx, int sy, int ex, int ey);
+
+        /// <summary>
+        /// Increases or decreases the size of a logical palette based on the specified value.
+        /// </summary>
+        /// <param name="palette"></param>
+        void ResizePalette(IGdiPalette palette);
+
+        /// <summary>
+        /// Draws a rectangle with rounded corners. 
+        /// The rectangle is outlined by using the current pen and filled by using the current brush.
+        /// </summary>
+        /// <param name="sx"></param>
+        /// <param name="sy"></param>
+        /// <param name="ex"></param>
+        /// <param name="ey"></param>
+        /// <param name="rw"></param>
+        /// <param name="rh"></param>
+        void RoundRect(int sx, int sy, int ex, int ey, int rw, int rh);
+
+        /// <summary>
+        /// Save device context (DC).
+        /// </summary>
+        void SeveDC();
+
+        /// <summary>
+        /// Modifies the viewport for a device context using the ratios formed by the specified multiplicands and divisors.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="xd"></param>
+        /// <param name="y"></param>
+        /// <param name="yd"></param>
+        /// <param name="old"></param>
+        void ScaleViewportExtEx(int x, int xd, int y, int yd, Size old);
+
+        /// <summary>
+        /// Modifies the window for a device context using the ratios formed by the specified multiplicands and divisors.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="xd"></param>
+        /// <param name="y"></param>
+        /// <param name="yd"></param>
+        /// <param name="old"></param>
+        void ScaleWindowExtEx(int x, int xd, int y, int yd, Size old);
+
+        /// <summary>
+        /// Selects a region as the current clipping region for the specified device context.
+        /// </summary>
+        /// <param name="rgn"></param>
+        void SelectClipRgn(IGdiRegion rgn);
+
+        /// <summary>
+        /// Selects an object into the specified device context (DC). The new object replaces the previous object of the same type.
+        /// </summary>
+        /// <param name="obj"></param>
+        void SelectObject(IGdiObject obj);
+
+        /// <summary>
+        /// Selects the specified logical palette into a device context.
+        /// </summary>
+        /// <param name="palette"></param>
+        /// <param name="mode"></param>
+        void SelectPalette(IGdiPalette palette, bool mode);
+
+        /// <summary>
+        /// Sets the current background color to the specified color value, or to the nearest physical color if the device cannot represent the specified color value.
+        /// </summary>
+        /// <param name="color"></param>
+        void SetBkColor(int color);
+
+        /// <summary>
+        /// Sets the background mix mode of the specified device context. 
+        /// The background mix mode is used with text, hatched brushes, and pen styles that are not solid lines.
+        /// </summary>
+        /// <param name="mode"></param>
+        void SetBkMode(int mode);
+
+        /// <summary>
+        /// Sets the pixels in the specified rectangle on the device that is associated with the destination device context using color data from a DIB, JPEG, or PNG image.
+        /// </summary>
+        /// <param name="dx"></param>
+        /// <param name="dy"></param>
+        /// <param name="dw"></param>
+        /// <param name="dh"></param>
+        /// <param name="sx"></param>
+        /// <param name="sy"></param>
+        /// <param name="startscan"></param>
+        /// <param name="scanlines"></param>
+        /// <param name="image"></param>
+        /// <param name="colorUse"></param>
+        void SetDIBitsToDevice(int dx, int dy, int dw, int dh, int sx, int sy,
+                       int startscan, int scanlines, byte[] image, int colorUse);
+
+        /// <summary>
+        /// Changes the layout of a device context (DC).
+        /// </summary>
+        /// <param name="layout"></param>
+        void SetLayout(long layout);
+
+        /// <summary>
+        /// Sets the mapping mode of the specified device context. 
+        /// The mapping mode defines the unit of measure used to transform page-space units into device-space units, and also defines the orientation of the device's x and y axes.
+        /// </summary>
+        /// <param name="mode"></param>
+        void SetMapMode(int mode);
+
+        /// <summary>
+        /// Alters the algorithm the font mapper uses when it maps logical fonts to physical fonts.
+        /// </summary>
+        /// <param name="flags"></param>
+        void SetMapperFlags(long flags);
+
+        /// <summary>
+        /// Sets RGB (red, green, blue) color values and flags in a range of entries in a logical palette.
+        /// </summary>
+        /// <param name="palette"></param>
+        /// <param name="startIndex"></param>
+        /// <param name="entries"></param>
+        void SetPaletteEntries(IGdiPalette palette, int startIndex, int[] entries);
+
+        /// <summary>
+        /// Sets the pixel at the specified coordinates to the specified color.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="color"></param>
+        void SetPixel(int x, int y, int color);
+
+        /// <summary>
+        /// Sets the polygon fill mode for functions that fill polygons.
+        /// </summary>
+        /// <param name="mode"></param>
+        void SetPolyFillMode(int mode);
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="mode"></param>
+        void SetRelAbs(int mode);
+
+        /// <summary>
+        /// Sets the current foreground mix mode. 
+        /// GDI uses the foreground mix mode to combine pens and interiors of filled objects with the colors already on the screen. 
+        /// The foreground mix mode defines how colors from the brush or pen and the colors in the existing image are to be combined.
+        /// </summary>
+        /// <param name="mode"></param>
+        void SetROP2(int mode);
+
+        /// <summary>
+        /// Sets the bitmap stretching mode in the specified device context.
+        /// </summary>
+        /// <param name="mode"></param>
+        void SetStretchBltMode(int mode);
+        
+        /// <summary>
+        /// Sets the text-alignment flags for the specified device context.
+        /// </summary>
+        /// <param name="align"></param>
+        void SetTextAlign(int align);
+
+        /// <summary>
+        /// Sets the intercharacter spacing. 
+        /// Intercharacter spacing is added to each character, including break characters, when the system writes a line of text.
+        /// </summary>
+        /// <param name="extra"></param>
+        void SetTextCharacterExtra(int extra);
+
+        /// <summary>
+        /// Sets the text color for the specified device context to the specified color.
+        /// </summary>
+        /// <param name="color"></param>
+        void SetTextColor(int color);
+
+        /// <summary>
+        /// Specifies the amount of space the system should add to the break characters in a string of text. 
+        /// The space is added when an application calls the TextOut or ExtTextOut functions.
+        /// </summary>
+        /// <param name="breakExtra"></param>
+        /// <param name="breakCount"></param>
+        void SetTextJustification(int breakExtra, int breakCount);
+
+        /// <summary>
+        /// Sets the horizontal and vertical extents of the viewport for a device context by using the specified values.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="old"></param>
+        void SetViewportExtEx(int x, int y, Size old);
+
+        /// <summary>
+        /// Specifies which device point maps to the window origin (0,0).
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="old"></param>
+        void SetViewportOrgEx(int x, int y, Point old);
+
+        /// <summary>
+        /// Sets the horizontal and vertical extents of the window for a device context by using the specified values.
+        /// </summary>
+        /// <param name="width"></param>
+        /// <param name="height"></param>
+        /// <param name="old"></param>
+        void SetWindowExtEx(int width, int height, Size old);
+
+        /// <summary>
+        /// Specifies which window point maps to the viewport origin (0,0).
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="old"></param>
+        void SetWindowOrgEx(int x, int y, Point old);
+
+        /// <summary>
+        /// Copies a bitmap from a source rectangle into a destination rectangle, stretching or compressing the bitmap to fit the dimensions of the destination rectangle, if necessary. 
+        /// The system stretches or compresses the bitmap according to the stretching mode currently set in the destination device context.
+        /// </summary>
+        /// <param name="image"></param>
+        /// <param name="dx"></param>
+        /// <param name="dy"></param>
+        /// <param name="dw"></param>
+        /// <param name="dh"></param>
+        /// <param name="sx"></param>
+        /// <param name="sy"></param>
+        /// <param name="sw"></param>
+        /// <param name="sh"></param>
+        /// <param name="rop"></param>
+        void StretchBlt(byte[] image, int dx, int dy, int dw, int dh,
+               int sx, int sy, int sw, int sh, long rop);
+
+        /// <summary>
+        /// Copies the color data for a rectangle of pixels in a DIB, JPEG, or PNG image to the specified destination rectangle. 
+        /// If the destination rectangle is larger than the source rectangle, this function stretches the rows and columns of color data to fit the destination rectangle. If the destination rectangle is smaller than the source rectangle, this function compresses the rows and columns by using the specified raster operation.
+        /// </summary>
+        /// <param name="dx"></param>
+        /// <param name="dy"></param>
+        /// <param name="dw"></param>
+        /// <param name="dh"></param>
+        /// <param name="sx"></param>
+        /// <param name="sy"></param>
+        /// <param name="sw"></param>
+        /// <param name="sh"></param>
+        /// <param name="image"></param>
+        /// <param name="usage"></param>
+        /// <param name="rop"></param>
+        void StretchDIBits(int dx, int dy, int dw, int dh,
+                       int sx, int sy, int sw, int sh,
+                       byte[] image, int usage, long rop);
+
+        /// <summary>
+        /// Writes a character string at the specified location, using the currently selected font, background color, and text color.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="text"></param>
+        void TextOut(int x, int y, byte[] text);
+
+        /// <summary>
+        /// 
+        /// </summary>
+        void Footer();
+    }
+}

+ 36 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdiBrush.cs

@@ -0,0 +1,36 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Graphics Device Interface - Represents a Brush object.
+    /// </summary>
+    public interface IGdiBrush : IGdiObject
+    {
+        #region Properties
+
+        /// <summary>
+        /// Object Style.
+        /// </summary>
+        /// <returns></returns>
+        int Style { get; }
+
+        /// <summary>
+        /// Object Color.
+        /// </summary>
+        /// <returns></returns>
+        int Color {get;}
+
+        /// <summary>
+        /// Object Hatch.
+        /// </summary>
+        /// <returns></returns>
+        int Hatch { get; }
+
+        #endregion
+    }
+}

+ 102 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdiFont.cs

@@ -0,0 +1,102 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Graphics Device Interface - Represents a Font object.
+    /// </summary>
+    public interface IGdiFont : IGdiObject
+    {
+        #region Properties
+
+        /// <summary>
+        /// Object Height.
+        /// </summary>
+        /// <returns></returns>
+        int Height {get;}
+
+        /// <summary>
+        /// Object Width.
+        /// </summary>
+        /// <returns></returns>
+        int Width { get; }
+
+        /// <summary>
+        /// Object Escapement.
+        /// </summary>
+        /// <returns></returns>
+        int Escapement { get; }
+
+        /// <summary>
+        /// Object Orientation.
+        /// </summary>
+        /// <returns></returns>
+        int Orientation { get; }
+
+        /// <summary>
+        /// Object Weight.
+        /// </summary>
+        /// <returns></returns>
+        int Weight { get; }
+
+        /// <summary>
+        /// Italic font.
+        /// </summary>
+        /// <returns></returns>
+        bool IsItalic { get; }
+
+        /// <summary>
+        /// Underlined font.
+        /// </summary>
+        /// <returns></returns>
+        bool IsUnderlined { get; }
+
+        /// <summary>
+        /// Striked font.
+        /// </summary>
+        /// <returns></returns>
+        bool IsStrikedOut { get; }
+
+        /// <summary>
+        /// Object Charset.
+        /// </summary>
+        /// <returns></returns>
+        int Charset { get; }
+
+        /// <summary>
+        /// Object out precision.
+        /// </summary>
+        /// <returns></returns>
+        int OutPrecision { get; }
+
+        /// <summary>
+        /// Object clip precision.
+        /// </summary>
+        /// <returns></returns>
+        int ClipPrecision { get; }
+
+        /// <summary>
+        /// Object Quality.
+        /// </summary>
+        /// <returns></returns>
+        int Quality { get; }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <returns></returns>
+        int PitchAndFamily { get; }
+
+        /// <summary>
+        /// Font face name.
+        /// </summary>
+        /// <returns></returns>
+        string FaceName { get; }
+
+        #endregion
+    }
+}

+ 15 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdiObject.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Graphic Device Interface - Object base.
+    /// </summary>
+    public interface IGdiObject
+    {
+    }
+}

+ 30 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdiPalette.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Graphics Device Interface - Represents a Palette object.
+    /// </summary>
+    public interface IGdiPalette : IGdiObject
+    {
+        #region Properties
+
+        /// <summary>
+        /// Object Version.
+        /// </summary>
+        /// <returns></returns>
+        int Version { get; }
+
+        /// <summary>
+        /// Object Entries.
+        /// </summary>
+        /// <returns></returns>
+        int[] Entries { get; }
+
+        #endregion
+    }
+}

+ 24 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdiPatternBrush.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Graphics Device Interface - Represents a Pattern Brush object.
+    /// </summary>
+    public interface IGdiPatternBrush : IGdiObject
+    {
+        #region Properties
+
+        /// <summary>
+        /// Object Patterns.
+        /// </summary>
+        /// <returns></returns>
+        byte[] Pattern { get; }
+
+        #endregion
+    }
+}

+ 33 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdiPen.cs

@@ -0,0 +1,33 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Graphics Device Interface - Represents a Pen object.
+    /// </summary>
+    public interface IGdiPen : IGdiObject
+    {
+        #region Properties
+
+        /// <summary>
+        /// Object Style.
+        /// </summary>
+        int Style { get; }
+
+        /// <summary>
+        /// Object Width.
+        /// </summary>
+        int Width { get; }
+
+        /// <summary>
+        /// Object Color.
+        /// </summary>
+        int Color { get; }
+
+        #endregion
+    }
+}

+ 16 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/IGdiRegion.cs

@@ -0,0 +1,16 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Graphics Device Interface - Represents a Region Object.
+    /// </summary>
+    public interface IGdiRegion : IGdiObject
+    {
+        
+    }
+}

+ 22 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/PenEnum.cs

@@ -0,0 +1,22 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Enumeração de Pen
+    /// </summary>
+    public enum PenPSEnum
+    {
+         PS_SOLID = 0,
+         PS_DASH = 1,
+         PS_DOT = 2,
+         PS_DASHDOT = 3,
+         PS_DASHDOTDOT = 4,
+         PS_NULL = 5,
+         PS_INSIDEFRAME = 6,
+    }
+}

+ 90 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/Point.cs

@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Represents a point (x,y).
+    /// </summary>
+    public class Point
+    {
+        #region Properties
+
+        /// <summary>
+        /// Point X
+        /// </summary>
+        public int X { get; set; }
+
+        /// <summary>
+        /// Point Y
+        /// </summary>
+        public int Y { get; set; }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        public Point(int x, int y)
+        {
+            X = x;
+            Y = y;
+        }
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// Serves as the default hash function.
+        /// </summary>
+        /// <returns></returns>
+        public override int GetHashCode()
+        {
+            int prime = 31;
+            int result = 1;
+            result = prime * result + X;
+            result = prime * result + Y;
+            return result;
+        }
+
+        /// <summary>
+        /// Determines whether the specified object is equal to the current object.
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public override bool Equals(Object obj)
+        {
+            if (this == obj)
+                return true;
+            if (obj == null)
+                return false;
+            if (typeof(Point) != obj.GetType())
+                return false;
+            Point other = (Point)obj;
+            if (X != other.X)
+                return false;
+            if (Y != other.Y)
+                return false;
+            return true;
+        }
+
+        /// <summary>
+        /// Returns a string that represents the current object.
+        /// </summary>
+        /// <returns></returns>
+        public override string ToString()
+        {
+            return "Point [x=" + X + ", y=" + Y + "]";
+        }
+
+        #endregion
+    }
+}

+ 19 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/RegionEnum.cs

@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Region Enum
+    /// </summary>
+    public enum RegionEnum
+    {
+        NULLREGION = 1,
+        SIMPLEREGION = 2,
+        COMPLEXREGION = 3,
+        ERROR = 0,
+    }
+}

+ 90 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Gdi/Size.cs

@@ -0,0 +1,90 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Gdi
+{
+    /// <summary>
+    /// Represents a size object.
+    /// </summary>
+    public class Size
+    {
+        #region Properties
+
+        /// <summary>
+        /// Width of the object.
+        /// </summary>
+        public int Width { get; set; }
+
+        /// <summary>
+        /// Height of the object.
+        /// </summary>
+        public int Height { get; set; }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        /// <param name="width"></param>
+        /// <param name="height"></param>
+        public Size(int width, int height)
+        {
+            Width = width;
+            Height = height;
+        }
+
+        #endregion 
+
+        #region Public Methods
+
+        /// <summary>
+        /// Serves as the default hash function.
+        /// </summary>
+        /// <returns></returns>
+        public override int GetHashCode()
+        {
+            int prime = 31;
+            int result = 1;
+            result = prime * result + Height;
+            result = prime * result + Width;
+            return result;
+        }
+
+        /// <summary>
+        /// Determines whether the specified object is equal to the current object.
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public override bool Equals(Object obj)
+        {
+            if (this == obj)
+                return true;
+            if (obj == null)
+                return false;
+            if (typeof(Size) != obj.GetType())
+                return false;
+            Size other = (Size)obj;
+            if (Height != other.Height)
+                return false;
+            if (Width != other.Width)
+                return false;
+            return true;
+        }
+
+        /// <summary>
+        /// Returns a string that represents the current object.
+        /// </summary>
+        /// <returns></returns>
+        public override string ToString()
+        {
+            return "Size [width=" + Width + ", height=" + Height + "]";
+        }
+
+        #endregion
+    }
+}

+ 228 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/IO/DataInput.cs

@@ -0,0 +1,228 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.IO
+{
+    /// <summary>
+    /// Read input stream of wmf file.
+    /// </summary>
+    public class DataInput
+    {
+        #region Local Variables
+
+        private System.IO.Stream _inputStream;
+        private bool _isLittleEndian = BitConverter.IsLittleEndian;
+
+        private byte[] _buf = new byte[4];
+        private int _count = 0;
+
+        #endregion
+
+        #region Properties
+
+        /// <summary>
+        /// Represents the count of bytes read
+        /// </summary>
+        public int Count
+        {
+            get
+            {
+                return _count;
+            }
+            set
+            {
+                _count = value;
+            }
+        }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// Create a DataInput instance using native order.
+        /// </summary>
+        /// <param name="inputStream"></param>
+	    public DataInput(System.IO.Stream inputStream)
+        {
+            _isLittleEndian = BitConverter.IsLittleEndian;
+            _inputStream = inputStream;
+        }
+
+        /// <summary>
+        /// Default contructor.
+        /// Create a DataInput instance receving the order.
+        /// </summary>
+        /// <param name="inputStream"></param>
+        /// <param name="endian"></param>
+        public DataInput(System.IO.Stream inputStream, bool endian)
+        {
+            _inputStream = inputStream;
+            _isLittleEndian = endian;
+        }
+
+        #endregion 
+
+        #region Public Methods
+
+        /// <summary>
+        /// Reads the next one byte of this input stream as a signed 8-bit integer.
+	    /// </summary>
+	    /// <returns></returns>
+	    public int ReadByte()
+        {
+            if (_inputStream.Read(_buf, 0, 1) == 1)
+            {
+                _count += 1;
+                return (0xff & _buf[0]);
+            }
+            throw new System.IO.EndOfStreamException();
+        }
+
+        /// <summary>
+        /// Reads the next two bytes of this input stream as a signed 16-bit integer.
+        /// </summary>
+        /// <returns></returns>
+        public int ReadInt16()
+        {
+            if (_inputStream.Read(_buf, 0, 2) == 2)
+            {
+                short value = 0;
+                if (_isLittleEndian == false)
+                {
+                    value |= (short)(0xff & _buf[1]);
+                    value |= (short)((0xff & _buf[0]) << 8);
+                }
+                else
+                {
+                    value |= (short)(0xff & _buf[0]);
+                    value |= (short)((0xff & _buf[1]) << 8);
+                }
+                _count += 2;
+                return value;
+            }
+            throw new System.IO.EndOfStreamException();
+        }
+
+        /// <summary>
+        /// Reads the next four bytes of this input stream as a signed 32-bit integer.
+        /// </summary>
+        /// <returns></returns>
+	    public int ReadInt32()
+        {
+            if (_inputStream.Read(_buf, 0, 4) == 4)
+            {
+                int value = 0;
+                if (_isLittleEndian == false)
+                {
+                    value |= (0xff & _buf[3]);
+                    value |= (0xff & _buf[2]) << 8;
+                    value |= (0xff & _buf[1]) << 16;
+                    value |= (0xff & _buf[0]) << 24;
+                }
+                else
+                {
+                    value |= (0xff & _buf[0]);
+                    value |= (0xff & _buf[1]) << 8;
+                    value |= (0xff & _buf[2]) << 16;
+                    value |= (0xff & _buf[3]) << 24;
+                }
+                _count += 4;
+                return value;
+            }
+            throw new System.IO.EndOfStreamException();
+        }
+
+        /// <summary>
+        /// Reads the next two bytes of this input stream as a unsigned 16-bit integer.
+        /// </summary>
+        /// <returns></returns>
+        public int ReadUint16()
+        {
+            if (_inputStream.Read(_buf, 0, 2) == 2)
+            {
+                int value = 0;
+                if (_isLittleEndian == false)
+                {
+                    value |= (0xff & _buf[1]);
+                    value |= (0xff & _buf[0]) << 8;
+                }
+                else
+                {
+                    value |= (0xff & _buf[0]);
+                    value |= (0xff & _buf[1]) << 8;
+                }
+                _count += 2;
+                return value;
+            }
+            throw new System.IO.EndOfStreamException();
+        }
+
+        /// <summary>
+        /// Reads the next four bytes of this input stream as a unsigned 32-bit integer.
+        /// </summary>
+        /// <returns></returns>
+        public long ReadUint32()
+        {
+            if (_inputStream.Read(_buf, 0, 4) == 4)
+            {
+                long value = 0;
+                if (_isLittleEndian == false)
+                {
+                    value |= (0xff & _buf[3]);
+                    value |= (0xff & _buf[2]) << 8;
+                    value |= (0xff & _buf[1]) << 16;
+                    value |= (0xff & _buf[0]) << 24;
+                }
+                else
+                {
+                    value |= (0xff & _buf[0]);
+                    value |= (0xff & _buf[1]) << 8;
+                    value |= (0xff & _buf[2]) << 16;
+                    value |= (0xff & _buf[3]) << 24;
+                }
+                _count += 4;
+                return value;
+            }
+            throw new System.IO.EndOfStreamException();
+        }
+
+        /// <summary>
+        /// Reads the next n bytes.
+        /// </summary>
+        /// <param name="n"></param>
+        /// <returns></returns>
+	    public byte[] ReadBytes(int n)
+        {
+            byte[] array = new byte[n];
+            if (_inputStream.Read(array, 0, array.Length) == n)
+            {
+                _count += n;
+                return array;
+            }
+            throw new System.IO.EndOfStreamException();
+        }
+
+
+        /// <summary>
+        /// Close the input stream.
+        /// </summary>
+        public void Close()
+        {
+            try
+            {
+                _inputStream.Close();
+            }
+            catch (System.IO.IOException ex)
+            {
+                Console.Write(ex.Message);
+            }
+        }
+
+        #endregion 
+    }
+}

+ 132 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/Properties.cs

@@ -0,0 +1,132 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Svg
+{
+    public class Properties : Dictionary<string, string>
+    {
+        public void load()
+        {
+            var props = new Properties();
+            props.Add("alternative-font.\uff2d\uff33\u0020\u30b4\u30b7\u30c3\u30af", "MS Gothic");
+            props.Add("alternative-font.\uff2d\uff33\u0020\uff30\u30b4\u30b7\u30c3\u30af", "MS PGothic");
+            props.Add("alternative-font.\uff2d\uff33\u0020\u660e\u671d", "MS Mincho");
+            props.Add("alternative-font.\uff2d\uff33\u0020\uff30\u660e\u671d", "MS PMincho");
+            props.Add("alternative-font.\u30E1\u30A4\u30EA\u30AA", "Meiryo");
+
+            props.Add("font-emheight.Andalus", "0.655150351887396");
+            props.Add("font-emheight.Angsana\u0020New", "0.740285559371046");
+            props.Add("font-emheight.AngsanaUPC", "0.740285559371046");
+            props.Add("font-emheight.Aparajita", "0.846280991735537");
+            props.Add("font-emheight.Arabic\u0020Typesetting", "0.877463581833762");
+            props.Add("font-emheight.Arial", "0.895104895104895");
+            props.Add("font-emheight.Arial\u0020Black", "0.709141274238227");
+            props.Add("font-emheight.Browallia\u0020New", "0.800312622118015");
+            props.Add("font-emheight.BrowalliaUPC", "0.800312622118015");
+            props.Add("font-emheight.Calibri", "0.8192");
+            props.Add("font-emheight.Cambria", "0.852977925864223");
+            props.Add("font-emheight.Cambria\u0020Math", "0.179208960448022");
+            props.Add("font-emheight.Comic\u0020Sans\u0020MS", "0.717589348283111");
+            props.Add("font-emheight.Consolas", "0.854045037531276");
+            props.Add("font-emheight.Constantia", "0.8192");
+            props.Add("font-emheight.Corbel", "0.8192");
+            props.Add("font-emheight.Cordia\u0020New", "0.721380767876013");
+            props.Add("font-emheight.CordiaUPC", "0.721380767876013");
+            props.Add("font-emheight.Courier\u0020New", "0.882758620689655");
+            props.Add("font-emheight.DaunPenh", "0.745540589734256");
+            props.Add("font-emheight.David", "1.01637717121588");
+            props.Add("font-emheight.DejaVu\u0020Sans", "0.859060402684564");
+            props.Add("font-emheight.DejaVu\u0020Sans\u0020Mono", "0.859060402684564");
+            props.Add("font-emheight.DejaVu\u0020Serif", "0.859060402684564");
+            props.Add("font-emheight.DilleniaUPC", "0.766323666978485");
+            props.Add("font-emheight.DokChampa", "0.516259137887572");
+            props.Add("font-emheight.Dutch801\u0020SWC", "0.844187963726298");
+            props.Add("font-emheight.Ebrima", "0.751835535976505");
+            props.Add("font-emheight.Estrangelo\u0020Edessa", "0.894323144104804");
+            props.Add("font-emheight.EucrosiaUPC", "0.816912644595134");
+            props.Add("font-emheight.Euphemia", "0.761338289962825");
+            props.Add("font-emheight.Franklin\u0020Gothic\u0020Medium", "0.881998277347115");
+            props.Add("font-emheight.FrankRuehl", "1.07563025210084");
+            props.Add("font-emheight.FreesiaUPC", "0.834046019140705");
+            props.Add("font-emheight.Gabriola", "0.543236074270557");
+            props.Add("font-emheight.Gautami", "0.575928008998875");
+            props.Add("font-emheight.Gentium\u0020Basic", "0.864135021097046");
+            props.Add("font-emheight.Gentium\u0020Book\u0020Basic", "0.864135021097046");
+            props.Add("font-emheight.Georgia", "0.880103137086377");
+            props.Add("font-emheight.Gisha", "0.853333333333333");
+            props.Add("font-emheight.Impact", "0.819855884707766");
+            props.Add("font-emheight.IrisUPC", "0.790580968924918");
+            props.Add("font-emheight.Iskoola\u0020Pota", "0.880860215053763");
+            props.Add("font-emheight.JasmineUPC", "0.945958429561201");
+            props.Add("font-emheight.Kalinga", "0.673684210526316");
+            props.Add("font-emheight.Kartika", "0.701129750085587");
+            props.Add("font-emheight.Khmer\u0020UI", "0.883520276100086");
+            props.Add("font-emheight.KodchiangUPC", "1.0173869846001");
+            props.Add("font-emheight.Kokila", "0.867429055484964");
+            props.Add("font-emheight.Lao\u0020UI", "0.751835535976505");
+            props.Add("font-emheight.Latha", "0.728825622775801");
+            props.Add("font-emheight.Leelawadee", "0.836259697835851");
+            props.Add("font-emheight.Levenim\u0020MT", "0.757676655567888");
+            props.Add("font-emheight.Liberation\u0020Sans\u0020Narrow", "0.883139284174213");
+            props.Add("font-emheight.LilyUPC", "1.04944914168588");
+            props.Add("font-emheight.Lingoes\u0020Unicode", "0.746355685131195");
+            props.Add("font-emheight.Linux\u0020Biolinum\u0020G", "0.877087794432548");
+            props.Add("font-emheight.Linux\u0020Libertine\u0020G", "0.877087794432548");
+            props.Add("font-emheight.Lucida\u0020Sans\u0020Unicode", "0.650778519224658");
+            props.Add("font-emheight.Malgun\u0020Gothic", "0.751835535976505");
+            props.Add("font-emheight.Mangal", "0.595348837209302");
+            props.Add("font-emheight.Meiryo\u0020UI", "0.787389465590158");
+            props.Add("font-emheight.Microsoft\u0020JhengHei", "0.751835535976505");
+            props.Add("font-emheight.Microsoft\u0020New\u0020Tai\u0020Lue", "0.764464352370287");
+            props.Add("font-emheight.Microsoft\u0020PhagsPa", "0.781679389312977");
+            props.Add("font-emheight.Microsoft\u0020Sans\u0020Serif", "0.883520276100086");
+            props.Add("font-emheight.Microsoft\u0020Tai\u0020Le", "0.786482334869432");
+            props.Add("font-emheight.Microsoft\u0020YaHei", "0.757676655567888");
+            props.Add("font-emheight.Microsoft\u0020Yi\u0020Baiti", "0.999024390243902");
+            props.Add("font-emheight.Miriam\u0020Fixed", "1.01285855588526");
+            props.Add("font-emheight.Miriam", "0.99514091350826");
+            props.Add("font-emheight.Mongolian\u0020Baiti", "0.940312213039486");
+            props.Add("font-emheight.MoolBoran", "0.745540589734256");
+            props.Add("font-emheight.MV\u0020Boli", "0.620606060606061");
+            props.Add("font-emheight.Narkisim", "1.0123578843302");
+            props.Add("font-emheight.Nyala", "0.957009345794393");
+            props.Add("font-emheight.Palatino\u0020Linotype", "0.741223307998552");
+            props.Add("font-emheight.Plantagenet\u0020Cherokee", "0.787995382839554");
+            props.Add("font-emheight.Raavi", "0.602352941176471");
+            props.Add("font-emheight.Rod", "1.01941264310602");
+            props.Add("font-emheight.Sakkal\u0020Majalla", "0.716083916083916");
+            props.Add("font-emheight.Segoe\u0020Print", "0.573830204539087");
+            props.Add("font-emheight.Segoe\u0020Script", "0.631319358816276");
+            props.Add("font-emheight.Segoe\u0020UI", "0.751835535976505");
+            props.Add("font-emheight.Segoe\u0020UI\u0020Symbol", "0.751835535976505");
+            props.Add("font-emheight.Shonar\u0020Bangla", "0.772538664654847");
+            props.Add("font-emheight.Shruti", "0.594830090037758");
+            props.Add("font-emheight.Simplified\u0020Arabic", "0.603240058910162");
+            props.Add("font-emheight.Simplified\u0020Arabic\u0020Fixed", "0.915921288014311");
+            props.Add("font-emheight.Swiss742\u0020SWC", "0.803452334248725");
+            props.Add("font-emheight.Sylfaen", "0.759362254356693");
+            props.Add("font-emheight.Symbol", "0.816261458748505");
+            props.Add("font-emheight.Tahoma", "0.828478964401295");
+            props.Add("font-emheight.Times\u0020New\u0020Roman", "0.90299823633157");
+            props.Add("font-emheight.Traditional\u0020Arabic", "0.66906239790918");
+            props.Add("font-emheight.Trebuchet\u0020MS", "0.861227922624054");
+            props.Add("font-emheight.Tunga", "0.602352941176471");
+            props.Add("font-emheight.Utsaah", "0.893542757417103");
+            props.Add("font-emheight.Vani", "0.593795302986373");
+            props.Add("font-emheight.Verdana", "0.822820409803134");
+            props.Add("font-emheight.Vijaya", "0.993210475266731");
+            props.Add("font-emheight.Vrinda", "0.732737030411449");
+            props.Add("font-emheight.Wingdings", "0.901011878574571");
+            props.Add("font-emheight.Meiryo", "0.666666666666667");
+
+            props.Add("font-emheight.Academy\u0020Engraved\u0020LET", "0.870748299319728");
+            props.Add("font-emheight.Alma\u0020Iso", "0.997384481255449");
+            props.Add("font-emheight.Alma\u0020Large", "1.57250859106529");
+            props.Add("font-emheight.Alma\u0020Symbol", "0.997384481255449");
+            props.Add("font-emheight.AVGmdBU", "1.00986193293886");
+        }
+    }
+}

+ 271 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgBrush.cs

@@ -0,0 +1,271 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Svg
+{
+    /// <summary>
+    /// Scalable Vector Graphics - Represents a Brush SVG object.
+    /// </summary>
+    public class SvgBrush : SvgObject, Gdi.IGdiBrush
+    {
+        #region Local Variables 
+
+        private int _style;
+        private int _color;
+        private int _hatch;
+
+        #endregion
+
+        #region Properties
+
+        /// <summary>
+        /// Object style.
+        /// </summary>
+        public int Style
+        {
+            get
+            {
+                return _style;
+            }
+        }
+
+        /// <summary>
+        /// Object color.
+        /// </summary>
+        public int Color
+        {
+            get
+            {
+                return _color;
+            }
+        }
+
+        /// <summary>
+        /// Object hatch.
+        /// </summary>
+        public int Hatch
+        {
+            get
+            {
+                return _hatch;
+            }
+        }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        /// <param name="gdi"></param>
+        /// <param name="style"></param>
+        /// <param name="color"></param>
+        /// <param name="hatch"></param>
+        public SvgBrush(
+            SvgGdi gdi,
+            int style,
+            int color,
+            int hatch)
+            : base(gdi)
+        {
+            _style = style;
+            _color = color;
+            _hatch = hatch;
+        }
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// Create element FillPatern.
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public System.Xml.XmlElement CreateFillPattern(string id)
+        {
+            System.Xml.XmlElement pattern = GDI.Document.CreateElement("pattern");
+
+            if (_style == (int)Gdi.BrushBSEnum.BS_HATCHED)
+            {
+                pattern.SetAttribute("id", id);
+                pattern.SetAttribute("patternUnits", "userSpaceOnUse");
+                pattern.SetAttribute("x", "" + ToRealSize(0));
+                pattern.SetAttribute("y", "" + ToRealSize(0));
+                pattern.SetAttribute("width", "" + ToRealSize(8));
+                pattern.SetAttribute("height", "" + ToRealSize(8));
+                GDI.Document.AppendChild(pattern);
+
+                if (GDI.DC.BkMode == (int)Gdi.GdiEnum.OPAQUE)
+                {
+                    System.Xml.XmlElement rect = GDI.Document.CreateElement("rect");
+                    rect.SetAttribute("fill", ToColor(GDI.DC.BkColor));
+                    rect.SetAttribute("x", "" + ToRealSize(0));
+                    rect.SetAttribute("y", "" + ToRealSize(0));
+                    rect.SetAttribute("width", "" + ToRealSize(8));
+                    rect.SetAttribute("height", "" + ToRealSize(8));
+                    pattern.AppendChild(rect);
+                }
+
+                switch (_hatch)
+                {
+                    case (int)Gdi.BrushHSEnum.HS_HORIZONTAL:
+                        {
+                            System.Xml.XmlElement path = GDI.Document.CreateElement("line");
+                            path.SetAttribute("stroke", ToColor(_color));
+                            path.SetAttribute("x1", "" + ToRealSize(0));
+                            path.SetAttribute("y1", "" + ToRealSize(4));
+                            path.SetAttribute("x2", "" + ToRealSize(8));
+                            path.SetAttribute("y2", "" + ToRealSize(4));
+                            pattern.AppendChild(path);
+                        } break;
+                    case (int)Gdi.BrushHSEnum.HS_VERTICAL:
+                        {
+                            System.Xml.XmlElement path = GDI.Document.CreateElement("line");
+                            path.SetAttribute("stroke", ToColor(_color));
+                            path.SetAttribute("x1", "" + ToRealSize(4));
+                            path.SetAttribute("y1", "" + ToRealSize(0));
+                            path.SetAttribute("x2", "" + ToRealSize(4));
+                            path.SetAttribute("y2", "" + ToRealSize(8));
+                            pattern.AppendChild(path);
+                        } break;
+                    case (int)Gdi.BrushHSEnum.HS_FDIAGONAL:
+                        {
+                            System.Xml.XmlElement path = GDI.Document.CreateElement("line");
+                            path.SetAttribute("stroke", ToColor(_color));
+                            path.SetAttribute("x1", "" + ToRealSize(0));
+                            path.SetAttribute("y1", "" + ToRealSize(0));
+                            path.SetAttribute("x2", "" + ToRealSize(8));
+                            path.SetAttribute("y2", "" + ToRealSize(8));
+                            pattern.AppendChild(path);
+                        } break;
+                    case (int)Gdi.BrushHSEnum.HS_BDIAGONAL:
+                        {
+                            System.Xml.XmlElement path = GDI.Document.CreateElement("line");
+                            path.SetAttribute("stroke", ToColor(_color));
+                            path.SetAttribute("x1", "" + ToRealSize(0));
+                            path.SetAttribute("y1", "" + ToRealSize(8));
+                            path.SetAttribute("x2", "" + ToRealSize(8));
+                            path.SetAttribute("y2", "" + ToRealSize(0));
+                            pattern.AppendChild(path);
+                        } break;
+                    case (int)Gdi.BrushHSEnum.HS_CROSS:
+                        {
+                            System.Xml.XmlElement path1 = GDI.Document.CreateElement("line");
+                            path1.SetAttribute("stroke", ToColor(_color));
+                            path1.SetAttribute("x1", "" + ToRealSize(0));
+                            path1.SetAttribute("y1", "" + ToRealSize(4));
+                            path1.SetAttribute("x2", "" + ToRealSize(8));
+                            path1.SetAttribute("y2", "" + ToRealSize(4));
+                            pattern.AppendChild(path1);
+                            System.Xml.XmlElement path2 = GDI.Document.CreateElement("line");
+                            path2.SetAttribute("stroke", ToColor(_color));
+                            path2.SetAttribute("x1", "" + ToRealSize(4));
+                            path2.SetAttribute("y1", "" + ToRealSize(0));
+                            path2.SetAttribute("x2", "" + ToRealSize(4));
+                            path2.SetAttribute("y2", "" + ToRealSize(8));
+                            pattern.AppendChild(path2);
+                        } break;
+                    case (int)Gdi.BrushHSEnum.HS_DIAGCROSS:
+                        {
+                            System.Xml.XmlElement path1 = GDI.Document.CreateElement("line");
+                            path1.SetAttribute("stroke", ToColor(_color));
+                            path1.SetAttribute("x1", "" + ToRealSize(0));
+                            path1.SetAttribute("y1", "" + ToRealSize(0));
+                            path1.SetAttribute("x2", "" + ToRealSize(8));
+                            path1.SetAttribute("y2", "" + ToRealSize(8));
+                            pattern.AppendChild(path1);
+                            System.Xml.XmlElement path2 = GDI.Document.CreateElement("line");
+                            path2.SetAttribute("stroke", ToColor(_color));
+                            path2.SetAttribute("x1", "" + ToRealSize(0));
+                            path2.SetAttribute("y1", "" + ToRealSize(8));
+                            path2.SetAttribute("x2", "" + ToRealSize(8));
+                            path2.SetAttribute("y2", "" + ToRealSize(0));
+                            pattern.AppendChild(path2);
+                        } break;
+                }
+            }
+
+            return pattern;
+        }
+
+        /// <summary>
+        /// Serves as the default hash function.
+        /// </summary>
+        /// <returns></returns>
+        public override int GetHashCode()
+        {
+            int PRIME = 31;
+            int result = 1;
+            result = PRIME * result + _color;
+            result = PRIME * result + _hatch;
+            result = PRIME * result + _style;
+            return result;
+        }
+
+        /// <summary>
+        /// Determines whether the specified object is equal to the current object.
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public override bool Equals(Object obj)
+        {
+            if (this == obj)
+                return true;
+            if (obj == null)
+                return false;
+            if (typeof(SvgBrush) != obj.GetType())
+                return false;
+            SvgBrush other = (SvgBrush)obj;
+            if (_color != other._color)
+                return false;
+            if (_hatch != other._hatch)
+                return false;
+            if (_style != other._style)
+                return false;
+            return true;
+        }
+
+        /// <summary>
+        /// Create element inner text.
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public System.Xml.XmlText CreateTextNode(string id)
+        {
+            return GDI.Document.CreateTextNode("." + id + " { " + ToString() + " }\r\n");
+        }
+
+        /// <summary>
+        /// Returns a string that represents the current object.
+        /// </summary>
+        /// <returns></returns>
+        public override string ToString()
+        {
+            System.Text.StringBuilder buffer = new System.Text.StringBuilder();
+
+            // fill
+            switch (_style)
+            {
+                case (int)Gdi.BrushBSEnum.BS_SOLID:
+                    buffer.Append("fill: ").Append(ToColor(_color)).Append("; ");
+                    break;
+                case (int)Gdi.BrushBSEnum.BS_HATCHED:
+                    break;
+                default:
+                    buffer.Append("fill: none; ");
+                    break;
+            }
+
+            if (buffer.Length > 0)
+                buffer.Length = buffer.Length - 1;
+            return buffer.ToString();
+        }
+
+        #endregion
+    }
+}

+ 976 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgDc.cs

@@ -0,0 +1,976 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Svg
+{
+    /// <summary>
+    /// Scalable Vector Graphics - Represents SVG document.
+    /// </summary>
+    public class SvgDc : ICloneable
+    {
+
+        #region Local Variables
+
+        private SvgGdi _gdi;
+
+        private int _dpi = 1440;
+
+        // window
+        private int _wx = 0;
+        private int _wy = 0;
+        private int _ww = 0;
+        private int _wh = 0;
+
+        // window offset
+        private int _wox = 0;
+        private int _woy = 0;
+
+        // window scale
+        private double _wsx = 1.0;
+        private double _wsy = 1.0;
+
+        // mapping scale
+        private double _mx = 1.0;
+        private double _my = 1.0;
+
+        // viewport
+        private int _vx = 0;
+        private int _vy = 0;
+        private int _vw = 0;
+        private int _vh = 0;
+
+        // viewport offset
+        private int _vox = 0;
+        private int _voy = 0;
+
+        // viewport scale
+        private double _vsx = 1.0;
+        private double _vsy = 1.0;
+
+        // current location
+        private int _cx = 0;
+        private int _cy = 0;
+
+        // clip offset
+        private int _cox = 0;
+        private int _coy = 0;
+
+        private int _mapMode = (int)Gdi.GdiEnum.MM_TEXT;
+        private int _bkColor = 0x00FFFFFF;
+        private int _bkMode = (int)Gdi.GdiEnum.OPAQUE;
+        private int _textColor = 0x00000000;
+        private int _textSpace = 0;
+        private int _textAlign = (int)Gdi.GdiEnum.TA_TOP | (int)Gdi.GdiEnum.TA_LEFT;
+        private int _textDx = 0;
+        private int _polyFillMode = (int)Gdi.GdiEnum.ALTERNATE;
+        private int _relAbsMode = 0;
+        private int _rop2Mode = (int)Gdi.GdiEnum.R2_COPYPEN;
+        private int _stretchBltMode = (int)Gdi.GdiEnum.STRETCH_ANDSCANS;
+        private long _layout = 0;
+        private long _mapperFlags = 0;
+
+        private SvgBrush _brush = null;
+        private SvgFont _font = null;
+        private SvgPen _pen = null;
+
+        private System.Xml.XmlElement _mask = null;
+
+        #endregion 
+
+        #region Properties
+
+        /// <summary>
+        /// Background color.
+        /// </summary>
+        public int BkColor
+        {
+            get
+            {
+                return _bkColor;
+            }
+            set
+            {
+                _bkColor = value;
+            }
+        }
+
+        /// <summary>
+        /// Background mode.
+        /// </summary>
+        public int BkMode
+        {
+            get
+            {
+                return _bkMode;
+            }
+            set
+            {
+                _bkColor = value;
+            }
+        }
+
+        /// <summary>
+        /// Text color.
+        /// </summary>
+        public int TextColor
+        {
+            get
+            {
+                return _textColor;
+            }
+            set
+            {
+                _textColor = value;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int PolyFillMode
+        {
+            get
+            {
+                return _polyFillMode;
+
+            }
+            set
+            {
+                _polyFillMode = value;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int RelAbs
+        {
+            get
+            {
+                return _relAbsMode;
+            }
+            set
+            {
+                _relAbsMode = value;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int ROP2
+        {
+            get
+            {
+                return _rop2Mode;
+            }
+            set
+            {
+                _rop2Mode = value;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int StretchBltMode
+        {
+            get
+            {
+                return _stretchBltMode;
+            }
+            set
+            {
+                _stretchBltMode = value;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int TextSpace
+        {
+            get
+            {
+                return _textSpace;
+            }
+            set
+            {
+                _textSpace = value;
+            }
+        }
+
+        /// <summary>
+        /// Text align.
+        /// </summary>
+        public int TextAlign
+        {
+            get
+            {
+                return _textAlign;
+            }
+            set
+            {
+                _textAlign = value;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int TextCharacterExtra
+        {
+            get
+            {
+                return _textDx;
+            }
+            set
+            {
+                _textDx = value;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public long Layout
+        {
+            get
+            {
+                return _layout;
+            }
+            set
+            {
+                _layout = value;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public long MapperFlags
+        {
+            get
+            {
+                return _mapperFlags;
+            }
+            set
+            {
+                _mapperFlags = value;
+            }
+        }
+
+        /// <summary>
+        /// Brush instance.
+        /// </summary>
+        public SvgBrush Brush
+        {
+            get
+            {
+                return _brush;
+            }
+            set
+            {
+                _brush = value;
+            }
+        }
+
+        /// <summary>
+        /// Font instance.
+        /// </summary>
+        public SvgFont Font
+        {
+            get
+            {
+                return _font;
+            }
+            set
+            {
+                _font = value;
+            }
+        }
+
+        /// <summary>
+        /// Pen instance.
+        /// </summary>
+        public SvgPen Pen
+        {
+            get
+            {
+                return _pen;
+            }
+            set
+            {
+                _pen = value;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public System.Xml.XmlElement Mask
+        {
+            get
+            {
+                return _mask;
+            }
+            set
+            {
+                _mask = value;
+            }
+        }
+
+        /// <summary>
+        /// Current X Point.
+        /// </summary>
+        public int CurrentX
+        {
+            get
+            {
+                return _cx;
+            }
+        }
+
+        /// <summary>
+        /// Current Y Point.
+        /// </summary>
+        public int CurrentY
+        {
+            get
+            {
+                return _cy;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int OffsetClipX
+        {
+            get
+            {
+                return _cox;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int OffsetClipY
+        {
+            get
+            {
+                return _coy;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int MapMode
+        {
+            get
+            {
+                return _mapMode;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int Dpi
+        {
+            get
+            {
+                return _dpi;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int WindowX
+        {
+            get
+            {
+                return _wx;
+            }
+        }
+
+        /// <summary>
+        /// 
+        /// </summary>
+        public int WindowY
+        {
+            get
+            {
+                return _wy;
+            }
+        }
+
+        /// <summary>
+        /// Represents window width.
+        /// </summary>
+        public int WindowWidth
+        {
+            get
+            {
+                return _ww;
+            }
+        }
+
+        /// <summary>
+        /// Represents window height.
+        /// </summary>
+        public int WindowHeight
+        {
+            get
+            {
+                return _wh;
+            }
+        }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default Constructor.
+        /// </summary>
+        /// <param name="gdi"></param>
+        public SvgDc(SvgGdi gdi)
+        {
+            _gdi = gdi;
+        }
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// Specifies which window point maps to the viewport origin (0,0).
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="old"></param>
+        public void SetWindowOrgEx(int x, int y, WMFConverter.Gdi.Point old)
+        {
+            if (old != null)
+            {
+                old.X = _wx;
+                old.Y = _wy;
+            }
+            _wx = x;
+            _wy = y;
+        }
+
+        /// <summary>
+        /// Sets the horizontal and vertical extents of the window for a device context by using the specified values.
+        /// </summary>
+        /// <param name="width"></param>
+        /// <param name="height"></param>
+        /// <param name="old"></param>
+        public void SetWindowExtEx(int width, int height, WMFConverter.Gdi.Size old)
+        {
+            if (old != null)
+            {
+                old.Width = _ww;
+                old.Height = _wh;
+            }
+            _ww = width;
+            _wh = height;
+        }
+
+        /// <summary>
+        /// Modifies the window origin for a device context using the specified horizontal and vertical offsets.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="old"></param>
+        public void OffSetWindowOrgEx(int x, int y, WMFConverter.Gdi.Point old)
+        {
+            if (old != null)
+            {
+                old.X = _wox;
+                old.Y = _woy;
+            }
+            _wox += x;
+            _woy += y;
+        }
+
+        /// <summary>
+        /// Modifies the window for a device context using the ratios formed by the specified multiplicands and divisors.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="xd"></param>
+        /// <param name="y"></param>
+        /// <param name="yd"></param>
+        /// <param name="old"></param>
+        public void ScaleWindowExtEx(int x, int xd, int y, int yd, WMFConverter.Gdi.Size old)
+        {
+            // TODO
+            _wsx = (_wsx * x) / xd;
+            _wsy = (_wsy * y) / yd;
+        }
+
+        /// <summary>
+        /// Specifies which device point maps to the window origin (0,0).
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="old"></param>
+        public void SetViewportOrgEx(int x, int y, WMFConverter.Gdi.Point old)
+        {
+            if (old != null)
+            {
+                old.X = _vx;
+                old.Y = _vy;
+            }
+            _vx = x;
+            _vy = y;
+        }
+
+        /// <summary>
+        /// Sets the horizontal and vertical extents of the viewport for a device context by using the specified values.
+        /// </summary>
+        /// <param name="width"></param>
+        /// <param name="height"></param>
+        /// <param name="old"></param>
+        public void SetViewportExtEx(int width, int height, WMFConverter.Gdi.Size old)
+        {
+            if (old != null)
+            {
+                old.Width = _vw;
+                old.Height = _vh;
+            }
+            _vw = width;
+            _vh = height;
+        }
+
+        /// <summary>
+        /// Modifies the viewport origin for a device context using the specified horizontal and vertical offsets.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="old"></param>
+        public void OffSetViewportOrgEx(int x, int y, WMFConverter.Gdi.Point old)
+        {
+            if (old != null)
+            {
+                old.X = _vox;
+                old.Y = _voy;
+            }
+            _vox = x;
+            _voy = y;
+        }
+
+        /// <summary>
+        /// Modifies the viewport for a device context using the ratios formed by the specified multiplicands and divisors.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="xd"></param>
+        /// <param name="y"></param>
+        /// <param name="yd"></param>
+        /// <param name="old"></param>
+        public void ScaleViewportExtEx(int x, int xd, int y, int yd, WMFConverter.Gdi.Size old)
+        {
+            // TODO
+            _vsx = (_vsx * x) / xd;
+            _vsy = (_vsy * y) / yd;
+        }
+
+        /// <summary>
+        /// Moves the clipping region of a device context by the specified offsets.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        public void OffSetClipRgn(int x, int y)
+        {
+            _cox = x;
+            _coy = y;
+        }
+
+        /// <summary>
+        /// Sets the mapping mode of the specified device context. 
+        /// The mapping mode defines the unit of measure used to transform page-space units into device-space units, and also defines the orientation of the device's x and y axes.
+        /// </summary>
+        /// <param name="mode"></param>
+        public void SetMapMode(int mode)
+        {
+            _mapMode = mode;
+            switch (mode)
+            {
+                case (int)Gdi.GdiEnum.MM_HIENGLISH:
+                    _mx = 0.09;
+                    _my = -0.09;
+                    break;
+                case (int)Gdi.GdiEnum.MM_LOENGLISH:
+                    _mx = 0.9;
+                    _my = -0.9;
+                    break;
+                case (int)Gdi.GdiEnum.MM_HIMETRIC:
+                    _mx = 0.03543307;
+                    _my = -0.03543307;
+                    break;
+                case (int)Gdi.GdiEnum.MM_LOMETRIC:
+                    _mx = 0.3543307;
+                    _my = -0.3543307;
+                    break;
+                case (int)Gdi.GdiEnum.MM_TWIPS:
+                    _mx = 0.0625;
+                    _my = -0.0625;
+                    break;
+                default:
+                    _mx = 1.0;
+                    _my = 1.0;
+                    break;
+            }
+        }
+
+        /// <summary>
+        /// Updates the current position to the specified point and optionally returns the previous position.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <param name="y"></param>
+        /// <param name="old"></param>
+        public void MoveToEx(int x, int y, WMFConverter.Gdi.Point old)
+        {
+            if (old != null)
+            {
+                old.X = _cx;
+                old.Y = _cy;
+            }
+            _cx = x;
+            _cy = y;
+        }
+
+        /// <summary>
+        /// Return the absolute X position from x point.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <returns></returns>
+        public double ToAbsoluteX(double x)
+        {
+            // TODO Handle Viewport
+            return ((_ww >= 0) ? 1 : -1) * (_mx * x - (_wx + _wox)) / _wsx;
+        }
+
+        /// <summary>
+        /// Return the absolute Y position from y point.
+        /// </summary>
+        /// <param name="y"></param>
+        /// <returns></returns>
+        public double ToAbsoluteY(double y)
+        {
+            // TODO Handle Viewport
+            return ((_wh >= 0) ? 1 : -1) * (_my * y - (_wy + _woy)) / _wsy;
+        }
+
+        /// <summary>
+        /// Return the relative X position from x point.
+        /// </summary>
+        /// <param name="x"></param>
+        /// <returns></returns>
+        public double ToRelativeX(double x)
+        {
+            // TODO Handle Viewport
+            return ((_ww >= 0) ? 1 : -1) * (_mx * x) / _wsx;
+        }
+
+        /// <summary>
+        /// Return the relative Y position from y point.
+        /// </summary>
+        /// <param name="y"></param>
+        /// <returns></returns>
+        public double ToRelativeY(double y)
+        {
+            // TODO Handle Viewport
+            return ((_wh >= 0) ? 1 : -1) * (_my * y) / _wsy;
+        }
+
+        /// <summary>
+        /// Define Dpi value
+        /// </summary>
+        /// <param name="dpi"></param>
+        public void SetDpi(int dpi)
+        {
+            _dpi = (dpi > 0) ? dpi : 1440;
+        }
+
+        
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="rop"></param>
+        /// <returns></returns>
+        public string GetRopFilter(long rop)
+        {
+            string name = null;
+            System.Xml.XmlDocument doc = _gdi.Document;
+            
+            if (rop == (int)Gdi.GdiEnum.BLACKNESS)
+            {
+                name = "BLACKNESS_FILTER";
+                System.Xml.XmlElement filter = doc.GetElementById(name);
+                if (filter == null)
+                {
+                    filter = _gdi.Document.CreateElement("filter");
+                    filter.SetAttribute("id", name);
+                    //filter.setIdAttribute("id", true);
+
+                    System.Xml.XmlElement feColorMatrix = doc.CreateElement("feColorMatrix");
+                    feColorMatrix.SetAttribute("type", "matrix");
+                    feColorMatrix.SetAttribute("in", "SourceGraphic");
+                    feColorMatrix.SetAttribute("values", "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0");
+                    filter.AppendChild(feColorMatrix);
+
+                    _gdi.DefsElement.AppendChild(filter);
+                }
+            }
+            else if (rop == (int)Gdi.GdiEnum.NOTSRCERASE)
+            {
+                name = "NOTSRCERASE_FILTER";
+                System.Xml.XmlElement filter = doc.GetElementById(name);
+                if (filter == null)
+                {
+                    filter = _gdi.Document.CreateElement("filter");
+                    filter.SetAttribute("id", name);
+                    //filter.setIdAttribute("id", true);
+
+                    System.Xml.XmlElement feComposite = doc.CreateElement("feComposite");
+                    feComposite.SetAttribute("in", "SourceGraphic");
+                    feComposite.SetAttribute("in2", "BackgroundImage");
+                    feComposite.SetAttribute("operator", "arithmetic");
+                    feComposite.SetAttribute("k1", "1");
+                    feComposite.SetAttribute("result", "result0");
+                    filter.AppendChild(feComposite);
+
+                    System.Xml.XmlElement feColorMatrix = doc.CreateElement("feColorMatrix");
+                    feColorMatrix.SetAttribute("in", "result0");
+                    feColorMatrix.SetAttribute("values", "-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0");
+                    filter.AppendChild(feColorMatrix);
+
+                    _gdi.DefsElement.AppendChild(filter);
+                }
+            }
+            else if (rop == (int)Gdi.GdiEnum.NOTSRCCOPY)
+            {
+                name = "NOTSRCCOPY_FILTER";
+                System.Xml.XmlElement filter = doc.GetElementById(name);
+                if (filter == null)
+                {
+                    filter = _gdi.Document.CreateElement("filter");
+                    filter.SetAttribute("id", name);
+                    //filter.setIdAttribute("id", true);
+
+                    System.Xml.XmlElement feColorMatrix = doc.CreateElement("feColorMatrix");
+                    feColorMatrix.SetAttribute("type", "matrix");
+                    feColorMatrix.SetAttribute("in", "SourceGraphic");
+                    feColorMatrix.SetAttribute("values", "-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0");
+                    filter.AppendChild(feColorMatrix);
+
+                    _gdi.DefsElement.AppendChild(filter);
+                }
+            }
+            else if (rop == (int)Gdi.GdiEnum.SRCERASE)
+            {
+                name = "SRCERASE_FILTER";
+                System.Xml.XmlElement filter = doc.GetElementById(name);
+                if (filter == null)
+                {
+                    filter = _gdi.Document.CreateElement("filter");
+                    filter.SetAttribute("id", name);
+                    //filter.setIdAttribute("id", true);
+
+                    System.Xml.XmlElement feColorMatrix = doc.CreateElement("feColorMatrix");
+                    feColorMatrix.SetAttribute("type", "matrix");
+                    feColorMatrix.SetAttribute("in", "BackgroundImage");
+                    feColorMatrix.SetAttribute("values", "-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0");
+                    feColorMatrix.SetAttribute("result", "result0");
+                    filter.AppendChild(feColorMatrix);
+
+                    System.Xml.XmlElement feComposite = doc.CreateElement("feComposite");
+                    feComposite.SetAttribute("in", "SourceGraphic");
+                    feComposite.SetAttribute("in2", "result0");
+                    feComposite.SetAttribute("operator", "arithmetic");
+                    feComposite.SetAttribute("k2", "1");
+                    feComposite.SetAttribute("k3", "1");
+                    filter.AppendChild(feComposite);
+
+                    _gdi.DefsElement.AppendChild(filter);
+                }
+            }
+            else if (rop == (int)Gdi.GdiEnum.PATINVERT)
+            {
+                // TODO
+            }
+            else if (rop == (int)Gdi.GdiEnum.SRCINVERT)
+            {
+                // TODO
+            }
+            else if (rop == (int)Gdi.GdiEnum.DSTINVERT)
+            {
+                name = "DSTINVERT_FILTER";
+                System.Xml.XmlElement filter = doc.GetElementById(name);
+                if (filter == null)
+                {
+                    filter = _gdi.Document.CreateElement("filter");
+                    filter.SetAttribute("id", name);
+                    //filter.SetIdAttribute("id", true);
+
+                    System.Xml.XmlElement feColorMatrix = doc.CreateElement("feColorMatrix");
+                    feColorMatrix.SetAttribute("type", "matrix");
+                    feColorMatrix.SetAttribute("in", "BackgroundImage");
+                    feColorMatrix.SetAttribute("values", "-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0");
+                    filter.AppendChild(feColorMatrix);
+
+                    _gdi.DefsElement.AppendChild(filter);
+                }
+            }
+            else if (rop == (int)Gdi.GdiEnum.SRCAND)
+            {
+                name = "SRCAND_FILTER";
+                System.Xml.XmlElement filter = doc.GetElementById(name);
+                if (filter == null)
+                {
+                    filter = _gdi.Document.CreateElement("filter");
+                    filter.SetAttribute("id", name);
+                    //filter.setIdAttribute("id", true);
+
+                    System.Xml.XmlElement feComposite = doc.CreateElement("feComposite");
+                    feComposite.SetAttribute("in", "SourceGraphic");
+                    feComposite.SetAttribute("in2", "BackgroundImage");
+                    feComposite.SetAttribute("operator", "arithmetic");
+                    feComposite.SetAttribute("k1", "1");
+                    filter.AppendChild(feComposite);
+
+                    _gdi.DefsElement.AppendChild(filter);
+                }
+            }
+            else if (rop == (int)Gdi.GdiEnum.MERGEPAINT)
+            {
+                name = "MERGEPAINT_FILTER";
+                System.Xml.XmlElement filter = doc.GetElementById(name);
+                if (filter == null)
+                {
+                    filter = _gdi.Document.CreateElement("filter");
+                    filter.SetAttribute("id", name);
+                    //filter.setIdAttribute("id", true);
+
+                    System.Xml.XmlElement feColorMatrix = doc.CreateElement("feColorMatrix");
+                    feColorMatrix.SetAttribute("type", "matrix");
+                    feColorMatrix.SetAttribute("in", "SourceGraphic");
+                    feColorMatrix.SetAttribute("values", "-1 0 0 0 1 0 -1 0 0 1 0 0 -1 0 1 0 0 0 1 0");
+                    feColorMatrix.SetAttribute("result", "result0");
+                    filter.AppendChild(feColorMatrix);
+
+                    System.Xml.XmlElement feComposite = doc.CreateElement("feComposite");
+                    feComposite.SetAttribute("in", "result0");
+                    feComposite.SetAttribute("in2", "BackgroundImage");
+                    feComposite.SetAttribute("operator", "arithmetic");
+                    feComposite.SetAttribute("k1", "1");
+                    filter.AppendChild(feComposite);
+
+                    _gdi.DefsElement.AppendChild(filter);
+                }
+            }
+            else if (rop == (int)Gdi.GdiEnum.MERGECOPY)
+            {
+                // TODO
+            }
+            else if (rop == (int)Gdi.GdiEnum.SRCPAINT)
+            {
+                name = "SRCPAINT_FILTER";
+                System.Xml.XmlElement filter = doc.GetElementById(name);
+                if (filter == null)
+                {
+                    filter = _gdi.Document.CreateElement("filter");
+                    filter.SetAttribute("id", name);
+                    //filter.setIdAttribute("id", true);
+
+                    System.Xml.XmlElement feComposite = doc.CreateElement("feComposite");
+                    feComposite.SetAttribute("in", "SourceGraphic");
+                    feComposite.SetAttribute("in2", "BackgroundImage");
+                    feComposite.SetAttribute("operator", "arithmetic");
+                    feComposite.SetAttribute("k2", "1");
+                    feComposite.SetAttribute("k3", "1");
+                    filter.AppendChild(feComposite);
+
+                    _gdi.DefsElement.AppendChild(filter);
+                }
+            }
+            else if (rop == (int)Gdi.GdiEnum.PATCOPY)
+            {
+                // TODO
+            }
+            else if (rop == (int)Gdi.GdiEnum.PATPAINT)
+            {
+                // TODO
+            }
+            else if (rop == (int)Gdi.GdiEnum.WHITENESS)
+            {
+                name = "WHITENESS_FILTER";
+                System.Xml.XmlElement filter = doc.GetElementById(name);
+                if (filter == null)
+                {
+                    filter = _gdi.Document.CreateElement("filter");
+                    filter.SetAttribute("id", name);
+                    //filter.SetIdAttribute("id", true);
+
+                    System.Xml.XmlElement feColorMatrix = doc.CreateElement("feColorMatrix");
+                    feColorMatrix.SetAttribute("type", "matrix");
+                    feColorMatrix.SetAttribute("in", "SourceGraphic");
+                    feColorMatrix.SetAttribute("values", "1 0 0 0 1 0 1 0 0 1 0 0 1 0 1 0 0 0 1 0");
+                    filter.AppendChild(feColorMatrix);
+
+                    _gdi.DefsElement.AppendChild(filter);
+                }
+            }
+
+            if (name != null)
+            {
+                if (!doc.DocumentElement.HasAttribute("enable-background"))
+                {
+                    doc.DocumentElement.SetAttribute("enable-background", "new");
+                }
+                return "url(#" + name + ")";
+            }
+            return null;
+        }
+
+        /// <summary>
+        /// Clone this object.
+        /// </summary>
+        /// <returns></returns>
+        public object Clone()
+        {
+            return this.Clone();
+        }
+
+        /// <summary>
+        /// Returns a string that represents the current object.
+        /// </summary>
+        /// <returns></returns>
+        public override string ToString()
+        {
+            return "SvgDc [gdi=" + _gdi + ", dpi=" + _dpi + ", wx=" + _wx + ", wy="
+                    + _wy + ", ww=" + _ww + ", wh=" + _wh + ", wox=" + _wox + ", woy="
+                    + _woy + ", wsx=" + _wsx + ", wsy=" + _wsy + ", mx=" + _mx
+                    + ", my=" + _my + ", vx=" + _vx + ", vy=" + _vy + ", vw=" + _vw
+                    + ", vh=" + _vh + ", vox=" + _vox + ", voy=" + _voy + ", vsx="
+                    + _vsx + ", vsy=" + _vsy + ", cx=" + _cx + ", cy=" + _cy
+                    + ", mapMode=" + _mapMode + ", bkColor=" + _bkColor + ", bkMode="
+                    + _bkMode + ", textColor=" + _textColor + ", textSpace="
+                    + _textSpace + ", textAlign=" + _textAlign + ", textDx=" + _textDx
+                    + ", polyFillMode=" + _polyFillMode + ", relAbsMode="
+                    + _relAbsMode + ", rop2Mode=" + _rop2Mode + ", stretchBltMode="
+                    + _stretchBltMode + ", brush=" + _brush + ", font=" + _font
+                    + ", pen=" + _pen + "]";
+        }
+
+        #endregion
+    }
+}

+ 532 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgFont.cs

@@ -0,0 +1,532 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Svg
+{
+    /// <summary>
+    /// Scalable Vector Graphics - Represents a SVG Font object.
+    /// </summary>
+    public class SvgFont : SvgObject,Gdi.IGdiFont
+    {
+        #region Properties
+
+        /// <summary>
+        /// Object height.
+        /// </summary>
+        public int Height
+        {
+            get
+            {
+                return _height;
+            }
+        }
+
+        /// <summary>
+        /// Object width.
+        /// </summary>
+        public int Width
+        {
+            get
+            {
+                return _width;
+            }
+        }
+
+        /// <summary>
+        /// Object escapement.
+        /// </summary>
+        public int Escapement
+        {
+            get
+            {
+                return _escapement;
+            }
+        }
+
+        /// <summary>
+        /// Object orientation
+        /// </summary>
+        public int Orientation
+        {
+            get
+            {
+                return _orientation;
+            }
+        }
+
+        /// <summary>
+        /// Object weight.
+        /// </summary>
+        public int Weight
+        {
+            get
+            {
+                return _weight;
+            }
+        }
+
+        /// <summary>
+        /// Italic font.
+        /// </summary>
+        public bool IsItalic
+        {
+            get
+            {
+                return _italic;
+            }
+        }
+
+        /// <summary>
+        /// Underlined font.
+        /// </summary>
+        public bool IsUnderlined
+        {
+            get
+            {
+                return _underline;
+            }
+        }
+
+        /// <summary>
+        /// Striked font.
+        /// </summary>
+        public bool IsStrikedOut
+        {
+            get
+            {
+                return _strikeout;
+            }
+        }
+
+        /// <summary>
+        /// Object charset.
+        /// </summary>
+        public int Charset
+        {
+            get
+            {
+                return _charset;
+            }
+        }
+
+        /// <summary>
+        /// Object precision.
+        /// </summary>
+        public int OutPrecision
+        {
+            get
+            {
+                return _outPrecision;
+            }
+        }
+
+        /// <summary>
+        /// Object ClipPrecision.
+        /// </summary>
+        public int ClipPrecision
+        {
+            get
+            {
+                return _clipPrecision;
+            }
+        }
+
+        /// <summary>
+        /// Font quality.
+        /// </summary>
+        public int Quality
+        {
+            get
+            {
+                return _quality;
+            }
+        }
+
+        /// <summary>
+        /// Defines pitch and family.
+        /// </summary>
+        public int PitchAndFamily
+        {
+            get
+            {
+                return _pitchAndFamily;
+            }
+        }
+
+        /// <summary>
+        /// Specifies the font name.
+        /// </summary>
+        public string FaceName
+        {
+            get
+            {
+                return _faceName;
+            }
+        }
+
+        /// <summary>
+        /// Font language.
+        /// </summary>
+        public string Lang
+        {
+            get
+            {
+                return _lang;
+            }
+        }
+        
+        /// <summary>
+        /// Font size.
+        /// </summary>
+        public int FontSize
+        {
+            get
+            {
+                return Math.Abs((int)GDI.DC.ToRelativeY(_height * _heightMultiply));
+            }
+        }
+
+        #endregion
+
+        #region Local Variables
+
+        private int _height;
+        private int _width;
+        private int _escapement;
+        private int _orientation;
+        private int _weight;
+        private bool _italic;
+        private bool _underline;
+        private bool _strikeout;
+        private int _charset;
+        private int _outPrecision;
+        private int _clipPrecision;
+        private int _quality;
+        private int _pitchAndFamily;
+
+        private string _faceName;
+        private double _heightMultiply = 1.0;
+        private string _lang;
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default Constructor.
+        /// </summary>
+        /// <param name="gdi"></param>
+        /// <param name="height"></param>
+        /// <param name="width"></param>
+        /// <param name="escapement"></param>
+        /// <param name="orientation"></param>
+        /// <param name="weight"></param>
+        /// <param name="italic"></param>
+        /// <param name="underline"></param>
+        /// <param name="strikeout"></param>
+        /// <param name="charset"></param>
+        /// <param name="outPrecision"></param>
+        /// <param name="clipPrecision"></param>
+        /// <param name="quality"></param>
+        /// <param name="pitchAndFamily"></param>
+        /// <param name="faceName"></param>
+        public SvgFont(
+            SvgGdi gdi,
+            int height,
+            int width,
+            int escapement,
+            int orientation,
+            int weight,
+            bool italic,
+            bool underline,
+            bool strikeout,
+            int charset,
+            int outPrecision,
+            int clipPrecision,
+            int quality,
+            int pitchAndFamily,
+            byte[] faceName)
+            : base (gdi)
+        {
+            _height = height;
+            _width = width;
+            _escapement = escapement;
+            _orientation = orientation;
+            _weight = weight;
+            _italic = italic;
+            _underline = underline;
+            _strikeout = strikeout;
+            _charset = charset;
+            _outPrecision = outPrecision;
+            _clipPrecision = clipPrecision;
+            _quality = quality;
+            _pitchAndFamily = pitchAndFamily;
+            _faceName = WMFConverter.Gdi.GdiUtils.ConvertString(faceName, charset);
+
+            // xml:lang
+            _lang = WMFConverter.Gdi.GdiUtils.GetLanguage(charset);
+
+            string emheight = gdi.GetProperty("font-emheight." + _faceName);
+            if (emheight == null)
+            {
+                string alter = gdi.GetProperty("alternative-font." + _faceName);
+                if (alter != null)
+                {
+                    emheight = gdi.GetProperty("font-emheight." + alter);
+                }
+            }
+
+            if (emheight != null)
+            {
+                _heightMultiply = Convert.ToDouble(emheight);
+            }
+        }
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// 
+        /// </summary>
+        /// <param name="chars"></param>
+        /// <param name="dx"></param>
+        /// <returns></returns>
+        public int[] ValidateDx(byte[] chars, int[] dx)
+        {
+            if (dx == null || dx.Length == 0)
+            {
+                return null;
+            }
+
+            int[,] area = WMFConverter.Gdi.GdiUtils.GetFirstByteArea(_charset);
+            if (area == null)
+            {
+                return dx;
+            }
+
+            int n = 0;
+            bool skip = false;
+
+            for (int i = 0; i < chars.Length && i < dx.Length; i++)
+            {
+                int c = (0xFF & chars[i]);
+
+                if (skip)
+                {
+                    dx[n - 1] += dx[i];
+                    skip = false;
+                    continue;
+                }
+
+                for (int j = 0; j < area.Length; j++)
+                {
+                    if (area[j,0] <= c && c <= area[j,1])
+                    {
+                        skip = true;
+                        break;
+                    }
+                }
+
+                dx[n++] = dx[i];
+            }
+
+            int[] ndx = new int[n];
+            Array.Copy(dx, 0, ndx, 0, n);
+
+            return ndx;
+        }
+
+        /// <summary>
+        /// Serves as the default hash function.
+        /// </summary>
+        /// <returns></returns>
+        public override int GetHashCode() 
+        {
+		    int PRIME = 31;
+		    int result = 1;
+		    result = PRIME * result + _charset;
+		    result = PRIME * result + _clipPrecision;
+		    result = PRIME * result + _escapement;
+		    result = PRIME * result + ((_faceName == null) ? 0 : _faceName.GetHashCode());
+		    result = PRIME * result + _height;
+		    result = PRIME * result + (_italic ? 1231 : 1237);
+		    result = PRIME * result + _orientation;
+		    result = PRIME * result + _outPrecision;
+		    result = PRIME * result + _pitchAndFamily;
+		    result = PRIME * result + _quality;
+		    result = PRIME * result + (_strikeout ? 1231 : 1237);
+		    result = PRIME * result + (_underline ? 1231 : 1237);
+		    result = PRIME * result + _weight;
+		    result = PRIME * result + _width;
+		    return result;
+	    }
+
+        /// <summary>
+        /// Determines whether the specified object is equal to the current object.
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public override bool Equals(Object obj) 
+        {
+		    if (this == obj)
+			    return true;
+		    if (obj == null)
+			    return false;
+		    if (typeof(SvgFont) != obj.GetType())
+			    return false;
+		    SvgFont other = (SvgFont) obj;
+		    if (_charset != other._charset)
+			    return false;
+		    if (_clipPrecision != other._clipPrecision)
+			    return false;
+		    if (_escapement != other._escapement)
+			    return false;
+		    if (_faceName == null) 
+            {
+			    if (other._faceName != null)
+				    return false;
+		    } 
+            else if (!_faceName.Equals(other._faceName))
+			    return false;
+		    if (_height != other._height)
+			    return false;
+		    if (_italic != other._italic)
+			    return false;
+		    if (_orientation != other._orientation)
+			    return false;
+		    if (_outPrecision != other._outPrecision)
+			    return false;
+		    if (_pitchAndFamily != other._pitchAndFamily)
+			    return false;
+		    if (_quality != other._quality)
+			    return false;
+		    if (_strikeout != other._strikeout)
+			    return false;
+		    if (_underline != other._underline)
+			    return false;
+		    if (_weight != other._weight)
+			    return false;
+		    if (_width != other._width)
+			    return false;
+		    return true;
+	    }
+
+        /// <summary>
+        /// Create inner text element.
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public System.Xml.XmlText CreateTextNode(string id)
+        {
+            return GDI.Document.CreateTextNode("." + id + " { " + ToString() + " }\r\n");
+        }
+
+        /// <summary>
+        /// Returns a string that represents the current object.
+        /// </summary>
+        /// <returns></returns>
+        public override string ToString()
+        {
+            System.Text.StringBuilder buffer = new System.Text.StringBuilder();
+
+            // font-style
+            if (_italic)
+                buffer.Append("font-style: italic; ");
+
+            // font-weight
+            if (_weight != (int)Gdi.FontFWEnum.FW_DONTCARE && _weight != (int)Gdi.FontFWEnum.FW_NORMAL)
+            {
+                if (_weight < 100)
+                    _weight = 100;
+                else if (_weight > 900)
+                    _weight = 900;
+                else
+                    _weight = (_weight / 100) * 100;
+
+                if (_weight == (int)Gdi.FontFWEnum.FW_BOLD)
+                    buffer.Append("font-weight: bold; ");
+                else
+                    buffer.Append("font-weight: " + _weight + "; ");
+            }
+
+            int fontSize = FontSize;
+            if (fontSize != 0) 
+                buffer.Append("font-size: ").Append(fontSize).Append("px; ");
+
+            // font-family
+            List<string> fontList = new List<string>();
+            if (_faceName.Length != 0)
+            {
+                string fontFamily = _faceName;
+                if (_faceName.ElementAt(0) == '@') fontFamily = _faceName.Substring(1);
+                fontList.Add(fontFamily);
+
+                string altfont = GDI.GetProperty("alternative-font." + fontFamily);
+                if (altfont != null && altfont.Length != 0)
+                {
+                    fontList.Add(altfont);
+                }
+            }
+
+            // int pitch = pitchAndFamily & 0x00000003;
+            int family = _pitchAndFamily & 0x000000F0;
+            switch (family)
+            {
+                case (int)Gdi.FontFFEnum.FF_DECORATIVE:
+                    fontList.Add("fantasy");
+                    break;
+                case (int)Gdi.FontFFEnum.FF_MODERN:
+                    fontList.Add("monospace");
+                    break;
+                case (int)Gdi.FontFFEnum.FF_ROMAN:
+                    fontList.Add("serif");
+                    break;
+                case (int)Gdi.FontFFEnum.FF_SCRIPT:
+                    fontList.Add("cursive");
+                    break;
+                case (int)Gdi.FontFFEnum.FF_SWISS:
+                    fontList.Add("sans-serif");
+                    break;
+            }
+
+            if (fontList != null)
+                if (fontList.Count()>0)
+                {
+                    buffer.Append("font-family:");
+                    for (int i = 0; i < fontList.Count(); i ++ )
+                    {
+                        string font = fontList[i];
+                        if (font.IndexOf(" ") != -1)
+                            buffer.Append(" \"" + font + "\"");
+                        else
+                            buffer.Append(" " + font);
+
+                        if (i < fontList.Count())
+                            buffer.Append(",");
+                    }
+                    buffer.Append("; ");
+                }
+
+            // text-decoration
+            if (_underline || _strikeout)
+            {
+                buffer.Append("text-decoration:");
+                if (_underline)
+                    buffer.Append(" underline");
+                if (_strikeout)
+                    buffer.Append(" overline");
+                buffer.Append("; ");
+            }
+
+            if (buffer.Length > 0) 
+                buffer.Length = buffer.Length - 1;
+            return buffer.ToString();
+        }
+
+        #endregion
+    }
+}

Plik diff jest za duży
+ 2292 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgGdi.cs


+ 77 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgObject.cs

@@ -0,0 +1,77 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Svg
+{
+    /// <summary>
+    /// Scalable Vector Graphics - SVG base object.
+    /// </summary>
+    public abstract class SvgObject
+    {
+        #region Local Variables
+
+        private SvgGdi _gdi;
+
+        #endregion
+
+        #region Properties
+
+        /// <summary>
+        /// Gdi object instance.
+        /// </summary>
+        /// <returns></returns>
+        public SvgGdi GDI
+        {
+            get
+            {
+                return _gdi;
+            }
+        }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        /// <param name="gdi"></param>
+        public SvgObject(SvgGdi gdi)
+        {
+            _gdi = gdi;
+        }
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// Convert to real size.
+        /// </summary>
+        /// <param name="px"></param>
+        /// <returns></returns>
+        public int ToRealSize(int px)
+        {
+            return GDI.DC.Dpi * px / 90;
+        }
+
+        /// <summary>
+        /// Convert int color to rgb color.
+        /// </summary>
+        /// <param name="color"></param>
+        /// <returns></returns>
+        public static string ToColor(int color)
+        {
+            int b = (0x00FF0000 & color) >> 16;
+            int g = (0x0000FF00 & color) >> 8;
+            int r = (0x000000FF & color);
+
+            return "rgb(" + r + "," + g + "," + b + ")";
+        }
+
+        #endregion
+    }
+}

+ 67 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgPalette.cs

@@ -0,0 +1,67 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Svg
+{
+    /// <summary>
+    /// Scalable Vector Graphics - Represents a SVG Palette object.
+    /// </summary>
+    public class SvgPalette: SvgObject, Gdi.IGdiPalette
+    {
+        #region Local Variables
+
+        private int _version;
+        private int[] _entries;
+
+        #endregion
+
+        #region Properties
+
+        /// <summary>
+        /// Object version.
+        /// </summary>
+        public int Version
+        {
+            get
+            {
+                return _version;
+            }
+        }
+
+        /// <summary>
+        /// Object entries.
+        /// </summary>
+        public int[] Entries
+        {
+            get
+            {
+                return _entries;
+            }
+        }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        /// <param name="gdi"></param>
+        /// <param name="version"></param>
+        /// <param name="entries"></param>
+        public SvgPalette(
+            SvgGdi gdi,
+            int version,
+            int[] entries)
+            :base(gdi)
+        {
+            _version = version;
+            _entries = entries;
+        }
+
+        #endregion
+    }
+}

+ 50 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgPatternBrush.cs

@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Svg
+{
+    /// <summary>
+    /// Scalable Vector Graphics - Represents a SVG Pattern Brush object.
+    /// </summary>
+    public class SvgPatternBrush : SvgObject, Gdi.IGdiPatternBrush
+    {
+        #region Local Variables
+
+        private byte[] _bmp;
+
+        #endregion
+
+        #region Properties
+
+        /// <summary>
+        /// Object patterns
+        /// </summary>
+        public byte[] Pattern
+        {
+            get
+            {
+                return _bmp;
+            }
+        }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        /// <param name="gdi"></param>
+        /// <param name="bmp"></param>
+        public SvgPatternBrush(SvgGdi gdi, byte[] bmp)
+            : base(gdi)
+        {
+            _bmp = bmp;
+        }
+
+        #endregion
+    }
+}

+ 205 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgPen.cs

@@ -0,0 +1,205 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Svg
+{
+    /// <summary>
+    /// Scalable Vector Graphics - Represents a Pen object.
+    /// </summary>
+    public class SvgPen: SvgObject,Gdi.IGdiPen
+    {
+        #region Local Variables
+
+        private int _style;
+        private int _width;
+        private int _color;
+
+        #endregion
+
+        #region Properties
+
+        /// <summary>
+        /// Object style.
+        /// </summary>
+        public int Style
+        {
+            get
+            {
+                return _style;
+            }
+        }
+
+        /// <summary>
+        /// Object width.
+        /// </summary>
+        public int Width
+        {
+            get
+            {
+                return _width;
+            }
+        }
+
+        /// <summary>
+        /// Object color.
+        /// </summary>
+        public int Color
+        {
+            get
+            {
+                return _color;
+            }
+        }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Construdor padrão.
+        /// </summary>
+        /// <param name="gdi"></param>
+        /// <param name="style"></param>
+        /// <param name="width"></param>
+        /// <param name="color"></param>
+        public SvgPen(
+            SvgGdi gdi,
+            int style,
+            int width,
+            int color)
+            :base(gdi)
+        {
+            _style = style;
+            _width = (width > 0) ? width : 1;
+            _color = color;
+        }
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// Serves as the default hash function.
+        /// </summary>
+        /// <returns></returns>
+        public override int GetHashCode() 
+        {
+		    int PRIME = 31;
+		    int result = 1;
+		    result = PRIME * result + _color;
+		    result = PRIME * result + _style;
+		    result = PRIME * result + _width;
+		    return result;
+	    }
+
+        /// <summary>
+        /// Determines whether the specified object is equal to the current object.
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public override bool Equals(Object obj) 
+        {
+		    if (this == obj)
+			    return true;
+		    if (obj == null)
+			    return false;
+		    if (typeof(SvgPen) != obj.GetType())
+			    return false;
+		    SvgPen other = (SvgPen) obj;
+		    if (_color != other._color)
+			    return false;
+		    if (_style != other._style)
+			    return false;
+		    if (_width != other._width)
+			    return false;
+		    return true;
+	    }
+
+        /// <summary>
+        /// Create inner text element.
+        /// </summary>
+        /// <param name="id"></param>
+        /// <returns></returns>
+        public System.Xml.XmlText CreateTextNode(String id)
+        {
+            return GDI.Document.CreateTextNode("." + id + " { " + ToString() + " }\r\n");
+        }
+
+        /// <summary>
+        /// Returns a string that represents the current object.
+        /// </summary>
+        /// <returns></returns>
+        public override string ToString()
+        {
+            System.Text.StringBuilder buffer = new System.Text.StringBuilder();
+
+            if (_style == (int)Gdi.PenPSEnum.PS_NULL)
+            {
+                buffer.Append("stroke: none; ");
+            }
+            else
+            {
+                // stroke
+                buffer.Append("stroke: " + ToColor(_color) + "; ");
+
+                // stroke-width
+                buffer.Append("stroke-width: " + _width + "; ");
+
+                // stroke-linejoin
+                buffer.Append("stroke-linejoin: round; ");
+
+                // stroke-dasharray
+                if (_width == 1 && (int)Gdi.PenPSEnum.PS_DASH <= _style && _style <= (int)Gdi.PenPSEnum.PS_DASHDOTDOT)
+                {
+                    buffer.Append("stroke-dasharray: ");
+                    switch (_style)
+                    {
+                        case (int)Gdi.PenPSEnum.PS_DASH:
+                            buffer.Append(
+                                "" + ToRealSize(18) + "," + ToRealSize(6));
+                            break;
+                        case (int)Gdi.PenPSEnum.PS_DOT:
+                            buffer.Append("" + ToRealSize(3) + "," + ToRealSize(3));
+                            break;
+                        case (int)Gdi.PenPSEnum.PS_DASHDOT:
+                            buffer.Append(
+                                ""
+                                    + ToRealSize(9)
+                                    + ","
+                                    + ToRealSize(3)
+                                    + ","
+                                    + ToRealSize(3)
+                                    + ","
+                                    + ToRealSize(3));
+                            break;
+                        case (int)Gdi.PenPSEnum.PS_DASHDOTDOT:
+                            buffer.Append(
+                                ""
+                                    + ToRealSize(9)
+                                    + ","
+                                    + ToRealSize(3)
+                                    + ","
+                                    + ToRealSize(3)
+                                    + ","
+                                    + ToRealSize(3)
+                                    + ","
+                                    + ToRealSize(3)
+                                    + ","
+                                    + ToRealSize(3));
+                            break;
+                    }
+                    buffer.Append("; ");
+                }
+            }
+
+            if (buffer.Length > 0) 
+                buffer.Length = buffer.Length - 1;
+            return buffer.ToString();
+        }
+
+        #endregion
+    }
+}

+ 149 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgRectRegion.cs

@@ -0,0 +1,149 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Svg
+{
+    /// <summary>
+    /// Scalable Vector Graphics - Represents SVG Rect Region object.
+    /// </summary>
+    public class SvgRectRegion : SvgRegion
+    {
+        #region Local Variables
+
+        private int _left;
+        private int _top;
+        private int _right;
+        private int _bottom;
+
+        #endregion
+
+        #region Properties
+
+        /// <summary>
+        /// Left value.
+        /// </summary>
+        public int Left
+        {
+            get
+            {
+                return _left;
+            }
+        }
+
+        /// <summary>
+        /// Top value.
+        /// </summary>
+        public int Top
+        {
+            get
+            {
+                return _top;
+            }
+        }
+
+        /// <summary>
+        /// Right value.
+        /// </summary>
+        public int Right
+        {
+            get
+            {
+                return _right;
+            }
+        }
+
+        /// <summary>
+        /// Bottom value.
+        /// </summary>
+        public int Bottom
+        {
+            get
+            {
+                return _bottom;
+            }
+        }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        /// <param name="gdi"></param>
+        /// <param name="left"></param>
+        /// <param name="top"></param>
+        /// <param name="right"></param>
+        /// <param name="bottom"></param>
+        public SvgRectRegion(SvgGdi gdi, int left, int top, int right, int bottom)
+            : base(gdi)
+        {
+            _left = left;
+            _top = top;
+            _right = right;
+            _bottom = bottom;
+        }
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// Create rect element.
+        /// </summary>
+        /// <returns></returns>
+        public override System.Xml.XmlElement CreateElement()
+        {
+            System.Xml.XmlElement elem = GDI.Document.CreateElement("rect");
+            elem.SetAttribute("x", "" + (int)GDI.DC.ToAbsoluteX(Left));
+            elem.SetAttribute("y", "" + (int)GDI.DC.ToAbsoluteY(Top));
+            elem.SetAttribute("width", "" + (int)GDI.DC.ToRelativeX(Right - Left));
+            elem.SetAttribute("height", "" + (int)GDI.DC.ToRelativeY(Bottom - Top));
+            return elem;
+        }
+
+        /// <summary>
+        /// Serves as the default hash function.
+        /// </summary>
+        /// <returns></returns>
+        public override int GetHashCode() {
+		    int prime = 31;
+		    int result = 1;
+		    result = prime * result + _bottom;
+		    result = prime * result + _left;
+		    result = prime * result + _right;
+		    result = prime * result + _top;
+		    return result;
+	    }
+
+        /// <summary>
+        /// Determines whether the specified object is equal to the current object.
+        /// </summary>
+        /// <param name="obj"></param>
+        /// <returns></returns>
+        public override bool Equals(Object obj)
+        {
+            if (this == obj)
+                return true;
+            if (obj == null)
+                return false;
+            if (typeof(SvgRectRegion) != obj.GetType())
+                return false;
+            SvgRectRegion other = (SvgRectRegion)obj;
+            if (_bottom != other._bottom)
+                return false;
+            if (_left != other._left)
+                return false;
+            if (_right != other._right)
+                return false;
+            if (_top != other._top)
+                return false;
+            return true;
+        }
+
+        #endregion
+    }
+}

+ 38 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Svg/SvgRegion.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Svg
+{
+    /// <summary>
+    /// 
+    /// </summary>
+    public abstract class SvgRegion : SvgObject, Gdi.IGdiRegion
+    {
+        #region Constructors
+
+        /// <summary>
+        /// Default Constructor.
+        /// </summary>
+        /// <param name="gdi"></param>
+        public SvgRegion(SvgGdi gdi)
+            : base(gdi)
+        {
+
+        }
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// Create element - abstract method.
+        /// </summary>
+        /// <returns></returns>
+        public abstract System.Xml.XmlElement CreateElement();
+
+        #endregion
+    }
+}

+ 84 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Util/Base64.cs

@@ -0,0 +1,84 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Util
+{
+    /// <summary>
+    /// Base 64 encode
+    /// </summary>
+    public class Base64
+    {
+        #region Local Variables
+
+        private static char[] ENCODE_DATA = {
+		    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H',
+		    'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
+		    'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
+		    'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
+		    'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+		    'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
+		    'w', 'x', 'y', 'z', '0', '1', '2', '3',
+		    '4', '5', '6', '7', '8', '9', '+', '/' 
+	    };
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// Encode byte array.
+        /// </summary>
+        /// <param name="data"></param>
+        /// <returns></returns>
+	    public static string Encode(byte[] data) 
+        {
+		    char[] buffer = null;
+
+		    if (data.Length % 3 == 0) 
+			    buffer = new char[data.Length / 3 * 4];
+		    else 
+			    buffer = new char[(data.Length / 3 + 1) * 4];
+		    
+
+		    int buf = 0;
+		    for (int i = 0; i < data.Length; i++) 
+            {
+			    switch (i % 3) 
+                {
+				    case 0 :
+					    buffer[i / 3 * 4] = ENCODE_DATA[(data[i] & 0xFC) >> 2];
+					    buf = (data[i] & 0x03) << 4;
+					    if (i + 1 == data.Length) 
+                        {
+						    buffer[i / 3 * 4 + 1] = ENCODE_DATA[buf];
+						    buffer[i / 3 * 4 + 2] = '=';
+						    buffer[i / 3 * 4 + 3] = '=';
+					    }
+					    break;
+				    case 1 :
+					    buf += (data[i] & 0xF0) >> 4;
+					    buffer[i / 3 * 4 + 1] = ENCODE_DATA[buf];
+					    buf = (data[i] & 0x0F) << 2;
+					    if (i + 1 == data.Length) 
+                        {
+						    buffer[i / 3 * 4 + 2] = ENCODE_DATA[buf];
+						    buffer[i / 3 * 4 + 3] = '=';
+					    }
+					    break;
+				    case 2 :
+					    buf += (data[i] & 0xC0) >> 6;
+					    buffer[i / 3 * 4 + 2] = ENCODE_DATA[buf];
+					    buffer[i / 3 * 4 + 3] = ENCODE_DATA[data[i] & 0x3F];
+					    break;
+			    }
+		    }
+
+		    return new string(buffer);
+        }
+
+        #endregion
+    }
+}

+ 15 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Util/ImageUtil.cs

@@ -0,0 +1,15 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Util
+{
+    
+    public class ImageUtil
+    {
+       //Not implemented.
+	
+    }
+}

+ 74 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfBrush.cs

@@ -0,0 +1,74 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Wmf
+{
+    /// <summary>
+    /// Windows Metafile - Represents WMF Brush object.
+    /// </summary>
+    public class WmfBrush : WmfObject, Gdi.IGdiBrush
+    {
+        #region Local Variables
+
+        private int _style;
+        private int _color;
+        private int _hatch;
+
+        #endregion
+
+        #region Properties
+
+        /// <summary>
+        /// Object Style.
+        /// </summary>
+        public int Style
+        {
+            get
+            {
+                return _style;
+            }
+        }
+
+        /// <summary>
+        /// Object Color.
+        /// </summary>
+        public int Color
+        {
+            get
+            {
+                return _color;
+            }
+        }
+
+        /// <summary>
+        /// Object Hatch.
+        /// </summary>
+        public int Hatch
+        {
+            get
+            {
+                return _hatch;
+            }
+        }
+
+        /// <summary>
+        /// Default Constructor
+        /// </summary>
+        /// <param name="id"></param>
+        /// <param name="style"></param>
+        /// <param name="color"></param>
+        /// <param name="hatch"></param>
+        public WmfBrush(int id, int style, int color, int hatch)
+            :base (id)
+        {
+            _style = style;
+            _color = color;
+            _hatch = hatch;
+        }
+
+        #endregion
+    }
+}

+ 85 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfConstants.cs

@@ -0,0 +1,85 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Wmf
+{
+    /// <summary>
+    /// Constants Enum.
+    /// </summary>
+    public enum WmfConstants
+    {
+         RECORD_EOF = 0x0000,
+         RECORD_REALIZE_PALETTE = 0x0035,
+         RECORD_SET_PALETTE_ENTRIES = 0x0037,
+         RECORD_SET_BK_MODE = 0x0102,
+         RECORD_SET_MAP_MODE = 0x0103,
+         RECORD_SET_ROP2 = 0x0104,
+         RECORD_SET_REL_ABS = 0x0105,
+         RECORD_SET_POLY_FILL_MODE = 0x0106,
+         RECORD_SET_STRETCH_BLT_MODE = 0x0107,
+         RECORD_SET_TEXT_CHARACTER_EXTRA = 0x0108,
+         RECORD_RESTORE_DC = 0x0127,
+         RECORD_RESIZE_PALETTE = 0x0139,
+         RECORD_DIB_CREATE_PATTERN_BRUSH = 0x0142,
+         RECORD_SET_LAYOUT = 0x0149,
+         RECORD_SET_BK_COLOR = 0x0201,
+         RECORD_SET_TEXT_COLOR = 0x0209,
+         RECORD_OFFSET_VIEWPORT_ORG_EX = 0x0211,
+         RECORD_LINE_TO = 0x0213,
+         RECORD_MOVE_TO_EX = 0x0214,
+         RECORD_OFFSET_CLIP_RGN = 0x0220,
+         RECORD_FILL_RGN = 0x0228,
+         RECORD_SET_MAPPER_FLAGS = 0x0231,
+         RECORD_SELECT_PALETTE = 0x0234,
+         RECORD_POLYGON = 0x0324,
+         RECORD_POLYLINE = 0x0325,
+         RECORD_SET_TEXT_JUSTIFICATION = 0x020A,
+         RECORD_SET_WINDOW_ORG_EX = 0x020B,
+         RECORD_SET_WINDOW_EXT_EX = 0x020C,
+         RECORD_SET_VIEWPORT_ORG_EX = 0x020D,
+         RECORD_SET_VIEWPORT_EXT_EX = 0x020E,
+         RECORD_OFFSET_WINDOW_ORG_EX = 0x020F,
+         RECORD_SCALE_WINDOW_EXT_EX = 0x0410,
+         RECORD_SCALE_VIEWPORT_EXT_EX = 0x0412,
+         RECORD_EXCLUDE_CLIP_RECT = 0x0415,
+         RECORD_INTERSECT_CLIP_RECT = 0x0416,
+         RECORD_ELLIPSE = 0x0418,
+         RECORD_FLOOD_FILL = 0x0419,
+         RECORD_FRAME_RGN = 0x0429,
+         RECORD_ANIMATE_PALETTE = 0x0436,
+         RECORD_TEXT_OUT = 0x0521,
+         RECORD_POLY_POLYGON = 0x0538,
+         RECORD_EXT_FLOOD_FILL = 0x0548,
+         RECORD_RECTANGLE = 0x041B,
+         RECORD_SET_PIXEL = 0x041F,
+         RECORD_ROUND_RECT = 0x061C,
+         RECORD_PAT_BLT = 0x061D,
+         RECORD_SAVE_DC = 0x001E,
+         RECORD_PIE = 0x081A,
+         RECORD_STRETCH_BLT = 0x0B23,
+         RECORD_ESCAPE = 0x0626,
+         RECORD_INVERT_RGN = 0x012A,
+         RECORD_PAINT_RGN = 0x012B,
+         RECORD_SELECT_CLIP_RGN = 0x012C,
+         RECORD_SELECT_OBJECT = 0x012D,
+         RECORD_SET_TEXT_ALIGN = 0x012E,
+         RECORD_ARC = 0x0817,
+         RECORD_CHORD = 0x0830,
+         RECORD_BIT_BLT = 0x0922,
+         RECORD_EXT_TEXT_OUT = 0x0a32,
+         RECORD_SET_DIBITS_TO_DEVICE = 0x0d33,
+         RECORD_DIB_BIT_BLT = 0x0940,
+         RECORD_DIB_STRETCH_BLT = 0x0b41,
+         RECORD_STRETCH_DIBITS = 0x0f43,
+         RECORD_DELETE_OBJECT = 0x01f0,
+         RECORD_CREATE_PALETTE = 0x00f7,
+         RECORD_CREATE_PATTERN_BRUSH = 0x01F9,
+         RECORD_CREATE_PEN_INDIRECT = 0x02FA,
+         RECORD_CREATE_FONT_INDIRECT = 0x02FB,
+         RECORD_CREATE_BRUSH_INDIRECT = 0x02FC,
+         RECORD_CREATE_RECT_RGN = 0x06FF,
+    }
+}

+ 250 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfFont.cs

@@ -0,0 +1,250 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Wmf
+{
+    /// <summary>
+    /// Windows Metafile - Represents WMF Font object.
+    /// </summary>
+    public class WmfFont : WmfObject, Gdi.IGdiFont
+    {
+        #region Local Variables
+
+        private int _height;
+        private int _width;
+        private int _escapement;
+        private int _orientation;
+        private int _weight;
+        private bool _italic;
+        private bool _underline;
+        private bool _strikeout;
+        private int _charset;
+        private int _outPrecision;
+        private int _clipPrecision;
+        private int _quality;
+        private int _pitchAndFamily;
+
+        private string _faceName;
+
+        #endregion
+
+        #region Properties
+
+        /// <summary>
+        /// Object Height.
+        /// </summary>
+        public int Height
+        {
+            get
+            {
+                return _height;
+            }
+        }
+
+        /// <summary>
+        /// Object Width.
+        /// </summary>
+        public int Width
+        {
+            get
+            {
+                return _width;
+            }
+        }
+
+        /// <summary>
+        /// Object Escapement.
+        /// </summary>
+        public int Escapement
+        {
+            get
+            {
+                return _escapement;
+            }
+        }
+
+        /// <summary>
+        /// Object Orientation.
+        /// </summary>
+        public int Orientation
+        {
+            get
+            {
+                return _orientation;
+            }
+        }
+
+        /// <summary>
+        /// Object Weight.
+        /// </summary>
+        public int Weight
+        {
+            get
+            {
+                return _weight;
+            }
+        }
+
+        /// <summary>
+        /// Defines whether the font is italic.
+        /// </summary>
+        public bool IsItalic
+        {
+            get
+            {
+                return _italic;
+            }
+        }
+
+        /// <summary>
+        /// Defines whether the font is underlined.
+        /// </summary>
+        public bool IsUnderlined
+        {
+            get
+            {
+                return _underline;
+            }
+        }
+
+        /// <summary>
+        /// Defines whether the font is striked.
+        /// </summary>
+        public bool IsStrikedOut
+        {
+            get
+            {
+                return _strikeout;
+            }
+        }
+
+        /// <summary>
+        /// Defines the font charset.
+        /// </summary>
+        public int Charset
+        {
+            get
+            {
+                return _charset;
+            }
+        }
+
+        /// <summary>
+        /// Defines the font out precision.
+        /// </summary>
+        public int OutPrecision
+        {
+            get
+            {
+                return _outPrecision;
+            }
+        }
+
+        /// <summary>
+        /// Defines the clip precision.
+        /// </summary>
+        public int ClipPrecision
+        {
+            get
+            {
+                return _clipPrecision;
+            }
+        }
+
+        /// <summary>
+        /// Object quality.
+        /// </summary>
+        public int Quality
+        {
+            get
+            {
+                return _quality;
+            }
+        }
+
+        /// <summary>
+        /// Defines pitch and famility font.
+        /// </summary>
+        public int PitchAndFamily
+        {
+            get
+            {
+                return _pitchAndFamily;
+            }
+        }
+
+        /// <summary>
+        /// Defines face name rules.
+        /// </summary>
+        public string FaceName
+        {
+            get
+            {
+                return _faceName;
+            }
+        }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default Constructor.
+        /// </summary>
+        /// <param name="id"></param>
+        /// <param name="height"></param>
+        /// <param name="width"></param>
+        /// <param name="escapement"></param>
+        /// <param name="orientation"></param>
+        /// <param name="weight"></param>
+        /// <param name="italic"></param>
+        /// <param name="underline"></param>
+        /// <param name="strikeout"></param>
+        /// <param name="charset"></param>
+        /// <param name="outPrecision"></param>
+        /// <param name="clipPrecision"></param>
+        /// <param name="quality"></param>
+        /// <param name="pitchAndFamily"></param>
+        /// <param name="faceName"></param>
+        public WmfFont(int id,
+            int height,
+            int width,
+            int escapement,
+            int orientation,
+            int weight,
+            bool italic,
+            bool underline,
+            bool strikeout,
+            int charset,
+            int outPrecision,
+            int clipPrecision,
+            int quality,
+            int pitchAndFamily,
+            byte[] faceName)
+            : base (id)
+        {
+
+            _height = height;
+            _width = width;
+            _escapement = escapement;
+            _orientation = orientation;
+            _weight = weight;
+            _italic = italic;
+            _underline = underline;
+            _strikeout = strikeout;
+            _charset = charset;
+            _outPrecision = outPrecision;
+            _clipPrecision = clipPrecision;
+            _quality = quality;
+            _pitchAndFamily = pitchAndFamily;
+            _faceName = WMFConverter.Gdi.GdiUtils.ConvertString(faceName, charset);
+        }
+
+        #endregion
+
+       
+    }
+}

Plik diff jest za duży
+ 1647 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfGdi.cs


+ 49 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfObject.cs

@@ -0,0 +1,49 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Wmf
+{
+    /// <summary>
+    /// Windows Metafile - Represents WMF Object base
+    /// </summary>
+    public class WmfObject : Gdi.IGdiObject
+    {
+        #region Local Variables
+
+        public int _id;
+
+        #endregion
+
+        #region Properties
+
+        /// <summary>
+        /// Object Id.
+        /// </summary>
+        public int Id
+        {
+            get
+            {
+                return _id;
+            }
+        }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        /// <param name="id"></param>
+        public WmfObject(int id)
+        {
+            _id = id;
+        }
+
+        #endregion
+       
+    }
+}

+ 65 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfPalette.cs

@@ -0,0 +1,65 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Wmf
+{
+    /// <summary>
+    /// Windows Metafile - Represents WMF Palette object.
+    /// </summary>
+    public class WmfPalette: WmfObject, Gdi.IGdiPalette
+    {
+        #region Local Variables
+
+        private int _version;
+        private int[] _entries;
+
+        #endregion
+
+        #region Properties
+
+        /// <summary>
+        /// Object version.
+        /// </summary>
+        public int Version
+        {
+            get
+            {
+                return _version;
+            }
+        }
+
+        /// <summary>
+        /// Object entries.
+        /// </summary>
+        public int[] Entries
+        {
+            get
+            {
+                return _entries;
+            }
+        }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        /// <param name="id"></param>
+        /// <param name="version"></param>
+        /// <param name="entries"></param>
+        public WmfPalette(int id, int version, int[] entries)
+            : base(id)
+        {
+            _version = version;
+            _entries = entries;
+        }
+
+        #endregion
+
+    }
+}

+ 30 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfParseException.cs

@@ -0,0 +1,30 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Wmf
+{
+    public class WmfParseException : Exception
+    {
+        public WmfParseException()
+            :base()
+        {
+
+        }
+
+        public WmfParseException(String message)
+            : base(message)
+        {
+
+        }
+
+        public WmfParseException(String message, Exception t)
+            : base(message,t)
+        {
+
+        }
+
+    }
+}

+ 821 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfParser.cs

@@ -0,0 +1,821 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Wmf
+{
+    /// <summary>
+    /// Windows Metafile - Parse WMF to SVG 
+    /// </summary>
+    public class WmfParser
+    {
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        public WmfParser()
+        {
+        }
+
+        #endregion
+
+        #region Public Methods
+
+        /// <summary>
+        /// Parse WMF file to SVG file.
+        /// </summary>
+        /// <param name="stream"></param>
+        /// <param name="gdi"></param>
+        public void Parse(System.IO.Stream stream, Gdi.IGdi gdi) 
+        {
+            WMFConverter.IO.DataInput binReader = null;
+            bool isEmpty = true;
+
+            try
+            {
+                binReader = new WMFConverter.IO.DataInput(stream, true);
+
+                int mtType = 0;
+                int mtHeaderSize = 0;
+
+                long key = binReader.ReadUint32();
+                isEmpty = false;
+                if (key == -1698247209)//0x9AC6CDD7)
+                {
+                    int hmf = binReader.ReadInt16();
+                    int vsx = binReader.ReadInt16();
+                    int vsy = binReader.ReadInt16();
+                    int vex = binReader.ReadInt16();
+                    int vey = binReader.ReadInt16();
+                    int dpi = binReader.ReadUint16();
+                    long reserved = binReader.ReadUint32();
+                    int checksum = binReader.ReadUint16();
+
+                    gdi.PlaceableHeader(vsx, vsy, vex, vey, dpi);
+
+                    mtType = binReader.ReadUint16();
+                    mtHeaderSize = binReader.ReadUint16();
+                }
+                else
+                {
+                    mtType = (int)(key & 0x0000FFFF);
+                    mtHeaderSize = (int)((key & 0xFFFF0000) >> 16);
+                }
+
+                int mtVersion = binReader.ReadUint16();
+                long mtSize = binReader.ReadUint32();
+                int mtNoObjects = binReader.ReadUint16();
+                long mtMaxRecord = binReader.ReadUint32();
+                int mtNoParameters = binReader.ReadUint16();
+
+                if (mtType != 1 || mtHeaderSize != 9)
+                {
+                    throw new WmfParseException("invalid file format.");
+                }
+
+                gdi.Header();
+
+                WMFConverter.Gdi.IGdiObject[] objs = new WMFConverter.Gdi.IGdiObject[mtNoObjects];
+
+                while (true)
+                {
+                    int size = (int)binReader.ReadUint32() - 3;
+                    int id = binReader.ReadUint16();
+
+                    if (id == (int)WmfConstants.RECORD_EOF)
+                        break; // Last record
+
+                    binReader.Count = 0;
+
+                    switch (id)
+                    {
+                        case (int)WmfConstants.RECORD_REALIZE_PALETTE:
+                            gdi.RealizePalette();
+                            break;
+                        case (int)WmfConstants.RECORD_SET_PALETTE_ENTRIES:
+                            {
+                                int[] entries = new int[binReader.ReadUint16()];
+                                int startIndex = binReader.ReadUint16();
+                                int objID = binReader.ReadUint16();
+                                for (int i = 0; i < entries.Length; i++)
+                                    entries[i] = binReader.ReadInt32();
+                                gdi.SetPaletteEntries((Gdi.IGdiPalette)objs[objID], startIndex, entries);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_BK_MODE:
+                            {
+                                int mode = binReader.ReadInt16();
+                                gdi.SetBkMode(mode);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_MAP_MODE:
+                            {
+                                int mode = binReader.ReadInt16();
+                                gdi.SetMapMode(mode);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_ROP2:
+                            {
+                                int mode = binReader.ReadInt16();
+                                gdi.SetROP2(mode);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_REL_ABS:
+                            {
+                                int mode = binReader.ReadInt16();
+                                gdi.SetRelAbs(mode);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_POLY_FILL_MODE:
+                            {
+                                int mode = binReader.ReadInt16();
+                                gdi.SetPolyFillMode(mode);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_STRETCH_BLT_MODE:
+                            {
+                                int mode = binReader.ReadInt16();
+                                gdi.SetStretchBltMode(mode);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_TEXT_CHARACTER_EXTRA:
+                            {
+                                int extra = binReader.ReadInt16();
+                                gdi.SetTextCharacterExtra(extra);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_RESTORE_DC:
+                            {
+                                int dc = binReader.ReadInt16();
+                                gdi.RestoreDC(dc);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_RESIZE_PALETTE:
+                            {
+                                int objID = binReader.ReadUint16();
+                                gdi.ResizePalette((Gdi.IGdiPalette)objs[objID]);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_DIB_CREATE_PATTERN_BRUSH:
+                            {
+                                int usage = binReader.ReadInt32();
+                                byte[] image = binReader.ReadBytes(size * 2 - binReader.Count);
+
+                                for (int i = 0; i < objs.Length; i++)
+                                {
+                                    if (objs[i] == null)
+                                    {
+                                        objs[i] = gdi.DibCreatePatternBrush(image, usage);
+                                        break;
+                                    }
+                                }
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_LAYOUT:
+                            {
+                                long layout = binReader.ReadUint32();
+                                gdi.SetLayout(layout);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_BK_COLOR:
+                            {
+                                int color = binReader.ReadInt32();
+                                gdi.SetBkColor(color);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_TEXT_COLOR:
+                            {
+                                int color = binReader.ReadInt32();
+                                gdi.SetTextColor(color);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_OFFSET_VIEWPORT_ORG_EX:
+                            {
+                                int y = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                gdi.OffsetViewportOrgEx(x, y, null);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_LINE_TO:
+                            {
+                                int ey = binReader.ReadInt16();
+                                int ex = binReader.ReadInt16();
+                                gdi.LineTo(ex, ey);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_MOVE_TO_EX:
+                            {
+                                int y = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                gdi.MoveToEx(x, y, null);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_OFFSET_CLIP_RGN:
+                            {
+                                int y = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                gdi.OffsetClipRgn(x, y);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_FILL_RGN:
+                            {
+                                int brushID = binReader.ReadUint16();
+                                int rgnID = binReader.ReadUint16();
+                                gdi.FillRgn((Gdi.IGdiRegion)objs[rgnID], (Gdi.IGdiBrush)objs[brushID]);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_MAPPER_FLAGS:
+                            {
+                                long flag = binReader.ReadUint32();
+                                gdi.SetMapperFlags(flag);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SELECT_PALETTE:
+                            {
+                                bool mode = (binReader.ReadInt16() != 0);
+                                if ((size * 2 - binReader.Count) > 0)
+                                {
+                                    int objID = binReader.ReadUint16();
+                                    gdi.SelectPalette((Gdi.IGdiPalette)objs[objID], mode);
+                                }
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_POLYGON:
+                            {
+                                WMFConverter.Gdi.Point[] points = new WMFConverter.Gdi.Point[binReader.ReadInt16()];
+                                for (int i = 0; i < points.Length; i++)
+                                    points[i] = new WMFConverter.Gdi.Point(binReader.ReadInt16(), binReader.ReadInt16());
+
+                                gdi.Polygon(points);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_POLYLINE:
+                            {
+                                WMFConverter.Gdi.Point[] points = new WMFConverter.Gdi.Point[binReader.ReadInt16()];
+                                for (int i = 0; i < points.Length; i++)
+                                    points[i] = new WMFConverter.Gdi.Point(binReader.ReadInt16(), binReader.ReadInt16());
+
+                                gdi.Polyline(points);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_TEXT_JUSTIFICATION:
+                            {
+                                int breakCount = binReader.ReadInt16();
+                                int breakExtra = binReader.ReadInt16();
+                                gdi.SetTextJustification(breakExtra, breakCount);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_WINDOW_ORG_EX:
+                            {
+                                int y = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                gdi.SetWindowOrgEx(x, y, null);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_WINDOW_EXT_EX:
+                            {
+                                int height = binReader.ReadInt16();
+                                int width = binReader.ReadInt16();
+                                gdi.SetWindowExtEx(width, height, null);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_VIEWPORT_ORG_EX:
+                            {
+                                int y = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                gdi.SetViewportOrgEx(x, y, null);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_VIEWPORT_EXT_EX:
+                            {
+                                int y = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                gdi.SetViewportExtEx(x, y, null);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_OFFSET_WINDOW_ORG_EX:
+                            {
+                                int y = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                gdi.OffsetWindowOrgEx(x, y, null);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SCALE_WINDOW_EXT_EX:
+                            {
+                                int yd = binReader.ReadInt16();
+                                int y = binReader.ReadInt16();
+                                int xd = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                gdi.ScaleWindowExtEx(x, xd, y, yd, null);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SCALE_VIEWPORT_EXT_EX:
+                            {
+                                int yd = binReader.ReadInt16();
+                                int y = binReader.ReadInt16();
+                                int xd = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                gdi.ScaleViewportExtEx(x, xd, y, yd, null);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_EXCLUDE_CLIP_RECT:
+                            {
+                                int ey = binReader.ReadInt16();
+                                int ex = binReader.ReadInt16();
+                                int sy = binReader.ReadInt16();
+                                int sx = binReader.ReadInt16();
+                                gdi.ExcludeClipRect(sx, sy, ex, ey);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_INTERSECT_CLIP_RECT:
+                            {
+                                int ey = binReader.ReadInt16();
+                                int ex = binReader.ReadInt16();
+                                int sy = binReader.ReadInt16();
+                                int sx = binReader.ReadInt16();
+                                gdi.IntersectClipRect(sx, sy, ex, ey);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_ELLIPSE:
+                            {
+                                int ey = binReader.ReadInt16();
+                                int ex = binReader.ReadInt16();
+                                int sy = binReader.ReadInt16();
+                                int sx = binReader.ReadInt16();
+                                gdi.Ellipse(sx, sy, ex, ey);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_FLOOD_FILL:
+                            {
+                                int color = binReader.ReadInt32();
+                                int y = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                gdi.FloodFill(x, y, color);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_FRAME_RGN:
+                            {
+                                int height = binReader.ReadInt16();
+                                int width = binReader.ReadInt16();
+                                int brushID = binReader.ReadUint16();
+                                int rgnID = binReader.ReadUint16();
+                                gdi.FrameRgn((Gdi.IGdiRegion)objs[rgnID], (Gdi.IGdiBrush)objs[brushID], width, height);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_ANIMATE_PALETTE:
+                            {
+                                int[] entries = new int[binReader.ReadUint16()];
+                                int startIndex = binReader.ReadUint16();
+                                int objID = binReader.ReadUint16();
+                                for (int i = 0; i < entries.Length; i++)
+                                    entries[i] = binReader.ReadInt32();
+
+                                gdi.AnimatePalette((Gdi.IGdiPalette)objs[objID], startIndex, entries);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_TEXT_OUT:
+                            {
+                                int count = binReader.ReadInt16();
+                                byte[] text = binReader.ReadBytes(count);
+                                if (count % 2 == 1)
+                                {
+                                    binReader.ReadByte();
+                                }
+                                int y = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                gdi.TextOut(x, y, text);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_POLY_POLYGON:
+                            {
+                                WMFConverter.Gdi.Point[][] points = new WMFConverter.Gdi.Point[binReader.ReadInt16()][];
+                                for (int i = 0; i < points.Length; i++)
+                                    points[i] = new WMFConverter.Gdi.Point[binReader.ReadInt16()];
+
+                                for (int i = 0; i < points.Length; i++)
+                                    for (int j = 0; j < points[i].Length; j++)
+                                        points[i][j] = new WMFConverter.Gdi.Point(binReader.ReadInt16(), binReader.ReadInt16());
+
+
+                                gdi.PolyPolygon(points);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_EXT_FLOOD_FILL:
+                            {
+                                int type = binReader.ReadUint16();
+                                int color = binReader.ReadInt32();
+                                int y = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                gdi.ExtFloodFill(x, y, color, type);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_RECTANGLE:
+                            {
+                                int ey = binReader.ReadInt16();
+                                int ex = binReader.ReadInt16();
+                                int sy = binReader.ReadInt16();
+                                int sx = binReader.ReadInt16();
+                                gdi.Rectangle(sx, sy, ex, ey);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_PIXEL:
+                            {
+                                int color = binReader.ReadInt32();
+                                int y = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                gdi.SetPixel(x, y, color);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_ROUND_RECT:
+                            {
+                                int rh = binReader.ReadInt16();
+                                int rw = binReader.ReadInt16();
+                                int ey = binReader.ReadInt16();
+                                int ex = binReader.ReadInt16();
+                                int sy = binReader.ReadInt16();
+                                int sx = binReader.ReadInt16();
+                                gdi.RoundRect(sx, sy, ex, ey, rw, rh);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_PAT_BLT:
+                            {
+                                long rop = binReader.ReadUint32();
+                                int height = binReader.ReadInt16();
+                                int width = binReader.ReadInt16();
+                                int y = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                gdi.PatBlt(x, y, width, height, rop);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SAVE_DC:
+                            {
+                                gdi.SeveDC();
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_PIE:
+                            {
+                                int eyr = binReader.ReadInt16();
+                                int exr = binReader.ReadInt16();
+                                int syr = binReader.ReadInt16();
+                                int sxr = binReader.ReadInt16();
+                                int ey = binReader.ReadInt16();
+                                int ex = binReader.ReadInt16();
+                                int sy = binReader.ReadInt16();
+                                int sx = binReader.ReadInt16();
+                                gdi.Pie(sx, sy, ex, ey, sxr, syr, exr, eyr);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_STRETCH_BLT:
+                            {
+                                long rop = binReader.ReadUint32();
+                                int sh = binReader.ReadInt16();
+                                int sw = binReader.ReadInt16();
+                                int sy = binReader.ReadInt16();
+                                int sx = binReader.ReadInt16();
+                                int dh = binReader.ReadInt16();
+                                int dw = binReader.ReadInt16();
+                                int dy = binReader.ReadInt16();
+                                int dx = binReader.ReadInt16();
+
+                                byte[] image = binReader.ReadBytes(size * 2 - binReader.Count);
+
+                                gdi.StretchBlt(image, dx, dy, dw, dh, sx, sy, sw, sh, rop);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_ESCAPE:
+                            {
+                                byte[] data = binReader.ReadBytes(2 * size);
+                                gdi.Escape(data);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_INVERT_RGN:
+                            {
+                                int rgnID = binReader.ReadUint16();
+                                gdi.InvertRgn((Gdi.IGdiRegion)objs[rgnID]);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_PAINT_RGN:
+                            {
+                                int objID = binReader.ReadUint16();
+                                gdi.PaintRgn((Gdi.IGdiRegion)objs[objID]);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SELECT_CLIP_RGN:
+                            {
+                                int objID = binReader.ReadUint16();
+                                Gdi.IGdiRegion rgn = (objID > 0) ? (Gdi.IGdiRegion)objs[objID] : null;
+                                gdi.SelectClipRgn(rgn);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SELECT_OBJECT:
+                            {
+                                int objID = binReader.ReadUint16();
+                                gdi.SelectObject(objs[objID]);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_TEXT_ALIGN:
+                            {
+                                int align = binReader.ReadInt16();
+                                gdi.SetTextAlign(align);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_ARC:
+                            {
+                                int eya = binReader.ReadInt16();
+                                int exa = binReader.ReadInt16();
+                                int sya = binReader.ReadInt16();
+                                int sxa = binReader.ReadInt16();
+                                int eyr = binReader.ReadInt16();
+                                int exr = binReader.ReadInt16();
+                                int syr = binReader.ReadInt16();
+                                int sxr = binReader.ReadInt16();
+                                gdi.Arc(sxr, syr, exr, eyr, sxa, sya, exa, eya);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_CHORD:
+                            {
+                                int eya = binReader.ReadInt16();
+                                int exa = binReader.ReadInt16();
+                                int sya = binReader.ReadInt16();
+                                int sxa = binReader.ReadInt16();
+                                int eyr = binReader.ReadInt16();
+                                int exr = binReader.ReadInt16();
+                                int syr = binReader.ReadInt16();
+                                int sxr = binReader.ReadInt16();
+                                gdi.Chord(sxr, syr, exr, eyr, sxa, sya, exa, eya);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_BIT_BLT:
+                            {
+                                long rop = binReader.ReadUint32();
+                                int sy = binReader.ReadInt16();
+                                int sx = binReader.ReadInt16();
+                                int height = binReader.ReadInt16();
+                                int width = binReader.ReadInt16();
+                                int dy = binReader.ReadInt16();
+                                int dx = binReader.ReadInt16();
+
+                                byte[] image = binReader.ReadBytes(size * 2 - binReader.Count);
+
+                                gdi.BitBlt(image, dx, dy, width, height, sx, sy, rop);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_EXT_TEXT_OUT:
+                            {
+                                int rsize = size;
+
+                                int y = binReader.ReadInt16();
+                                int x = binReader.ReadInt16();
+                                int count = binReader.ReadInt16();
+                                int options = binReader.ReadUint16();
+                                rsize -= 4;
+
+                                int[] rect = null;
+                                if ((options & 0x0006) > 0)
+                                {
+                                    rect = new int[] { binReader.ReadInt16(), binReader.ReadInt16(), binReader.ReadInt16(), binReader.ReadInt16() };
+                                    rsize -= 4;
+                                }
+                                byte[] text = binReader.ReadBytes(count);
+                                if (count % 2 == 1)
+                                    binReader.ReadByte();
+
+                                rsize -= (count + 1) / 2;
+
+                                int[] dx = null;
+                                if (rsize > 0)
+                                {
+                                    dx = new int[rsize];
+                                    for (int i = 0; i < dx.Length; i++)
+                                        dx[i] = binReader.ReadInt16();
+                                }
+                                gdi.ExtTextOut(x, y, options, rect, text, dx);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_SET_DIBITS_TO_DEVICE:
+                            {
+                                int colorUse = binReader.ReadUint16();
+                                int scanlines = binReader.ReadUint16();
+                                int startscan = binReader.ReadUint16();
+                                int sy = binReader.ReadInt16();
+                                int sx = binReader.ReadInt16();
+                                int dh = binReader.ReadInt16();
+                                int dw = binReader.ReadInt16();
+                                int dy = binReader.ReadInt16();
+                                int dx = binReader.ReadInt16();
+
+                                byte[] image = binReader.ReadBytes(size * 2 - binReader.Count);
+
+                                gdi.SetDIBitsToDevice(dx, dy, dw, dh, sx, sy, startscan, scanlines, image, colorUse);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_DIB_BIT_BLT:
+                            {
+                                bool isRop = false;
+
+                                long rop = binReader.ReadUint32();
+                                int sy = binReader.ReadInt16();
+                                int sx = binReader.ReadInt16();
+                                int height = binReader.ReadInt16();
+                                if (height == 0)
+                                {
+                                    height = binReader.ReadInt16();
+                                    isRop = true;
+                                }
+                                int width = binReader.ReadInt16();
+                                int dy = binReader.ReadInt16();
+                                int dx = binReader.ReadInt16();
+
+                                if (isRop)
+                                    gdi.DibBitBlt(null, dx, dy, width, height, sx, sy, rop);
+                                else
+                                {
+                                    byte[] image = binReader.ReadBytes(size * 2 - binReader.Count);
+
+                                    gdi.DibBitBlt(image, dx, dy, width, height, sx, sy, rop);
+                                }
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_DIB_STRETCH_BLT:
+                            {
+                                long rop = binReader.ReadUint32();
+                                int sh = binReader.ReadInt16();
+                                int sw = binReader.ReadInt16();
+                                int sx = binReader.ReadInt16();
+                                int sy = binReader.ReadInt16();
+                                int dh = binReader.ReadInt16();
+                                int dw = binReader.ReadInt16();
+                                int dy = binReader.ReadInt16();
+                                int dx = binReader.ReadInt16();
+
+                                byte[] image = binReader.ReadBytes(size * 2 - binReader.Count);
+
+                                gdi.DibStretchBlt(image, dx, dy, dw, dh, sx, sy, sw, sh, rop);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_STRETCH_DIBITS:
+                            {
+                                long rop = binReader.ReadUint32();
+                                int usage = binReader.ReadUint16();
+                                int sh = binReader.ReadInt16();
+                                int sw = binReader.ReadInt16();
+                                int sy = binReader.ReadInt16();
+                                int sx = binReader.ReadInt16();
+                                int dh = binReader.ReadInt16();
+                                int dw = binReader.ReadInt16();
+                                int dy = binReader.ReadInt16();
+                                int dx = binReader.ReadInt16();
+
+                                byte[] image = binReader.ReadBytes(size * 2 - binReader.Count);
+
+                                gdi.StretchDIBits(dx, dy, dw, dh, sx, sy, sw, sh, image, usage, rop);
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_DELETE_OBJECT:
+                            {
+                                int objID = binReader.ReadUint16();
+                                gdi.DeleteObject(objs[objID]);
+                                objs[objID] = null;
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_CREATE_PALETTE:
+                            {
+                                int version = binReader.ReadUint16();
+                                int[] entries = new int[binReader.ReadUint16()];
+                                for (int i = 0; i < entries.Length; i++)
+                                    entries[i] = binReader.ReadInt32();
+
+
+                                for (int i = 0; i < objs.Length; i++)
+                                {
+                                    if (objs[i] == null)
+                                    {
+                                        objs[i] = gdi.CreatePalette(version, entries);
+                                        break;
+                                    }
+                                }
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_CREATE_PATTERN_BRUSH:
+                            {
+                                byte[] image = binReader.ReadBytes(size * 2 - binReader.Count);
+
+                                for (int i = 0; i < objs.Length; i++)
+                                {
+                                    if (objs[i] == null)
+                                    {
+                                        objs[i] = gdi.CreatePatternBrush(image);
+                                        break;
+                                    }
+                                }
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_CREATE_PEN_INDIRECT:
+                            {
+                                int style = binReader.ReadUint16();
+                                int width = binReader.ReadInt16();
+                                binReader.ReadInt16();
+                                int color = binReader.ReadInt32();
+                                for (int i = 0; i < objs.Length; i++)
+                                {
+                                    if (objs[i] == null)
+                                    {
+                                        objs[i] = gdi.CreatePenIndirect(style, width, color);
+                                        break;
+                                    }
+                                }
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_CREATE_FONT_INDIRECT:
+                            {
+                                int height = binReader.ReadInt16();
+                                int width = binReader.ReadInt16();
+                                int escapement = binReader.ReadInt16();
+                                int orientation = binReader.ReadInt16();
+                                int weight = binReader.ReadInt16();
+                                bool italic = (binReader.ReadByte() == 1);
+                                bool underline = (binReader.ReadByte() == 1);
+                                bool strikeout = (binReader.ReadByte() == 1);
+                                int charset = binReader.ReadByte();
+                                int outPrecision = binReader.ReadByte();
+                                int clipPrecision = binReader.ReadByte();
+                                int quality = binReader.ReadByte();
+                                int pitchAndFamily = binReader.ReadByte();
+                                byte[] faceName = binReader.ReadBytes(size * 2 - binReader.Count);
+
+                                Gdi.IGdiObject obj = gdi.CreateFontIndirect(height, width, escapement, orientation, weight, italic,
+                                        underline, strikeout, charset, outPrecision, clipPrecision, quality, pitchAndFamily,
+                                        faceName);
+
+                                for (int i = 0; i < objs.Length; i++)
+                                {
+                                    if (objs[i] == null)
+                                    {
+                                        objs[i] = obj;
+                                        break;
+                                    }
+                                }
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_CREATE_BRUSH_INDIRECT:
+                            {
+                                int style = binReader.ReadUint16();
+                                int color = binReader.ReadInt32();
+                                int hatch = binReader.ReadUint16();
+                                for (int i = 0; i < objs.Length; i++)
+                                {
+                                    if (objs[i] == null)
+                                    {
+                                        objs[i] = gdi.CreateBrushIndirect(style, color, hatch);
+                                        break;
+                                    }
+                                }
+                                break;
+                            }
+                        case (int)WmfConstants.RECORD_CREATE_RECT_RGN:
+                            {
+                                int ey = binReader.ReadInt16();
+                                int ex = binReader.ReadInt16();
+                                int sy = binReader.ReadInt16();
+                                int sx = binReader.ReadInt16();
+                                for (int i = 0; i < objs.Length; i++)
+                                {
+                                    if (objs[i] == null)
+                                    {
+                                        objs[i] = gdi.CreateRectRgn(sx, sy, ex, ey);
+                                        break;
+                                    }
+                                }
+                                break;
+                            }
+                        default:
+                            {
+                                //log.fine("unsuppored id find: " + id + " (size=" + size + ")");
+                                Console.Write("unsuppored id find:" + id + "(size=" + size + ")");
+                                break;
+                            }
+                    }
+
+                    int rest = size * 2 - binReader.Count;
+                    for (int i = 0; i < rest; i++)
+                    {
+                        binReader.ReadByte();
+                    }
+                }
+                binReader.Close();
+
+                gdi.Footer();
+            }
+            catch (Exception)
+            {
+                if (isEmpty) 
+                    throw new WmfParseException("input file size is zero.");
+            }
+        }
+
+        #endregion
+    }
+}

+ 52 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfPatternBrush.cs

@@ -0,0 +1,52 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Wmf
+{
+    /// <summary>
+    /// Windows Metafile - Represents WMF Pattern Brush object.
+    /// </summary>
+    public class WmfPatternBrush : WmfObject, Gdi.IGdiPatternBrush
+    {
+        #region Local Variables
+
+        private byte[] _image;
+
+        #endregion 
+
+        #region Properties
+
+        /// <summary>
+        /// Object pattern.
+        /// </summary>
+        public byte[] Pattern
+        {
+            get
+            {
+                return _image;
+            }
+        }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        /// <param name="id"></param>
+        /// <param name="image"></param>
+        public WmfPatternBrush(int id, byte[] image)
+            : base (id)
+        {
+            _image = image;
+        }
+
+        #endregion 
+
+       
+    }
+}

+ 75 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfPen.cs

@@ -0,0 +1,75 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Wmf
+{
+    /// <summary>
+    /// Windows Metafile - Represents WMF Pen object.
+    /// </summary>
+    class WmfPen: WmfObject,Gdi.IGdiPen
+    {
+        #region Local Variables
+
+        private int _style;
+        private int _width;
+        private int _color;
+
+        #endregion
+
+        #region Properties
+
+        /// <summary>
+        /// Object style.
+        /// </summary>
+        public int Style
+        {
+            get
+            {
+                return _style;
+            }
+        }
+
+        /// <summary>
+        /// Object width.
+        /// </summary>
+        public int Width
+        {
+            get
+            {
+                return _width;
+            }
+        }
+
+        /// <summary>
+        /// Object color.
+        /// </summary>
+        public int Color
+        {
+            get
+            {
+                return _color;
+            }
+        }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        /// <param name="id"></param>
+        /// <param name="style"></param>
+        /// <param name="width"></param>
+        /// <param name="color"></param>
+        public WmfPen(int id, int style, int width, int color)
+            : base(id)
+        {
+        }
+
+        #endregion
+    }
+}

+ 92 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfRectRegion.cs

@@ -0,0 +1,92 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Wmf
+{
+    /// <summary>
+    /// Windows Metafile - Representes WMF RecRegion object.
+    /// </summary>
+    public class WmfRectRegion: WmfObject, Gdi.IGdiRegion
+    {
+        #region Local Variables
+
+        private int _left;
+        private int _top;
+        private int _right;
+        private int _bottom;
+
+        #endregion
+
+        #region Properties
+        
+        /// <summary>
+        /// Get left value.
+        /// </summary>
+        public int Left
+        {
+            get
+            {
+                return _left;
+            }
+        }
+
+        /// <summary>
+        /// Get top value.
+        /// </summary>
+        public int Top
+        {
+            get
+            {
+                return _top;
+            }
+        }
+
+        /// <summary>
+        /// Get right value.
+        /// </summary>
+        public int Right
+        {
+            get
+            {
+                return _right;
+            }
+        }
+
+        /// <summary>
+        /// Get Bottom value.
+        /// </summary>
+        public int Bottom
+        {
+            get
+            {
+                return _bottom;
+            }
+        }
+
+        #endregion
+
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        /// <param name="id"></param>
+        /// <param name="left"></param>
+        /// <param name="top"></param>
+        /// <param name="right"></param>
+        /// <param name="bottom"></param>
+        public WmfRectRegion(int id, int left, int top, int right, int bottom)
+            :base(id)
+        {
+            _left = left;
+            _top = top;
+            _right = right;
+            _bottom = bottom;
+        }
+
+        #endregion
+    }
+}

+ 27 - 0
TEAMModelOS.HTEXLib/COMM/Helpers/WMFConverter/Wmf/WmfRegion.cs

@@ -0,0 +1,27 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WMFConverter.Wmf
+{
+    /// <summary>
+    /// Windows Metafile - Represents WMF Region.
+    /// </summary>
+    public class WmfRegion : WmfObject,Gdi.IGdiRegion
+    {
+        #region Constructors
+
+        /// <summary>
+        /// Default constructor.
+        /// </summary>
+        /// <param name="id"></param>
+        public WmfRegion(int id)
+            :base (id)
+        {
+        }
+
+        #endregion
+    }
+}

+ 23 - 0
TEAMModelOS.HTEXLib/COMM/TransException.cs

@@ -0,0 +1,23 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Xml.Linq;
+
+namespace HTEXLib.COMM
+{
+    public class TransException : Exception
+    {
+        public XElement node { get; set; }
+        public TransException(XElement node) : base()
+        {
+           this. node = node;
+        }
+        public TransException(XElement node,string message):base(message) {
+            this.node = node;
+        }
+        public TransException(XElement node,string message, Exception innerException) : base(message, innerException)
+        {
+            this.node = node;
+        }
+    }
+}

+ 24 - 0
TEAMModelOS.HTEXLib/DOCX/Models/ItemInfo.cs

@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel.DataAnnotations;
+using System.Text;
+
+namespace HTEXLib.DOCX.Models
+{
+    public class ItemInfo : BaseItem
+    {
+        public ItemInfo() {
+            answer = new List<string>();
+            knowledge = new List<string>();
+            gradeIds = new List<string>();
+            repair = new List<Repair>();
+            children = new List<ItemInfo>();
+            option = new List<CodeValue>();
+        }
+
+        public    List<ItemInfo> children { get; set; }
+        public string question { get; set; }
+        // 选项 单选 多选 判断
+        public List<CodeValue> option { get; set; }
+    }
+}

+ 38 - 0
TEAMModelOS.HTEXLib/DOCX/Models/LangConfig.cs

@@ -0,0 +1,38 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace HTEXLib.DOCX.Models
+{
+    public class TagConfig {
+
+        public string Options{ get; set; }
+        public string Start { get; set; }
+        public string End { get; set; }
+        public List<LangConfig> LangConfig { get; set; }
+    }
+    public class LangConfig
+    {
+        public string Lang { get; set; }
+        public string Name { get; set; }
+        public string Alias { get; set; }
+        public ItemConfig Item { get; set; }
+    }
+    public class ItemConfig
+    {
+        public Dictionary<string, string> Type { get; set; }
+        public string Answer { get; set; }
+        public string Analysis { get; set; }
+        public string Ended { get; set; }
+        public string Options { get; set; }
+        public string Start { get; set; }
+        public string End { get; set; }
+        public string Score { get; set; }
+        public string Point { get; set; }
+        public string Filed { get; set; }
+        public string Judge { get; set; }
+        public string Level { get; set; }
+        public string Count { get; set; }
+        public string Taxonomy { get; set; }
+    }
+}

+ 0 - 0
TEAMModelOS.HTEXLib/DOCX/Models/ReplaceDto.cs


Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików