Skip to content

Commit

Permalink
chore: 拖拽(补档)
Browse files Browse the repository at this point in the history
谁把它拿走了
  • Loading branch information
tangge233 committed Jan 24, 2025
1 parent e91d1a2 commit 0c9e028
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions Plain Craft Launcher 2/FormMain.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -800,6 +800,41 @@ Public Class FormMain
End If
'安装 Mod
If PageVersionMod.InstallMods(FilePathList) Then Exit Sub
'处理资源安装
If PageCurrent = PageType.VersionSetup AndAlso {"zip"}.Any(Function(i) i = Extension) Then
Select Case PageCurrentSub
Case PageSubType.VersionWorld
Dim DestFolder = PageVersionLeft.Version.PathIndie + "saves\" + GetFileNameWithoutExtentionFromPath(FilePath)
If Directory.Exists(DestFolder) Then
Hint("发现同名文件夹,无法粘贴:" + DestFolder, HintType.Critical)
Exit Sub
End If
ExtractFile(FilePath, DestFolder)
Hint($"已导入 {GetFileNameWithoutExtentionFromPath(FilePath)}", HintType.Finish)
If FrmVersionWorld IsNot Nothing Then RunInUi(Sub() FrmVersionWorld.Reload())
Exit Sub
Case PageSubType.VersionResourcePack
Dim DestFile = PageVersionLeft.Version.PathIndie + "resourcepacks\" + GetFileNameFromPath(FilePath)
If File.Exists(DestFile) Then
Hint("已存在同名文件:" + DestFile, HintType.Critical)
Exit Sub
End If
CopyFile(FilePath, DestFile)
Hint($"已导入 {GetFileNameFromPath(FilePath)}", HintType.Finish)
If FrmVersionResourcePack IsNot Nothing Then RunInUi(Sub() FrmVersionResourcePack.Reload())
Exit Sub
Case PageSubType.VersionShader
Dim DestFile = PageVersionLeft.Version.PathIndie + "shaderpacks\" + GetFileNameFromPath(FilePath)
If File.Exists(DestFile) Then
Hint("已存在同名文件:" + DestFile, HintType.Critical)
Exit Sub
End If
CopyFile(FilePath, DestFile)
Hint($"已导入 {GetFileNameFromPath(FilePath)}", HintType.Finish)
If FrmVersionShader IsNot Nothing Then RunInUi(Sub() FrmVersionShader.Reload())
Exit Sub
End Select
End If
'安装整合包
If {"zip", "rar", "mrpack"}.Any(Function(t) t = Extension) Then '部分压缩包是 zip 格式但后缀为 rar,总之试一试
Log("[System] 文件为压缩包,尝试作为整合包安装")
Expand Down

0 comments on commit 0c9e028

Please sign in to comment.