From 126017b26c796f50354f9f7a170f91f32603a662 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Sat, 21 Mar 2026 23:21:02 +0800 Subject: [PATCH] =?UTF-8?q?boom=E5=91=BD=E4=BB=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- BuildTime.txt | 2 +- GitCommit.txt | 2 +- Kernel.cs | 4 +++ System/UserSystem.cs | 3 +++ docs/cmleonos/docs/commands.md | 12 +++++++++ shell/CommandList.cs | 3 +++ shell/Commands/Utility/BoomCommand.cs | 35 +++++++++++++++++++++++++++ shell/Shell.cs | 5 ++++ 8 files changed, 64 insertions(+), 2 deletions(-) create mode 100644 shell/Commands/Utility/BoomCommand.cs diff --git a/BuildTime.txt b/BuildTime.txt index 36e950c..3c23539 100644 --- a/BuildTime.txt +++ b/BuildTime.txt @@ -1 +1 @@ -2026-03-20 22:07:06 \ No newline at end of file +2026-03-21 23:18:24 \ No newline at end of file diff --git a/GitCommit.txt b/GitCommit.txt index daa4a36..33d3d71 100644 --- a/GitCommit.txt +++ b/GitCommit.txt @@ -1 +1 @@ -f5b8faa \ No newline at end of file +ca30113 \ No newline at end of file diff --git a/Kernel.cs b/Kernel.cs index 9628a18..c280808 100644 --- a/Kernel.cs +++ b/Kernel.cs @@ -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); diff --git a/System/UserSystem.cs b/System/UserSystem.cs index a78f00d..0f1d3e5 100644 --- a/System/UserSystem.cs +++ b/System/UserSystem.cs @@ -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."); } diff --git a/docs/cmleonos/docs/commands.md b/docs/cmleonos/docs/commands.md index f0ad57e..665a690 100644 --- a/docs/cmleonos/docs/commands.md +++ b/docs/cmleonos/docs/commands.md @@ -844,6 +844,18 @@ exportbackground 0:\mywallpaper.bmp beep ``` +### boom +触发系统崩溃(用于测试)。 + +**用法:** +```bash +boom +``` + +**说明:** +- 此命令会抛出BoomCommandCrash异常 +- 仅用于测试和调试目的 + ### cal 显示日历。 diff --git a/shell/CommandList.cs b/shell/CommandList.cs index 33f5bf7..fc4f57b 100644 --- a/shell/CommandList.cs +++ b/shell/CommandList.cs @@ -239,6 +239,9 @@ namespace CMLeonOS.shell case "femboy": shell.ProcessFemboy(); break; + case "boom": + shell.ProcessBoom(); + break; case "alias": shell.ProcessAlias(args); break; diff --git a/shell/Commands/Utility/BoomCommand.cs b/shell/Commands/Utility/BoomCommand.cs new file mode 100644 index 0000000..edcff9e --- /dev/null +++ b/shell/Commands/Utility/BoomCommand.cs @@ -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 . + +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(); + } + } +} diff --git a/shell/Shell.cs b/shell/Shell.cs index a29782e..2c20b64 100644 --- a/shell/Shell.cs +++ b/shell/Shell.cs @@ -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);