Compare commits
14 commits
Author | SHA1 | Date | |
---|---|---|---|
1067ff8e71 | |||
56a8b4b3ad | |||
ab4b7397a2 | |||
32f5b23ef1 | |||
4ce580e264 | |||
354301b9ce | |||
1a6ebaf12e | |||
20d9dc34f3 | |||
2b6c8d58c8 | |||
9d0a834e47 | |||
024e1f284c | |||
2bd31b6bd2 | |||
27459246bd | |||
7dbfaa13ea |
11 changed files with 596 additions and 595 deletions
|
@ -1,34 +1,34 @@
|
||||||
|
|
||||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||||
# Visual Studio Version 17
|
# Visual Studio Version 17
|
||||||
VisualStudioVersion = 17.12.35707.178 d17.12
|
VisualStudioVersion = 17.12.35707.178 d17.12
|
||||||
MinimumVisualStudioVersion = 10.0.40219.1
|
MinimumVisualStudioVersion = 10.0.40219.1
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerLauncher", "ServerLauncher\ServerLauncher.csproj", "{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ServerLauncher", "ServerLauncher\ServerLauncher.csproj", "{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
Debug|Any CPU = Debug|Any CPU
|
||||||
Debug|x64 = Debug|x64
|
Debug|x64 = Debug|x64
|
||||||
Debug|x86 = Debug|x86
|
Debug|x86 = Debug|x86
|
||||||
Release|Any CPU = Release|Any CPU
|
Release|Any CPU = Release|Any CPU
|
||||||
Release|x64 = Release|x64
|
Release|x64 = Release|x64
|
||||||
Release|x86 = Release|x86
|
Release|x86 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||||
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Debug|x64.ActiveCfg = Release|x64
|
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Debug|x64.ActiveCfg = Release|x64
|
||||||
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Debug|x64.Build.0 = Release|x64
|
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Debug|x64.Build.0 = Release|x64
|
||||||
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Debug|x86.ActiveCfg = Debug|x86
|
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Debug|x86.ActiveCfg = Debug|x86
|
||||||
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Debug|x86.Build.0 = Debug|x86
|
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Debug|x86.Build.0 = Debug|x86
|
||||||
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Release|Any CPU.Build.0 = Release|Any CPU
|
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Release|x64.ActiveCfg = Release|x64
|
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Release|x64.ActiveCfg = Release|x64
|
||||||
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Release|x64.Build.0 = Release|x64
|
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Release|x64.Build.0 = Release|x64
|
||||||
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Release|x86.ActiveCfg = Release|x86
|
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Release|x86.ActiveCfg = Release|x86
|
||||||
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Release|x86.Build.0 = Release|x86
|
{D8519CE3-2A8B-4B58-A689-EA3B7CB8DA9B}.Release|x86.Build.0 = Release|x86
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|
|
@ -1,56 +1,59 @@
|
||||||
<Window x:Class="ServerLauncher.Window2"
|
<Window x:Class="ServerLauncher.Window2"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:ServerLauncher"
|
xmlns:local="clr-namespace:ServerLauncher"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="TslGame Server Launcher - About US"
|
Title="TslGame 服务器启动器 - 关于我们"
|
||||||
Icon="pack://application:,,,/Resource/Image/MWIcon.ico"
|
Icon="pack://application:,,,/Resource/Image/MWIcon.ico"
|
||||||
Height="450"
|
Height="450"
|
||||||
Width="800"
|
Width="800"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
ResizeMode="NoResize">
|
ResizeMode="NoResize">
|
||||||
<!-- <Window.Background>
|
<!-- <Window.Background>
|
||||||
<ImageBrush ImageSource="pack://application:,,,/Resource/Image/TslGameServerBack1.jpg"/>
|
<ImageBrush ImageSource="pack://application:,,,/Resource/Image/TslGameServerBack1.jpg"/>
|
||||||
</Window.Background> -->
|
</Window.Background> -->
|
||||||
<Grid Margin="10,10,10,-5">
|
<Grid Margin="10,10,10,-5">
|
||||||
<TextBlock
|
<!-- 定义行和列 -->
|
||||||
Foreground="Black"
|
<!-- 添加一列用于状态文字 -->
|
||||||
HorizontalAlignment="Center"
|
<!-- 状态文字 -->
|
||||||
FontSize="20"
|
<TextBlock
|
||||||
FontFamily="Alimama FangYuanTi VF SemiBold"
|
Foreground="Black"
|
||||||
Margin="0,10,0,359"><Run Text="S"/><Run Text="ocial "/><Run Language="zh-cn" Text="M"/><Run Text="edia"/></TextBlock>
|
HorizontalAlignment="Center"
|
||||||
<TextBlock
|
FontSize="20"
|
||||||
Foreground="Black"
|
FontFamily="Alimama FangYuanTi VF SemiBold"
|
||||||
HorizontalAlignment="Center"
|
Margin="0,10,0,359"><Run Language="zh-cn" Text="社交媒体"/></TextBlock>
|
||||||
FontSize="14"
|
<TextBlock
|
||||||
FontFamily="Alimama FangYuanTi VF SemiBold"
|
Foreground="Black"
|
||||||
Margin="0,34,0,289"><Run Text="Don't be deceived! This project and other related contents are completely open source"/><Run Language="zh-cn" Text="."/></TextBlock>
|
HorizontalAlignment="Center"
|
||||||
<Image Margin="392,-680,360,-458" Source="/Resource/Image/Line1.png" Stretch="Fill" RenderTransformOrigin="2.111,0.505">
|
FontSize="14"
|
||||||
<Image.RenderTransform>
|
FontFamily="Alimama FangYuanTi VF SemiBold"
|
||||||
<TransformGroup>
|
Margin="0,34,0,289"><Run Language="zh-cn" Text="切勿上当受骗!本项目及其他有关内容是完全开源的。"/></TextBlock>
|
||||||
<ScaleTransform/>
|
<Image Margin="392,-680,360,-458" Source="/Resource/Image/Line1.png" Stretch="Fill" RenderTransformOrigin="2.111,0.505">
|
||||||
<SkewTransform/>
|
<Image.RenderTransform>
|
||||||
<RotateTransform Angle="90.021"/>
|
<TransformGroup>
|
||||||
<TranslateTransform/>
|
<ScaleTransform/>
|
||||||
</TransformGroup>
|
<SkewTransform/>
|
||||||
</Image.RenderTransform>
|
<RotateTransform Angle="90.021"/>
|
||||||
</Image>
|
<TranslateTransform/>
|
||||||
<TextBlock
|
</TransformGroup>
|
||||||
Foreground="Black"
|
</Image.RenderTransform>
|
||||||
FontSize="14"
|
</Image>
|
||||||
FontFamily="Alimama FangYuanTi VF SemiBold"
|
<TextBlock
|
||||||
Margin="209,369,0,-350" Width="388" ScrollViewer.HorizontalScrollBarVisibility="Visible" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left">
|
Foreground="Black"
|
||||||
<TextBlock.RenderTransform>
|
FontSize="14"
|
||||||
<TransformGroup>
|
FontFamily="Alimama FangYuanTi VF SemiBold"
|
||||||
<ScaleTransform/>
|
Margin="209,369,0,-350" Width="388" ScrollViewer.HorizontalScrollBarVisibility="Visible" RenderTransformOrigin="0.5,0.5" HorizontalAlignment="Left">
|
||||||
<SkewTransform AngleX="0"/>
|
<TextBlock.RenderTransform>
|
||||||
<RotateTransform/>
|
<TransformGroup>
|
||||||
<TranslateTransform X="0"/>
|
<ScaleTransform/>
|
||||||
</TransformGroup>
|
<SkewTransform AngleX="0"/>
|
||||||
</TextBlock.RenderTransform><Run Text="Copyright © 2025 "/><Run Text=" DEV:"/><Run Text="Land "/><Run Text="(Please do not sell!)"/></TextBlock>
|
<RotateTransform/>
|
||||||
<Button Content="Join Discord" FontFamily="Alimama FangYuanTi VF SemiBold" Background="Yellow" Padding="9,0" HorizontalAlignment="Center" Click="Button_JoinDC_Click" RenderTransformOrigin="0.368,0.386" Width="136" VerticalAlignment="Top" Height="27" Margin="0,164,0,0"/>
|
<TranslateTransform X="0"/>
|
||||||
<Button Content="Join QQ Group" FontFamily="Alimama FangYuanTi VF SemiBold" Padding="9,0" HorizontalAlignment="Center" Click="Button_JoinQQ_Click" RenderTransformOrigin="0.368,0.386" Width="136" Background="Yellow" VerticalAlignment="Top" Height="27" Margin="0,215,0,0"/>
|
</TransformGroup>
|
||||||
</Grid>
|
</TextBlock.RenderTransform><Run Text="Copyright © 2025 "/><Run Text=" 开发者:"/><Run Text="在下王某人 "/><Run Language="zh-cn" Text="(请勿转卖!)"/></TextBlock>
|
||||||
</Window>
|
<Button Content="加入 Discord" FontFamily="Alimama FangYuanTi VF SemiBold" Background="Yellow" Padding="9,0" HorizontalAlignment="Center" Click="Button_JoinDC_Click" RenderTransformOrigin="0.368,0.386" Width="136" VerticalAlignment="Top" Height="27" Margin="0,164,0,0"/>
|
||||||
|
<Button Content="加入 QQ 群" FontFamily="Alimama FangYuanTi VF SemiBold" Padding="9,0" HorizontalAlignment="Center" Click="Button_JoinQQ_Click" RenderTransformOrigin="0.368,0.386" Width="136" Background="Yellow" VerticalAlignment="Top" Height="27" Margin="0,215,0,0"/>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
||||||
|
|
|
@ -1,56 +1,56 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace ServerLauncher
|
namespace ServerLauncher
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Window2.xaml 的交互逻辑
|
/// Window2.xaml 的交互逻辑
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class Window2 : Window
|
public partial class Window2 : Window
|
||||||
{
|
{
|
||||||
public Window2()
|
public Window2()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
|
|
||||||
//加入 Discord 按钮
|
//加入 Discord 按钮
|
||||||
private void Button_JoinDC_Click(object sender, RoutedEventArgs e)
|
private void Button_JoinDC_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
string url = "https://discord.gg/yrcaukyEcw";
|
string url = "https://discord.gg/yrcaukyEcw";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 使用默认浏览器打开链接
|
// 使用默认浏览器打开链接
|
||||||
Process.Start(new ProcessStartInfo
|
Process.Start(new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = url,
|
FileName = url,
|
||||||
UseShellExecute = true
|
UseShellExecute = true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (System.ComponentModel.Win32Exception ex)
|
catch (System.ComponentModel.Win32Exception ex)
|
||||||
{
|
{
|
||||||
// 如果系统中没有默认浏览器,会抛出异常
|
// 如果系统中没有默认浏览器,会抛出异常
|
||||||
MessageBox.Show($"An error was encountered while opening the link: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show($"无法打开链接:{ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//加入 QQ 群 按钮
|
//加入 QQ 群 按钮
|
||||||
private void Button_JoinQQ_Click(object sender, RoutedEventArgs e)
|
private void Button_JoinQQ_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
string url = "https://qm.qq.com/q/q8dzw0E8Xm";
|
string url = "https://qm.qq.com/q/q8dzw0E8Xm";
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 使用默认浏览器打开链接
|
// 使用默认浏览器打开链接
|
||||||
Process.Start(new ProcessStartInfo
|
Process.Start(new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = url,
|
FileName = url,
|
||||||
UseShellExecute = true
|
UseShellExecute = true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (System.ComponentModel.Win32Exception ex)
|
catch (System.ComponentModel.Win32Exception ex)
|
||||||
{
|
{
|
||||||
// 如果系统中没有默认浏览器,会抛出异常
|
// 如果系统中没有默认浏览器,会抛出异常
|
||||||
MessageBox.Show($"An error was encountered while opening the link: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show($"无法打开链接:{ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,9 +1,9 @@
|
||||||
<Application x:Class="ServerLauncher.App"
|
<Application x:Class="ServerLauncher.App"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:local="clr-namespace:ServerLauncher"
|
xmlns:local="clr-namespace:ServerLauncher"
|
||||||
StartupUri="MainWindow.xaml">
|
StartupUri="MainWindow.xaml">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
|
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
</Application>
|
</Application>
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
using System.Configuration;
|
using System.Configuration;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
namespace ServerLauncher
|
namespace ServerLauncher
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Interaction logic for App.xaml
|
/// Interaction logic for App.xaml
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App : Application
|
public partial class App : Application
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
|
||||||
[assembly: ThemeInfo(
|
[assembly: ThemeInfo(
|
||||||
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
|
||||||
//(used if a resource is not found in the page,
|
//(used if a resource is not found in the page,
|
||||||
// or application resource dictionaries)
|
// or application resource dictionaries)
|
||||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
//(used if a resource is not found in the page,
|
//(used if a resource is not found in the page,
|
||||||
// app, or any theme specific resource dictionaries)
|
// app, or any theme specific resource dictionaries)
|
||||||
)]
|
)]
|
||||||
|
|
|
@ -1,68 +1,68 @@
|
||||||
<Window x:Class="ServerLauncher.MainWindow"
|
<Window x:Class="ServerLauncher.MainWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:ServerLauncher"
|
xmlns:local="clr-namespace:ServerLauncher"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="TslGame Server Launcher"
|
Title="TslGame 服务器启动器"
|
||||||
Icon="pack://application:,,,/Resource/Image/MWIcon.ico"
|
Icon="pack://application:,,,/Resource/Image/MWIcon.ico"
|
||||||
Height="450"
|
Height="450"
|
||||||
Width="800"
|
Width="800"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
ResizeMode="NoResize">
|
ResizeMode="NoResize">
|
||||||
<Window.Background>
|
<Window.Background>
|
||||||
<ImageBrush ImageSource="pack://application:,,,/Resource/Image/TslGameServerBack1.jpg"/>
|
<ImageBrush ImageSource="pack://application:,,,/Resource/Image/TslGameServerBack1.jpg"/>
|
||||||
</Window.Background>
|
</Window.Background>
|
||||||
<Grid Margin="10,10,0,-5">
|
<Grid Margin="10,10,0,-5">
|
||||||
<!-- 定义行和列 -->
|
<!-- 定义行和列 -->
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="45.96"/>
|
<RowDefinition Height="45.96"/>
|
||||||
<RowDefinition Height="104.44"/>
|
<RowDefinition Height="104.44"/>
|
||||||
<RowDefinition Height="Auto"/>
|
<RowDefinition Height="Auto"/>
|
||||||
<RowDefinition Height="*"/>
|
<RowDefinition Height="*"/>
|
||||||
<!-- 添加一个额外的行用于状态显示 -->
|
<!-- 添加一个额外的行用于状态显示 -->
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto"/>
|
<ColumnDefinition Width="Auto"/>
|
||||||
<ColumnDefinition Width="*"/>
|
<ColumnDefinition Width="*"/>
|
||||||
<!-- 添加一列用于状态文字 -->
|
<!-- 添加一列用于状态文字 -->
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
<!-- 按钮 -->
|
<!-- 按钮 -->
|
||||||
<Button Content="Start Server" FontFamily="Alimama FangYuanTi VF SemiBold" Background="Yellow" Padding="9,4" HorizontalAlignment="Center" Grid.Row="0" Margin="0,5,0,5" Click="Button_StartTSLServer_Click"/>
|
<Button Content="启动服务器" FontFamily="Alimama FangYuanTi VF SemiBold" Background="Yellow" Padding="9,4" HorizontalAlignment="Center" Grid.Row="0" Margin="0,5,0,5" Click="Button_StartTSLServer_Click"/>
|
||||||
<Button Content="End Server" FontFamily="Alimama FangYuanTi VF SemiBold" Background="Yellow" Padding="9,4" HorizontalAlignment="Center" Grid.Row="1" Margin="0,1,0,9" Click="Button_KillTSLServer_Click"/>
|
<Button Content="结束服务器" FontFamily="Alimama FangYuanTi VF SemiBold" Background="Yellow" Padding="9,4" HorizontalAlignment="Center" Grid.Row="1" Margin="0,1,0,9" Click="Button_KillTSLServer_Click"/>
|
||||||
<Button Content="Start Game" FontFamily="Alimama FangYuanTi VF SemiBold" Background="Yellow" Padding="9,4" HorizontalAlignment="Center" Grid.Row="2" Margin="0,23,0,103" Click="Button_Start_TslGame" Grid.RowSpan="2"/>
|
<Button Content="开始游戏" FontFamily="Alimama FangYuanTi VF SemiBold" Background="Yellow" Padding="9,4" HorizontalAlignment="Center" Grid.Row="2" Margin="0,23,0,103" Click="Button_Start_TslGame" Grid.RowSpan="2"/>
|
||||||
<Button Content="Exit" FontFamily="Alimama FangYuanTi VF SemiBold" Background="Yellow" Padding="9,0" HorizontalAlignment="Center" Grid.Row="3" Margin="0,6,0,71" Click="Button_Exit_Click" RenderTransformOrigin="0.368,0.386"/>
|
<Button Content="退出程序" FontFamily="Alimama FangYuanTi VF SemiBold" Background="Yellow" Padding="9,0" HorizontalAlignment="Center" Grid.Row="3" Margin="0,6,0,71" Click="Button_Exit_Click" RenderTransformOrigin="0.368,0.386"/>
|
||||||
<!-- 状态文字 -->
|
<!-- 状态文字 -->
|
||||||
<TextBlock x:Name="StatusText"
|
<TextBlock x:Name="StatusText"
|
||||||
Text="Not running"
|
Text="未运行"
|
||||||
FontSize="20"
|
FontSize="20"
|
||||||
FontFamily="Alimama FangYuanTi VF SemiBold"
|
FontFamily="Alimama FangYuanTi VF SemiBold"
|
||||||
Foreground="Red"
|
Foreground="Red"
|
||||||
Margin="178,23,-178,21"
|
Margin="140,23,-140,21"
|
||||||
Grid.Column="1" Grid.RowSpan="2"/>
|
Grid.Column="1" Grid.RowSpan="2"/>
|
||||||
<TextBlock Text="Server Status:"
|
<TextBlock Text="服务器状态:"
|
||||||
Foreground="White"
|
Foreground="White"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
FontSize="20"
|
FontSize="20"
|
||||||
FontFamily="Alimama FangYuanTi VF SemiBold"
|
FontFamily="Alimama FangYuanTi VF SemiBold"
|
||||||
Margin="20,23,0,21" Grid.Column="1" Grid.RowSpan="2"/>
|
Margin="20,23,0,21" Grid.Column="1" Grid.RowSpan="2"/>
|
||||||
<Button Content="About US" FontFamily="Alimama FangYuanTi VF SemiBold" Background="Yellow" Padding="9,0" HorizontalAlignment="Center" Grid.Row="3" Margin="0,65,0,12" Click="Button_OpenNewWindow_Click" RenderTransformOrigin="0.368,0.386"/>
|
<Button Content="关于我们" FontFamily="Alimama FangYuanTi VF SemiBold" Background="Yellow" Padding="9,0" HorizontalAlignment="Center" Grid.Row="3" Margin="0,65,0,12" Click="Button_OpenNewWindow_Click" RenderTransformOrigin="0.368,0.386"/>
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Foreground="White"
|
Foreground="White"
|
||||||
FontSize="14"
|
FontSize="14"
|
||||||
FontFamily="Alimama FangYuanTi VF SemiBold"
|
FontFamily="Alimama FangYuanTi VF SemiBold"
|
||||||
Margin="120,164,0,0" Width="367" ScrollViewer.HorizontalScrollBarVisibility="Visible" Grid.Row="5" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Top" HorizontalAlignment="Left" Height="17" Grid.Column="1" Background="Black">
|
Margin="121,123,0,0" Width="388" ScrollViewer.HorizontalScrollBarVisibility="Visible" Grid.Row="4" RenderTransformOrigin="0.5,0.5" VerticalAlignment="Top" HorizontalAlignment="Left" Height="17" Grid.RowSpan="2" Grid.Column="1">
|
||||||
<TextBlock.RenderTransform>
|
<TextBlock.RenderTransform>
|
||||||
<TransformGroup>
|
<TransformGroup>
|
||||||
<ScaleTransform/>
|
<ScaleTransform/>
|
||||||
<SkewTransform AngleX="0"/>
|
<SkewTransform AngleX="0"/>
|
||||||
<RotateTransform/>
|
<RotateTransform/>
|
||||||
<TranslateTransform X="0"/>
|
<TranslateTransform X="0"/>
|
||||||
</TransformGroup>
|
</TransformGroup>
|
||||||
</TextBlock.RenderTransform><Run Text="Copyright © 2025 "/><Run Text=" DEV:"/><Run Text="Land "/><Run Language="zh-cn" Text="(Please do not sell!)"/></TextBlock>
|
</TextBlock.RenderTransform><Run Text="Copyright © 2025 "/><Run Text=" 开发者:"/><Run Text="在下王某人 "/><Run Language="zh-cn" Text="(请勿转卖!)"/></TextBlock>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
|
@ -1,206 +1,204 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace ServerLauncher
|
namespace ServerLauncher
|
||||||
{
|
{
|
||||||
public partial class MainWindow : Window
|
public partial class MainWindow : Window
|
||||||
{
|
{
|
||||||
private DispatcherTimer timer;
|
private DispatcherTimer timer;
|
||||||
public MainWindow()
|
public MainWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
// 初始化定时器
|
// 初始化定时器
|
||||||
timer = new DispatcherTimer();
|
timer = new DispatcherTimer();
|
||||||
timer.Interval = TimeSpan.FromSeconds(5); // 每 5 秒检测一次
|
timer.Interval = TimeSpan.FromSeconds(5); // 每 5 秒检测一次
|
||||||
timer.Tick += Timer_Tick;
|
timer.Tick += Timer_Tick;
|
||||||
timer.Start();
|
timer.Start();
|
||||||
|
|
||||||
// 初始检测
|
// 初始检测
|
||||||
CheckTslGameProcess();
|
CheckTslGameProcess();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//启动服务器进程
|
//启动服务器进程
|
||||||
private static void StartTSLServer()
|
private static void StartTSLServer()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Process.Start(new ProcessStartInfo
|
Process.Start(new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = "TslGame.exe",
|
FileName = "TslGame.exe",
|
||||||
Arguments = "/Game/Maps/Erangel/Erangel_Main?listen?game=/Game/Blueprints/TSLGameMode.TSLGameMode_C -nullrhi -nosound -AllowJoinAnyMatchState -Server -port=8888 -NoVerifyGC -NoEAC -NoBattleEye",
|
Arguments = "/Game/Maps/Erangel/Erangel_Main?listen?game=/Game/Blueprints/TSLGameMode.TSLGameMode_C -nullrhi -nosound -AllowJoinAnyMatchState -Server -port=8888 -NoVerifyGC -NoEAC -NoBattleEye",
|
||||||
UseShellExecute = true,
|
UseShellExecute = true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"An error was encountered while starting TslGame Server:{ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show($"无法启动 TslGame Server:{ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//结束服务器进程
|
//结束服务器进程
|
||||||
private static void KillTSLProcess()
|
private static void KillTSLProcess()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 获取所有名为 "TslGame" 的进程
|
// 获取所有名为 "TslGame" 的进程
|
||||||
Process[] processes = Process.GetProcessesByName("TslGame");
|
Process[] processes = Process.GetProcessesByName("TslGame");
|
||||||
|
|
||||||
if (processes.Length > 0)
|
if (processes.Length > 0)
|
||||||
{
|
{
|
||||||
foreach (var process in processes)
|
foreach (var process in processes)
|
||||||
{
|
{
|
||||||
process.Kill(); // 强制结束进程
|
process.Kill(); // 强制结束进程
|
||||||
process.WaitForExit(); // 等待进程完全退出
|
process.WaitForExit(); // 等待进程完全退出
|
||||||
}
|
}
|
||||||
|
|
||||||
MessageBox.Show("TslGame Server was successfully closed.", "Message", MessageBoxButton.OK, MessageBoxImage.Information);
|
MessageBox.Show("TslGame Server 已成功关闭!", "操作成功", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBox.Show("TslGame Server Not running!", "Message", MessageBoxButton.OK, MessageBoxImage.Warning);
|
MessageBox.Show("TslGame Server 没有在运行!", "提示", MessageBoxButton.OK, MessageBoxImage.Warning);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"Failed to end process TslGame Server: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show($"无法结束 TslGame Server: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//启动游戏进程
|
//启动游戏进程
|
||||||
private static void StartTSLGame()
|
private static void StartTSLGame()
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Process.Start(new ProcessStartInfo
|
Process.Start(new ProcessStartInfo
|
||||||
{
|
{
|
||||||
FileName = "TslGame.exe",
|
FileName = "TslGame.exe",
|
||||||
Arguments = "127.0.0.1:8888 -NoVerifyGC -NoEAC -NoBattleEye",
|
Arguments = "127.0.0.1:8888 -NoVerifyGC -NoEAC -NoBattleEye",
|
||||||
UseShellExecute = true,
|
UseShellExecute = true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"An error was encountered while starting TslGame:{ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show($"无法启动 TslGame:{ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//监测 TslGame Server 是否正在运行(自动逻辑)
|
//监测 TslGame Server 是否正在运行(自动逻辑)
|
||||||
private void Timer_Tick(object sender, EventArgs e)
|
private void Timer_Tick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// 定时检测进程状态
|
// 定时检测进程状态
|
||||||
CheckTslGameProcess();
|
CheckTslGameProcess();
|
||||||
}
|
}
|
||||||
private void CheckTslGameProcess()
|
private void CheckTslGameProcess()
|
||||||
{
|
{
|
||||||
// 获取所有名为 "TslGame" 的进程
|
// 获取所有名为 "TslGame" 的进程
|
||||||
Process[] processes = Process.GetProcessesByName("TslGame");
|
Process[] processes = Process.GetProcessesByName("TslGame");
|
||||||
|
|
||||||
if (processes.Length > 0)
|
if (processes.Length > 0)
|
||||||
{
|
{
|
||||||
// 如果进程存在,更新界面为“运行”
|
// 如果进程存在,更新界面为“运行”
|
||||||
StatusText.Text = "Running";
|
StatusText.Text = "运行";
|
||||||
StatusText.Foreground = new SolidColorBrush(Colors.Green);
|
StatusText.Foreground = new SolidColorBrush(Colors.Green);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 如果进程不存在,更新界面为“未运行”
|
// 如果进程不存在,更新界面为“未运行”
|
||||||
StatusText.Text = "Not running";
|
StatusText.Text = "未运行";
|
||||||
StatusText.Foreground = new SolidColorBrush(Colors.Red);
|
StatusText.Foreground = new SolidColorBrush(Colors.Red);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//界面上的按钮事件
|
//界面上的按钮事件
|
||||||
//启动 TslGame 服务器
|
//启动 TslGame 服务器
|
||||||
private async void Button_StartTSLServer_Click(object sender, RoutedEventArgs e)
|
private async void Button_StartTSLServer_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
// 启动TslGame.exe
|
// 启动TslGame.exe
|
||||||
MessageBoxResult result = MessageBox.Show(
|
MessageBoxResult result = MessageBox.Show(
|
||||||
"Are you sure?",
|
"你确定要这么做吗?",
|
||||||
"Message",
|
"提示",
|
||||||
MessageBoxButton.YesNo,
|
MessageBoxButton.YesNo,
|
||||||
MessageBoxImage.Question);
|
MessageBoxImage.Question);
|
||||||
|
|
||||||
if (result == MessageBoxResult.Yes)
|
if (result == MessageBoxResult.Yes)
|
||||||
{
|
{
|
||||||
await Task.Delay(3000);
|
await Task.Delay(3000);
|
||||||
StartTSLServer();
|
StartTSLServer();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
MessageBox.Show($"An error was encountered while starting TslGame Server: {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
MessageBox.Show($"无法启动 TslGame Server: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//结束 TslGame 服务器
|
||||||
|
private void Button_KillTSLServer_Click(object sender, RoutedEventArgs e)
|
||||||
//结束 TslGame 服务器
|
{
|
||||||
private void Button_KillTSLServer_Click(object sender, RoutedEventArgs e)
|
try
|
||||||
{
|
{
|
||||||
try
|
MessageBoxResult result = MessageBox.Show(
|
||||||
{
|
"你确定要这么做吗?",
|
||||||
MessageBoxResult result = MessageBox.Show(
|
"提示",
|
||||||
"Are you sure?",
|
MessageBoxButton.YesNo,
|
||||||
"Message",
|
MessageBoxImage.Question);
|
||||||
MessageBoxButton.YesNo,
|
|
||||||
MessageBoxImage.Question);
|
if (result == MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
if (result == MessageBoxResult.Yes)
|
KillTSLProcess();
|
||||||
{
|
}
|
||||||
KillTSLProcess();
|
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
MessageBox.Show($"无法结束 TslGame Server: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
{
|
}
|
||||||
MessageBox.Show($"Failed to end process TslGame Server: {ex.Message}", "错误", MessageBoxButton.OK, MessageBoxImage.Error);
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
|
//启动 TslGame
|
||||||
|
private void Button_Start_TslGame(object sender, RoutedEventArgs e)
|
||||||
//启动 TslGame
|
{
|
||||||
private void Button_Start_TslGame(object sender, RoutedEventArgs e)
|
try
|
||||||
{
|
{
|
||||||
try
|
MessageBoxResult result = MessageBox.Show(
|
||||||
{
|
"你确定要这么做吗?",
|
||||||
MessageBoxResult result = MessageBox.Show(
|
"提示",
|
||||||
"Are you sure?",
|
MessageBoxButton.YesNo,
|
||||||
"Message",
|
MessageBoxImage.Question);
|
||||||
MessageBoxButton.YesNo,
|
|
||||||
MessageBoxImage.Question);
|
if (result == MessageBoxResult.Yes)
|
||||||
|
{
|
||||||
if (result == MessageBoxResult.Yes)
|
StartTSLGame();
|
||||||
{
|
}
|
||||||
StartTSLGame();
|
|
||||||
}
|
}
|
||||||
|
catch (Exception ex)
|
||||||
}
|
{
|
||||||
catch (Exception ex)
|
MessageBox.Show($"无法启动 TslGame {ex.Message}", "提示", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||||
{
|
}
|
||||||
MessageBox.Show($"An error was encountered while starting TslGame {ex.Message}", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
|
}
|
||||||
}
|
|
||||||
}
|
//退出应用
|
||||||
|
private void Button_Exit_Click(object sender, RoutedEventArgs e)
|
||||||
//退出应用
|
{
|
||||||
private void Button_Exit_Click(object sender, RoutedEventArgs e)
|
Application.Current.Shutdown();
|
||||||
{
|
}
|
||||||
Application.Current.Shutdown();
|
|
||||||
}
|
//关于我们
|
||||||
|
private void Button_OpenNewWindow_Click(object sender, RoutedEventArgs e)
|
||||||
//关于我们
|
{
|
||||||
private void Button_OpenNewWindow_Click(object sender, RoutedEventArgs e)
|
// 创建新窗口的实例
|
||||||
{
|
Window2 newWindow = new Window2();
|
||||||
// 创建新窗口的实例
|
// 显示新窗口
|
||||||
Window2 newWindow = new Window2();
|
newWindow.Show();
|
||||||
// 显示新窗口
|
}
|
||||||
newWindow.Show();
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -1,75 +1,75 @@
|
||||||
<Project Sdk="Microsoft.NET.Sdk">
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net8.0-windows</TargetFramework>
|
<TargetFramework>net8.0-windows</TargetFramework>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<UseWPF>true</UseWPF>
|
<UseWPF>true</UseWPF>
|
||||||
<Platforms>AnyCPU;x64;x86</Platforms>
|
<Platforms>AnyCPU;x64;x86</Platforms>
|
||||||
<UseWindowsForms>False</UseWindowsForms>
|
<UseWindowsForms>False</UseWindowsForms>
|
||||||
<ApplicationIcon>MWIcon.ico</ApplicationIcon>
|
<ApplicationIcon>MWIcon.ico</ApplicationIcon>
|
||||||
<NuGetAudit>False</NuGetAudit>
|
<NuGetAudit>False</NuGetAudit>
|
||||||
<StartupObject></StartupObject>
|
<StartupObject></StartupObject>
|
||||||
<PlatformTarget>x86</PlatformTarget>
|
<PlatformTarget>x86</PlatformTarget>
|
||||||
<Title>TslGame 服务器启动器</Title>
|
<Title>TslGame 服务器启动器</Title>
|
||||||
<Authors>在下王某人</Authors>
|
<Authors>在下王某人</Authors>
|
||||||
<NeutralLanguage>zh-CN</NeutralLanguage>
|
<NeutralLanguage>zh-CN</NeutralLanguage>
|
||||||
<Description>服务器启动器。</Description>
|
<Description>服务器启动器。</Description>
|
||||||
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
<GenerateDocumentationFile>False</GenerateDocumentationFile>
|
||||||
<SignAssembly>False</SignAssembly>
|
<SignAssembly>False</SignAssembly>
|
||||||
<DelaySign>False</DelaySign>
|
<DelaySign>False</DelaySign>
|
||||||
<ErrorReport>none</ErrorReport>
|
<ErrorReport>none</ErrorReport>
|
||||||
<Copyright>Copyright © 2025 在下王某人 版权所有.</Copyright>
|
<Copyright>Copyright © 2025 在下王某人 版权所有.</Copyright>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x86'">
|
||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|AnyCPU'">
|
||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x86'">
|
||||||
<DebugType>none</DebugType>
|
<DebugType>none</DebugType>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Remove="Window1.xaml.cs" />
|
<Compile Remove="Window1.xaml.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Remove="Resource\Fonts\Alimama FYT VF.ttf" />
|
<None Remove="Resource\Fonts\Alimama FYT VF.ttf" />
|
||||||
<None Remove="Resource\Image\Line1.png" />
|
<None Remove="Resource\Image\Line1.png" />
|
||||||
<None Remove="Resource\Image\MWIcon.ico" />
|
<None Remove="Resource\Image\MWIcon.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Page Remove="Window1.xaml" />
|
<Page Remove="Window1.xaml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="MWIcon.ico" />
|
<Content Include="MWIcon.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Resource Include="Resource\Fonts\Alimama FYT VF.ttf" />
|
<Resource Include="Resource\Fonts\Alimama FYT VF.ttf" />
|
||||||
<Resource Include="Resource\Image\Line1.png" />
|
<Resource Include="Resource\Image\Line1.png" />
|
||||||
<Resource Include="Resource\Image\TslGameServerBack1.jpg" />
|
<Resource Include="Resource\Image\TslGameServerBack1.jpg" />
|
||||||
<Resource Include="Resource\Image\MWIcon.ico" />
|
<Resource Include="Resource\Image\MWIcon.ico" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
<Window x:Class="ServerLauncher.NewWindow"
|
<Window x:Class="ServerLauncher.NewWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:local="clr-namespace:ServerLauncher"
|
xmlns:local="clr-namespace:ServerLauncher"
|
||||||
mc:Ignorable="d"
|
mc:Ignorable="d"
|
||||||
Title="Window1" Height="450" Width="800">
|
Title="Window1" Height="450" Width="800">
|
||||||
<Grid Margin="10">
|
<Grid Margin="10">
|
||||||
<!-- 状态显示 -->
|
<!-- 状态显示 -->
|
||||||
<TextBlock Text="服务器状态:" Foreground="Black" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Margin="0,0,10,0"/>
|
<TextBlock Text="服务器状态:" Foreground="Black" HorizontalAlignment="Left" VerticalAlignment="Center" FontSize="20" Margin="0,0,10,0"/>
|
||||||
<TextBlock x:Name="StatusText"
|
<TextBlock x:Name="StatusText"
|
||||||
Text="未运行"
|
Text="未运行"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
FontSize="20"
|
FontSize="20"
|
||||||
FontWeight="Bold"
|
FontWeight="Bold"
|
||||||
Foreground="Red"
|
Foreground="Red"
|
||||||
Margin="0,0,590,0"/>
|
Margin="0,0,590,0"/>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Window>
|
</Window>
|
|
@ -1,51 +1,51 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
|
||||||
namespace ServerLauncher
|
namespace ServerLauncher
|
||||||
{
|
{
|
||||||
public partial class NewWindow : Window
|
public partial class NewWindow : Window
|
||||||
{
|
{
|
||||||
private DispatcherTimer timer;
|
private DispatcherTimer timer;
|
||||||
|
|
||||||
public NewWindow()
|
public NewWindow()
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
// 初始化定时器
|
// 初始化定时器
|
||||||
timer = new DispatcherTimer();
|
timer = new DispatcherTimer();
|
||||||
timer.Interval = TimeSpan.FromSeconds(5); // 每 5 秒检测一次
|
timer.Interval = TimeSpan.FromSeconds(5); // 每 5 秒检测一次
|
||||||
timer.Tick += Timer_Tick;
|
timer.Tick += Timer_Tick;
|
||||||
timer.Start();
|
timer.Start();
|
||||||
|
|
||||||
// 初始检测
|
// 初始检测
|
||||||
CheckTslGameProcess();
|
CheckTslGameProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Timer_Tick(object sender, EventArgs e)
|
private void Timer_Tick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// 定时检测进程状态
|
// 定时检测进程状态
|
||||||
CheckTslGameProcess();
|
CheckTslGameProcess();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CheckTslGameProcess()
|
private void CheckTslGameProcess()
|
||||||
{
|
{
|
||||||
// 获取所有名为 "TslGame" 的进程
|
// 获取所有名为 "TslGame" 的进程
|
||||||
Process[] processes = Process.GetProcessesByName("TslGame");
|
Process[] processes = Process.GetProcessesByName("TslGame");
|
||||||
|
|
||||||
if (processes.Length > 0)
|
if (processes.Length > 0)
|
||||||
{
|
{
|
||||||
// 如果进程存在,更新界面为“运行”,并设置为绿色
|
// 如果进程存在,更新界面为“运行”,并设置为绿色
|
||||||
StatusText.Text = "运行";
|
StatusText.Text = "运行";
|
||||||
StatusText.Foreground = new SolidColorBrush(Colors.Green);
|
StatusText.Foreground = new SolidColorBrush(Colors.Green);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// 如果进程不存在,更新界面为“未运行”,并设置为红色
|
// 如果进程不存在,更新界面为“未运行”,并设置为红色
|
||||||
StatusText.Text = "未运行";
|
StatusText.Text = "未运行";
|
||||||
StatusText.Foreground = new SolidColorBrush(Colors.Red);
|
StatusText.Foreground = new SolidColorBrush(Colors.Red);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue