diff --git a/Plain Craft Launcher 2/Modules/Minecraft/ModModpack.vb b/Plain Craft Launcher 2/Modules/Minecraft/ModModpack.vb index cfa67aa..b4c93c3 100644 --- a/Plain Craft Launcher 2/Modules/Minecraft/ModModpack.vb +++ b/Plain Craft Launcher 2/Modules/Minecraft/ModModpack.vb @@ -919,12 +919,13 @@ Retry: ''' Public Sub ModpackExport(Options As ExportOptions) Hint("正在导出……") - RunInNewThread(Sub() - If ModpackExportBlocking(Options) Then - Hint("导出成功!", HintType.Finish) - OpenExplorer($"""{GetPathFromFullPath(Options.Dest)}""") - End If - End Sub, "Modpack Export") + RunInNewThread( + Sub() + If ModpackExportBlocking(Options) Then + Hint("导出成功!", HintType.Finish) + OpenExplorer($"""{GetPathFromFullPath(Options.Dest)}""") + End If + End Sub, "Modpack Export") End Sub Private Function ModpackExportBlocking(Options As ExportOptions) As Boolean If Options.IncludePCL Then diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionExport.xaml b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionExport.xaml index b03f78d..b9210f1 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionExport.xaml +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionExport.xaml @@ -9,8 +9,8 @@ - - + + @@ -33,11 +33,10 @@ - + - @@ -54,14 +53,12 @@ - - - + @@ -77,31 +74,36 @@ + - - + + + - - - - - + ToolTip="options.txt 文件" /> + + + + + + + - - + + + diff --git a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionExport.xaml.vb b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionExport.xaml.vb index d7fa6c0..1ef3932 100644 --- a/Plain Craft Launcher 2/Pages/PageVersion/PageVersionExport.xaml.vb +++ b/Plain Craft Launcher 2/Pages/PageVersion/PageVersionExport.xaml.vb @@ -1,42 +1,53 @@ Public Class PageVersionExport + Private Sub PageVersionExport_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded + TbExportName.HintText = PageVersionLeft.Version.Name + Reload() + End Sub + + Public ItemVersion As MyListItem + Public Sub Reload() + PanDisplayItem.Children.Clear() + ItemVersion = PageSelectRight.McVersionListItem(PageVersionLeft.Version) + ItemVersion.IsHitTestVisible = False + PanDisplayItem.Children.Add(ItemVersion) + End Sub - Private CurrentVersion As McVersion = PageVersionLeft.Version Private Type As ModpackType = ModpackType.Modrinth Private SelectedSaves As New List(Of Integer) Private ReadOnly Property Saves As List(Of String) Get - If Directory.Exists(CurrentVersion.Path & "saves\") Then - Return Directory.EnumerateDirectories(CurrentVersion.Path & "saves\").ToList + If Directory.Exists(PageVersionLeft.Version.Path & "saves\") Then + Return Directory.EnumerateDirectories(PageVersionLeft.Version.Path & "saves\").ToList End If Return New List(Of String) End Get End Property - Private Sub PageVersionExport_Loaded(sender As Object, e As RoutedEventArgs) Handles Me.Loaded - CurrentVersion = PageVersionLeft.Version '各个版本不同,每次都需要重新加载 - TbExportName.HintText = CurrentVersion.Name +#Region "整合包信息 & 预览栏" + Private Sub TbExportName_TextChanged(sender As MyTextBox, e As TextChangedEventArgs) Handles TbExportName.TextChanged + ItemVersion.Title = If(String.IsNullOrWhiteSpace(sender.Text), PageVersionLeft.Version.Name, sender.Text) End Sub +#End Region -#Region "控件事件" +#Region "导出" Private Function IncludePCL() As Boolean Return True End Function - Private Sub ComboExportType_Change(sender As ComboBox, e As SelectionChangedEventArgs) Handles ComboExportType.SelectionChanged - If AniControlEnabled <> 0 Then Exit Sub - Type = sender.SelectedIndex - Select Case Type - Case ModpackType.Modrinth - If IncludePCL() Then 'TODO:修改这里的条件 - If GridCompressed IsNot Nothing Then GridCompressed.Visibility = Visibility.Visible - If GridModrinth IsNot Nothing Then GridModrinth.Visibility = Visibility.Collapsed - Else - If GridCompressed IsNot Nothing Then GridCompressed.Visibility = Visibility.Collapsed - If GridModrinth IsNot Nothing Then GridModrinth.Visibility = Visibility.Visible - End If - End Select - CardExport.TriggerForceResize() - End Sub - If GridModrinth IsNot Nothing Then GridModrinth.Visibility = Visibility.Visible + 'Private Sub ComboExportType_Change(sender As ComboBox, e As SelectionChangedEventArgs) Handles ComboExportType.SelectionChanged + ' If AniControlEnabled <> 0 Then Exit Sub + ' Type = sender.SelectedIndex + ' Select Case Type + ' Case ModpackType.Modrinth + ' If IncludePCL() Then 'TODO:修改这里的条件 + ' If GridCompressed IsNot Nothing Then GridCompressed.Visibility = Visibility.Visible + ' If GridModrinth IsNot Nothing Then GridModrinth.Visibility = Visibility.Collapsed + ' Else + ' If GridCompressed IsNot Nothing Then GridCompressed.Visibility = Visibility.Collapsed + ' If GridModrinth IsNot Nothing Then GridModrinth.Visibility = Visibility.Visible + ' End If + ' End Select + ' CardExport.TriggerForceResize() + 'End Sub Private Sub BtnExportExport_Click() Handles BtnExportExport.Click If IncludePCL() AndAlso Val(VersionBranchCode) <> 50 Then If MyMsgBox("你当前的 PCL 不是正式版,有二次分发(制作压缩包)的限制。" & vbCrLf & @@ -47,17 +58,11 @@ Exit Sub End If Dim savePath As String = SelectAs( - "选择导出位置", $"整合包 - {If(String.IsNullOrWhiteSpace(TbExportName.Text), CurrentVersion.Name, TbExportName.Text)}" & If(Type = ModpackType.Modrinth, ".mrpack", ".zip"), + "选择导出位置", $"整合包 - {If(String.IsNullOrWhiteSpace(TbExportName.Text), PageVersionLeft.Version.Name, TbExportName.Text)}" & If(Type = ModpackType.Modrinth, ".mrpack", ".zip"), If(Type = ModpackType.Modrinth, "Modrinth 整合包(*.mrpack)|*.mrpack", "整合包文件(*.zip)|*.zip")) If String.IsNullOrEmpty(savePath) Then Exit Sub - ModpackExport(New ExportOptions(CurrentVersion, savePath, Type, {TbExportSave.Text}, - PCLSetupGlobal:=CheckExportGlobal.Checked, Name:=TbExportName.Text, - VerID:=TbExportVersion.Text)) - End Sub - ModpackExport(New ExportOptions(CurrentVersion, savePath, Type, {TbExportSave.Text}, - PCLSetupGlobal:=CheckExportGlobal.Checked, - PCLSetupVer:=CheckExportVersion.Checked, Name:=TbExportName.Text, - VerID:=TbExportVersion.Text)) + ModpackExport(New ExportOptions(PageVersionLeft.Version, savePath, Type, {}, 'TODO:改成要保留的文件列表 + Name:=TbExportName.Text, VerID:=TbExportVersion.Text)) End Sub #End Region