diff --git a/Bin/net40/SunnyUI.dll b/Bin/net40/SunnyUI.dll index 7397284b..dbfff86b 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 new file mode 100644 index 00000000..8f040c14 --- /dev/null +++ b/SunnyUI/Common/UFastLZ.cs @@ -0,0 +1,84 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Runtime.InteropServices; +using System.Text; +using System.Threading.Tasks; + +namespace Sunny.UI +{ + internal static unsafe class FastLZx86 + { + [DllImport("FastLZx86.dll", EntryPoint = "FastLZ_Compress", CallingConvention = CallingConvention.Cdecl)] + public static extern int FastLZ_Compress(void* input, int length, void* output); + + [DllImport("FastLZx86.dll", EntryPoint = "FastLZ_Compress_level", CallingConvention = CallingConvention.Cdecl)] + public static extern int FastLZ_Compress_level(int level, void* input, int length, void* output); + + [DllImport("FastLZx86.dll", EntryPoint = "FastLZ_Decompress", CallingConvention = CallingConvention.Cdecl)] + public static extern int FastLZ_Decompress(void* input, int length, void* output, int maxout); + } + + internal static unsafe class FastLZx64 + { + [DllImport("FastLZx64.dll", EntryPoint = "FastLZ_Compress", CallingConvention = CallingConvention.Cdecl)] + public static extern int FastLZ_Compress(void* input, int length, void* output); + + [DllImport("FastLZx64.dll", EntryPoint = "FastLZ_Compress_level", CallingConvention = CallingConvention.Cdecl)] + public static extern int FastLZ_Compress_level(int level, void* input, int length, void* output); + + [DllImport("FastLZx64.dll", EntryPoint = "FastLZ_Decompress", CallingConvention = CallingConvention.Cdecl)] + public static extern int FastLZ_Decompress(void* input, int length, void* output, int maxout); + } + + public static unsafe class FastLZ + { + /// + /// 是否64位 + /// + /// + public static bool IsSys64bit() + { + return IntPtr.Size == 8; + } + + public static byte[] Compress(byte[] input, int begin, int len) + { + byte[] output = new byte[input.Length]; + fixed (void* pSrc1 = &input[begin]) + fixed (void* pSrc2 = output) + { + int outlen = IsSys64bit() ? 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; + } + } + + public static byte[] Compress(int level, byte[] input, int begin, int len) + { + byte[] output = new byte[input.Length]; + 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); + byte[] result = new byte[outlen]; + Array.Copy(output, 0, result, 0, outlen); + return result; + } + } + + public static byte[] Decompress(byte[] input, int begin, int length, int maxout) + { + byte[] output = new byte[maxout]; + 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); + byte[] result = new byte[outlen]; + Array.Copy(output, 0, result, 0, outlen); + return result; + } + } + } +} \ No newline at end of file diff --git a/SunnyUI/Controls/DropItem/UIComboDataGridViewItem.cs b/SunnyUI/Controls/DropItem/UIComboDataGridViewItem.cs index 762290eb..92d30128 100644 --- a/SunnyUI/Controls/DropItem/UIComboDataGridViewItem.cs +++ b/SunnyUI/Controls/DropItem/UIComboDataGridViewItem.cs @@ -295,7 +295,7 @@ namespace Sunny.UI if (dataGridView.RowCount > 0 && dataGridView.SelectedIndex >= 0) { if (ShowFilter) - DoValueChanged(this, dataGridView.SelectedRows.Count>0 ? dataGridView.SelectedRows[0] : null); + DoValueChanged(this, dataGridView.SelectedRows.Count > 0 ? dataGridView.SelectedRows[0] : null); else DoValueChanged(this, dataGridView.SelectedIndex); } @@ -335,7 +335,7 @@ namespace Sunny.UI { if (column.Visible) { - strings.Add(column.HeaderText + " like '%" + edtFilter.Text + "%'"); + strings.Add(column.DataPropertyName + " like '%" + edtFilter.Text + "%'"); } }