Skip to content

Commit 27312a9

Browse files
committed
feature: 新增若干功能
1.添加build.bat脚本 2.添加StartManager程序
1 parent edd2fd2 commit 27312a9

File tree

9 files changed

+143
-36
lines changed

9 files changed

+143
-36
lines changed

src/Client/build.bat

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
REM 设置解决方案文件路径
33
set SOLUTION_PATH=ClientSample.sln
44

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

88
REM 运行dotnet build命令
@@ -11,7 +11,6 @@ dotnet build %SOLUTION_PATH% -c Release
1111
REM 检查构建是否成功
1212
if %errorlevel% neq 0 (
1313
echo Build failed
14-
exit /b %errorlevel%
1514
) else (
1615
echo Build succeeded
1716
)

src/Server/build.bat

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@echo off
2+
REM 设置解决方案文件路径
3+
set SOLUTION_PATH=ServerSample.sln
4+
5+
REM 切换到解决方案所在的目录
6+
cd /d %~dp0
7+
8+
REM 运行dotnet build命令
9+
dotnet build %SOLUTION_PATH% -c Release
10+
11+
REM 检查构建是否成功
12+
if %errorlevel% neq 0 (
13+
echo Build failed
14+
) else (
15+
echo Build succeeded
16+
)

src/StartManager/.idea/.idea.StartManager/.idea/vcs.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/StartManager/Program.cs

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,57 @@ class Program
44
{
55
static void Main(string[] args)
66
{
7-
Console.WriteLine("Hello, World!");
7+
bool exit = false;
8+
ShowMenu();
9+
while (!exit)
10+
{
11+
string input = Console.ReadLine();
12+
switch (input)
13+
{
14+
case "1":
15+
Option1();
16+
break;
17+
case "2":
18+
Option2();
19+
break;
20+
case "3":
21+
Option3();
22+
break;
23+
case "4":
24+
exit = true;
25+
break;
26+
default:
27+
Console.WriteLine("无效的选择,请重新输入。");
28+
break;
29+
}
30+
}
31+
}
32+
33+
static void ShowMenu()
34+
{
35+
Console.WriteLine("请选择一个选项:");
36+
Console.WriteLine("1. 启动服务端");
37+
Console.WriteLine("2. 启动客户端");
38+
Console.WriteLine("3. 还原");
39+
Console.WriteLine("4. 退出");
40+
Console.Write("输入你的选择: ");
41+
}
42+
43+
static void Option1()
44+
{
45+
Console.WriteLine("你选择了选项1");
46+
// 在这里添加选项1的逻辑
47+
}
48+
49+
static void Option2()
50+
{
51+
Console.WriteLine("你选择了选项2");
52+
// 在这里添加选项2的逻辑
53+
}
54+
55+
static void Option3()
56+
{
57+
Console.WriteLine("你选择了选项3");
58+
// 在这里添加选项3的逻辑
859
}
960
}

src/StartManager/StartManager.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,8 @@
1010
<InvariantGlobalization>true</InvariantGlobalization>
1111
</PropertyGroup>
1212

13+
<ItemGroup>
14+
<None Remove="build.bat" />
15+
</ItemGroup>
16+
1317
</Project>

src/StartManager/build.bat

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@echo off
2+
REM 设置解决方案文件路径
3+
set SOLUTION_PATH=StartManager.sln
4+
5+
REM 切换到解决方案所在的目录
6+
cd /d %~dp0
7+
8+
REM 运行dotnet build命令
9+
dotnet build %SOLUTION_PATH% -c Release
10+
11+
REM 检查构建是否成功
12+
if %errorlevel% neq 0 (
13+
echo Build failed
14+
) else (
15+
echo Build succeeded
16+
)

src/Upgrade/build.bat

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
@echo off
2+
REM 设置解决方案文件路径
3+
set SOLUTION_PATH=UpgradeSample.sln
4+
5+
REM 切换到解决方案所在的目录
6+
cd /d %~dp0
7+
8+
REM 运行dotnet build命令
9+
dotnet build %SOLUTION_PATH% -c Release
10+
11+
REM 检查构建是否成功
12+
if %errorlevel% neq 0 (
13+
echo Build failed
14+
) else (
15+
echo Build succeeded
16+
)

src/build.bat

Lines changed: 0 additions & 33 deletions
This file was deleted.

src/start.cmd

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
@echo off
2+
REM 保存初始目录
3+
set InitialDir=%CD%
4+
5+
echo Starting hfs.exe...
6+
start "" .\FileService\hfs.exe
7+
echo hfs.exe has been started.
8+
9+
echo Running Server.bat
10+
call .\Server\build.bat
11+
echo .\Server\build.bat completed
12+
13+
cd /d %InitialDir%
14+
echo Running Upgrade.bat
15+
call .\Upgrade\build.bat
16+
echo .\Upgrade\build.bat completed
17+
18+
cd /d %InitialDir%
19+
echo Running StartManager.bat
20+
call .\StartManager\build.bat
21+
echo .\StartManager\build.bat completed
22+
23+
cd /d %InitialDir%
24+
echo Running Client.bat
25+
call .\Client\build.bat
26+
echo .\Client\build.bat completed
27+
28+
echo All scripts completed.
29+
30+
REM 使用 timeout 命令进行2秒倒计时
31+
timeout /t 3 /nobreak >nul
32+
33+
cd /d %InitialDir%
34+
echo Running StartManager
35+
start "" .\StartManager\bin\Release\net8.0\StartManager.exe
36+
37+
exit

0 commit comments

Comments
 (0)