Skip to content

Commit

Permalink
feature: 新增若干功能
Browse files Browse the repository at this point in the history
1.添加build.bat脚本
2.添加StartManager程序
  • Loading branch information
JusterZhu committed Aug 21, 2024
1 parent edd2fd2 commit 27312a9
Show file tree
Hide file tree
Showing 9 changed files with 143 additions and 36 deletions.
3 changes: 1 addition & 2 deletions src/Client/build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
REM 设置解决方案文件路径
set SOLUTION_PATH=ClientSample.sln

REM 导航到解决方案目录
REM 切换到解决方案所在的目录
cd /d %~dp0

REM 运行dotnet build命令
Expand All @@ -11,7 +11,6 @@ dotnet build %SOLUTION_PATH% -c Release
REM 检查构建是否成功
if %errorlevel% neq 0 (
echo Build failed
exit /b %errorlevel%
) else (
echo Build succeeded
)
16 changes: 16 additions & 0 deletions src/Server/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@echo off
REM 设置解决方案文件路径
set SOLUTION_PATH=ServerSample.sln

REM 切换到解决方案所在的目录
cd /d %~dp0

REM 运行dotnet build命令
dotnet build %SOLUTION_PATH% -c Release

REM 检查构建是否成功
if %errorlevel% neq 0 (
echo Build failed
) else (
echo Build succeeded
)
1 change: 1 addition & 0 deletions src/StartManager/.idea/.idea.StartManager/.idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

53 changes: 52 additions & 1 deletion src/StartManager/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,57 @@ class Program
{
static void Main(string[] args)
{
Console.WriteLine("Hello, World!");
bool exit = false;
ShowMenu();
while (!exit)
{
string input = Console.ReadLine();
switch (input)
{
case "1":
Option1();
break;
case "2":
Option2();
break;
case "3":
Option3();
break;
case "4":
exit = true;
break;
default:
Console.WriteLine("无效的选择,请重新输入。");
break;
}
}
}

static void ShowMenu()
{
Console.WriteLine("请选择一个选项:");
Console.WriteLine("1. 启动服务端");
Console.WriteLine("2. 启动客户端");
Console.WriteLine("3. 还原");
Console.WriteLine("4. 退出");
Console.Write("输入你的选择: ");
}

static void Option1()
{
Console.WriteLine("你选择了选项1");
// 在这里添加选项1的逻辑
}

static void Option2()
{
Console.WriteLine("你选择了选项2");
// 在这里添加选项2的逻辑
}

static void Option3()
{
Console.WriteLine("你选择了选项3");
// 在这里添加选项3的逻辑
}
}
4 changes: 4 additions & 0 deletions src/StartManager/StartManager.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,8 @@
<InvariantGlobalization>true</InvariantGlobalization>
</PropertyGroup>

<ItemGroup>
<None Remove="build.bat" />
</ItemGroup>

</Project>
16 changes: 16 additions & 0 deletions src/StartManager/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@echo off
REM 设置解决方案文件路径
set SOLUTION_PATH=StartManager.sln

REM 切换到解决方案所在的目录
cd /d %~dp0

REM 运行dotnet build命令
dotnet build %SOLUTION_PATH% -c Release

REM 检查构建是否成功
if %errorlevel% neq 0 (
echo Build failed
) else (
echo Build succeeded
)
16 changes: 16 additions & 0 deletions src/Upgrade/build.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
@echo off
REM 设置解决方案文件路径
set SOLUTION_PATH=UpgradeSample.sln

REM 切换到解决方案所在的目录
cd /d %~dp0

REM 运行dotnet build命令
dotnet build %SOLUTION_PATH% -c Release

REM 检查构建是否成功
if %errorlevel% neq 0 (
echo Build failed
) else (
echo Build succeeded
)
33 changes: 0 additions & 33 deletions src/build.bat

This file was deleted.

37 changes: 37 additions & 0 deletions src/start.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
@echo off
REM 保存初始目录
set InitialDir=%CD%

echo Starting hfs.exe...
start "" .\FileService\hfs.exe
echo hfs.exe has been started.

echo Running Server.bat
call .\Server\build.bat
echo .\Server\build.bat completed

cd /d %InitialDir%
echo Running Upgrade.bat
call .\Upgrade\build.bat
echo .\Upgrade\build.bat completed

cd /d %InitialDir%
echo Running StartManager.bat
call .\StartManager\build.bat
echo .\StartManager\build.bat completed

cd /d %InitialDir%
echo Running Client.bat
call .\Client\build.bat
echo .\Client\build.bat completed

echo All scripts completed.

REM 使用 timeout 命令进行2秒倒计时
timeout /t 3 /nobreak >nul

cd /d %InitialDir%
echo Running StartManager
start "" .\StartManager\bin\Release\net8.0\StartManager.exe

exit

0 comments on commit 27312a9

Please sign in to comment.