Skip to content

Commit 711c80f

Browse files
authored
Merge pull request PCL-Community#57 from whitecat346/main
重提交
2 parents 1fad875 + 36e20e5 commit 711c80f

File tree

9 files changed

+518
-297
lines changed

9 files changed

+518
-297
lines changed

.github/workflows/build.yml

Lines changed: 84 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,6 @@ jobs:
1616
md: ${{ steps.date.outputs.md }}
1717
hm: ${{ steps.date.outputs.hm }}
1818
steps:
19-
- name: Checkout
20-
uses: actions/checkout@v4
21-
with:
22-
fetch-depth: 0
2319
- name: Time
2420
id: date
2521
run: |
@@ -30,8 +26,7 @@ jobs:
3026
- name: EchoTime
3127
run: |
3228
echo "The current time is: ${{ steps.date.outputs.time }}"
33-
34-
build:
29+
build-AppImage:
3530
runs-on: ubuntu-22.04
3631
needs: time
3732
steps:
@@ -42,32 +37,90 @@ jobs:
4237
- name: Setup dotnet
4338
uses: actions/setup-dotnet@v4
4439
with:
45-
dotnet-version: '9.x'
40+
dotnet-version: '9.x'
4641
- name: Dependency
4742
run: |
48-
dotnet tool install -g KuiperZone.PupNet
49-
sudo apt-get update
50-
sudo apt-get install fuse
43+
dotnet tool install -g KuiperZone.PupNet
44+
sudo apt-get update
45+
sudo apt-get install fuse
5146
- name: Build-AppImage
5247
run: |
5348
cd ./PCL2.Neo
5449
sudo su
5550
pupnet --runtime linux-x64 --kind appimage -o PCL2.Neo.linux.x64.AppImage -y --app-version ${{ needs.time.outputs.y }}.${{ needs.time.outputs.md }}.${{ needs.time.outputs.hm }}
5651
pupnet --runtime linux-arm64 --kind appimage -o PCL2.Neo.linux.arm64.AppImage -y --app-version ${{ needs.time.outputs.y }}.${{ needs.time.outputs.md }}.${{ needs.time.outputs.hm }}
52+
- name: UploadArtifacts linux.arm64
53+
uses: actions/upload-artifact@v4
54+
with:
55+
name: linux.arm64
56+
path: |
57+
PCL2.Neo/Deploy/OUT/PCL2.Neo.linux.arm64.AppImage
58+
- name: UploadArtifacts linux.x64
59+
uses: actions/upload-artifact@v4
60+
with:
61+
name: linux.x64
62+
path: |
63+
PCL2.Neo/Deploy/OUT/PCL2.Neo.linux.x64.AppImage
64+
build-MacOsApp:
65+
runs-on: ubuntu-22.04
66+
needs: time
67+
steps:
68+
- name: Checkout
69+
uses: actions/checkout@v4
70+
with:
71+
fetch-depth: 0
72+
- name: Setup dotnet
73+
uses: actions/setup-dotnet@v4
74+
with:
75+
dotnet-version: '9.x'
76+
- name: Dependency
77+
run: |
78+
dotnet tool install -g KuiperZone.PupNet
79+
sudo apt-get update
80+
sudo apt-get install fuse
5781
- name: Build-MacOsApp
5882
run: |
59-
cd ./PCL2.Neo
60-
sudo su
61-
dotnet restore -r osx-x64
62-
dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-x64 -property:Configuration=Release -p:SelfContained=true -p:TrimMode=link
63-
dotnet restore -r osx-arm64
64-
dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-arm64 -property:Configuration=Release -p:SelfContained=true -p:TrimMode=link
65-
cd ./bin/Release/net9.0/
66-
cd ./osx-x64/publish/
67-
zip -9 -r ../../PCL2.Neo.osx.mac.x64.app.zip ./PCL2.Neo.app
68-
cd ../../
69-
cd ./osx-arm64/publish/
70-
zip -9 -r ../../PCL2.Neo.osx.mac.arm64.app.zip ./PCL2.Neo.app
83+
cd ./PCL2.Neo
84+
sudo su
85+
dotnet restore -r osx-x64
86+
dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-x64 -property:Configuration=Release -p:SelfContained=true -p:TrimMode=link
87+
dotnet restore -r osx-arm64
88+
dotnet msbuild -t:BundleApp -p:RuntimeIdentifier=osx-arm64 -property:Configuration=Release -p:SelfContained=true -p:TrimMode=link
89+
cd ./bin/Release/net9.0/
90+
cd ./osx-x64/publish/
91+
zip -9 -r ../../PCL2.Neo.osx.mac.x64.app.zip ./PCL2.Neo.app
92+
cd ../../
93+
cd ./osx-arm64/publish/
94+
zip -9 -r ../../PCL2.Neo.osx.mac.arm64.app.zip ./PCL2.Neo.app
95+
- name: UploadArtifacts osx.mac.arm64
96+
uses: actions/upload-artifact@v4
97+
with:
98+
name: osx.mac.arm64
99+
path: |
100+
PCL2.Neo/bin/Release/net9.0/PCL2.Neo.osx.mac.arm64.app.zip
101+
- name: UploadArtifacts osx.mac.x64
102+
uses: actions/upload-artifact@v4
103+
with:
104+
name: osx.mac.x64
105+
path: |
106+
PCL2.Neo/bin/Release/net9.0/PCL2.Neo.osx.mac.x64.app.zip
107+
build-WinExe:
108+
runs-on: ubuntu-22.04
109+
needs: time
110+
steps:
111+
- name: Checkout
112+
uses: actions/checkout@v4
113+
with:
114+
fetch-depth: 0
115+
- name: Setup dotnet
116+
uses: actions/setup-dotnet@v4
117+
with:
118+
dotnet-version: '9.x'
119+
- name: Dependency
120+
run: |
121+
dotnet tool install -g KuiperZone.PupNet
122+
sudo apt-get update
123+
sudo apt-get install fuse
71124
- name: Build-WinExe
72125
run: |
73126
cd ./PCL2.Neo
@@ -87,45 +140,21 @@ jobs:
87140
cd ../
88141
cd ./win-arm64/
89142
zip -9 -r "../PCL2.Neo.win.arm64.zip" "./publish"
90-
- name: UploadArtifacts linux.arm64
91-
uses: actions/upload-artifact@v4
92-
with:
93-
name: linux.arm64
94-
path: |
95-
PCL2.Neo/Deploy/OUT/PCL2.Neo.linux.arm64.AppImage
96-
- name: UploadArtifacts linux.x64
97-
uses: actions/upload-artifact@v4
98-
with:
99-
name: linux.x64
100-
path: |
101-
PCL2.Neo/Deploy/OUT/PCL2.Neo.linux.x64.AppImage
102143
- name: UploadArtifacts win.x64
103144
uses: actions/upload-artifact@v4
104145
with:
105-
name: win.x64
106-
path: |
107-
PCL2.Neo/bin/Release/net9.0/PCL2.Neo.win.x64.zip
146+
name: win.x64
147+
path: |
148+
PCL2.Neo/bin/Release/net9.0/PCL2.Neo.win.x64.zip
108149
- name: UploadArtifacts win.x86
109150
uses: actions/upload-artifact@v4
110151
with:
111-
name: win.x86
112-
path: |
113-
PCL2.Neo/bin/Release/net9.0/PCL2.Neo.win.x86.zip
152+
name: win.x86
153+
path: |
154+
PCL2.Neo/bin/Release/net9.0/PCL2.Neo.win.x86.zip
114155
- name: UploadArtifacts win.arm64
115156
uses: actions/upload-artifact@v4
116157
with:
117-
name: win.arm64
118-
path: |
119-
PCL2.Neo/bin/Release/net9.0/PCL2.Neo.win.arm64.zip
120-
- name: UploadArtifacts osx.mac.arm64
121-
uses: actions/upload-artifact@v4
122-
with:
123-
name: osx.mac.arm64
124-
path: |
125-
PCL2.Neo/bin/Release/net9.0/PCL2.Neo.osx.mac.arm64.app.zip
126-
- name: UploadArtifacts osx.mac.x64
127-
uses: actions/upload-artifact@v4
128-
with:
129-
name: osx.mac.x64
130-
path: |
131-
PCL2.Neo/bin/Release/net9.0/PCL2.Neo.osx.mac.x64.app.zip
158+
name: win.arm64
159+
path: |
160+
PCL2.Neo/bin/Release/net9.0/PCL2.Neo.win.arm64.zip

PCL2.Neo.sln.DotSettings.user

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,10 @@
3636
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AThrowHelper_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffe877ad5dc9742caa5e7dfcad5831d581e2200_003F82_003F21113a39_003FThrowHelper_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
3737
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATransitionBase_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffe877ad5dc9742caa5e7dfcad5831d581e2200_003F01_003Fa44768fa_003FTransitionBase_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
3838
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ATransition_00601_002Ecs_002Fl_003A_002E_002E_003F_002E_002E_003F_002E_002E_003FAppData_003FRoaming_003FJetBrains_003FRider2024_002E3_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003Ffe877ad5dc9742caa5e7dfcad5831d581e2200_003F62_003F990aa4ca_003FTransition_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
39-
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=95a7c32b_002D520d_002D4ed1_002Db22f_002Df3b6e550fab3/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="ArgumentsParsingTest" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;
40-
&lt;TestAncestor&gt;
41-
&lt;TestId&gt;NUnit3x::438856D4-C249-4E5F-8AC1-07B5EF401DC0::net9.0::PCL2.Neo.Tests.Minecraft.Models.MetadataFileTest.ArgumentsParsingTest&lt;/TestId&gt;
42-
&lt;/TestAncestor&gt;
39+
<s:String x:Key="/Default/Environment/UnitTesting/UnitTestSessionStore/Sessions/=95a7c32b_002D520d_002D4ed1_002Db22f_002Df3b6e550fab3/@EntryIndexedValue">&lt;SessionState ContinuousTestingMode="0" IsActive="True" Name="ArgumentsParsingTest" xmlns="urn:schemas-jetbrains-com:jetbrains-ut-session"&gt;&#xD;
40+
&lt;TestAncestor&gt;&#xD;
41+
&lt;TestId&gt;NUnit3x::438856D4-C249-4E5F-8AC1-07B5EF401DC0::net9.0::PCL2.Neo.Tests.Minecraft.Models.MetadataFileTest.ArgumentsParsingTest&lt;/TestId&gt;&#xD;
42+
&lt;/TestAncestor&gt;&#xD;
4343
&lt;/SessionState&gt;</s:String>
4444

4545

PCL2.Neo/Helpers/ThemeHelper.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,17 +55,17 @@ public void Refresh(ThemeVariant themeVariant)
5555
brushTitle.GradientStops.Add(new GradientStop
5656
{
5757
Offset = 0,
58-
Color = new MyColor().FromHsl2(_colorHue - _colorHueTopbarDelta, _colorSat, 48 + _colorLightAdjust)
58+
Color = MyColor.FromHsl2(_colorHue - _colorHueTopbarDelta, _colorSat, 48 + _colorLightAdjust)
5959
});
6060
brushTitle.GradientStops.Add(new GradientStop
6161
{
6262
Offset = 0.5,
63-
Color = new MyColor().FromHsl2(_colorHue, _colorSat, 54 + _colorLightAdjust)
63+
Color = MyColor.FromHsl2(_colorHue, _colorSat, 54 + _colorLightAdjust)
6464
});
6565
brushTitle.GradientStops.Add(new GradientStop
6666
{
6767
Offset = 1,
68-
Color = new MyColor().FromHsl2(_colorHue + _colorHueTopbarDelta, _colorSat, 48 + _colorLightAdjust)
68+
Color = MyColor.FromHsl2(_colorHue + _colorHueTopbarDelta, _colorSat, 48 + _colorLightAdjust)
6969
});
7070

7171
_mainWindow.NavBackgroundBorder.Background = brushTitle;
@@ -90,17 +90,17 @@ public void Refresh(ThemeVariant themeVariant)
9090
brushBackground.GradientStops.Add(new GradientStop
9191
{
9292
Offset = -0.1,
93-
Color = new MyColor().FromHsl2(_colorHue - 20, Math.Min(60, _colorSat) * 0.5, 80 * lightAdjust)
93+
Color = MyColor.FromHsl2(_colorHue - 20, Math.Min(60, _colorSat) * 0.5, 80 * lightAdjust)
9494
});
9595
brushBackground.GradientStops.Add(new GradientStop
9696
{
9797
Offset = 0.4,
98-
Color = new MyColor().FromHsl2(_colorHue, _colorSat * 0.9, 90 * lightAdjust)
98+
Color = MyColor.FromHsl2(_colorHue, _colorSat * 0.9, 90 * lightAdjust)
9999
});
100100
brushBackground.GradientStops.Add(new GradientStop
101101
{
102102
Offset = 1.1,
103-
Color = new MyColor().FromHsl2(_colorHue + 20, Math.Min(60, _colorSat) * 0.5, 80 * lightAdjust)
103+
Color = MyColor.FromHsl2(_colorHue + 20, Math.Min(60, _colorSat) * 0.5, 80 * lightAdjust)
104104
});
105105

106106
_mainWindow.MainBorder.Background = brushBackground;

PCL2.Neo/Models/Minecraft/Java.cs

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,54 @@
11
using System;
22
using System.Collections.Generic;
33
using System.Threading.Tasks;
4-
using PCL2.Neo.Models.Minecraft.JavaSearcher;
4+
using System.Runtime.InteropServices;
55

6-
namespace PCL2.Neo.Models.Minecraft
6+
namespace PCL2.Neo.Models.Minecraft.Java
77
{
88
/// <summary>
99
/// 测试
1010
/// </summary>
1111
public class Java
1212
{
13-
public static async Task<List<JavaEntity>> SearchJava()
13+
public static async Task<IEnumerable<JavaEntity>> SearchJava()
1414
{
15-
var javaList = new List<JavaEntity>();
15+
//switch (Environment.OSVersion.Platform)
16+
//{
17+
// case PlatformID.Win32NT:
18+
// javaList.AddRange(await JavaSearcher.Windows.SearchJava());
19+
// break;
20+
// case PlatformID.Unix:
21+
// javaList.AddRange(Unix.SerachJavaForLinuxAsync());
22+
// break;
23+
// case PlatformID.MacOSX:
24+
// break;
25+
// default:
26+
// throw new PlatformNotSupportedException();
27+
//}
1628

17-
switch (Environment.OSVersion.Platform)
29+
// warning: Environment.OSVersion.Platform will have different performance in different .net planform
30+
// detail: .net type : | system | performance
31+
// .net framewrok: macos | Not Support
32+
// .net Core <= 3.1 macos | Unix
33+
// .net 5+ macos | macosx
34+
// this problenm is fixed by follow code
35+
36+
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
1837
{
19-
case PlatformID.Win32NT:
20-
javaList.AddRange(await PCL2.Neo.Models.Minecraft.JavaSearcher.Windows.SearchJava());
21-
break;
22-
case PlatformID.Unix:
23-
javaList.AddRange(Unix.SerachJava());
24-
break;
25-
default:
26-
throw new PlatformNotSupportedException();
38+
return await Windows.SearchJavaAsync(); // TODO: Read setting to get whether full search or not.
39+
}
40+
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
41+
{
42+
return await Unix.SearchJava();
43+
}
44+
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
45+
{
46+
return await Unix.SearchJava();
47+
}
48+
else
49+
{
50+
throw new PlatformNotSupportedException();
2751
}
28-
29-
return javaList;
3052
}
3153
}
32-
}
54+
}

0 commit comments

Comments
 (0)