mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-03-03 15:30:27 +00:00
磁盘1
This commit is contained in:
25
Kernel.cs
25
Kernel.cs
@@ -15,6 +15,7 @@ using System;
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Reflection.Metadata.Ecma335;
|
using System.Reflection.Metadata.Ecma335;
|
||||||
|
using System.Runtime.CompilerServices;
|
||||||
using System.Security.Cryptography.X509Certificates;
|
using System.Security.Cryptography.X509Certificates;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Sys = Cosmos.System;
|
using Sys = Cosmos.System;
|
||||||
@@ -253,9 +254,33 @@ namespace CMLeonOS
|
|||||||
Console.WriteLine("Press any keys to restart.");
|
Console.WriteLine("Press any keys to restart.");
|
||||||
Console.ReadKey();
|
Console.ReadKey();
|
||||||
Sys.Power.Reboot();
|
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()
|
private void ExecuteStartupScript()
|
||||||
{
|
{
|
||||||
string startupFilePath = @"0:\system\startup.cm";
|
string startupFilePath = @"0:\system\startup.cm";
|
||||||
|
|||||||
Reference in New Issue
Block a user