改版本号,解决样式排序问题

This commit is contained in:
小红帽 2023-12-27 15:24:48 +08:00
parent 22236251cb
commit 26b051b222
24 changed files with 59 additions and 30 deletions

View File

@ -2,7 +2,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<Version>0.9.6.6</Version> <Version>0.9.6.7</Version>
<Authors>QQ:761716178</Authors> <Authors>QQ:761716178</Authors>
<Company>QQ:761716178</Company> <Company>QQ:761716178</Company>
<Product>QQ:761716178 跨平台UI框架</Product> <Product>QQ:761716178 跨平台UI框架</Product>
@ -12,6 +12,7 @@
<PackageId>Xhm.CPF.Linux</PackageId> <PackageId>Xhm.CPF.Linux</PackageId>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance> <PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.1</TargetFramework> <TargetFramework>netstandard2.1</TargetFramework>
<Product>QQ:761716178 跨平台UI框架</Product> <Product>QQ:761716178 跨平台UI框架</Product>
<Version>0.9.6.6</Version> <Version>0.9.6.7</Version>
<PackageId>Xhm.CPF.Mac</PackageId> <PackageId>Xhm.CPF.Mac</PackageId>
<Description>CPF(Cross platform UI framework) QQ:761716178 跨平台UI框架 http://cpf.cskin.net/</Description> <Description>CPF(Cross platform UI framework) QQ:761716178 跨平台UI框架 http://cpf.cskin.net/</Description>
<Copyright>Copyright (c) 2020 by http://cpf.cskin.net/</Copyright> <Copyright>Copyright (c) 2020 by http://cpf.cskin.net/</Copyright>
@ -11,6 +11,7 @@
<Authors>QQ:761716178</Authors> <Authors>QQ:761716178</Authors>
<Company>QQ:761716178</Company> <Company>QQ:761716178</Company>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks> <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@ -3,13 +3,14 @@
<PropertyGroup> <PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework> <TargetFramework>netstandard2.0</TargetFramework>
<Product>QQ:761716178 跨平台UI框架</Product> <Product>QQ:761716178 跨平台UI框架</Product>
<Version>0.9.6.6</Version> <Version>0.9.6.7</Version>
<PackageId>Xhm.CPF.Skia</PackageId> <PackageId>Xhm.CPF.Skia</PackageId>
<Description>CPF(Cross platform UI framework) QQ:761716178 跨平台UI框架 http://cpf.cskin.net/</Description> <Description>CPF(Cross platform UI framework) QQ:761716178 跨平台UI框架 http://cpf.cskin.net/</Description>
<Copyright>Copyright (c) 2020 by http://cpf.cskin.net/</Copyright> <Copyright>Copyright (c) 2020 by http://cpf.cskin.net/</Copyright>
<PackageReleaseNotes>CPF(Cross platform UI framework) QQ:761716178 跨平台UI框架 http://cpf.cskin.net/</PackageReleaseNotes> <PackageReleaseNotes>CPF(Cross platform UI framework) QQ:761716178 跨平台UI框架 http://cpf.cskin.net/</PackageReleaseNotes>
<Authors>QQ:761716178</Authors> <Authors>QQ:761716178</Authors>
<Company>QQ:761716178</Company> <Company>QQ:761716178</Company>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@ -3,7 +3,7 @@
<PropertyGroup> <PropertyGroup>
<TargetFrameworks>net40;netstandard2.0;net5</TargetFrameworks> <TargetFrameworks>net40;netstandard2.0;net5</TargetFrameworks>
<Product>QQ:761716178 跨平台UI框架</Product> <Product>QQ:761716178 跨平台UI框架</Product>
<Version>0.9.6.6</Version> <Version>0.9.6.7</Version>
<PackageId>Xhm.CPF.Windows</PackageId> <PackageId>Xhm.CPF.Windows</PackageId>
<Description>CPF(Cross platform UI framework) QQ:761716178 跨平台UI框架 http://cpf.cskin.net/</Description> <Description>CPF(Cross platform UI framework) QQ:761716178 跨平台UI框架 http://cpf.cskin.net/</Description>
<PackageProjectUrl>http://cpf.cskin.net/</PackageProjectUrl> <PackageProjectUrl>http://cpf.cskin.net/</PackageProjectUrl>
@ -55,6 +55,7 @@
<PropertyGroup> <PropertyGroup>
<DefineConstants Condition="'$(TargetFramework)'=='net40'">Net4</DefineConstants> <DefineConstants Condition="'$(TargetFramework)'=='net40'">Net4</DefineConstants>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup> </PropertyGroup>
</Project> </Project>

View File

@ -1009,7 +1009,7 @@ namespace CPF
public bool ReadValue<T>(out T value) where T : struct public bool ReadValue<T>(out T value) where T : struct
{ {
value = default; value = default;
#if Net4 #if NET40
int len = Marshal.SizeOf(typeof(T)); int len = Marshal.SizeOf(typeof(T));
#else #else
int len = Marshal.SizeOf<T>(); int len = Marshal.SizeOf<T>();
@ -1018,7 +1018,7 @@ namespace CPF
{ {
IntPtr ptr = Marshal.AllocHGlobal(len); IntPtr ptr = Marshal.AllocHGlobal(len);
Marshal.Copy(data, 0, ptr, len); Marshal.Copy(data, 0, ptr, len);
#if Net4 #if NET40
value = (T)Marshal.PtrToStructure(ptr, typeof(T)); value = (T)Marshal.PtrToStructure(ptr, typeof(T));
#else #else
value = Marshal.PtrToStructure<T>(ptr); value = Marshal.PtrToStructure<T>(ptr);

View File

@ -6,7 +6,7 @@
<Company>QQ:761716178</Company> <Company>QQ:761716178</Company>
<Product>QQ:761716178 跨平台UI框架</Product> <Product>QQ:761716178 跨平台UI框架</Product>
<Description>CPF(Cross platform UI framework) QQ:761716178 跨平台UI框架 http://cpf.cskin.net/</Description> <Description>CPF(Cross platform UI framework) QQ:761716178 跨平台UI框架 http://cpf.cskin.net/</Description>
<Version>0.9.6.6</Version> <Version>0.9.6.7</Version>
<LangVersion>9.0</LangVersion> <LangVersion>9.0</LangVersion>
<PackageId>Xhm.CPF</PackageId> <PackageId>Xhm.CPF</PackageId>
<PackageProjectUrl></PackageProjectUrl> <PackageProjectUrl></PackageProjectUrl>
@ -50,7 +50,7 @@
<Compile Remove="Drawing\FormattedText.cs" /> <Compile Remove="Drawing\FormattedText.cs" />
<Compile Remove="Drawing\Matrix - 复制.cs" /> <Compile Remove="Drawing\Matrix - 复制.cs" />
<Compile Remove="Effects\OpacityMaskEffect.cs" /> <Compile Remove="Effects\OpacityMaskEffect.cs" />
<Compile Remove="Net4\CallerMember.cs" /> <Compile Remove="NET40\CallerMember.cs" />
<Compile Remove="Platform\IScreenImpl.cs" /> <Compile Remove="Platform\IScreenImpl.cs" />
<Compile Remove="Reflection\Accessor.cs" /> <Compile Remove="Reflection\Accessor.cs" />
<Compile Remove="Reflection\ConstructorInvoker.cs" /> <Compile Remove="Reflection\ConstructorInvoker.cs" />
@ -95,7 +95,7 @@
<EmbeddedResource Include="loading.gif" /> <EmbeddedResource Include="loading.gif" />
</ItemGroup> </ItemGroup>
<PropertyGroup> <PropertyGroup>
<DefineConstants Condition="'$(TargetFramework)'=='net40'">Net4</DefineConstants> <GeneratePackageOnBuild>false</GeneratePackageOnBuild>
</PropertyGroup> </PropertyGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net40'"> <ItemGroup Condition="'$(TargetFramework)'=='net40'">
<PackageReference Include="AsyncBridge" Version="0.3.1" /> <PackageReference Include="AsyncBridge" Version="0.3.1" />

View File

@ -225,7 +225,7 @@ namespace CPF.Controls
/// <summary> /// <summary>
/// 布局好的行 /// 布局好的行
/// </summary> /// </summary>
#if Net4 #if NET40
public IList<TextLine> Lines public IList<TextLine> Lines
{ {
get { return codeTextView.Lines; } get { return codeTextView.Lines; }
@ -269,7 +269,7 @@ namespace CPF.Controls
if (render) if (render)
{ {
render = false; render = false;
#if Net4 #if NET40
await TaskEx.Delay(30); await TaskEx.Delay(30);
#else #else
await Task.Delay(30); await Task.Delay(30);
@ -285,7 +285,7 @@ namespace CPF.Controls
Cancellation = new CancellationTokenSource(); Cancellation = new CancellationTokenSource();
} }
var ks = KeywordsStyles.ToArray(); var ks = KeywordsStyles.ToArray();
#if Net4 #if NET40
var styles = await TaskEx.Run(() => CodeTextView.RenderKeywords(Cancellation.Token, ks, codeTextView.Text)); var styles = await TaskEx.Run(() => CodeTextView.RenderKeywords(Cancellation.Token, ks, codeTextView.Text));
#else #else
var styles = await Task.Run(() => CodeTextView.RenderKeywords(Cancellation.Token, ks, codeTextView.Text)); var styles = await Task.Run(() => CodeTextView.RenderKeywords(Cancellation.Token, ks, codeTextView.Text));

View File

@ -742,7 +742,7 @@ namespace CPF.Controls
/// <summary> /// <summary>
/// 布局好的行 /// 布局好的行
/// </summary> /// </summary>
#if Net4 #if NET40
public IList<TextLine> Lines public IList<TextLine> Lines
{ {
get { return lines; } get { return lines; }

View File

@ -273,7 +273,7 @@ namespace CPF.Controls
/// <param name="propertyName">缓存的属性</param> /// <param name="propertyName">缓存的属性</param>
/// <param name="descending">降序</param> /// <param name="descending">降序</param>
public void Sort(Comparison<object> comparison, string propertyName = null, bool descending = false) public void Sort(Comparison<object> comparison, string propertyName = null, bool descending = false)
{//选择排序 {
Events[nameof(StartSort)]?.Invoke(this, EventArgs.Empty); Events[nameof(StartSort)]?.Invoke(this, EventArgs.Empty);
this.comparison = comparison; this.comparison = comparison;

View File

@ -174,7 +174,7 @@ namespace CPF.Controls
{ {
try try
{ {
#if Net4 #if NET40
if (item.CanRead && item.GetGetMethod().GetParameters().Length == 0) if (item.CanRead && item.GetGetMethod().GetParameters().Length == 0)
{ {
var v = item.GetValue(ele, null); var v = item.GetValue(ele, null);

View File

@ -3044,7 +3044,32 @@ namespace CPF
public void Sort(IComparer<T> comparison) public void Sort(IComparer<T> comparison)
{ {
Array.Sort(_items, 0, Count, comparison); //Array.Sort(_items, 0, Count, comparison);
InsertSort(_items, Count, comparison);
}
//插入排序法
void InsertSort(T[] array, int count, IComparer<T> comparison)
{
//for循环i作为指针进行从左到右扫描数据的工作
//指针i从1开始扫描因为i=0时指针左侧无元素
for (int i = 1; i < count; i++)
{
//temp作为指针键值
var temp = array[i];
//新建变量j从i开始向左扫描已经有序的元素并与temp比较
//若temp小于扫描元素则将j指针元素向右移位腾出空间
int j = i;
while (j > 0 && comparison.Compare(array[j - 1], temp) > 0)//array[j - 1] > temp
{
array[j] = array[j - 1];
j--;
}
//循环完成后将temp放在j指针位置完成本次插入
array[j] = temp;
}
} }
} }

View File

@ -45,7 +45,7 @@ namespace CPF.Design
} }
Screen[] screens = new Screen[] { new Screen(new Rect(0, 0, 1920, 1080), new Rect(0, 0, 1920, 1080), true) }; Screen[] screens = new Screen[] { new Screen(new Rect(0, 0, 1920, 1080), new Rect(0, 0, 1920, 1080), true) };
#if Net4 #if NET40
public override IList<Screen> GetAllScreen() public override IList<Screen> GetAllScreen()
{ {
return screens; return screens;

View File

@ -211,7 +211,7 @@ namespace CPF.Documents
/// <summary> /// <summary>
/// 布局好的行 /// 布局好的行
/// </summary> /// </summary>
#if Net4 #if NET40
public IList<TextLine> Lines public IList<TextLine> Lines
{ {
get { return lines; } get { return lines; }

View File

@ -17,7 +17,7 @@ namespace CPF.Documents
/// <summary> /// <summary>
/// 布局好的行 /// 布局好的行
/// </summary> /// </summary>
#if Net4 #if NET40
IList<TextLine> Lines { get; } IList<TextLine> Lines { get; }
#else #else
IReadOnlyList<TextLine> Lines { get; } IReadOnlyList<TextLine> Lines { get; }

View File

@ -1,4 +1,4 @@
#if Net4 #if NET40
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View File

@ -1,4 +1,4 @@
#if Net4 #if NET40
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;

View File

@ -535,7 +535,7 @@ namespace CPF
}; };
layer.ShowDialog(root); layer.ShowDialog(root);
return await return await
#if Net4 #if NET40
TaskEx TaskEx
#else #else
Task Task
@ -574,7 +574,7 @@ namespace CPF
}; };
layer.ShowDialog(root); layer.ShowDialog(root);
await await
#if Net4 #if NET40
TaskEx TaskEx
#else #else
Task Task

View File

@ -39,7 +39,7 @@ namespace CPF.Platform
{ {
Threading.Dispatcher.mainId = Thread.CurrentThread.ManagedThreadId; Threading.Dispatcher.mainId = Thread.CurrentThread.ManagedThreadId;
CPF.Threading.Dispatcher.mainThread = null; CPF.Threading.Dispatcher.mainThread = null;
#if Net4 #if NET40
OperatingSystem = OperatingSystemType.Windows; OperatingSystem = OperatingSystemType.Windows;
foreach (var item in runtimes) foreach (var item in runtimes)
{ {

View File

@ -25,7 +25,7 @@ namespace CPF.Platform
public abstract INotifyIconImpl CreateNotifyIcon(); public abstract INotifyIconImpl CreateNotifyIcon();
#if Net4 #if NET40
public abstract IList<Screen> GetAllScreen(); public abstract IList<Screen> GetAllScreen();
#else #else
public abstract IReadOnlyList<Screen> GetAllScreen(); public abstract IReadOnlyList<Screen> GetAllScreen();

View File

@ -8,7 +8,7 @@ namespace CPF.Platform
public class Screen public class Screen
{ {
#if Net4 #if NET40
private static IList<Screen> _allScreens; private static IList<Screen> _allScreens;
public static IList<Screen> AllScreens public static IList<Screen> AllScreens
#else #else

View File

@ -23,7 +23,7 @@ namespace CPF.Shapes
if (points == null) if (points == null)
{ {
points = new Collection<Point>(); points = new Collection<Point>();
//#if Net4 //#if NET40
points.CollectionChanged += Points_CollectionChanged; points.CollectionChanged += Points_CollectionChanged;
//#else //#else
// var method = typeof(Polyline).GetMethod(nameof(Points_CollectionChanged), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance); // var method = typeof(Polyline).GetMethod(nameof(Points_CollectionChanged), System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);

View File

@ -77,7 +77,7 @@ namespace CPF.Threading
timeMre.Reset(); timeMre.Reset();
//Thread.Sleep(1); //Thread.Sleep(1);
//Thread.SpinWait(10000); //Thread.SpinWait(10000);
//#if Net4 //#if NET40
// var task = TaskEx.Delay(delay, cancellationTokenSource.Token); // var task = TaskEx.Delay(delay, cancellationTokenSource.Token);
//#else //#else
// var task = Task.Delay(delay, cancellationTokenSource.Token); // var task = Task.Delay(delay, cancellationTokenSource.Token);

View File

@ -3062,7 +3062,7 @@ namespace CPF
/// </summary> /// </summary>
/// <returns></returns> /// <returns></returns>
#if Net4 #if NET40
public IList<UIElement> GetChildren() public IList<UIElement> GetChildren()
#else #else
public IReadOnlyList<UIElement> GetChildren() public IReadOnlyList<UIElement> GetChildren()

View File

@ -10,7 +10,7 @@ namespace CPF
/// 子元素集合 /// 子元素集合
/// </summary> /// </summary>
public class UIElementCollection : IEnumerable<UIElement>, IList, IList<UIElement> public class UIElementCollection : IEnumerable<UIElement>, IList, IList<UIElement>
#if Net4 #if NET40
#else #else
, IReadOnlyList<UIElement> , IReadOnlyList<UIElement>
#endif #endif