Ver código fonte

1. 修正树结构Children为null报错的问题
2. 优化图片生成缩略图
3. 更正xlsx的Mime Type

懒得勤快 1 ano atrás
pai
commit
a143f8817e

+ 74 - 131
Masuit.Tools.Abstractions/HtmlSanitizer/EventArgs.cs

@@ -10,7 +10,10 @@ namespace Ganss.Xss
     /// <summary>
     /// Provides data for the <see cref="HtmlSanitizer.PostProcessDom"/> event.
     /// </summary>
-    public class PostProcessDomEventArgs : EventArgs
+    /// <remarks>
+    /// Initializes a new instance of the <see cref="PostProcessDomEventArgs"/> class.
+    /// </remarks>
+    public class PostProcessDomEventArgs(IHtmlDocument document) : EventArgs
     {
         /// <summary>
         /// Gets the document.
@@ -18,21 +21,16 @@ namespace Ganss.Xss
         /// <value>
         /// The document.
         /// </value>
-        public IHtmlDocument Document { get; private set; }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="PostProcessDomEventArgs"/> class.
-        /// </summary>
-        public PostProcessDomEventArgs(IHtmlDocument document)
-        {
-            Document = document;
-        }
+        public IHtmlDocument Document { get; private set; } = document;
     }
 
     /// <summary>
     /// Provides data for the <see cref="HtmlSanitizer.PostProcessNode"/> event.
     /// </summary>
-    public class PostProcessNodeEventArgs : EventArgs
+    /// <remarks>
+    /// Initializes a new instance of the <see cref="PostProcessNodeEventArgs"/> class.
+    /// </remarks>
+    public class PostProcessNodeEventArgs(IHtmlDocument document, INode node) : EventArgs
     {
         /// <summary>
         /// Gets the document.
@@ -40,7 +38,7 @@ namespace Ganss.Xss
         /// <value>
         /// The document.
         /// </value>
-        public IHtmlDocument Document { get; private set; }
+        public IHtmlDocument Document { get; private set; } = document;
 
         /// <summary>
         /// Gets the DOM node to be processed.
@@ -48,7 +46,7 @@ namespace Ganss.Xss
         /// <value>
         /// The DOM node.
         /// </value>
-        public INode Node { get; private set; }
+        public INode Node { get; private set; } = node;
 
         /// <summary>
         /// Gets the replacement nodes. Leave empty if no replacement should occur.
@@ -56,23 +54,18 @@ namespace Ganss.Xss
         /// <value>
         /// The replacement nodes.
         /// </value>
-        public ICollection<INode> ReplacementNodes { get; private set; }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="PostProcessNodeEventArgs"/> class.
-        /// </summary>
-        public PostProcessNodeEventArgs(IHtmlDocument document, INode node)
-        {
-            Document = document;
-            Node = node;
-            ReplacementNodes = new List<INode>();
-        }
+        public ICollection<INode> ReplacementNodes { get; private set; } = new List<INode>();
     }
 
     /// <summary>
     /// Provides data for the <see cref="HtmlSanitizer.RemovingTag"/> event.
     /// </summary>
-    public class RemovingTagEventArgs : CancelEventArgs
+    /// <remarks>
+    /// Initializes a new instance of the <see cref="RemovingTagEventArgs"/> class.
+    /// </remarks>
+    /// <param name="tag">The element to be removed.</param>
+    /// <param name="reason">The reason why the tag will be removed.</param>
+    public class RemovingTagEventArgs(IElement tag, RemoveReason reason) : CancelEventArgs
     {
         /// <summary>
         /// Gets the tag to be removed.
@@ -80,7 +73,7 @@ namespace Ganss.Xss
         /// <value>
         /// The tag.
         /// </value>
-        public IElement Tag { get; private set; }
+        public IElement Tag { get; private set; } = tag;
 
         /// <summary>
         /// Gets the reason why the tag will be removed.
@@ -88,24 +81,19 @@ namespace Ganss.Xss
         /// <value>
         /// The reason.
         /// </value>
-        public RemoveReason Reason { get; private set; }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="RemovingTagEventArgs"/> class.
-        /// </summary>
-        /// <param name="tag">The element to be removed.</param>
-        /// <param name="reason">The reason why the tag will be removed.</param>
-        public RemovingTagEventArgs(IElement tag, RemoveReason reason)
-        {
-            Tag = tag;
-            Reason = reason;
-        }
+        public RemoveReason Reason { get; private set; } = reason;
     }
 
     /// <summary>
     /// Provides data for the <see cref="HtmlSanitizer.RemovingAttribute"/> event.
     /// </summary>
-    public class RemovingAttributeEventArgs : CancelEventArgs
+    /// <remarks>
+    /// Initializes a new instance of the <see cref="RemovingAttributeEventArgs"/> class.
+    /// </remarks>
+    /// <param name="tag">The element containing the attribute.</param>
+    /// <param name="attribute">The attribute to be removed.</param>
+    /// <param name="reason">The reason why the attribute will be removed.</param>
+    public class RemovingAttributeEventArgs(IElement tag, IAttr attribute, RemoveReason reason) : CancelEventArgs
     {
         /// <summary>
         /// Gets the tag containing the attribute to be removed.
@@ -113,7 +101,7 @@ namespace Ganss.Xss
         /// <value>
         /// The tag.
         /// </value>
-        public IElement Tag { get; private set; }
+        public IElement Tag { get; private set; } = tag;
 
         /// <summary>
         /// Gets the attribute to be removed.
@@ -121,7 +109,7 @@ namespace Ganss.Xss
         /// <value>
         /// The attribute.
         /// </value>
-        public IAttr Attribute { get; private set; }
+        public IAttr Attribute { get; private set; } = attribute;
 
         /// <summary>
         /// Gets the reason why the attribute will be removed.
@@ -129,26 +117,19 @@ namespace Ganss.Xss
         /// <value>
         /// The reason.
         /// </value>
-        public RemoveReason Reason { get; private set; }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="RemovingAttributeEventArgs"/> class.
-        /// </summary>
-        /// <param name="tag">The element containing the attribute.</param>
-        /// <param name="attribute">The attribute to be removed.</param>
-        /// <param name="reason">The reason why the attribute will be removed.</param>
-        public RemovingAttributeEventArgs(IElement tag, IAttr attribute, RemoveReason reason)
-        {
-            Tag = tag;
-            Attribute = attribute;
-            Reason = reason;
-        }
+        public RemoveReason Reason { get; private set; } = reason;
     }
 
     /// <summary>
     /// Provides data for the <see cref="HtmlSanitizer.RemovingStyle"/> event.
     /// </summary>
-    public class RemovingStyleEventArgs : CancelEventArgs
+    /// <remarks>
+    /// Initializes a new instance of the <see cref="RemovingStyleEventArgs"/> class.
+    /// </remarks>
+    /// <param name="tag">The element containing the attribute.</param>
+    /// <param name="style">The style to be removed.</param>
+    /// <param name="reason">The reason why the attribute will be removed.</param>
+    public class RemovingStyleEventArgs(IElement tag, ICssProperty style, RemoveReason reason) : CancelEventArgs
     {
         /// <summary>
         /// Gets the tag containing the style to be removed.
@@ -156,7 +137,7 @@ namespace Ganss.Xss
         /// <value>
         /// The tag.
         /// </value>
-        public IElement Tag { get; private set; }
+        public IElement Tag { get; private set; } = tag;
 
         /// <summary>
         /// Gets the style to be removed.
@@ -164,7 +145,7 @@ namespace Ganss.Xss
         /// <value>
         /// The style.
         /// </value>
-        public ICssProperty Style { get; private set; }
+        public ICssProperty Style { get; private set; } = style;
 
         /// <summary>
         /// Gets the reason why the style will be removed.
@@ -172,26 +153,18 @@ namespace Ganss.Xss
         /// <value>
         /// The reason.
         /// </value>
-        public RemoveReason Reason { get; private set; }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="RemovingStyleEventArgs"/> class.
-        /// </summary>
-        /// <param name="tag">The element containing the attribute.</param>
-        /// <param name="style">The style to be removed.</param>
-        /// <param name="reason">The reason why the attribute will be removed.</param>
-        public RemovingStyleEventArgs(IElement tag, ICssProperty style, RemoveReason reason)
-        {
-            Tag = tag;
-            Style = style;
-            Reason = reason;
-        }
+        public RemoveReason Reason { get; private set; } = reason;
     }
 
     /// <summary>
     /// Provides data for the <see cref="HtmlSanitizer.RemovingAtRule"/> event.
     /// </summary>
-    public class RemovingAtRuleEventArgs : CancelEventArgs
+    /// <remarks>
+    /// Initializes a new instance of the <see cref="RemovingAtRuleEventArgs"/> class.
+    /// </remarks>
+    /// <param name="tag">The element containing the attribute.</param>
+    /// <param name="rule">The rule to be removed.</param>
+    public class RemovingAtRuleEventArgs(IElement tag, ICssRule rule) : CancelEventArgs
     {
         /// <summary>
         /// Gets the tag containing the at-rule to be removed.
@@ -199,7 +172,7 @@ namespace Ganss.Xss
         /// <value>
         /// The tag.
         /// </value>
-        public IElement Tag { get; private set; }
+        public IElement Tag { get; private set; } = tag;
 
         /// <summary>
         /// Gets the rule to be removed.
@@ -207,24 +180,17 @@ namespace Ganss.Xss
         /// <value>
         /// The rule.
         /// </value>
-        public ICssRule Rule { get; private set; }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="RemovingAtRuleEventArgs"/> class.
-        /// </summary>
-        /// <param name="tag">The element containing the attribute.</param>
-        /// <param name="rule">The rule to be removed.</param>
-        public RemovingAtRuleEventArgs(IElement tag, ICssRule rule)
-        {
-            Tag = tag;
-            Rule = rule;
-        }
+        public ICssRule Rule { get; private set; } = rule;
     }
 
     /// <summary>
     /// Provides data for the <see cref="HtmlSanitizer.RemovingComment"/> event.
     /// </summary>
-    public class RemovingCommentEventArgs : CancelEventArgs
+    /// <remarks>
+    /// Initializes a new instance of the <see cref="RemovingCommentEventArgs"/> class.
+    /// </remarks>
+    /// <param name="comment">The comment to be removed.</param>
+    public class RemovingCommentEventArgs(IComment comment) : CancelEventArgs
     {
         /// <summary>
         /// Gets the comment node to be removed.
@@ -232,22 +198,19 @@ namespace Ganss.Xss
         /// <value>
         /// The comment node.
         /// </value>
-        public IComment Comment { get; private set; }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="RemovingCommentEventArgs"/> class.
-        /// </summary>
-        /// <param name="comment">The comment to be removed.</param>
-        public RemovingCommentEventArgs(IComment comment)
-        {
-            Comment = comment;
-        }
+        public IComment Comment { get; private set; } = comment;
     }
 
     /// <summary>
     /// Provides data for the <see cref="HtmlSanitizer.RemovingCssClass"/> event.
     /// </summary>
-    public class RemovingCssClassEventArgs : CancelEventArgs
+    /// <remarks>
+    /// Initializes a new instance of the <see cref="RemovingCssClassEventArgs"/> class.
+    /// </remarks>
+    /// <param name="tag">The element containing the attribute.</param>
+    /// <param name="cssClass">The CSS class to be removed.</param>
+    /// <param name="reason">The reason why the attribute will be removed.</param>
+    public class RemovingCssClassEventArgs(IElement tag, string cssClass, RemoveReason reason) : CancelEventArgs
     {
         /// <summary>
         /// Gets the tag containing the CSS class to be removed.
@@ -255,7 +218,7 @@ namespace Ganss.Xss
         /// <value>
         /// The tag.
         /// </value>
-        public IElement Tag { get; private set; }
+        public IElement Tag { get; private set; } = tag;
 
         /// <summary>
         /// Gets the CSS class to be removed.
@@ -263,7 +226,7 @@ namespace Ganss.Xss
         /// <value>
         /// The CSS class.
         /// </value>
-        public string CssClass { get; private set; }
+        public string CssClass { get; private set; } = cssClass;
 
         /// <summary>
         /// Gets the reason why the CSS class will be removed.
@@ -271,26 +234,19 @@ namespace Ganss.Xss
         /// <value>
         /// The reason.
         /// </value>
-        public RemoveReason Reason { get; private set; }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="RemovingCssClassEventArgs"/> class.
-        /// </summary>
-        /// <param name="tag">The element containing the attribute.</param>
-        /// <param name="cssClass">The CSS class to be removed.</param>
-        /// <param name="reason">The reason why the attribute will be removed.</param>
-        public RemovingCssClassEventArgs(IElement tag, string cssClass, RemoveReason reason)
-        {
-            Tag = tag;
-            CssClass = cssClass;
-            Reason = reason;
-        }
+        public RemoveReason Reason { get; private set; } = reason;
     }
 
     /// <summary>
     /// Provides data for the <see cref="HtmlSanitizer.FilterUrl"/> event.
     /// </summary>
-    public class FilterUrlEventArgs: EventArgs
+    /// <remarks>
+    /// Initializes a new instance of the <see cref="FilterUrlEventArgs"/> class.
+    /// </remarks>
+    /// <param name="tag">The tag containing the URI being sanitized.</param>
+    /// <param name="originalUrl">The original URL.</param>
+    /// <param name="sanitizedUrl">The sanitized URL.</param>
+    public class FilterUrlEventArgs(IElement tag, string originalUrl, string? sanitizedUrl = null) : EventArgs
     {
         /// <summary>
         /// Gets the original URL.
@@ -298,7 +254,7 @@ namespace Ganss.Xss
         /// <value>
         /// The original URL.
         /// </value>
-        public string OriginalUrl { get; private set; }
+        public string OriginalUrl { get; private set; } = originalUrl;
 
         /// <summary>
         /// Gets or sets the sanitized URL.
@@ -306,7 +262,7 @@ namespace Ganss.Xss
         /// <value>
         /// The sanitized URL. If it is null, it will be removed.
         /// </value>
-        public string? SanitizedUrl { get; set; }
+        public string? SanitizedUrl { get; set; } = sanitizedUrl;
 
         /// <summary>
         /// Gets the tag containing the URI being sanitized.
@@ -314,19 +270,6 @@ namespace Ganss.Xss
         /// <value>
         /// The tag.
         /// </value>
-        public IElement Tag { get; private set; }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="FilterUrlEventArgs"/> class.
-        /// </summary>
-        /// <param name="tag">The tag containing the URI being sanitized.</param>
-        /// <param name="originalUrl">The original URL.</param>
-        /// <param name="sanitizedUrl">The sanitized URL.</param>
-        public FilterUrlEventArgs(IElement tag, string originalUrl, string? sanitizedUrl = null)
-        {
-            OriginalUrl = originalUrl;
-            SanitizedUrl = sanitizedUrl;
-            Tag = tag;
-        }
+        public IElement Tag { get; private set; } = tag;
     }
 }

+ 18 - 8
Masuit.Tools.Abstractions/HtmlSanitizer/HtmlSanitizer.cs

@@ -52,6 +52,8 @@ namespace Ganss.Xss
     /// </example>
     public class HtmlSanitizer : IHtmlSanitizer
     {
+        private const string StyleAttributeName = "style";
+
         // from http://genshi.edgewall.org/
         private static readonly Regex CssUnicodeEscapes = new(@"\\([0-9a-fA-F]{1,6})\s?|\\([^\r\n\f0-9a-fA-F'""{};:()#*])", RegexOptions.Compiled);
         private static readonly Regex CssComments = new(@"/\*.*?\*/", RegexOptions.Compiled);
@@ -529,7 +531,7 @@ namespace Ganss.Xss
                 }
 
                 // sanitize the style attribute
-                var oldStyleEmpty = string.IsNullOrEmpty(tag.GetAttribute("style"));
+                var oldStyleEmpty = string.IsNullOrEmpty(tag.GetAttribute(StyleAttributeName));
                 SanitizeStyle(tag, baseUrl);
 
                 // sanitize the value of the attributes
@@ -553,7 +555,7 @@ namespace Ganss.Xss
                             if (!tag.ClassList.Any())
                                 RemoveAttribute(tag, attribute, RemoveReason.ClassAttributeEmpty);
                         }
-                        else if (!oldStyleEmpty && attribute.Name == "style" && string.IsNullOrEmpty(attribute.Value))
+                        else if (!oldStyleEmpty && attribute.Name == StyleAttributeName && string.IsNullOrEmpty(attribute.Value))
                         {
                             RemoveAttribute(tag, attribute, RemoveReason.StyleAttributeEmpty);
                         }
@@ -574,8 +576,9 @@ namespace Ganss.Xss
             foreach (var styleSheet in dom.StyleSheets.OfType<ICssStyleSheet>())
             {
                 var styleTag = styleSheet.OwnerNode;
+                var i = 0;
 
-                for (int i = 0; i < styleSheet.Rules.Length;)
+                while (i < styleSheet.Rules.Length)
                 {
                     var rule = styleSheet.Rules[i];
                     if (!SanitizeStyleRule(rule, styleTag, baseUrl) && RemoveAtRule(styleTag, rule))
@@ -599,7 +602,9 @@ namespace Ganss.Xss
             {
                 if (rule is ICssGroupingRule groupingRule)
                 {
-                    for (int i = 0; i < groupingRule.Rules.Length;)
+                    var i = 0;
+
+                    while (i < groupingRule.Rules.Length)
                     {
                         var childRule = groupingRule.Rules[i];
                         if (!SanitizeStyleRule(childRule, styleTag, baseUrl) && RemoveAtRule(styleTag, childRule))
@@ -702,17 +707,17 @@ namespace Ganss.Xss
         {
             // filter out invalid CSS declarations
             // see https://github.com/AngleSharp/AngleSharp/issues/101
-            var attribute = element.GetAttribute("style");
+            var attribute = element.GetAttribute(StyleAttributeName);
             if (attribute == null)
                 return;
 
             if (element.GetStyle() == null)
             {
-                element.RemoveAttribute("style");
+                element.RemoveAttribute(StyleAttributeName);
                 return;
             }
 
-            element.SetAttribute("style", element.GetStyle().ToCss(StyleFormatter));
+            element.SetAttribute(StyleAttributeName, element.GetStyle().ToCss(StyleFormatter));
 
             var styles = element.GetStyle();
             if (styles == null || styles.Length == 0)
@@ -853,7 +858,12 @@ namespace Ganss.Xss
                 {
                     try
                     {
-                        return new Uri(baseUri, iri.Value).AbsoluteUri;
+                        var sanitizedUrl = new Uri(baseUri, iri.Value).AbsoluteUri;
+                        var ev = new FilterUrlEventArgs(element, url, sanitizedUrl);
+
+                        OnFilteringUrl(ev);
+
+                        return ev.SanitizedUrl;
                     }
                     catch (UriFormatException)
                     {

+ 8 - 14
Masuit.Tools.Abstractions/HtmlSanitizer/Iri.cs

@@ -8,7 +8,12 @@ namespace Ganss.Xss
     /// <summary>
     /// Represents an Internationalized Resource Identifier.
     /// </summary>
-    public class Iri
+    /// <remarks>
+    /// Initializes a new instance of the <see cref="Iri"/> class.
+    /// </remarks>
+    /// <param name="value">The value.</param>
+    /// <param name="scheme">The scheme.</param>
+    public class Iri(string value, string? scheme = null)
     {
         /// <summary>
         /// Gets or sets the value of the IRI.
@@ -16,7 +21,7 @@ namespace Ganss.Xss
         /// <value>
         /// The value of the IRI.
         /// </value>
-        public string Value { get; private set; }
+        public string Value { get; private set; } = value;
 
         /// <summary>
         /// Gets a value indicating whether the IRI is absolute.
@@ -32,17 +37,6 @@ namespace Ganss.Xss
         /// <value>
         /// The scheme of the IRI.
         /// </value>
-        public string? Scheme { get; private set; }
-
-        /// <summary>
-        /// Initializes a new instance of the <see cref="Iri"/> class.
-        /// </summary>
-        /// <param name="value">The value.</param>
-        /// <param name="scheme">The scheme.</param>
-        public Iri(string value, string? scheme = null)
-        {
-            Value = value;
-            Scheme = scheme;
-        }
+        public string? Scheme { get; private set; } = scheme;
     }
 }

+ 2 - 2
Masuit.Tools.Abstractions/Masuit.Tools.Abstractions.csproj

@@ -3,7 +3,7 @@
         <TargetFrameworks>netstandard2.0;netstandard2.1;net461;net5;net6;net7;net8</TargetFrameworks>
         <LangVersion>latest</LangVersion>
         <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-        <Version>2024.1</Version>
+        <Version>2024.2</Version>
         <Authors>懒得勤快</Authors>
         <Description>全龄段友好的C#万能工具库,码数吐司库,不管你是菜鸟新手还是骨灰级玩家都能轻松上手,Masuit.Tools基础公共库(适用于.NET4.6.1/.NET Standard2.0及以上项目),包含一些常用的操作类,大都是静态类,加密解密,反射操作,Excel简单导出,权重随机筛选算法,分布式短id,表达式树,linq扩展,文件压缩,多线程下载和FTP客户端,硬件信息,字符串扩展方法,日期时间扩展操作,中国农历,大文件拷贝,图像裁剪,验证码,断点续传,集合扩展等常用封装。
             官网教程:https://masuit.tools
@@ -58,7 +58,7 @@
         <PackageReference Include="System.Configuration.ConfigurationManager" Version="8.0.0" />
         <PackageReference Include="System.Management" Version="8.0" />
         <PackageReference Include="System.Reflection.Emit.Lightweight" Version="4.7.0" />
-        <PackageReference Include="SharpCompress" Version="0.36.0" />
+        <PackageReference Include="SharpCompress" Version="0.37.2" />
     </ItemGroup>
 
     <ItemGroup Condition=" '$(TargetFramework)' == 'netstandard2.0'">

+ 4 - 5
Masuit.Tools.Abstractions/Media/ImageUtilities.cs

@@ -73,12 +73,12 @@ namespace Masuit.Tools.Media
         /// <param name="mode">生成缩略图的方式</param>
         public static void MakeThumbnail(this Image originalImage, string thumbnailPath, int width, int height, ResizeMode mode)
         {
-            originalImage.Mutate(c => c.Resize(new ResizeOptions()
+            using var image = originalImage.Clone(c => c.Resize(new ResizeOptions()
             {
                 Size = new Size(width, height),
                 Mode = mode
             }));
-            originalImage.Save(thumbnailPath);
+            image.Save(thumbnailPath);
         }
 
         /// <summary>
@@ -90,12 +90,11 @@ namespace Masuit.Tools.Media
         /// <param name="mode">生成缩略图的方式</param>
         public static Image MakeThumbnail(this Image originalImage, int width, int height, ResizeMode mode)
         {
-            originalImage.Mutate(c => c.Resize(new ResizeOptions()
+            return originalImage.Clone(c => c.Resize(new ResizeOptions()
             {
                 Size = new Size(width, height),
                 Mode = mode
             }));
-            return originalImage;
         }
 
         #endregion 缩略图
@@ -341,4 +340,4 @@ namespace Masuit.Tools.Media
             return Image.Load(ms);
         }
     }
-}
+}

+ 3 - 2
Masuit.Tools.Abstractions/Models/TreeExtensions.cs

@@ -574,10 +574,11 @@ namespace Masuit.Tools.Models
         /// 递归取出所有下级
         /// </summary>
         /// <param name="t"></param>
+        /// <param name="selector"></param>
         /// <returns></returns>
         private static List<T> GetChildren<T>(T t, Func<T, IEnumerable<T>> selector)
         {
-            return selector(t).Union(selector(t).Where(c => selector(c).Any()).SelectMany(c => GetChildren(c, selector))).ToList();
+            return selector(t).Union(selector(t).Where(c => selector(c)?.Any() == true).SelectMany(c => GetChildren(c, selector))).ToList();
         }
 
         /// <summary>
@@ -652,4 +653,4 @@ namespace Masuit.Tools.Models
             return temp;
         }
     }
-}
+}

+ 2 - 2
Masuit.Tools.AspNetCore/Masuit.Tools.AspNetCore.csproj

@@ -18,7 +18,7 @@
         <Product>Masuit.Tools.AspNetCore</Product>
         <PackageId>Masuit.Tools.AspNetCore</PackageId>
         <LangVersion>latest</LangVersion>
-        <Version>2024.1</Version>
+        <Version>2024.2</Version>
         <RepositoryType></RepositoryType>
         <GeneratePackageOnBuild>True</GeneratePackageOnBuild>
         <FileVersion>1.1.9</FileVersion>
@@ -46,7 +46,7 @@
 
     <ItemGroup>
         <FrameworkReference Include="Microsoft.AspNetCore.App" />
-        <PackageReference Include="FastExpressionCompiler" Version="4.1.0" />
+        <PackageReference Include="FastExpressionCompiler" Version="4.2.0" />
     </ItemGroup>
 
     <ItemGroup>

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

@@ -6,7 +6,7 @@
 官网教程:https://tools.masuit.org
 github:https://github.com/ldqk/Masuit.Tools
         </Description>
-        <Version>2024.1</Version>
+        <Version>2024.2</Version>
         <Copyright>Copyright © 懒得勤快</Copyright>
         <PackageProjectUrl>https://github.com/ldqk/Masuit.Tools</PackageProjectUrl>
         <PackageTags>Masuit.Tools,工具库,Utility,Crypt,Extensions</PackageTags>

+ 2 - 2
Masuit.Tools.Excel/Masuit.Tools.Excel.csproj

@@ -3,7 +3,7 @@
         <TargetFramework>netstandard2.0</TargetFramework>
         <LangVersion>latest</LangVersion>
         <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
-        <Version>2024.1</Version>
+        <Version>2024.2</Version>
         <Authors>懒得勤快</Authors>
         <Description>Masuit.Tools.Excel导出库,支持一些简单数据的导出,支持图片列</Description>
         <Copyright>懒得勤快</Copyright>
@@ -38,7 +38,7 @@
       </None>
     </ItemGroup>
     <ItemGroup>
-        <PackageReference Include="EPPlus" Version="7.1.1" />
+        <PackageReference Include="EPPlus" Version="7.1.2" />
         <PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" PrivateAssets="All" />
     </ItemGroup>
     <ItemGroup>

+ 2 - 2
Masuit.Tools.Net45/package.nuspec

@@ -1,8 +1,8 @@
-<?xml version="1.0"?>
+<?xml version="1.0"?>
 <package>
     <metadata>
         <id>Masuit.Tools.Net45</id>
-        <version>2024.1</version>
+        <version>2024.2</version>
         <title>Masuit.Tools</title>
         <authors>懒得勤快</authors>
         <owners>masuit.com</owners>

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

@@ -38,7 +38,7 @@
   </PropertyGroup>
 
   <ItemGroup>
-    <PackageReference Include="MongoDB.Driver" Version="2.24.0" />
+    <PackageReference Include="MongoDB.Driver" Version="2.25.0" />
   </ItemGroup>
 
 </Project>

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

@@ -209,7 +209,7 @@
       <Version>1.7.0</Version>
     </PackageReference>
     <PackageReference Include="HtmlSanitizer">
-      <Version>8.0.843</Version>
+      <Version>8.0.865</Version>
     </PackageReference>
     <PackageReference Include="Microsoft.AspNet.Mvc">
       <Version>5.3.0</Version>
@@ -218,7 +218,7 @@
       <Version>13.0.3</Version>
     </PackageReference>
     <PackageReference Include="SharpCompress">
-      <Version>0.36.0</Version>
+      <Version>0.37.2</Version>
     </PackageReference>
     <PackageReference Include="SixLabors.ImageSharp.Drawing">
       <Version>1.0.0</Version>

+ 2 - 2
Masuit.Tools/package.nuspec

@@ -1,8 +1,8 @@
-<?xml version="1.0"?>
+<?xml version="1.0"?>
 <package>
     <metadata>
         <id>Masuit.Tools.Net</id>
-        <version>2024.1</version>
+        <version>2024.2</version>
         <title>Masuit.Tools</title>
         <authors>懒得勤快</authors>
         <owners>masuit.com</owners>

+ 2 - 2
Test/Masuit.Tools.Abstractions.Test/Masuit.Tools.Abstractions.Test.csproj

@@ -14,8 +14,8 @@
 
   <ItemGroup>
     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
-    <PackageReference Include="xunit" Version="2.7.1" />
-    <PackageReference Include="xunit.runner.visualstudio" Version="2.5.8">
+    <PackageReference Include="xunit" Version="2.8.0" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
     </PackageReference>

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

@@ -12,8 +12,8 @@
     <PackageReference Include="Microsoft.AspNetCore.TestHost" Version="8.0.4" />
     <PackageReference Include="Microsoft.Extensions.Hosting" Version="8.0.0" />
     <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.9.0" />
-    <PackageReference Include="xunit" Version="2.7.1" />
-    <PackageReference Include="xunit.runner.visualstudio" Version="2.5.8">
+    <PackageReference Include="xunit" Version="2.8.0" />
+    <PackageReference Include="xunit.runner.visualstudio" Version="2.8.0">
       <PrivateAssets>all</PrivateAssets>
       <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
     </PackageReference>

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

@@ -107,25 +107,25 @@
       <Version>4.5.0</Version>
     </PackageReference>
     <PackageReference Include="xunit">
-      <Version>2.7.1</Version>
+      <Version>2.8.0</Version>
     </PackageReference>
     <PackageReference Include="xunit.abstractions">
       <Version>2.0.3</Version>
     </PackageReference>
     <PackageReference Include="xunit.analyzers">
-      <Version>1.12.0</Version>
+      <Version>1.13.0</Version>
     </PackageReference>
     <PackageReference Include="xunit.assert">
-      <Version>2.7.1</Version>
+      <Version>2.8.0</Version>
     </PackageReference>
     <PackageReference Include="xunit.core">
-      <Version>2.7.1</Version>
+      <Version>2.8.0</Version>
     </PackageReference>
     <PackageReference Include="xunit.extensibility.core">
-      <Version>2.7.1</Version>
+      <Version>2.8.0</Version>
     </PackageReference>
     <PackageReference Include="xunit.extensibility.execution">
-      <Version>2.7.1</Version>
+      <Version>2.8.0</Version>
     </PackageReference>
   </ItemGroup>
   <Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />