boom命令

This commit is contained in:
2026-03-21 23:21:02 +08:00
parent ca30113efb
commit 126017b26c
8 changed files with 64 additions and 2 deletions

View File

@@ -1 +1 @@
2026-03-20 22:07:06
2026-03-21 23:18:24

View File

@@ -1 +1 @@
f5b8faa
ca30113

View File

@@ -112,6 +112,8 @@ namespace CMLeonOS
// 显示可用空间(动态单位)
var available_space = fs.GetAvailableFreeSpace(@"0:\");
_logger.Info("Kernel", "Getting available free space");
string spaceWithUnit = FormatBytes(available_space);
_logger.Info("Kernel", $"Available Free Space: {spaceWithUnit}");
@@ -121,6 +123,7 @@ namespace CMLeonOS
// 检查并创建system文件夹
string systemFolderPath = @"0:\system";
_logger.Info("Kernel", $"Checking for system folder at {systemFolderPath}");
if (!System.IO.Directory.Exists(systemFolderPath))
{
System.IO.Directory.CreateDirectory(systemFolderPath);
@@ -129,6 +132,7 @@ namespace CMLeonOS
// 检查并创建apps文件夹
string appsFolderPath = @"0:\apps";
_logger.Info("Kernel", $"Checking for apps folder at {appsFolderPath}");
if (!System.IO.Directory.Exists(appsFolderPath))
{
System.IO.Directory.CreateDirectory(appsFolderPath);

View File

@@ -74,8 +74,11 @@ namespace CMLeonOS
{
// 清空用户列表并重新加载
users = null;
_logger.Info("UserSystem", "Initializing user system...");
var tempUserSystem = new UserSystem();
_logger.Info("UserSystem", "Loading user data...");
tempUserSystem.LoadUsers();
_logger.Info("UserSystem", "User data loaded successfully.");
initialized = true;
_logger.Info("UserSystem", $"User system initialized. Loaded {users?.Count ?? 0} users.");
}

View File

@@ -844,6 +844,18 @@ exportbackground 0:\mywallpaper.bmp
beep
```
### boom
触发系统崩溃(用于测试)。
**用法:**
```bash
boom
```
**说明:**
- 此命令会抛出BoomCommandCrash异常
- 仅用于测试和调试目的
### cal
显示日历。

View File

@@ -239,6 +239,9 @@ namespace CMLeonOS.shell
case "femboy":
shell.ProcessFemboy();
break;
case "boom":
shell.ProcessBoom();
break;
case "alias":
shell.ProcessAlias(args);
break;

View File

@@ -0,0 +1,35 @@
// The CMLeonOS Project (https://github.com/Leonmmcoset/CMLeonOS)
// Copyright (C) 2025-present LeonOS 2 Developer Team
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
using System;
namespace CMLeonOS.Commands.Utility
{
public class BoomCommandCrash : Exception
{
public BoomCommandCrash() : base("Boom! The boom command was executed!")
{
}
}
public static class BoomCommand
{
public static void ProcessBoom()
{
throw new BoomCommandCrash();
}
}
}

View File

@@ -632,6 +632,11 @@ namespace CMLeonOS
Commands.Utility.FemboyCommand.ProcessFemboy();
}
public void ProcessBoom()
{
Commands.Utility.BoomCommand.ProcessBoom();
}
public void ChangePrompt(string args)
{
Commands.Utility.PromptCommand.ChangePrompt(args, ref prompt);