懒得勤快 6 anni fa
parent
commit
0acf2f0114

+ 1 - 1
Masuit.Tools.Core.UnitTest/Masuit.Tools.Core.UnitTest.csproj

@@ -8,7 +8,7 @@
 
   <ItemGroup>
     <PackageReference Include="Microsoft.AspNetCore.TestHost" Version="2.2.0" />
-    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
+    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.1.1" />
     <PackageReference Include="xunit" Version="2.4.1" />
     <PackageReference Include="xunit.runner.visualstudio" Version="2.4.1">
       <PrivateAssets>all</PrivateAssets>

+ 17 - 74
Masuit.Tools.Core/Html/HtmlTools.cs

@@ -1,7 +1,8 @@
 using Ganss.XSS;
-using Masuit.Tools.Win32;
+using HtmlAgilityPack;
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using System.Text.RegularExpressions;
 
 namespace Masuit.Tools.Html
@@ -80,8 +81,9 @@ namespace Masuit.Tools.Html
         /// <returns></returns>
         public static string RemoveHtmlTag(this string html, int length = 0)
         {
-            string strText = Regex.Replace(html, "<[^>]+>", "");
-            strText = Regex.Replace(strText, "&[^;]+;", "");
+            var doc = new HtmlDocument();
+            doc.LoadHtml(html);
+            var strText = doc.DocumentNode.InnerText;
             if (length > 0 && strText.Length > length)
             {
                 return strText.Substring(0, length);
@@ -104,41 +106,6 @@ namespace Masuit.Tools.Html
             return s;
         }
 
-        ///<summary>   
-        /// 清除HTML标记   
-        ///</summary>   
-        ///<param name="htmlstring">包括HTML的源码</param>   
-        ///<returns>已经去除后的文字</returns>   
-        public static string RemoveHtml(this string htmlstring)
-        {
-            //删除脚本   
-            htmlstring = Regex.Replace(htmlstring, "<script[^>]*?>.*?</script>", "", RegexOptions.IgnoreCase);
-
-            //删除HTML   
-            Regex regex = new Regex("<.+?>", RegexOptions.IgnoreCase);
-            htmlstring = regex.Replace(htmlstring, "");
-            htmlstring = Regex.Replace(htmlstring, "<(.[^>]*)>", "", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "-->", "", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "<!--.*", "", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(quot|#34);", "\"", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(amp|#38);", "&", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(lt|#60);", "<", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(gt|#62);", ">", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(nbsp|#160);", "   ", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(iexcl|#161);", "\xa1", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(cent|#162);", "\xa2", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(pound|#163);", "\xa3", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(copy|#169);", "\xa9", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, @"&#(\d+);", "", RegexOptions.IgnoreCase);
-
-            htmlstring.Replace("<", "");
-            htmlstring.Replace(">", "");
-            htmlstring.Replace("\r\n", "");
-
-            return htmlstring;
-        }
-
         /// <summary>
         /// 替换html的img路径为绝对路径
         /// </summary>
@@ -157,14 +124,18 @@ namespace Masuit.Tools.Html
             return Regex.Replace(s, @"<img src=""(http:\/\/.+?)/", @"<img src=""/");
         }
 
-        private static readonly Regex ImgRegex = new Regex(@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<src>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>");
-
         /// <summary>
         /// 匹配html的所有img标签集合
         /// </summary>
         /// <param name="html"></param>
         /// <returns></returns>
-        public static MatchCollection MatchImgTags(this string html) => ImgRegex.Matches(html);
+        public static IEnumerable<HtmlNode> MatchImgTags(this string html)
+        {
+            var doc = new HtmlDocument();
+            doc.LoadHtml(html);
+            var nodes = doc.DocumentNode.Descendants("img");
+            return nodes;
+        }
 
         /// <summary>
         /// 匹配html的所有img标签的src集合
@@ -173,19 +144,9 @@ namespace Masuit.Tools.Html
         /// <returns></returns>
         public static IEnumerable<string> MatchImgSrcs(this string html)
         {
-            foreach (Match m in ImgRegex.Matches(html))
-            {
-                yield return m.Groups["src"].Value;
-            }
+            return MatchImgTags(html).Where(n => n.Attributes.Contains("src")).Select(n => n.Attributes["src"].Value);
         }
 
-        /// <summary>
-        /// 匹配html的一个img标签
-        /// </summary>
-        /// <param name="html"></param>
-        /// <returns></returns>
-        public static Match MatchImgTag(this string html) => ImgRegex.Match(html);
-
         /// <summary>
         /// 获取html中第一个img标签的src
         /// </summary>
@@ -193,14 +154,7 @@ namespace Masuit.Tools.Html
         /// <returns></returns>
         public static string MatchFirstImgSrc(this string html)
         {
-            string src = ImgRegex.Match(html).Groups["src"].Value;
-            int index = src.IndexOf("\"", StringComparison.Ordinal);
-            if (index > 0)
-            {
-                src = src.Substring(0, index);
-            }
-
-            return src;
+            return MatchImgSrcs(html).FirstOrDefault();
         }
 
         /// <summary>
@@ -210,20 +164,9 @@ namespace Masuit.Tools.Html
         /// <returns></returns>
         public static string MatchRandomImgSrc(this string html)
         {
-            var collection = ImgRegex.Matches(html);
-            if (collection.Count > 0)
-            {
-                string src = collection[new Random().StrictNext(collection.Count)].Groups["src"].Value;
-                int index = src.IndexOf("\"", StringComparison.Ordinal);
-                if (index > 0)
-                {
-                    src = src.Substring(0, index);
-                }
-
-                return src;
-            }
-
-            return string.Empty;
+            int count = MatchImgSrcs(html).Count();
+            var rnd = new Random();
+            return MatchImgSrcs(html).ElementAtOrDefault(rnd.Next(count));
         }
 
         /// <summary>

+ 3 - 2
Masuit.Tools.Core/Masuit.Tools.Core.csproj

@@ -2,7 +2,7 @@
 
   <PropertyGroup>
     <TargetFramework>netcoreapp2.1</TargetFramework>
-    <Version>2.2.6.1</Version>
+    <Version>2.2.6.2</Version>
     <Authors>懒得勤快</Authors>
     <Company>masuit.com</Company>
     <Description>包含一些常用的操作类,大都是静态类,加密解密,反射操作,硬件信息,字符串扩展方法,日期时间扩展操作,大文件拷贝,图像裁剪,html处理,验证码、NoSql等常用封装。
@@ -29,7 +29,8 @@ github:https://github.com/ldqk/Masuit.Tools</Description>
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="HtmlSanitizer" Version="4.0.210" />
+    <PackageReference Include="HtmlAgilityPack" Version="1.11.7" />
+    <PackageReference Include="HtmlSanitizer" Version="4.0.217" />
     <PackageReference Include="Microsoft.AspNetCore.All" Version="2.1.5" />
     <PackageReference Include="SharpCompress" Version="0.23.0" />
     <PackageReference Include="System.Diagnostics.PerformanceCounter" Version="4.5.0" />

+ 0 - 14
Masuit.Tools.Core/Masuit.Tools.Core.xml

@@ -2820,13 +2820,6 @@
             <param name="html"></param>
             <returns></returns>
         </member>
-        <member name="M:Masuit.Tools.Html.HtmlTools.RemoveHtml(System.String)">
-            <summary>   
-             清除HTML标记   
-            </summary>   
-            <param name="htmlstring">包括HTML的源码</param>   
-            <returns>已经去除后的文字</returns>   
-        </member>
         <member name="M:Masuit.Tools.Html.HtmlTools.ReplaceHtmlImgSource(System.String,System.String)">
             <summary>
             替换html的img路径为绝对路径
@@ -2856,13 +2849,6 @@
             <param name="html"></param>
             <returns></returns>
         </member>
-        <member name="M:Masuit.Tools.Html.HtmlTools.MatchImgTag(System.String)">
-            <summary>
-            匹配html的一个img标签
-            </summary>
-            <param name="html"></param>
-            <returns></returns>
-        </member>
         <member name="M:Masuit.Tools.Html.HtmlTools.MatchFirstImgSrc(System.String)">
             <summary>
             获取html中第一个img标签的src

+ 1 - 1
Masuit.Tools.ExpressionMapperBenchmark/Masuit.Tools.ExpressionMapperBenchmark.csproj

@@ -6,7 +6,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="AutoMapper" Version="8.1.0" />
+    <PackageReference Include="AutoMapper" Version="8.1.1" />
   </ItemGroup>
 
   <ItemGroup>

+ 3 - 3
Masuit.Tools.NoSQL.MongoDBClient/Masuit.Tools.NoSQL.MongoDBClient.csproj

@@ -26,9 +26,9 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="MongoDB.Bson" Version="2.8.0" />
-    <PackageReference Include="MongoDB.Driver" Version="2.8.0" />
-    <PackageReference Include="MongoDB.Driver.Core" Version="2.8.0" />
+    <PackageReference Include="MongoDB.Bson" Version="2.8.1" />
+    <PackageReference Include="MongoDB.Driver" Version="2.8.1" />
+    <PackageReference Include="MongoDB.Driver.Core" Version="2.8.1" />
   </ItemGroup>
 
 </Project>

+ 6 - 6
Masuit.Tools.UnitTest/Masuit.Tools.UnitTest.csproj

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <Import Project="..\packages\NUnit.3.11.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.11.0\build\NUnit.props')" />
+  <Import Project="..\packages\NUnit.3.12.0\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" />
   <Import Project="..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props')" />
   <Import Project="..\packages\xunit.core.2.4.1\build\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.4.1\build\xunit.core.props')" />
   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
@@ -54,11 +54,11 @@
     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
-    <Reference Include="Moq, Version=4.10.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
-      <HintPath>..\packages\Moq.4.10.1\lib\net45\Moq.dll</HintPath>
+    <Reference Include="Moq, Version=4.11.0.0, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
+      <HintPath>..\packages\Moq.4.11.0\lib\net45\Moq.dll</HintPath>
     </Reference>
-    <Reference Include="nunit.framework, Version=3.11.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
-      <HintPath>..\packages\NUnit.3.11.0\lib\net45\nunit.framework.dll</HintPath>
+    <Reference Include="nunit.framework, Version=3.12.0.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
+      <HintPath>..\packages\NUnit.3.12.0\lib\net45\nunit.framework.dll</HintPath>
     </Reference>
     <Reference Include="System" />
     <Reference Include="System.Configuration" />
@@ -169,7 +169,7 @@
     <Error Condition="!Exists('..\packages\xunit.core.2.4.1\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.4.1\build\xunit.core.targets'))" />
     <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.props'))" />
     <Error Condition="!Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets'))" />
-    <Error Condition="!Exists('..\packages\NUnit.3.11.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.11.0\build\NUnit.props'))" />
+    <Error Condition="!Exists('..\packages\NUnit.3.12.0\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.12.0\build\NUnit.props'))" />
   </Target>
   <Import Project="..\packages\xunit.core.2.4.1\build\xunit.core.targets" Condition="Exists('..\packages\xunit.core.2.4.1\build\xunit.core.targets')" />
   <Import Project="..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\packages\MSTest.TestAdapter.1.4.0\build\net45\MSTest.TestAdapter.targets')" />

+ 2 - 2
Masuit.Tools.UnitTest/packages.config

@@ -5,10 +5,10 @@
   <package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net461" />
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net461" />
   <package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net461" />
-  <package id="Moq" version="4.10.1" targetFramework="net461" />
+  <package id="Moq" version="4.11.0" targetFramework="net461" />
   <package id="MSTest.TestAdapter" version="1.4.0" targetFramework="net461" />
   <package id="MSTest.TestFramework" version="1.4.0" targetFramework="net461" />
-  <package id="NUnit" version="3.11.0" targetFramework="net461" />
+  <package id="NUnit" version="3.12.0" targetFramework="net461" />
   <package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net461" />
   <package id="System.Threading.Tasks.Extensions" version="4.5.2" targetFramework="net461" />
   <package id="xunit" version="2.4.1" targetFramework="net461" />

+ 17 - 74
Masuit.Tools/Html/HtmlTools.cs

@@ -1,7 +1,8 @@
 using Ganss.XSS;
-using Masuit.Tools.Win32;
+using HtmlAgilityPack;
 using System;
 using System.Collections.Generic;
+using System.Linq;
 using System.Text.RegularExpressions;
 
 namespace Masuit.Tools.Html
@@ -80,8 +81,9 @@ namespace Masuit.Tools.Html
         /// <returns></returns>
         public static string RemoveHtmlTag(this string html, int length = 0)
         {
-            string strText = Regex.Replace(html, "<[^>]+>", "");
-            strText = Regex.Replace(strText, "&[^;]+;", "");
+            var doc = new HtmlDocument();
+            doc.LoadHtml(html);
+            var strText = doc.DocumentNode.InnerText;
             if (length > 0 && strText.Length > length)
             {
                 return strText.Substring(0, length);
@@ -104,41 +106,6 @@ namespace Masuit.Tools.Html
             return s;
         }
 
-        ///<summary>   
-        /// 清除HTML标记   
-        ///</summary>   
-        ///<param name="htmlstring">包括HTML的源码</param>   
-        ///<returns>已经去除后的文字</returns>   
-        public static string RemoveHtml(this string htmlstring)
-        {
-            //删除脚本   
-            htmlstring = Regex.Replace(htmlstring, "<script[^>]*?>.*?</script>", "", RegexOptions.IgnoreCase);
-
-            //删除HTML   
-            Regex regex = new Regex("<.+?>", RegexOptions.IgnoreCase);
-            htmlstring = regex.Replace(htmlstring, "");
-            htmlstring = Regex.Replace(htmlstring, "<(.[^>]*)>", "", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "-->", "", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "<!--.*", "", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(quot|#34);", "\"", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(amp|#38);", "&", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(lt|#60);", "<", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(gt|#62);", ">", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(nbsp|#160);", "   ", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(iexcl|#161);", "\xa1", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(cent|#162);", "\xa2", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(pound|#163);", "\xa3", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, "&(copy|#169);", "\xa9", RegexOptions.IgnoreCase);
-            htmlstring = Regex.Replace(htmlstring, @"&#(\d+);", "", RegexOptions.IgnoreCase);
-
-            htmlstring.Replace("<", "");
-            htmlstring.Replace(">", "");
-            htmlstring.Replace("\r\n", "");
-
-            return htmlstring;
-        }
-
         /// <summary>
         /// 替换html的img路径为绝对路径
         /// </summary>
@@ -157,14 +124,18 @@ namespace Masuit.Tools.Html
             return Regex.Replace(s, @"<img src=""(http:\/\/.+?)/", @"<img src=""/");
         }
 
-        private static readonly Regex ImgRegex = new Regex(@"<img\b[^<>]*?\bsrc[\s\t\r\n]*=[\s\t\r\n]*[""']?[\s\t\r\n]*(?<src>[^\s\t\r\n""'<>]*)[^<>]*?/?[\s\t\r\n]*>");
-
         /// <summary>
         /// 匹配html的所有img标签集合
         /// </summary>
         /// <param name="html"></param>
         /// <returns></returns>
-        public static MatchCollection MatchImgTags(this string html) => ImgRegex.Matches(html);
+        public static IEnumerable<HtmlNode> MatchImgTags(this string html)
+        {
+            var doc = new HtmlDocument();
+            doc.LoadHtml(html);
+            var nodes = doc.DocumentNode.Descendants("img");
+            return nodes;
+        }
 
         /// <summary>
         /// 匹配html的所有img标签的src集合
@@ -173,19 +144,9 @@ namespace Masuit.Tools.Html
         /// <returns></returns>
         public static IEnumerable<string> MatchImgSrcs(this string html)
         {
-            foreach (Match m in ImgRegex.Matches(html))
-            {
-                yield return m.Groups["src"].Value;
-            }
+            return MatchImgTags(html).Where(n => n.Attributes.Contains("src")).Select(n => n.Attributes["src"].Value);
         }
 
-        /// <summary>
-        /// 匹配html的一个img标签
-        /// </summary>
-        /// <param name="html"></param>
-        /// <returns></returns>
-        public static Match MatchImgTag(this string html) => ImgRegex.Match(html);
-
         /// <summary>
         /// 获取html中第一个img标签的src
         /// </summary>
@@ -193,14 +154,7 @@ namespace Masuit.Tools.Html
         /// <returns></returns>
         public static string MatchFirstImgSrc(this string html)
         {
-            string src = ImgRegex.Match(html).Groups["src"].Value;
-            int index = src.IndexOf("\"", StringComparison.Ordinal);
-            if (index > 0)
-            {
-                src = src.Substring(0, index);
-            }
-
-            return src;
+            return MatchImgSrcs(html).FirstOrDefault();
         }
 
         /// <summary>
@@ -210,20 +164,9 @@ namespace Masuit.Tools.Html
         /// <returns></returns>
         public static string MatchRandomImgSrc(this string html)
         {
-            var collection = ImgRegex.Matches(html);
-            if (collection.Count > 0)
-            {
-                string src = collection[new Random().StrictNext(collection.Count)].Groups["src"].Value;
-                int index = src.IndexOf("\"", StringComparison.Ordinal);
-                if (index > 0)
-                {
-                    src = src.Substring(0, index);
-                }
-
-                return src;
-            }
-
-            return string.Empty;
+            int count = MatchImgSrcs(html).Count();
+            var rnd = new Random();
+            return MatchImgSrcs(html).ElementAtOrDefault(rnd.Next(count));
         }
 
         /// <summary>

+ 7 - 1
Masuit.Tools/Masuit.Tools.csproj

@@ -43,13 +43,19 @@
     <Reference Include="AngleSharp, Version=0.9.9.0, Culture=neutral, PublicKeyToken=e83494dcdc6d31ea, processorArchitecture=MSIL">
       <HintPath>..\packages\AngleSharp.0.9.11\lib\net45\AngleSharp.dll</HintPath>
     </Reference>
+    <Reference Include="HtmlAgilityPack, Version=1.11.7.0, Culture=neutral, PublicKeyToken=bd319b19eaf3b43a, processorArchitecture=MSIL">
+      <HintPath>..\packages\HtmlAgilityPack.1.11.7\lib\Net45\HtmlAgilityPack.dll</HintPath>
+    </Reference>
     <Reference Include="HtmlSanitizer, Version=4.0.0.0, Culture=neutral, PublicKeyToken=61c49a1a9e79cc28, processorArchitecture=MSIL">
-      <HintPath>..\packages\HtmlSanitizer.4.0.210\lib\net45\HtmlSanitizer.dll</HintPath>
+      <HintPath>..\packages\HtmlSanitizer.4.0.217\lib\net45\HtmlSanitizer.dll</HintPath>
     </Reference>
     <Reference Include="Microsoft.CSharp" />
     <Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
       <HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
     </Reference>
+    <Reference Include="Newtonsoft.Json, Version=12.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
+      <HintPath>..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll</HintPath>
+    </Reference>
     <Reference Include="SharpCompress, Version=0.23.0.0, Culture=neutral, PublicKeyToken=afb0a02973931d96, processorArchitecture=MSIL">
       <HintPath>..\packages\SharpCompress.0.23.0\lib\net45\SharpCompress.dll</HintPath>
     </Reference>

+ 2 - 2
Masuit.Tools/Properties/AssemblyInfo.cs

@@ -36,7 +36,7 @@ using System.Runtime.InteropServices;
 // 方法是按如下所示使用“*”: :
 // [assembly: AssemblyVersion("1.0.*")]
 
-[assembly: AssemblyVersion("2.2.6.1")]
-[assembly: AssemblyFileVersion("2.2.6.1")]
+[assembly: AssemblyVersion("2.2.6.2")]
+[assembly: AssemblyFileVersion("2.2.6.2")]
 [assembly: NeutralResourcesLanguage("zh-CN")]
 

+ 2 - 1
Masuit.Tools/packages.config

@@ -1,7 +1,8 @@
 <?xml version="1.0" encoding="utf-8"?>
 <packages>
   <package id="AngleSharp" version="0.9.11" targetFramework="net45" />
-  <package id="HtmlSanitizer" version="4.0.210" targetFramework="net45" />
+  <package id="HtmlAgilityPack" version="1.11.7" targetFramework="net45" />
+  <package id="HtmlSanitizer" version="4.0.217" targetFramework="net45" />
   <package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net45" />
   <package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net45" />
   <package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net45" />