diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll
index 7c3d1c84..ec775cb2 100644
Binary files a/Bin/net40/SunnyUI.dll and b/Bin/net40/SunnyUI.dll differ
diff --git a/SunnyUI/Common/UFastLZ.cs b/SunnyUI/Common/UFastLZ.cs
index 8f040c14..0485aa64 100644
--- a/SunnyUI/Common/UFastLZ.cs
+++ b/SunnyUI/Common/UFastLZ.cs
@@ -1,4 +1,33 @@
-using System;
+/******************************************************************************
+ * SunnyUI 开源控件库、工具类库、扩展类库、多页面开发框架。
+ * CopyRight (C) 2012-2022 ShenYongHua(沈永华).
+ * QQ群:56829229 QQ:17612584 EMail:SunnyUI@QQ.Com
+ *
+ * Blog: https://www.cnblogs.com/yhuse
+ * Gitee: https://gitee.com/yhuse/SunnyUI
+ * GitHub: https://github.com/yhuse/SunnyUI
+ *
+ * SunnyUI.dll can be used for free under the GPL-3.0 license.
+ * If you use this code, please keep this note.
+ * 如果您使用此代码,请保留此说明。
+ ******************************************************************************
+ * 文件名称: FastLZ.cs
+ * 文件说明: FastLZ压缩解压类
+ * 当前版本: V3.1
+ * 创建日期: 2022-03-31
+ * 引用地址: https://ariya.github.io/FastLZ/
+ *
+ * FastLZ (MIT license) is an ANSI C/C90 implementation of Lempel-Ziv 77
+ * algorithm (LZ77) of lossless data compression. It is suitable to compress
+ * series of text/paragraphs, sequences of raw pixel data, or any other blocks
+ * of data with lots of repetition. It is not intended to be used on images,
+ * videos, and other formats of data typically already in an optimal
+ * compressed form.
+ *
+ * 2022-03-31: V3.1.2 增加文件说明
+******************************************************************************/
+
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
@@ -37,7 +66,7 @@ namespace Sunny.UI
/// 是否64位
///
///
- public static bool IsSys64bit()
+ public static bool Is64bitApp()
{
return IntPtr.Size == 8;
}
@@ -48,7 +77,7 @@ namespace Sunny.UI
fixed (void* pSrc1 = &input[begin])
fixed (void* pSrc2 = output)
{
- int outlen = IsSys64bit() ? FastLZx64.FastLZ_Compress(pSrc1, len, pSrc2) : FastLZx86.FastLZ_Compress(pSrc1, len, pSrc2);
+ int outlen = Is64bitApp() ? FastLZx64.FastLZ_Compress(pSrc1, len, pSrc2) : FastLZx86.FastLZ_Compress(pSrc1, len, pSrc2);
byte[] result = new byte[outlen];
Array.Copy(output, 0, result, 0, outlen);
return result;
@@ -61,7 +90,7 @@ namespace Sunny.UI
fixed (void* pSrc1 = &input[begin])
fixed (void* pSrc2 = output)
{
- int outlen = IsSys64bit() ? FastLZx64.FastLZ_Compress_level(level, pSrc1, len, pSrc2) : FastLZx86.FastLZ_Compress_level(level, pSrc1, len, pSrc2);
+ int outlen = Is64bitApp() ? FastLZx64.FastLZ_Compress_level(level, pSrc1, len, pSrc2) : FastLZx86.FastLZ_Compress_level(level, pSrc1, len, pSrc2);
byte[] result = new byte[outlen];
Array.Copy(output, 0, result, 0, outlen);
return result;
@@ -74,7 +103,7 @@ namespace Sunny.UI
fixed (byte* pSrc1 = &input[begin])
fixed (byte* pSrc2 = output)
{
- int outlen = IsSys64bit() ? FastLZx64.FastLZ_Decompress(pSrc1, length, pSrc2, maxout) : FastLZx86.FastLZ_Decompress(pSrc1, length, pSrc2, maxout);
+ int outlen = Is64bitApp() ? FastLZx64.FastLZ_Decompress(pSrc1, length, pSrc2, maxout) : FastLZx86.FastLZ_Decompress(pSrc1, length, pSrc2, maxout);
byte[] result = new byte[outlen];
Array.Copy(output, 0, result, 0, outlen);
return result;
diff --git a/SunnyUI/Common/UFile.cs b/SunnyUI/Common/UFile.cs
index a0e6fa49..4b4c91bb 100644
--- a/SunnyUI/Common/UFile.cs
+++ b/SunnyUI/Common/UFile.cs
@@ -209,7 +209,7 @@ namespace Sunny.UI
///
/// 文件名
/// 结果
- public static FileInfo FileInfo(this string filename)
+ public static FileInfo FileInfo(string filename)
{
return File.Exists(filename) ? new FileInfo(filename) : null;
}
@@ -254,7 +254,8 @@ namespace Sunny.UI
/// 是否运行
public static bool IsRun(string filename)
{
- return filename.FileInfo().IsRun();
+ FileInfo info = FileInfo(filename);
+ return info == null ? false : info.IsRun();
}
///
@@ -492,7 +493,8 @@ namespace Sunny.UI
/// 结果
public static bool TryDelete(string file)
{
- return file.FileInfo().TryDelete();
+ FileInfo info = FileInfo(file);
+ return info == null ? false : info.TryDelete();
}
///
diff --git a/SunnyUI/Common/UGDI.cs b/SunnyUI/Common/UGDI.cs
index eb00eb50..111c1883 100644
--- a/SunnyUI/Common/UGDI.cs
+++ b/SunnyUI/Common/UGDI.cs
@@ -210,7 +210,7 @@ namespace Sunny.UI
return colors;
}
- public static void Smooth(this Graphics g, bool smooth = true)
+ public static Graphics Smooth(this Graphics g, bool smooth = true)
{
if (smooth)
{
@@ -220,6 +220,8 @@ namespace Sunny.UI
{
g.SetDefaultQuality();
}
+
+ return g;
}
@@ -336,22 +338,24 @@ namespace Sunny.UI
/// 设置GDI高质量模式抗锯齿
///
///
- public static void SetHighQuality(this Graphics g)
+ public static Graphics SetHighQuality(this Graphics g)
{
g.SmoothingMode = SmoothingMode.AntiAlias; //使绘图质量最高,即消除锯齿
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
g.CompositingQuality = CompositingQuality.HighQuality;
+ return g;
}
///
/// 设置GDI默认值
///
///
- public static void SetDefaultQuality(this Graphics g)
+ public static Graphics SetDefaultQuality(this Graphics g)
{
g.SmoothingMode = SmoothingMode.Default;
g.InterpolationMode = InterpolationMode.Default;
g.CompositingQuality = CompositingQuality.Default;
+ return g;
}
public static string ToHTML(this Color color)
diff --git a/SunnyUI/Common/USystem.cs b/SunnyUI/Common/USystem.cs
index ad5a85e7..a185e53a 100644
--- a/SunnyUI/Common/USystem.cs
+++ b/SunnyUI/Common/USystem.cs
@@ -133,12 +133,16 @@ namespace Sunny.UI
/// The ms.
public static void Delay(int ms)
{
- int start = Environment.TickCount;
- while (Environment.TickCount - start < ms)
- {
- System.Threading.Thread.Sleep(1);
- Application.DoEvents();
- }
+ System.Threading.Thread.Sleep(Math.Max(0, ms));
+ }
+
+ ///
+ /// 是否64位
+ ///
+ ///
+ public static bool Is64bitApp()
+ {
+ return IntPtr.Size == 8;
}
///
diff --git a/SunnyUI/Forms/UIFormHelper.cs b/SunnyUI/Forms/UIFormHelper.cs
index 52b0f06c..ea2fa3c5 100644
--- a/SunnyUI/Forms/UIFormHelper.cs
+++ b/SunnyUI/Forms/UIFormHelper.cs
@@ -665,7 +665,6 @@ namespace Sunny.UI
{
topmost = baseForm.TopMost;
baseForm.TopMost = true;
- Application.DoEvents();
}
Form mask = new Form();