Skip to content

Commit

Permalink
Merge pull request #6 from Hex-Dragon/main
Browse files Browse the repository at this point in the history
[Sync] Update Code to make branch up to date with upstream
  • Loading branch information
shimoranla authored Jan 17, 2025
2 parents 060d9b5 + 604bcd0 commit 8e8de4d
Show file tree
Hide file tree
Showing 10 changed files with 37 additions and 15 deletions.
3 changes: 2 additions & 1 deletion Plain Craft Launcher 2/App.config
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup>
<runtime>
<AppContextSwitchOverrides value="Switch.System.Net.DontEnableSchUseStrongCrypto=false" />
<AppContextSwitchOverrides value="Switch.System.Net.DontEnableSchUseStrongCrypto=false"/>
<AppContextSwitchOverrides value="Switch.System.Windows.DoNotScaleForDpiChanges=false"/>
<generatePublisherEvidence enabled="false"/>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
Expand Down
5 changes: 3 additions & 2 deletions Plain Craft Launcher 2/Modules/Base/ModBase.vb
Original file line number Diff line number Diff line change
Expand Up @@ -1975,12 +1975,13 @@ RetryDir:
End Function

''' <summary>
''' 判断当前系统语言是否为中文。
''' 判断当前系统语言是否为中文(中国大陆)
''' </summary>
Public Function IsSystemLanguageChinese() As Boolean
Return CultureInfo.CurrentCulture.TwoLetterISOLanguageName = "zh" OrElse CultureInfo.CurrentUICulture.TwoLetterISOLanguageName = "zh"
Return CultureInfo.CurrentCulture.Name = "zh-CN" OrElse CultureInfo.CurrentUICulture.Name = "zh-CN"
End Function


Private Uuid As Integer = 1
Private UuidLock As Object
''' <summary>
Expand Down
18 changes: 15 additions & 3 deletions Plain Craft Launcher 2/Modules/Minecraft/ModComp.vb
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,10 @@
Public Function ToCompItem(ShowMcVersionDesc As Boolean, ShowLoaderDesc As Boolean) As MyCompItem
'获取版本描述
Dim GameVersionDescription As String
If GameVersions Is Nothing OrElse Not GameVersions.Any() Then
Dim AllSnapshot As Boolean = GameVersions.All(Function(v) RegexCheck(v, "[0-9]{2}w[0-9]{2}[a-z]{1}"))
If AllSnapshot Then
GameVersionDescription = "仅快照版本"
ElseIf GameVersions Is Nothing OrElse Not GameVersions.Any() Then
GameVersionDescription = "未知"
Else
Dim SpaVersions As New List(Of String)
Expand Down Expand Up @@ -493,12 +496,19 @@
ModLoaderDescriptionFull = "仅 " & ModLoadersForDesc.Single.ToString
ModLoaderDescriptionPart = ModLoadersForDesc.Single.ToString
Case Else
If ModLoaders.Contains(CompModLoaderType.Forge) AndAlso
If ModLoaders.Contains(CompModLoaderType.Forge) AndAlso Not AllSnapshot AndAlso
(GameVersions.Max < 14 OrElse ModLoaders.Contains(CompModLoaderType.Fabric)) AndAlso
(GameVersions.Max < 20 OrElse ModLoaders.Contains(CompModLoaderType.NeoForge)) AndAlso
(GameVersions.Max < 14 OrElse ModLoaders.Contains(CompModLoaderType.Quilt) OrElse Setup.Get("ToolDownloadIgnoreQuilt")) Then
ModLoaderDescriptionFull = "任意"
ModLoaderDescriptionPart = ""
ElseIf AllSnapshot AndAlso
ModLoaders.Contains(CompModLoaderType.Forge) AndAlso
ModLoaders.Contains(CompModLoaderType.Fabric) AndAlso
ModLoaders.Contains(CompModLoaderType.NeoForge) AndAlso
(ModLoaders.Contains(CompModLoaderType.Quilt) OrElse Setup.Get("ToolDownloadIgnoreQuilt")) Then
ModLoaderDescriptionFull = "任意"
ModLoaderDescriptionPart = ""
Else
ModLoaderDescriptionFull = ModLoadersForDesc.Join(" / ")
ModLoaderDescriptionPart = ModLoadersForDesc.Join(" / ")
Expand Down Expand Up @@ -1481,7 +1491,9 @@ Retry:
If Deps.Any Then
For Each DepProject In Deps.Where(Function(id) CompProjectCache.ContainsKey(id)).Select(Function(id) CompProjectCache(id))
For Each File In CompFilesCache(ProjectId)
If File.RawDependencies.Contains(DepProject.Id) AndAlso DepProject.Id <> ProjectId Then
If File.RawDependencies.Contains(DepProject.Id) AndAlso
DepProject.Id <> ProjectId AndAlso
Not File.Dependencies.Contains(DepProject.Id) Then
File.Dependencies.Add(DepProject.Id)
End If
Next
Expand Down
6 changes: 3 additions & 3 deletions Plain Craft Launcher 2/Modules/Minecraft/ModLaunch.vb
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ LoginFinish:
Url:=Data.Input.BaseUrl & "/validate",
Method:="POST",
Data:=RequestData.ToString(0),
Headers:=New Dictionary(Of String, String) From {{"Accept-Language", "zh_CN"}},
Headers:=New Dictionary(Of String, String) From {{"Accept-Language", "zh-CN"}},
ContentType:="application/json; charset=utf-8") '没有返回值的
'将登录结果输出
Data.Output.AccessToken = AccessToken
Expand Down Expand Up @@ -742,7 +742,7 @@ LoginFinish:
""name"":""" & Setup.Get("Cache" & Data.Input.Token & "Name") & """},", "") & "
""accessToken"":""" & Setup.Get("Cache" & Data.Input.Token & "Access") & """,
""clientToken"":""" & Setup.Get("Cache" & Data.Input.Token & "Client") & """}",
Headers:=New Dictionary(Of String, String) From {{"Accept-Language", "zh_CN"}},
Headers:=New Dictionary(Of String, String) From {{"Accept-Language", "zh-CN"}},
ContentType:="application/json; charset=utf-8"))
'将登录结果输出
If LoginJson("selectedProfile") Is Nothing Then Throw New Exception("选择的角色 " & Setup.Get("Cache" & Data.Input.Token & "Name") & " 无效!")
Expand Down Expand Up @@ -810,7 +810,7 @@ LoginFinish:
Url:=Data.Input.BaseUrl & "/authenticate",
Method:="POST",
Data:=RequestData.ToString(0),
Headers:=New Dictionary(Of String, String) From {{"Accept-Language", "zh_CN"}},
Headers:=New Dictionary(Of String, String) From {{"Accept-Language", "zh-CN"}},
ContentType:="application/json; charset=utf-8"))


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,13 @@ Public Class MyLocalModItem
End If
'计算滑动范围
Dim Index = CType(Parent, StackPanel).Children.IndexOf(Me)
If Index < 0 OrElse Index >= CType(Parent, StackPanel).Children.Count Then Exit Sub
SwipeStart = Math.Min(SwipeStart, Index)
SwipeEnd = Math.Max(SwipeEnd, Index)
If SwipeStart < 0 Then SwipeStart = 0
If SwipeEnd < 0 Then SwipeEnd = 0
If SwipeStart >= CType(Parent, StackPanel).Children.Count Then SwipeStart = CType(Parent, StackPanel).Children.Count - 1
If SwipeEnd >= CType(Parent, StackPanel).Children.Count Then SwipeEnd = CType(Parent, StackPanel).Children.Count - 1
'勾选所有范围中的项
If SwipeStart = SwipeEnd Then Exit Sub
For i = SwipeStart To SwipeEnd
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</local:MyCard>
<StackPanel Name="PanResults" />
</StackPanel>
<local:MyCard Grid.Row="2" HorizontalAlignment="Center" VerticalAlignment="Center" SnapsToDevicePixels="True" x:Name="PanLoad" UseAnimation="False" Margin="0,0,0,8">
<local:MyCard Grid.Row="1" HorizontalAlignment="Center" VerticalAlignment="Center" SnapsToDevicePixels="True" x:Name="PanLoad" UseAnimation="False" Margin="0,0,0,8">
<local:MyLoading Text="正在获取版本列表" Margin="20,20,20,17" x:Name="Load" HorizontalAlignment="Center" VerticalAlignment="Center" />
</local:MyCard>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@

'UI 化筛选器
PanFilter.Children.Clear()
If VersionFilters.Count <= 2 Then
If VersionFilters.Count < 2 Then
CardFilter.Visibility = Visibility.Collapsed
VersionFilter = Nothing
Else
Expand Down
3 changes: 2 additions & 1 deletion Plain Craft Launcher 2/Pages/PageLaunch/MySkin.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ Retry:
{"Vanilla", "原版披风"}, {"Minecon2011", "Minecon 2011 参与者披风"}, {"Minecon2012", "Minecon 2012 参与者披风"},
{"Minecon2013", "Minecon 2013 参与者披风"}, {"Minecon2015", "Minecon 2015 参与者披风"}, {"Minecon2016", "Minecon 2016 参与者披风"},
{"Cherry Blossom", "樱花披风"}, {"15th Anniversary", "15 周年纪念披风"}, {"Purple Heart", "紫色心形披风"},
{"Follower's", "追随者披风"}, {"MCC 15th Year", "MCC 15 周年披风"}, {"Minecraft Experience", "村民救援披风"}
{"Follower's", "追随者披风"}, {"MCC 15th Year", "MCC 15 周年披风"}, {"Minecraft Experience", "村民救援披风"},
{"Mojang Office", "Mojang 办公室披风"}
}
Dim SelectionControl As New List(Of IMyRadio) From {New MyRadioBox With {.Text = "无披风"}}
For Each Cape In SkinData("capes")
Expand Down
2 changes: 1 addition & 1 deletion Plain Craft Launcher 2/Pages/PageSetup/PageSetupUI.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@
<ColumnDefinition Width="0.8*" />
<ColumnDefinition Width="0.9*" />
<ColumnDefinition Width="0.8*" />
<ColumnDefinition Width="0.6*" />
<ColumnDefinition Width="0.8*" />
<ColumnDefinition Width="1.0*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
Expand Down
6 changes: 4 additions & 2 deletions Plain Craft Launcher 2/app.manifest
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,15 @@
自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
选择加入。选择加入此设置的 Windows 窗体应用程序(目标设定为 .NET Framework 4.6 )还应
在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。-->
<!--
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<!-- The combination of below two tags have the following effect :
1. Per-Monitor for >= Windows 10 Anniversary Update
2. System < Windows 10 Anniversary Update -->
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2</dpiAwareness>
<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
</windowsSettings>
</application>
-->

<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<dependency>
Expand Down

0 comments on commit 8e8de4d

Please sign in to comment.