diff --git a/MSL/MSL.csproj b/MSL/MSL.csproj
index 83e6067..856b72c 100644
--- a/MSL/MSL.csproj
+++ b/MSL/MSL.csproj
@@ -601,4 +601,4 @@
-
\ No newline at end of file
+
diff --git a/MSL/controls/ctrls_serverrunner/ServerProperties.xaml b/MSL/controls/ctrls_serverrunner/ServerProperties.xaml
index e61ac75..53e6727 100644
--- a/MSL/controls/ctrls_serverrunner/ServerProperties.xaml
+++ b/MSL/controls/ctrls_serverrunner/ServerProperties.xaml
@@ -1,4 +1,5 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/MSL/controls/dialogs/DownloadManagerControl.xaml b/MSL/controls/dialogs/DownloadManagerControl.xaml
index 0615644..59a779d 100644
--- a/MSL/controls/dialogs/DownloadManagerControl.xaml
+++ b/MSL/controls/dialogs/DownloadManagerControl.xaml
@@ -73,9 +73,9 @@
-
+
-
+
{
Visibility = Visibility.Collapsed;
- CloseDialog();
+ CloseDialog?.Invoke();
};
storyboard.Begin();
diff --git a/MSL/forms/DownloadServer.xaml b/MSL/forms/DownloadServer.xaml
index 6dc2e55..63d68d3 100644
--- a/MSL/forms/DownloadServer.xaml
+++ b/MSL/forms/DownloadServer.xaml
@@ -42,7 +42,7 @@
-
+
@@ -51,7 +51,7 @@
-
+
@@ -60,7 +60,7 @@
-
+
diff --git a/MSL/forms/ServerRunner.xaml.cs b/MSL/forms/ServerRunner.xaml.cs
index 53c5dc1..e96d890 100644
--- a/MSL/forms/ServerRunner.xaml.cs
+++ b/MSL/forms/ServerRunner.xaml.cs
@@ -167,6 +167,7 @@ private async Task LoadingInfoEvent()
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
+ _instanceSettingsPage?.ServerPropertiesInstance?.ClearConfigPresetState();
if (ServerList.RunningServers.Contains(RserverID))
{
e.Cancel = true;
@@ -182,6 +183,7 @@ private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs
public void DisposeRes()
{
+ _instanceSettingsPage?.ServerPropertiesInstance?.ClearConfigPresetState();
_dashboardPage?.CleanupSystemMonitoring();
ServerService?.Dispose();
}
@@ -269,8 +271,10 @@ private void OnServerStarted()
{
Dispatcher.Invoke(() =>
{
- _consolePage.ServerStartedEvent();
+ // 先同步“正在运行”的控件状态,再应用启动完成后的“已开服”和服务器详情。
+ // UpdateServerState(true) 会重置详情为“获取中”,因此必须放在成功回调之前。
_dashboardPage.UpdateServerState(true);
+ _consolePage.ServerStartedEvent();
});
}
diff --git a/MSL/langs/Lang.en-US.resx b/MSL/langs/Lang.en-US.resx
index 7bd0b41..56f6fa6 100644
--- a/MSL/langs/Lang.en-US.resx
+++ b/MSL/langs/Lang.en-US.resx
@@ -1352,6 +1352,108 @@ It is recommended not to upload these mods to the server.
Server Config
+
+ Config Presets:
+
+
+ Load Presets
+
+
+ Add Preset
+
+
+ Preset Configuration Items
+
+
+ Select None
+
+
+ Configuration Item
+
+
+ Value
+
+
+ Preset Name
+
+
+ Save Preset
+
+
+ Apply Preset
+
+
+ Delete Preset
+
+
+ server.properties was not found, so a configuration preset cannot be created.
+
+
+ Failed to load configuration presets: {0}
+
+
+ Adding a new preset. All configuration values are selected by default.
+
+
+ Preset “{0}” loaded. {1} item(s) selected.
+
+
+ Enter a preset name.
+
+
+ Select at least one configuration value.
+
+
+ Preset “{0}” already exists. Overwrite it?
+
+
+ Overwrite Preset
+
+
+ Overwrite
+
+
+ Preset overwrite canceled.
+
+
+ Preset “{0}” saved with {1} item(s).
+
+
+ Failed to save preset: {0}
+
+
+ Select and load an existing preset first.
+
+
+ Applied {0} configuration item(s).
+
+
+ Configuration presets cannot be applied while the server is running.
+
+
+ The configuration file does not exist.
+
+
+ There are no changes to apply.
+
+
+ Failed to apply configuration: {0}
+
+
+ Select a preset first.
+
+
+ Preset “{0}” deleted.
+
+
+ Failed to delete preset: {0}
+
+
+ All configuration values selected.
+
+
+ All configuration values deselected.
+
After disabling this feature, the output preview will also be closed!
@@ -3633,4 +3735,123 @@ Please go to "Mapping" - "My MSLFrp" to login.
Refresh
-
\ No newline at end of file
+
+ Server Core List:
+
+
+ Version List:
+
+
+ Build List:
+
+
+ Forge Installer
+
+
+ Preparing to install {0}...
+
+
+ Installation will start in 5 seconds...
+
+
+ Extracting the {0} installer...
+
+
+ Downloading vanilla server core
+
+
+ Downloading runtime libraries, please wait...
+
+
+ Processing compile arguments...
+
+
+ Downloading Minecraft mappings, please wait...
+
+
+ Compiling, please wait...
+
+
+ Finished! This dialog will close automatically!
+
+
+ Information
+
+
+ The configuration file does not exist!
+
+
+ Save failed! Please check whether the server is stopped.
+Error: {0}
+
+
+ There are no changes to save!
+
+
+ An error occurred while saving!
+Error: {0}
+
+
+ The server icon cannot be changed while the server is running!
+
+
+ This server already has an icon. Delete it?
+
+
+ Failed to delete the icon! Please check whether the server is stopped.
+Error: {0}
+
+
+ The original icon was deleted. Continue?
+
+
+ How to Use
+
+
+ Prepare a 64*64 pixel PNG image, then click OK to continue.
+
+
+ PNG Image|*.png
+
+
+ Server icon changed!
+
+
+ Failed to change the icon! Please check whether the server is stopped.
+Error: {0}
+
+
+ The world map cannot be changed while the server is running!
+
+
+ After clicking Confirm, MSL will delete the current overworld map permanently. Back it up first if needed!
+Click Cancel to abort.
+
+
+ Deleting, please wait
+
+
+ MSL also detected a Nether map. Delete it too?
+It will be permanently removed from the computer!
+
+
+ MSL also detected an End map. Delete it too?
+It will be permanently removed from the computer!
+
+
+ The related maps were deleted successfully. Import a new save? If you start the server without importing one, a new world will be created.
+
+
+ Select a world map folder (or an extracted folder).
+
+
+ Importing, please wait
+
+
+ World imported successfully! You can delete the source save folder manually.
+
+
+ Failed to import the world!
+Error: {0}
+
+
diff --git a/MSL/langs/Lang.resx b/MSL/langs/Lang.resx
index c4d8fc3..b663c76 100644
--- a/MSL/langs/Lang.resx
+++ b/MSL/langs/Lang.resx
@@ -1353,6 +1353,108 @@ MSLAPI —— MSL自有服务端&运行库镜像源
服务器配置
+
+ 配置预设:
+
+
+ 加载预设
+
+
+ 添加预设
+
+
+ 配置预设项目
+
+
+ 全不选
+
+
+ 配置项
+
+
+ 配置值
+
+
+ 预设名称
+
+
+ 保存预设
+
+
+ 应用预设
+
+
+ 删除预设
+
+
+ 未找到 server.properties,无法创建配置预设!
+
+
+ 加载配置预设失败:{0}
+
+
+ 正在添加新预设,默认选择全部配置值。
+
+
+ 已加载预设“{0}”,选中 {1} 项。
+
+
+ 请输入预设名称。
+
+
+ 请至少选择一个配置值。
+
+
+ 预设“{0}”已经存在,是否覆盖原预设?
+
+
+ 覆盖预设
+
+
+ 覆盖
+
+
+ 已取消覆盖预设。
+
+
+ 预设“{0}”已保存,共 {1} 项。
+
+
+ 预设保存失败:{0}
+
+
+ 请先选择并加载一个已有预设。
+
+
+ 已应用 {0} 项配置。
+
+
+ 服务器运行时无法应用配置预设!
+
+
+ 配置文件不存在!
+
+
+ 没有需要应用的更改。
+
+
+ 配置应用失败:{0}
+
+
+ 请先选择一个预设。
+
+
+ 预设“{0}”已删除。
+
+
+ 预设删除失败:{0}
+
+
+ 已选择全部配置值。
+
+
+ 已取消选择全部配置值。
+
关闭此功能后,输出预览功能也将同时关闭!
@@ -3639,4 +3741,123 @@ ID: {1} 远程端口: {2}
刷新
-
\ No newline at end of file
+
+ 服务端列表:
+
+
+ 版本列表:
+
+
+ 构建列表:
+
+
+ Forge安装器
+
+
+ 准备安装{0}···
+
+
+ 5秒后开始安装···
+
+
+ 正在解压{0}安装器···
+
+
+ 下载原版服务端核心
+
+
+ 正在下载运行Lib,请稍候……
+
+
+ 正在处理编译参数···
+
+
+ 正在下载MC映射表,请耐心等待……
+
+
+ 正在编译,请耐心等待……
+
+
+ 结束!本对话框将自动关闭!
+
+
+ 信息
+
+
+ 配置文件不存在!
+
+
+ 保存失败!请检查服务器是否关闭!
+错误代码:{0}
+
+
+ 没有需要保存的更改!
+
+
+ 保存过程中发生错误!
+错误代码:{0}
+
+
+ 服务器运行时无法更换图标!
+
+
+ 检测到服务器已设置有图标,是否删除该图标?
+
+
+ 图标删除失败!请检查服务器是否关闭!
+错误代码:{0}
+
+
+ 原图标已删除,是否继续操作?
+
+
+ 如何操作?
+
+
+ 请先准备一张64*64像素的图片(格式为png),准备完成后点击确定以继续
+
+
+ PNG图像|*.png
+
+
+ 图标更换完成!
+
+
+ 图标更换失败!请检查服务器是否关闭!
+错误代码:{0}
+
+
+ 服务器运行时无法更换地图!
+
+
+ 点击确定后,MSL将删除原先主世界地图(删除后,地图将从电脑上彻底消失,如有必要请提前备份!)
+点击取消以中止操作
+
+
+ 删除中,请稍候
+
+
+ MSL同时检测到了下界地图,是否一并删除?
+删除后,地图将从电脑上彻底消失!
+
+
+ MSL同时检测到了末地地图,是否一并删除?
+删除后,地图将从电脑上彻底消失!
+
+
+ 相关地图已经成功删除!是否选择新存档进行导入?(如果不导入而直接开服,服务器将会重新创建一个新世界)
+
+
+ 请选择地图文件夹(或解压后的文件夹)
+
+
+ 导入中,请稍候
+
+
+ 导入世界成功!源存档目录您可手动进行删除!
+
+
+ 导入世界失败!
+错误代码:{0}
+
+
diff --git a/MSL/pages/serverrunner/SRDashboard.xaml.cs b/MSL/pages/serverrunner/SRDashboard.xaml.cs
index cede01b..bfff744 100644
--- a/MSL/pages/serverrunner/SRDashboard.xaml.cs
+++ b/MSL/pages/serverrunner/SRDashboard.xaml.cs
@@ -421,27 +421,20 @@ public void GetServerInfoSys()
int dc1 = config.IndexOf("difficulty=") + 11;
string dc2 = config.Substring(dc1);
GameDifficultyText = dc2.Substring(0, dc2.IndexOf("\n"));
- int ip1 = config.IndexOf("server-ip=") + 10;
- string ip2 = config.Substring(ip1);
- string serverIP = ip2.Substring(0, ip2.IndexOf("\n"));
-
- int sp1 = config.IndexOf("server-port=") + 12;
- string sp2 = config.Substring(sp1);
- string serverPort = sp2.Substring(0, sp2.IndexOf("\n"));
- ServerIPText = serverIP + ":" + serverPort;
- if (string.IsNullOrEmpty(serverIP))
+ string serverIP = GetServerPropertyValue(config, "server-ip");
+ string serverPort = GetServerPropertyValue(config, "server-port");
+
+ // server-ip 为空是 Minecraft 的默认配置;部分配置会写成单独的 0。
+ if (string.IsNullOrWhiteSpace(serverIP) || serverIP == "0")
{
serverIP = "127.0.0.1";
}
- if (serverPort == "25565")
- {
- serverPort = string.Empty;
- }
- else
- {
- serverPort = ":" + serverPort;
- }
- LocalIPText = serverIP + serverPort;
+
+ // 仪表盘的“服务器IP”栏展示服务器端口;本地进入地址单独展示实际连接地址。
+ ServerIPText = string.IsNullOrWhiteSpace(serverPort) ? "25565" : serverPort;
+ LocalIPText = serverPort == "25565"
+ ? serverIP
+ : FormatServerEndpoint(serverIP, serverPort);
}
catch
{
@@ -449,6 +442,28 @@ public void GetServerInfoSys()
}
}
+ private static string GetServerPropertyValue(string config, string propertyName)
+ {
+ string prefix = propertyName + "=";
+ foreach (string line in config.Split('\n'))
+ {
+ string trimmedLine = line.Trim();
+ if (trimmedLine.StartsWith(prefix, StringComparison.OrdinalIgnoreCase))
+ {
+ return trimmedLine.Substring(prefix.Length).Trim();
+ }
+ }
+
+ return string.Empty;
+ }
+
+ private static string FormatServerEndpoint(string serverIP, string serverPort)
+ {
+ if (string.IsNullOrWhiteSpace(serverIP)) return serverPort?.Trim() ?? string.Empty;
+ if (string.IsNullOrWhiteSpace(serverPort)) return serverIP.Trim();
+ return $"{serverIP.Trim()}:{serverPort.Trim()}";
+ }
+
public void HandlePlayerListAdd(string playerName)
{
Dispatcher.InvokeAsync(() =>
diff --git a/MSL/utils/ServerRunnerModel.cs b/MSL/utils/ServerRunnerModel.cs
index 7eb2d95..490d44e 100644
--- a/MSL/utils/ServerRunnerModel.cs
+++ b/MSL/utils/ServerRunnerModel.cs
@@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.IO;
using System.Windows;
+using MSL.langs;
namespace MSL.utils
{
@@ -15,7 +16,7 @@ public string DisplayText // 用于在 ComboBox 和 ListBox 中展示的格式
{
get
{
- if (Cmd == "/") return "/(指令)"; // 根命令
+ if (Cmd == "/") return LanguageManager.Instance["SR_CmdHint"]; // 根命令
string text = $"/{Cmd.TrimStart('/')}"; // 统一显示前缀“/”
if (!string.IsNullOrEmpty(Remark)) text += $"({Remark})";
if (!string.IsNullOrEmpty(Alias)) text += $" [{Alias}]";