尝试修复alias+增加SkipToGui设置+启用UEFI

This commit is contained in:
2026-03-15 15:49:07 +08:00
parent d076d53025
commit ffc4db82e7
12 changed files with 59 additions and 9 deletions

View File

@@ -1 +1 @@
2026-03-15 13:19:36 2026-03-15 15:41:15

View File

@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net6.0</TargetFramework>
@@ -30,7 +30,7 @@
<VBEResolution>800x600x32</VBEResolution> <VBEResolution>800x600x32</VBEResolution>
<RunPostBuildEvent>Always</RunPostBuildEvent> <RunPostBuildEvent>Always</RunPostBuildEvent>
<Timeout>0</Timeout> <Timeout>0</Timeout>
<UseUEFI>False</UseUEFI> <UseUEFI>True</UseUEFI>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -1 +1 @@
d44fca8 d076d53

View File

@@ -89,6 +89,7 @@ namespace CMLeonOS.Gui.Apps
private readonly (string Name, string Path)[] shortcuts = new (string, string)[] private readonly (string Name, string Path)[] shortcuts = new (string, string)[]
{ {
("CMLeonOS (0:)", @"0:\"), ("CMLeonOS (0:)", @"0:\"),
("ISO (1:)", @"1:\"),
("My Home", @$"0:\user\{UserSystem.CurrentLoggedInUser.Username}"), ("My Home", @$"0:\user\{UserSystem.CurrentLoggedInUser.Username}"),
("Users", @"0:\user"), ("Users", @"0:\user"),
}; };
@@ -117,6 +118,8 @@ namespace CMLeonOS.Gui.Apps
{ {
case @"0:\": case @"0:\":
return Icons.Icon_Drive; return Icons.Icon_Drive;
case @"1:\":
return Icons.Icon_Drive;
default: default:
return Icons.Icon_Directory; return Icons.Icon_Directory;
} }

View File

@@ -87,6 +87,11 @@ namespace CMLeonOS.Gui.Apps
SettingsManager.GUI_ShowFps = @checked; SettingsManager.GUI_ShowFps = @checked;
} }
private void SkipToGuiChanged(bool @checked)
{
SettingsManager.SkipToGui = @checked;
}
private void MouseSensitivityChanged(float value) private void MouseSensitivityChanged(float value)
{ {
SettingsManager.GUI_MouseSensitivity = value; SettingsManager.GUI_MouseSensitivity = value;
@@ -115,6 +120,12 @@ namespace CMLeonOS.Gui.Apps
showFps.CheckBoxChanged = ShowFpsChanged; showFps.CheckBoxChanged = ShowFpsChanged;
wm.AddWindow(showFps); wm.AddWindow(showFps);
Switch skipToGui = new Switch(appearance, 12, 96, 244, 16);
skipToGui.Text = "Skip to GUI on boot";
skipToGui.Checked = SettingsManager.SkipToGui;
skipToGui.CheckBoxChanged = SkipToGuiChanged;
wm.AddWindow(skipToGui);
wm.Update(window); wm.Update(window);
} }

View File

@@ -96,7 +96,8 @@ namespace CMLeonOS
private void InitializeSystem() private void InitializeSystem()
{ {
// 修改光标样式 // 修改光标样式
_logger.Info("Kernel", "Setting cursor size to 100");
Console.CursorSize = 100; Console.CursorSize = 100;
// 注册VFS // 注册VFS

View File

@@ -38,7 +38,8 @@ namespace CMLeonOS.Settings
{ "GUI_MouseSensitivity", "1.0" }, { "GUI_MouseSensitivity", "1.0" },
{ "GUI_ScreenWidth", "1280" }, { "GUI_ScreenWidth", "1280" },
{ "GUI_ScreenHeight", "800" }, { "GUI_ScreenHeight", "800" },
{ "GUI_DarkNotepad", "false" } { "GUI_DarkNotepad", "false" },
{ "SkipToGui", "false" }
}; };
public static bool LoggerEnabled public static bool LoggerEnabled
@@ -206,6 +207,23 @@ namespace CMLeonOS.Settings
} }
} }
public static bool SkipToGui
{
get
{
if (settings.TryGetValue("SkipToGui", out string value))
{
return value.ToLower() == "true";
}
return false;
}
set
{
settings["SkipToGui"] = value ? "true" : "false";
SaveSettings();
}
}
public static void LoadSettings() public static void LoadSettings()
{ {
settings.Clear(); settings.Clear();

View File

@@ -113,6 +113,11 @@ namespace CMLeonOS
public static BootMenuAction Show() public static BootMenuAction Show()
{ {
if (Settings.SettingsManager.SkipToGui && UserDatExists())
{
return BootMenuAction.GuiBoot;
}
Console.BackgroundColor = ConsoleColor.Black; Console.BackgroundColor = ConsoleColor.Black;
Console.ForegroundColor = ConsoleColor.White; Console.ForegroundColor = ConsoleColor.White;

View File

@@ -143,7 +143,7 @@ namespace CMLeonOS
if (Directory.Exists(fullPath)) if (Directory.Exists(fullPath))
{ {
string displayPath = path == "." ? CurrentDirectory : path; string displayPath = path == "." ? CurrentDirectory : path;
Console.WriteLine($"Contents of {displayPath}:"); Console.WriteLine($"Contents of {fullPath}:");
try try
{ {

View File

@@ -144,6 +144,8 @@ ls /system
- 文本文件:.txt, .md, .rtf - 文本文件:.txt, .md, .rtf
- 图片文件:.bmp, .png, .jpg, .jpeg, .gif - 图片文件:.bmp, .png, .jpg, .jpeg, .gif
- 压缩文件:.zip, .rar, .7z, .tar, .gz - 压缩文件:.zip, .rar, .7z, .tar, .gz
- Markit文件.mi
- 数据文件:.dat
### cd ### cd
切换当前工作目录。 切换当前工作目录。

View File

@@ -24,10 +24,12 @@ namespace CMLeonOS.Commands
{ {
private static string aliasFilePath = @"0:\system\alias.dat"; private static string aliasFilePath = @"0:\system\alias.dat";
private static Dictionary<string, string> aliases = new Dictionary<string, string>(); private static Dictionary<string, string> aliases = new Dictionary<string, string>();
private static bool hasUnsavedChanges = false;
public static void LoadAliases() public static void LoadAliases()
{ {
aliases.Clear(); aliases.Clear();
hasUnsavedChanges = false;
try try
{ {
@@ -57,6 +59,11 @@ namespace CMLeonOS.Commands
public static void SaveAliases() public static void SaveAliases()
{ {
if (!hasUnsavedChanges)
{
return;
}
try try
{ {
Directory.CreateDirectory(Path.GetDirectoryName(aliasFilePath)); Directory.CreateDirectory(Path.GetDirectoryName(aliasFilePath));
@@ -87,6 +94,8 @@ namespace CMLeonOS.Commands
writer.WriteLine($"{key}={aliases[key]}"); writer.WriteLine($"{key}={aliases[key]}");
} }
} }
hasUnsavedChanges = false;
} }
catch (Exception e) catch (Exception e)
{ {
@@ -103,7 +112,7 @@ namespace CMLeonOS.Commands
} }
aliases[name] = command; aliases[name] = command;
SaveAliases(); hasUnsavedChanges = true;
Console.WriteLine($"Alias '{name}' added successfully"); Console.WriteLine($"Alias '{name}' added successfully");
} }
@@ -111,7 +120,7 @@ namespace CMLeonOS.Commands
{ {
if (aliases.Remove(name)) if (aliases.Remove(name))
{ {
SaveAliases(); hasUnsavedChanges = true;
Console.WriteLine($"Alias '{name}' removed successfully"); Console.WriteLine($"Alias '{name}' removed successfully");
} }
else else

View File

@@ -151,6 +151,7 @@ namespace CMLeonOS
// 如果需要退出,返回到登录页面 // 如果需要退出,返回到登录页面
if (shouldExit) if (shouldExit)
{ {
Commands.AliasCommand.SaveAliases();
return; return;
} }
} }