Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
a174c48
update
CiiLu Mar 7, 2025
855ff55
扩展名排除
CiiLu Mar 7, 2025
aa3f0cd
feat #4311: 模组管理页面无需点击右侧控件即可触发全选快捷键
Open-KFC Mar 17, 2025
ba3ed00
Merge branch 'Hex-Dragon:main' into feat4311
Open-KFC Mar 20, 2025
ca72906
feat: 点击“下载新 Mod”按钮跳转到下载页面时自动填充搜索框的内容
wyc-26 Apr 4, 2025
31f0b81
fix(PageDownloadMod): 小问题
wyc-26 Apr 4, 2025
52ddb97
chore(PageDownloadMod): 还是这样好了……
wyc-26 Apr 4, 2025
8dc1148
pref(ModComp):提高代码可读性
RyogiMutsuki Apr 11, 2025
35c5b69
fix:shao'o'e
RyogiMutsuki Apr 11, 2025
74657d5
pref(ModNet):使用 HttpClient 替代过时的 WebRequest 和 WebClient
RyogiMutsuki Apr 13, 2025
1e98e91
Merge pull request #19 from Hex-Dragon/main
RyogiMutsuki Apr 26, 2025
effdf5a
Merge pull request #32 from Hex-Dragon/main
RyogiMutsuki Apr 28, 2025
f3680f0
fix:大文件删除没有无法放入回收站的提示
RyogiMutsuki Apr 28, 2025
124f5c2
Merge pull request #43 from Hex-Dragon/main
RyogiMutsuki Apr 30, 2025
fa12897
feat(ModDownloadLib): 自动创建资源包文件夹
wyc-26 May 1, 2025
acaff10
fix(ModLaunch): 证书不信任导致无法登录皮肤站
wyc-26 May 5, 2025
443d306
fix(ModLaunch): 证书不信任导致无法登录皮肤站*2
wyc-26 May 5, 2025
9a0ad08
Merge pull request #49 from LuoYun-Team/modnet
RyogiMutsuki May 26, 2025
e19f910
fix:可能在获取正版皮肤时失败
RyogiMutsuki May 31, 2025
878ff98
Update PageDownloadShader.xaml
MoYuan-CN May 31, 2025
73d705a
fix(PageVersionOverall): 重命名版本时会修改后缀名且会修改不应重命名的文件或文件夹
wyc-26 May 31, 2025
d2e2103
Merge pull request #51 from Hex-Dragon/main
RyogiMutsuki Jun 1, 2025
dcac683
Update PageSetupLeft.xaml.vb
CreeperIsASpy Jun 1, 2025
5a94854
Refactor(ModNet): 使用 HttpClient 代替过失函数 Feat(ModNet): 支持 GZip 等压缩格式响应的读取
RyogiMutsuki Jun 1, 2025
ebd2019
Merge branch 'main' into feat#6026
wyc-26 Jun 2, 2025
36c03d1
fix(PageComp): 重复的代码
wyc-26 Jun 2, 2025
c2a476f
fix(ModWatcher): Quilt 加载器错误窗口关闭后提示启动成功
wyc-26 Jun 2, 2025
f2ae0fb
fix(PageDownloadCompDetail): 部分原版可用的光影无法显示可下载的游戏版本
wyc-26 Jun 2, 2025
9c9216c
revert: 错误的文件更改
RyogiMutsuki Jun 2, 2025
70a2f28
revert: 错误的文件更改
RyogiMutsuki Jun 2, 2025
3adf47a
fix: 编译错误
RyogiMutsuki Jun 2, 2025
7ecf306
chore: 弄错了
RyogiMutsuki Jun 2, 2025
cddcd9e
chore: 修复火绒的特征查杀 (感谢火绒论坛的 UnknownOoo 老哥)
tangge233 Jun 4, 2025
da8a50a
fix(PageDownloadCompDetail): 给资源包也加上
wyc-26 Jun 4, 2025
809a281
style: 修改变量名称
tangge233 Jun 4, 2025
0c1b9e3
fix(ModWatcher): 忘写对应的 WatcherLog
wyc-26 Jun 5, 2025
2991e43
chore: 小改
wyc-26 Jun 5, 2025
6dbb5c9
fix: 少了特定标头和异常抛出
RyogiMutsuki Jun 7, 2025
300d1ec
feat(Secret):允许使用环境变量覆盖部分内容
RyogiMutsuki Jun 7, 2025
81619cb
feat: 支持识别因为微软账号被标记为可疑活动导致登陆失败
baiyuexiao496 Jun 9, 2025
5e31a1d
Update MyMsgLogin.xaml.vb
baiyuexiao496 Jun 9, 2025
cbf038d
chore(CurseForge): 增加新的 Fallback
RyogiMutsuki Jun 16, 2025
6c426b0
Merge pull request #6437 from LuoYun-Team/Skin
LTCatt Jun 16, 2025
d1fa710
Merge pull request #6570 from LuoYun-Team/curseforge-link
LTCatt Jun 16, 2025
f1c0469
Merge pull request #6482 from tangge233/fix/HRKill
LTCatt Jun 16, 2025
66bf71a
Merge pull request #6456 from CreeperIsASpy/main
LTCatt Jun 16, 2025
666243e
Merge pull request #6249 from PCL-Community/feat#6244
LTCatt Jun 16, 2025
a219eca
Merge pull request #6440 from MoYuan-CN/issue/6438
LTCatt Jun 16, 2025
27b4df0
Merge pull request #6117 from LuoYun-Team/ModComp
LTCatt Jun 16, 2025
01b26cd
Merge pull request #6472 from PCL-Community/fix#6451
LTCatt Jun 16, 2025
a63c5b4
Merge pull request #5872 from Open-KFC/feat4311
LTCatt Jun 16, 2025
4585f31
2.10.2 正式版
LTCatt Jun 16, 2025
ebc9f5e
2.10.2
LTCatt Jun 16, 2025
fdf5407
2.10.3
LTCatt Jun 17, 2025
74e5eb8
修改筛选版本
Pearl-Luo Jun 19, 2025
70ec0b6
fix(java): JVM 崩溃导致错误将版本号识别为 JDK/JRE 64
RyogiMutsuki Jun 19, 2025
7cd5747
fix(ModSecret): 开源版本龙猫蓝配色错误
wyc-26 Jun 20, 2025
6616afd
chore: 一不小心动了注释位置
wyc-26 Jun 20, 2025
65812b8
chore: 删除无用代码
RyogiMutsuki Jun 20, 2025
83e34b8
Update Plain Craft Launcher 2/Modules/Base/ModNet.vb
RyogiMutsuki Jun 23, 2025
5274ae8
chore: 链接更新
Light-Beacon Jun 23, 2025
f3017b6
Update MyMsgLogin.xaml.vb
zkitefly Jun 25, 2025
72a2b5d
修改 Mod 支持所有常用版本的描述
Pearl-Luo Jun 25, 2025
a38e208
回退上次更改
Pearl-Luo Jun 25, 2025
d6043c7
feat(PageDownloadCompDetail): 为每种资源区分 CachedFolder
wyc-26 Jun 25, 2025
9af03d4
imp(download): 改进可选组件互斥逻辑
MoYuan-CN Jun 30, 2025
3f5392d
fix(version): 应当是 1.20.5+
MoYuan-CN Jun 30, 2025
48684f8
将版本号改为 1.21.7
Pearl-Luo Jul 1, 2025
5ae8138
fix(skin): 可能尝试使用 HTTPS 协议从没有 SSL 证书的服务器下载皮肤文件
RyogiMutsuki Jul 1, 2025
e40a41a
fix: 搜索旧版本 Forge mod 崩溃
shatyuka Jul 2, 2025
17031e1
feat:去掉“刷新头像”和“修改披风”之间的线
LuLu-ling Jul 4, 2025
3539805
fix(Drop): 文件拖拽修复
RyogiMutsuki Jul 11, 2025
5126b25
chore: 将旧代码还原获取
RyogiMutsuki Jul 11, 2025
dd028bb
chore: 自动搜索java路径添加 ~/.jdks
lingting Jul 13, 2025
6770e55
Merge pull request #5798 from CiiLu/music
LTCatt Jul 13, 2025
c332a4d
Merge pull request #6027 from PCL-Community/feat#6026
LTCatt Jul 13, 2025
f090a63
Merge pull request #6216 from LuoYun-Team/dialog
LTCatt Jul 13, 2025
9b49235
Merge pull request #6287 from PCL-Community/fix#5252
LTCatt Jul 13, 2025
f98dcd8
Merge pull request #6407 from LuoYun-Team/HttpClient
LTCatt Jul 13, 2025
ad583c2
fix: 选择图片不能选择 jpeg 格式
wyc-26 Jul 13, 2025
f271d72
Merge pull request #6797 from PCL-Community/#6774
LTCatt Jul 13, 2025
96b6ef2
Merge pull request #6473 from PCL-Community/fix#6439
LTCatt Jul 13, 2025
ff225e9
chore: 文件夹以\结尾
lingting Jul 14, 2025
08e4414
将版本号改为 1.21.8
Pearl-Luo Jul 17, 2025
a843b22
Merge branch 'Meloong-Git:main' into fix
Pearl-Luo Jul 17, 2025
d8efb76
Merge pull request #6505 from LuoYun-Team/CustomKey
LTCatt Jul 17, 2025
1458ce9
Merge pull request #6527 from Baiyuexiao-Studio/security-interrupt
LTCatt Jul 17, 2025
deb9029
Merge pull request #6585 from hongggggv/fix
LTCatt Jul 17, 2025
885b3ea
Merge pull request #6587 from LuoYun-Team/java-version
LTCatt Jul 17, 2025
d6a5a8b
Merge pull request #6626 from Light-Beacon/main
LTCatt Jul 18, 2025
8b234d8
Merge pull request #6635 from zkitefly/patch-4
LTCatt Jul 18, 2025
3d63ceb
Merge pull request #6644 from PCL-Community/optimize-1
LTCatt Jul 18, 2025
4d954ae
Merge pull request #6701 from LuoYun-Team/skin-url
LTCatt Jul 18, 2025
2de22b7
Merge pull request #6795 from lingting/main
LTCatt Jul 18, 2025
ae8de39
Merge pull request #6717 from xrlzu-Community/main
LTCatt Jul 18, 2025
eed6c92
Merge pull request #6594 from PCL-Community/fix#6588
LTCatt Jul 18, 2025
d6575df
Merge pull request #6685 from MoYuan-CN/issue/6673
LTCatt Jul 19, 2025
14e14b9
Merge pull request #6772 from LuoYun-Team/Drop
LTCatt Jul 20, 2025
4d91d0b
Merge pull request #6706 from shatyuka/fix/search-forge-mods
LTCatt Jul 20, 2025
4486e7e
Merge pull request #6445 from PCL-Community/fix#6443
LTCatt Jul 21, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug1.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body:
required: false
- label: "**我已尝试使用 HMCL 启动,HMCL 没有出现问题。** 如果 HMCL 也无法启动就不是 PCL 导致的问题,请 **不要** 提交反馈。[下载 HMCL](https://hmcl.huangyuhui.net/download)"
required: true
- label: "我已在 [Issues 页面](https://github.com/Hex-Dragon/PCL2/issues?q=is%3Aissue+) 和 [常见&难检反馈及问题列表](https://github.com/Hex-Dragon/PCL2/discussions/1930) 中搜索,确认了这一 Bug 未被提交过。"
- label: "我已在 [Issues 页面](https://github.com/Meloong-Git/PCL/issues?q=is%3Aissue+) 和 [常见&难检反馈及问题列表](https://github.com/Meloong-Git/PCL/discussions/1930) 中搜索,确认了这一 Bug 未被提交过。"
required: true
- type: textarea
id: "yml-2"
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body:
required: false
- label: "我知晓大多数此类问题都是网络环境不佳导致的,但我确实认为我的问题可能是 PCL 导致的,和网络环境无关。"
required: true
- label: "我已在 [Issues 页面](https://github.com/Hex-Dragon/PCL2/issues?q=is%3Aissue+) 和 [常见&难检反馈及问题列表](https://github.com/Hex-Dragon/PCL2/discussions/1930) 中搜索,确认了这一 Bug 未被提交过。"
- label: "我已在 [Issues 页面](https://github.com/Meloong-Git/PCL/issues?q=is%3Aissue+) 和 [常见&难检反馈及问题列表](https://github.com/Meloong-Git/PCL/discussions/1930) 中搜索,确认了这一 Bug 未被提交过。"
required: true
- type: textarea
id: "yml-2"
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug9.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ body:
label: "检查项"
description: "请逐个检查下列项目,并勾选确认。"
options:
- label: "我已在 [Issues 页面](https://github.com/Hex-Dragon/PCL2/issues?q=is%3Aissue+) 和 [常见&难检反馈及问题列表](https://github.com/Hex-Dragon/PCL2/discussions/1930) 中搜索,确认了这一 Bug 未被提交过。"
- label: "我已在 [Issues 页面](https://github.com/Meloong-Git/PCL/issues?q=is%3Aissue+) 和 [常见&难检反馈及问题列表](https://github.com/Meloong-Git/PCL/discussions/1930) 中搜索,确认了这一 Bug 未被提交过。"
required: true
- type: textarea
id: "yml-2"
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/ch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ body:
label: "检查项"
description: "请逐个检查下列项目,并勾选确认。"
options:
- label: "我已在 [Issues 页面](https://github.com/Hex-Dragon/PCL2/issues?q=is%3Aissue+) 和 [常见&难检反馈及问题列表](https://github.com/Hex-Dragon/PCL2/discussions/1930) 中搜索,确认了这一建议未被提交过。"
- label: "我已在 [Issues 页面](https://github.com/Meloong-Git/PCL/issues?q=is%3Aissue+) 和 [常见&难检反馈及问题列表](https://github.com/Meloong-Git/PCL/discussions/1930) 中搜索,确认了这一建议未被提交过。"
required: true
- label: "我已查看 [功能投票页面](https://github.com/Hex-Dragon/PCL2/discussions/categories/%E5%8A%9F%E8%83%BD%E6%8A%95%E7%A5%A8/),确认了这一建议未在投票列表中。"
- label: "我已查看 [功能投票页面](https://github.com/Meloong-Git/PCL/discussions/categories/%E5%8A%9F%E8%83%BD%E6%8A%95%E7%A5%A8/),确认了这一建议未在投票列表中。"
required: true
- type: textarea
id: "yml-2"
Expand Down
6 changes: 3 additions & 3 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
blank_issues_enabled: false
contact_links:
- name: 主页预设反馈
url: https://github.com/Hex-Dragon/PCL2/discussions/categories/自定义主页
url: https://github.com/Meloong-Git/PCL/discussions/categories/自定义主页
about: 提交与预设的主页(设置 → 个性化 → 主页预设)中的具体内容相关的反馈
- name: 帮助文档反馈
url: https://github.com/LTCatt/PCL2Help/issues
about: 提交与 PCL 帮助文档(更多 → 帮助)中的具体内容相关的反馈
- name: 提问
url: https://github.com/Hex-Dragon/PCL2/discussions/new?category=%E6%8F%90%E9%97%AE
url: https://github.com/Meloong-Git/PCL/discussions/new?category=%E6%8F%90%E9%97%AE
about: 我想问一些 PCL 相关的问题……
- name: 讨论
url: https://github.com/Hex-Dragon/PCL2/discussions/new?category=%E8%AE%A8%E8%AE%BA
url: https://github.com/Meloong-Git/PCL/discussions/new?category=%E8%AE%A8%E8%AE%BA
about: 我想讨论一些 PCL 相关的事情……
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ body:
label: "检查项"
description: "请逐个检查下列项目,并勾选确认。"
options:
- label: "我已在 [Issues 页面](https://github.com/Hex-Dragon/PCL2/issues?q=is%3Aissue+) 和 [常见&难检反馈及问题列表](https://github.com/Hex-Dragon/PCL2/discussions/1930) 中搜索,确认了这一提案未被提交过。"
- label: "我已在 [Issues 页面](https://github.com/Meloong-Git/PCL/issues?q=is%3Aissue+) 和 [常见&难检反馈及问题列表](https://github.com/Meloong-Git/PCL/discussions/1930) 中搜索,确认了这一提案未被提交过。"
required: true
- label: "我已查看 [功能投票页面](https://github.com/Hex-Dragon/PCL2/discussions/categories/%E5%8A%9F%E8%83%BD%E6%8A%95%E7%A5%A8/),确认了这一提案未在投票列表中。"
- label: "我已查看 [功能投票页面](https://github.com/Meloong-Git/PCL/discussions/categories/%E5%8A%9F%E8%83%BD%E6%8A%95%E7%A5%A8/),确认了这一提案未在投票列表中。"
required: true
- label: "我知晓还没做的新功能真的太多了,忙不过来,所以新功能提案几乎不会被处理,也不建议再提交新功能提案 qwq……"
required: true
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ jobs:

- name: Update Help
run: |
$workpath = [System.Environment]::CurrentDirectory
Set-Location ..
git clone https://github.com/LTCatt/PCL2Help.git -b master --single-branch --depth 1
Set-Location PCL2Help
Expand Down
2 changes: 1 addition & 1 deletion LICENCE
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@
这些规则主要是为了阻止恶意的使用和 “山寨版” 的出现,常规、善意的使用都没啥问题的,放心吧!

如果你只是参考了一小段代码,署个名就行啦,不用担心。
如果对具体细节有疑问,欢迎在 https://github.com/Hex-Dragon/PCL2/discussions/new?category=%E6%8F%90%E9%97%AE 发帖询问!
如果对具体细节有疑问,欢迎在 https://github.com/Meloong-Git/PCL/discussions/new?category=%E6%8F%90%E9%97%AE 发帖询问!

多谢大家啦!
2 changes: 1 addition & 1 deletion Plain Craft Launcher 2/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>
</configuration>
48 changes: 46 additions & 2 deletions Plain Craft Launcher 2/FormMain.xaml.vb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
Imports System.ComponentModel
Imports System.Windows.Interop

Public Class FormMain

Expand All @@ -10,6 +11,16 @@ Public Class FormMain
Dim FeatureList As New List(Of KeyValuePair(Of Integer, String))
'统计更新日志条目
#If BETA Then
If LastVersion < 361 Then 'Release 2.10.3
FeatureList.Add(New KeyValuePair(Of Integer, String)(2, "修复:无法安装部分使用老版本 PCL 导出的整合包"))
End If
If LastVersion < 359 Then 'Release 2.10.2
If LastVersion >= 357 Then FeatureList.Add(New KeyValuePair(Of Integer, String)(3, "优化:下载资源包、光影包时能自动跳转到对应的文件夹"))
FeatureList.Add(New KeyValuePair(Of Integer, String)(3, "优化:调整界面样式与动画,让整体视觉更干净,操作体验更顺滑"))
FeatureList.Add(New KeyValuePair(Of Integer, String)(2, "修复:无法从 CurseForge 下载 Mod 等资源,或是安装整合包"))
FeatureCount += 28
BugCount += 28
End If
If LastVersion < 357 Then 'Release 2.10.0
FeatureList.Add(New KeyValuePair(Of Integer, String)(5, "新增:下载资源包、光影包、数据包"))
FeatureList.Add(New KeyValuePair(Of Integer, String)(3, "新增:允许设置文件下载源"))
Expand Down Expand Up @@ -72,6 +83,15 @@ Public Class FormMain
'3:BUG+ IMP* FEAT-
'2:BUG* IMP-
'1:BUG-
If LastVersion < 362 Then 'Snapshot 2.10.3
FeatureList.Add(New KeyValuePair(Of Integer, String)(2, "修复:无法安装部分使用老版本 PCL 导出的整合包"))
End If
If LastVersion < 360 Then 'Snapshot 2.10.2
FeatureList.Add(New KeyValuePair(Of Integer, String)(2, "修复:无法从 CurseForge 下载 Mod 等资源,或是安装整合包"))
If LastVersion >= 358 Then FeatureList.Add(New KeyValuePair(Of Integer, String)(1, "修复:无法加载正版皮肤的头像"))
FeatureCount += 3
BugCount += 5
End If
If LastVersion < 358 Then 'Snapshot 2.10.1
If LastVersion >= 356 Then FeatureList.Add(New KeyValuePair(Of Integer, String)(3, "优化:下载资源包、光影包时能自动跳转到对应的文件夹"))
FeatureList.Add(New KeyValuePair(Of Integer, String)(3, "优化:调整界面样式与动画,让整体视觉更干净,操作体验更顺滑"))
Expand Down Expand Up @@ -184,6 +204,8 @@ Public Class FormMain
End Sub, "UpdateLog Output")
End Sub

Private ReadOnly Helper As New DragFileHelper()

'窗口加载
Private IsWindowLoadFinished As Boolean = False
Public Sub New()
Expand Down Expand Up @@ -222,14 +244,36 @@ Public Class FormMain
[AddHandler](DragDrop.DragOverEvent, New DragEventHandler(AddressOf HandleDrag), handledEventsToo:=True)
'加载 UI
InitializeComponent()



Opacity = 0
'旧代码
''开启管理员权限下的文件拖拽,但下列代码也没用(#2531)
'If IsAdmin() Then
' Log("[Start] PCL 正以管理员权限运行")
' ChangeWindowMessageFilter(&H233, 1)
' ChangeWindowMessageFilter(&H4A, 1)
' ChangeWindowMessageFilter(&H49, 1)
'End If

'开启管理员权限下的文件拖拽
If IsAdmin() Then
AddHandler Me.SourceInitialized,
Sub(sender, e)
Dim wpfHelper As New WindowInteropHelper(Me)
Helper.HwndIntPtrSource = HwndSource.FromHwnd(wpfHelper.Handle)
Helper.AddHook()
End Sub
AddHandler Me.Closing,
Sub(sender, e)
Helper.RemoveDragHook()
End Sub
AddHandler Helper.DragDrop,
Sub(sender, e)
Me.FileDrag(Helper.DropFilePaths)
End Sub
End If
'切换到首页
If Not IsNothing(FrmLaunchLeft.Parent) Then FrmLaunchLeft.SetValue(ContentPresenter.ContentProperty, Nothing)
If Not IsNothing(FrmLaunchRight.Parent) Then FrmLaunchRight.SetValue(ContentPresenter.ContentProperty, Nothing)
Expand Down Expand Up @@ -521,7 +565,7 @@ Public Class FormMain
If ReturnCode = ProcessReturnValues.Exception Then
If Not IsLogShown Then
FeedbackInfo()
Log("请在 https://github.com/Hex-Dragon/PCL2/issues 提交错误报告,以便于作者解决此问题!")
Log("请在 https://github.com/Meloong-Git/PCL/issues 提交错误报告,以便于作者解决此问题!")
IsLogShown = True
ShellOnly(Path & "PCL\Log1.txt")
End If
Expand Down Expand Up @@ -1461,4 +1505,4 @@ Public Class FormMain
lastMouseArg = e
End Sub

End Class
End Class
8 changes: 4 additions & 4 deletions Plain Craft Launcher 2/Modules/Base/ModBase.vb
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ Public Module ModBase
#Region "声明"

'下列版本信息由更新器自动修改
Public Const VersionBaseName As String = "2.10.1" '不含分支前缀的显示用版本名
Public Const VersionStandardCode As String = "2.10.1." & VersionBranchCode '标准格式的四段式版本号
Public Const VersionBaseName As String = "2.10.3" '不含分支前缀的显示用版本名
Public Const VersionStandardCode As String = "2.10.3." & VersionBranchCode '标准格式的四段式版本号
Public Const CommitHash As String = "" 'Commit Hash,由 GitHub Workflow 自动替换
#If BETA Then
Public Const VersionCode As Integer = 357 'Release
Public Const VersionCode As Integer = 361 'Release
#Else
Public Const VersionCode As Integer = 358 'Snapshot
Public Const VersionCode As Integer = 362 'Snapshot
#End If
'自动生成的版本信息
Public Const VersionDisplayName As String = VersionBranchName & " " & VersionBaseName
Expand Down
152 changes: 152 additions & 0 deletions Plain Craft Launcher 2/Modules/Base/ModDragHelper.vb
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
Imports System
Imports System.ComponentModel
Imports System.Runtime.InteropServices
Imports System.Text
Imports System.Windows.Interop


Public Class DragFileHelper

Public Event DragDrop As EventHandler

Public Property DropFilePaths As String()
Get
Return _DropFilePathsBackingField
End Get
Private Set(value As String())
_DropFilePathsBackingField = value
End Set
End Property
Private _DropFilePathsBackingField As String()

Public Property DropPoint As POINT
Get
Return _DropPointBackingField
End Get
Private Set(value As POINT)
_DropPointBackingField = value
End Set
End Property
Private _DropPointBackingField As POINT

Public Property HwndIntPtrSource As HwndSource

Public Sub AddHook()
Me.RemoveDragHook()
Me.HwndIntPtrSource.AddHook(AddressOf WndProc)
Dim handle As IntPtr = Me.HwndIntPtrSource.Handle
If IsUserAnAdmin() Then RevokeDragDrop(handle)
DragAcceptFiles(handle, True)
ChangeMessageFilter(handle)
End Sub

Public Sub RemoveDragHook()
Me.HwndIntPtrSource.RemoveHook(AddressOf WndProc)
DragAcceptFiles(Me.HwndIntPtrSource.Handle, False)
End Sub

Private Function WndProc(ByVal hwnd As IntPtr, ByVal msg As Integer, ByVal wParam As IntPtr, ByVal lParam As IntPtr, ByRef handled As Boolean) As IntPtr
Dim filePaths As String() = Nothing
Dim point As POINT = New POINT()

If TryGetDropInfo(msg, wParam, filePaths, point) Then
DropPoint = point
DropFilePaths = filePaths
RaiseEvent DragDrop(Me, EventArgs.Empty)
handled = True
End If
Return IntPtr.Zero
End Function

<DllImport("user32.dll", SetLastError:=True)>
Private Shared Function ChangeWindowMessageFilterEx(ByVal hWnd As IntPtr, ByVal msg As UInteger, ByVal action As UInteger, ByRef pChangeFilterStruct As CHANGEFILTERSTRUCT) As Boolean
End Function

<DllImport("user32.dll", SetLastError:=True)>
Private Shared Function ChangeWindowMessageFilter(ByVal msg As UInteger, ByVal flags As UInteger) As Boolean
End Function

<DllImport("shell32.dll")>
Private Shared Sub DragAcceptFiles(ByVal hWnd As IntPtr, ByVal fAccept As Boolean)
End Sub

<DllImport("shell32.dll", CharSet:=CharSet.Unicode)>
Private Shared Function DragQueryFile(ByVal hWnd As IntPtr, ByVal iFile As UInteger, ByVal lpszFile As StringBuilder, ByVal cch As Integer) As UInteger
End Function

<DllImport("shell32.dll")>
Private Shared Function DragQueryPoint(ByVal hDrop As IntPtr, ByRef lppt As POINT) As Boolean
End Function

<DllImport("shell32.dll")>
Private Shared Sub DragFinish(ByVal hDrop As IntPtr)
End Sub

<DllImport("ole32.dll")>
Private Shared Function RevokeDragDrop(ByVal hWnd As IntPtr) As Integer
End Function

<DllImport("shell32.dll")>
Private Shared Function IsUserAnAdmin() As Boolean
End Function

<StructLayout(LayoutKind.Sequential)>
Public Structure POINT
Public X As Integer
Public Y As Integer
End Structure

<StructLayout(LayoutKind.Sequential)>
Private Structure CHANGEFILTERSTRUCT
Public cbSize As UInteger
Public ExtStatus As UInteger
End Structure

Private Const WM_COPYGLOBALDATA As UInteger = &H49
Private Const WM_COPYDATA As UInteger = &H4A
Private Const WM_DROPFILES As UInteger = &H233
Private Const MSGFLT_ALLOW As UInteger = 1
Private Const MSGFLT_ADD As UInteger = 1
Private Const MAX_PATH As Integer = 260

Private Shared Sub ChangeMessageFilter(ByVal handle As IntPtr)
Dim ver As Version = Environment.OSVersion.Version
Dim isVistaOrHigher As Boolean = ver >= New Version(6, 0)
Dim isNt61OrHiger As Boolean = ver >= New Version(6, 1)

If isVistaOrHigher Then
Dim status As CHANGEFILTERSTRUCT = New CHANGEFILTERSTRUCT With {.cbSize = 8}
For Each msg As UInteger In New UInteger() {WM_DROPFILES, WM_COPYGLOBALDATA, WM_COPYDATA}
Dim [error] As Boolean = False
If isNt61OrHiger Then
[error] = Not ChangeWindowMessageFilterEx(handle, msg, MSGFLT_ALLOW, status)
Else
[error] = Not ChangeWindowMessageFilter(msg, MSGFLT_ADD)
End If

If [error] Then Throw New Win32Exception(Marshal.GetLastWin32Error())
Next
End If
End Sub

Private Shared Function TryGetDropInfo(ByVal msg As Integer, ByVal wParam As IntPtr, ByRef dropFilePaths As String(), ByRef dropPoint As POINT) As Boolean
dropFilePaths = Nothing
dropPoint = New POINT()

If msg <> WM_DROPFILES Then Return False

Dim fileCount As UInteger = DragQueryFile(wParam, UInteger.MaxValue, Nothing, 0)
ReDim dropFilePaths(CInt(fileCount) - 1)

For i As UInteger = 0 To fileCount - 1
Dim sb As New StringBuilder(MAX_PATH)
Dim result As UInteger = DragQueryFile(wParam, i, sb, sb.Capacity)
If result > 0 Then dropFilePaths(CInt(i)) = sb.ToString()
Next

DragQueryPoint(wParam, dropPoint)
DragFinish(wParam)
Return True
End Function

End Class
Loading
Loading