From f63be62f271bacf1fa4874361f1def1a1baf5c56 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Sun, 8 Feb 2026 18:13:51 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A3=81=E7=9B=981?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Kernel.cs | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/Kernel.cs b/Kernel.cs index eebd37b..574e8af 100644 --- a/Kernel.cs +++ b/Kernel.cs @@ -15,6 +15,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Reflection.Metadata.Ecma335; +using System.Runtime.CompilerServices; using System.Security.Cryptography.X509Certificates; using System.Text; using Sys = Cosmos.System; @@ -253,9 +254,33 @@ namespace CMLeonOS Console.WriteLine("Press any keys to restart."); Console.ReadKey(); Sys.Power.Reboot(); + // try { + // Disk targetDisk = fs.Disks[0]; + // CreateMBRandPartitionTable(targetDisk); + // } + // catch (Exception exe) + // { + // Console.WriteLine($"Error creating MBR and partition table: {exe.Message}"); + // } + // Console.WriteLine("Done."); + } } + // 我他妈居然成功了,我在没有任何文档的情况下研究出来了 + // private void CreateMBRandPartitionTable(Disk disk) + // { + // disk.Clear(); + // ulong diskSize = (ulong)(disk.Size / 1024 / 1024); + // uint partSize = (uint)(diskSize - 2); + + // disk.CreatePartition((int)partSize); + + // var part = disk.Partitions[disk.Partitions.Count - 1]; + // disk.FormatPartition(0, "FAT32", true); + // Console.WriteLine($"Partition type: {part.GetType()}"); + // } + private void ExecuteStartupScript() { string startupFilePath = @"0:\system\startup.cm";