From f2f57571c90ab0f9297972db7b600d6b2b438703 Mon Sep 17 00:00:00 2001 From: Leonmmcoset Date: Mon, 2 Feb 2026 18:08:24 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BD=91=E7=BB=9C=E5=88=9D=E5=A7=8B=E5=8C=96++?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .VSCodeCounter/2026-02-02_16-15-16/details.md | 29 +++++++++++++ .../2026-02-02_16-15-16/diff-details.md | 15 +++++++ .VSCodeCounter/2026-02-02_16-15-16/diff.csv | 2 + .VSCodeCounter/2026-02-02_16-15-16/diff.md | 19 +++++++++ .VSCodeCounter/2026-02-02_16-15-16/diff.txt | 22 ++++++++++ .../2026-02-02_16-15-16/results.csv | 16 ++++++++ .../2026-02-02_16-15-16/results.json | 1 + .VSCodeCounter/2026-02-02_16-15-16/results.md | 24 +++++++++++ .../2026-02-02_16-15-16/results.txt | 41 +++++++++++++++++++ Kernel.cs | 33 ++++++++++++++- UserSystem.cs | 2 +- 11 files changed, 201 insertions(+), 3 deletions(-) create mode 100644 .VSCodeCounter/2026-02-02_16-15-16/details.md create mode 100644 .VSCodeCounter/2026-02-02_16-15-16/diff-details.md create mode 100644 .VSCodeCounter/2026-02-02_16-15-16/diff.csv create mode 100644 .VSCodeCounter/2026-02-02_16-15-16/diff.md create mode 100644 .VSCodeCounter/2026-02-02_16-15-16/diff.txt create mode 100644 .VSCodeCounter/2026-02-02_16-15-16/results.csv create mode 100644 .VSCodeCounter/2026-02-02_16-15-16/results.json create mode 100644 .VSCodeCounter/2026-02-02_16-15-16/results.md create mode 100644 .VSCodeCounter/2026-02-02_16-15-16/results.txt diff --git a/.VSCodeCounter/2026-02-02_16-15-16/details.md b/.VSCodeCounter/2026-02-02_16-15-16/details.md new file mode 100644 index 0000000..31242be --- /dev/null +++ b/.VSCodeCounter/2026-02-02_16-15-16/details.md @@ -0,0 +1,29 @@ +# Details + +Date : 2026-02-02 16:15:16 + +Directory c:\\Users\\leon\\source\\repos\\CMLeonOS\\CMLeonOS + +Total : 14 files, 4271 codes, 214 comments, 649 blanks, all 5134 lines + +[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md) + +## Files +| filename | language | code | comment | blank | total | +| :--- | :--- | ---: | ---: | ---: | ---: | +| [Branswe.cs](/Branswe.cs) | C# | 482 | 28 | 53 | 563 | +| [Branswe.md](/Branswe.md) | Markdown | 261 | 0 | 67 | 328 | +| [CMLeonOS.csproj](/CMLeonOS.csproj) | XML | 42 | 1 | 5 | 48 | +| [CUI.cs](/CUI.cs) | C# | 122 | 8 | 28 | 158 | +| [Editor.cs](/Editor.cs) | C# | 257 | 47 | 27 | 331 | +| [EnvironmentVariableManager.cs](/EnvironmentVariableManager.cs) | C# | 151 | 5 | 17 | 173 | +| [FileSystem.cs](/FileSystem.cs) | C# | 324 | 17 | 30 | 371 | +| [Kernel.cs](/Kernel.cs) | C# | 159 | 28 | 32 | 219 | +| [LISENCE.md](/LISENCE.md) | Markdown | 485 | 0 | 110 | 595 | +| [SHA256.cs](/SHA256.cs) | C# | 179 | 6 | 41 | 226 | +| [Shell.cs](/Shell.cs) | C# | 1,289 | 48 | 156 | 1,493 | +| [UserSystem.cs](/UserSystem.cs) | C# | 492 | 26 | 78 | 596 | +| [Version.cs](/Version.cs) | C# | 22 | 0 | 5 | 27 | +| [global.json](/global.json) | JSON | 6 | 0 | 0 | 6 | + +[Summary](results.md) / Details / [Diff Summary](diff.md) / [Diff Details](diff-details.md) \ No newline at end of file diff --git a/.VSCodeCounter/2026-02-02_16-15-16/diff-details.md b/.VSCodeCounter/2026-02-02_16-15-16/diff-details.md new file mode 100644 index 0000000..208450a --- /dev/null +++ b/.VSCodeCounter/2026-02-02_16-15-16/diff-details.md @@ -0,0 +1,15 @@ +# Diff Details + +Date : 2026-02-02 16:15:16 + +Directory c:\\Users\\leon\\source\\repos\\CMLeonOS\\CMLeonOS + +Total : 0 files, 0 codes, 0 comments, 0 blanks, all 0 lines + +[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details + +## Files +| filename | language | code | comment | blank | total | +| :--- | :--- | ---: | ---: | ---: | ---: | + +[Summary](results.md) / [Details](details.md) / [Diff Summary](diff.md) / Diff Details \ No newline at end of file diff --git a/.VSCodeCounter/2026-02-02_16-15-16/diff.csv b/.VSCodeCounter/2026-02-02_16-15-16/diff.csv new file mode 100644 index 0000000..b7d8d75 --- /dev/null +++ b/.VSCodeCounter/2026-02-02_16-15-16/diff.csv @@ -0,0 +1,2 @@ +"filename", "language", "", "comment", "blank", "total" +"Total", "-", , 0, 0, 0 \ No newline at end of file diff --git a/.VSCodeCounter/2026-02-02_16-15-16/diff.md b/.VSCodeCounter/2026-02-02_16-15-16/diff.md new file mode 100644 index 0000000..4e179a1 --- /dev/null +++ b/.VSCodeCounter/2026-02-02_16-15-16/diff.md @@ -0,0 +1,19 @@ +# Diff Summary + +Date : 2026-02-02 16:15:16 + +Directory c:\\Users\\leon\\source\\repos\\CMLeonOS\\CMLeonOS + +Total : 0 files, 0 codes, 0 comments, 0 blanks, all 0 lines + +[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md) + +## Languages +| language | files | code | comment | blank | total | +| :--- | ---: | ---: | ---: | ---: | ---: | + +## Directories +| path | files | code | comment | blank | total | +| :--- | ---: | ---: | ---: | ---: | ---: | + +[Summary](results.md) / [Details](details.md) / Diff Summary / [Diff Details](diff-details.md) \ No newline at end of file diff --git a/.VSCodeCounter/2026-02-02_16-15-16/diff.txt b/.VSCodeCounter/2026-02-02_16-15-16/diff.txt new file mode 100644 index 0000000..18a490f --- /dev/null +++ b/.VSCodeCounter/2026-02-02_16-15-16/diff.txt @@ -0,0 +1,22 @@ +Date : 2026-02-02 16:15:16 +Directory : c:\Users\leon\source\repos\CMLeonOS\CMLeonOS +Total : 0 files, 0 codes, 0 comments, 0 blanks, all 0 lines + +Languages ++----------+------------+------------+------------+------------+------------+ +| language | files | code | comment | blank | total | ++----------+------------+------------+------------+------------+------------+ ++----------+------------+------------+------------+------------+------------+ + +Directories ++------+------------+------------+------------+------------+------------+ +| path | files | code | comment | blank | total | ++------+------------+------------+------------+------------+------------+ ++------+------------+------------+------------+------------+------------+ + +Files ++----------+----------+------------+------------+------------+------------+ +| filename | language | code | comment | blank | total | ++----------+----------+------------+------------+------------+------------+ +| Total | | 0 | 0 | 0 | 0 | ++----------+----------+------------+------------+------------+------------+ \ No newline at end of file diff --git a/.VSCodeCounter/2026-02-02_16-15-16/results.csv b/.VSCodeCounter/2026-02-02_16-15-16/results.csv new file mode 100644 index 0000000..b41a94b --- /dev/null +++ b/.VSCodeCounter/2026-02-02_16-15-16/results.csv @@ -0,0 +1,16 @@ +"filename", "language", "C#", "XML", "Markdown", "JSON", "comment", "blank", "total" +"c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\Branswe.cs", "C#", 482, 0, 0, 0, 28, 53, 563 +"c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\Branswe.md", "Markdown", 0, 0, 261, 0, 0, 67, 328 +"c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\CMLeonOS.csproj", "XML", 0, 42, 0, 0, 1, 5, 48 +"c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\CUI.cs", "C#", 122, 0, 0, 0, 8, 28, 158 +"c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\Editor.cs", "C#", 257, 0, 0, 0, 47, 27, 331 +"c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\EnvironmentVariableManager.cs", "C#", 151, 0, 0, 0, 5, 17, 173 +"c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\FileSystem.cs", "C#", 324, 0, 0, 0, 17, 30, 371 +"c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\Kernel.cs", "C#", 159, 0, 0, 0, 28, 32, 219 +"c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\LISENCE.md", "Markdown", 0, 0, 485, 0, 0, 110, 595 +"c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\SHA256.cs", "C#", 179, 0, 0, 0, 6, 41, 226 +"c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\Shell.cs", "C#", 1289, 0, 0, 0, 48, 156, 1493 +"c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\UserSystem.cs", "C#", 492, 0, 0, 0, 26, 78, 596 +"c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\Version.cs", "C#", 22, 0, 0, 0, 0, 5, 27 +"c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\global.json", "JSON", 0, 0, 0, 6, 0, 0, 6 +"Total", "-", 3477, 42, 746, 6, 214, 649, 5134 \ No newline at end of file diff --git a/.VSCodeCounter/2026-02-02_16-15-16/results.json b/.VSCodeCounter/2026-02-02_16-15-16/results.json new file mode 100644 index 0000000..5d9a0c5 --- /dev/null +++ b/.VSCodeCounter/2026-02-02_16-15-16/results.json @@ -0,0 +1 @@ +{"file:///c%3A/Users/leon/source/repos/CMLeonOS/CMLeonOS/Editor.cs":{"language":"C#","code":257,"comment":47,"blank":27},"file:///c%3A/Users/leon/source/repos/CMLeonOS/CMLeonOS/CMLeonOS.csproj":{"language":"XML","code":42,"comment":1,"blank":5},"file:///c%3A/Users/leon/source/repos/CMLeonOS/CMLeonOS/CUI.cs":{"language":"C#","code":122,"comment":8,"blank":28},"file:///c%3A/Users/leon/source/repos/CMLeonOS/CMLeonOS/EnvironmentVariableManager.cs":{"language":"C#","code":151,"comment":5,"blank":17},"file:///c%3A/Users/leon/source/repos/CMLeonOS/CMLeonOS/Version.cs":{"language":"C#","code":22,"comment":0,"blank":5},"file:///c%3A/Users/leon/source/repos/CMLeonOS/CMLeonOS/Branswe.cs":{"language":"C#","code":482,"comment":28,"blank":53},"file:///c%3A/Users/leon/source/repos/CMLeonOS/CMLeonOS/Branswe.md":{"language":"Markdown","code":261,"comment":0,"blank":67},"file:///c%3A/Users/leon/source/repos/CMLeonOS/CMLeonOS/UserSystem.cs":{"language":"C#","code":492,"comment":26,"blank":78},"file:///c%3A/Users/leon/source/repos/CMLeonOS/CMLeonOS/Shell.cs":{"language":"C#","code":1289,"comment":48,"blank":156},"file:///c%3A/Users/leon/source/repos/CMLeonOS/CMLeonOS/SHA256.cs":{"language":"C#","code":179,"comment":6,"blank":41},"file:///c%3A/Users/leon/source/repos/CMLeonOS/CMLeonOS/LISENCE.md":{"language":"Markdown","code":485,"comment":0,"blank":110},"file:///c%3A/Users/leon/source/repos/CMLeonOS/CMLeonOS/Kernel.cs":{"language":"C#","code":159,"comment":28,"blank":32},"file:///c%3A/Users/leon/source/repos/CMLeonOS/CMLeonOS/global.json":{"language":"JSON","code":6,"comment":0,"blank":0},"file:///c%3A/Users/leon/source/repos/CMLeonOS/CMLeonOS/FileSystem.cs":{"language":"C#","code":324,"comment":17,"blank":30}} \ No newline at end of file diff --git a/.VSCodeCounter/2026-02-02_16-15-16/results.md b/.VSCodeCounter/2026-02-02_16-15-16/results.md new file mode 100644 index 0000000..533e145 --- /dev/null +++ b/.VSCodeCounter/2026-02-02_16-15-16/results.md @@ -0,0 +1,24 @@ +# Summary + +Date : 2026-02-02 16:15:16 + +Directory c:\\Users\\leon\\source\\repos\\CMLeonOS\\CMLeonOS + +Total : 14 files, 4271 codes, 214 comments, 649 blanks, all 5134 lines + +Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md) + +## Languages +| language | files | code | comment | blank | total | +| :--- | ---: | ---: | ---: | ---: | ---: | +| C# | 10 | 3,477 | 213 | 467 | 4,157 | +| Markdown | 2 | 746 | 0 | 177 | 923 | +| XML | 1 | 42 | 1 | 5 | 48 | +| JSON | 1 | 6 | 0 | 0 | 6 | + +## Directories +| path | files | code | comment | blank | total | +| :--- | ---: | ---: | ---: | ---: | ---: | +| . | 14 | 4,271 | 214 | 649 | 5,134 | + +Summary / [Details](details.md) / [Diff Summary](diff.md) / [Diff Details](diff-details.md) \ No newline at end of file diff --git a/.VSCodeCounter/2026-02-02_16-15-16/results.txt b/.VSCodeCounter/2026-02-02_16-15-16/results.txt new file mode 100644 index 0000000..9c30586 --- /dev/null +++ b/.VSCodeCounter/2026-02-02_16-15-16/results.txt @@ -0,0 +1,41 @@ +Date : 2026-02-02 16:15:16 +Directory : c:\Users\leon\source\repos\CMLeonOS\CMLeonOS +Total : 14 files, 4271 codes, 214 comments, 649 blanks, all 5134 lines + +Languages ++----------+------------+------------+------------+------------+------------+ +| language | files | code | comment | blank | total | ++----------+------------+------------+------------+------------+------------+ +| C# | 10 | 3,477 | 213 | 467 | 4,157 | +| Markdown | 2 | 746 | 0 | 177 | 923 | +| XML | 1 | 42 | 1 | 5 | 48 | +| JSON | 1 | 6 | 0 | 0 | 6 | ++----------+------------+------------+------------+------------+------------+ + +Directories ++----------------------------------------------------------------------------+------------+------------+------------+------------+------------+ +| path | files | code | comment | blank | total | ++----------------------------------------------------------------------------+------------+------------+------------+------------+------------+ +| . | 14 | 4,271 | 214 | 649 | 5,134 | ++----------------------------------------------------------------------------+------------+------------+------------+------------+------------+ + +Files ++----------------------------------------------------------------------------+----------+------------+------------+------------+------------+ +| filename | language | code | comment | blank | total | ++----------------------------------------------------------------------------+----------+------------+------------+------------+------------+ +| c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\Branswe.cs | C# | 482 | 28 | 53 | 563 | +| c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\Branswe.md | Markdown | 261 | 0 | 67 | 328 | +| c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\CMLeonOS.csproj | XML | 42 | 1 | 5 | 48 | +| c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\CUI.cs | C# | 122 | 8 | 28 | 158 | +| c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\Editor.cs | C# | 257 | 47 | 27 | 331 | +| c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\EnvironmentVariableManager.cs | C# | 151 | 5 | 17 | 173 | +| c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\FileSystem.cs | C# | 324 | 17 | 30 | 371 | +| c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\Kernel.cs | C# | 159 | 28 | 32 | 219 | +| c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\LISENCE.md | Markdown | 485 | 0 | 110 | 595 | +| c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\SHA256.cs | C# | 179 | 6 | 41 | 226 | +| c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\Shell.cs | C# | 1,289 | 48 | 156 | 1,493 | +| c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\UserSystem.cs | C# | 492 | 26 | 78 | 596 | +| c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\Version.cs | C# | 22 | 0 | 5 | 27 | +| c:\Users\leon\source\repos\CMLeonOS\CMLeonOS\global.json | JSON | 6 | 0 | 0 | 6 | +| Total | | 4,271 | 214 | 649 | 5,134 | ++----------------------------------------------------------------------------+----------+------------+------------+------------+------------+ \ No newline at end of file diff --git a/Kernel.cs b/Kernel.cs index 50bd9a9..1b6f8c0 100644 --- a/Kernel.cs +++ b/Kernel.cs @@ -1,9 +1,12 @@ +using Cosmos.HAL; +using Cosmos.System.Network.Config; +using Cosmos.System.Network.IPv4.UDP.DHCP; using System; using System.Collections.Generic; -using System.Text; using System.IO; +using System.Reflection.Metadata.Ecma335; +using System.Text; using Sys = Cosmos.System; -using Cosmos.System.Network.IPv4.UDP.DHCP; namespace CMLeonOS { @@ -53,6 +56,7 @@ namespace CMLeonOS SystemStartTime = DateTime.Now; Console.WriteLine($"System started at: {SystemStartTime.ToString("yyyy-MM-dd HH:mm:ss")}"); + // 初始化网络 Console.WriteLine("Starting network..."); try { @@ -60,8 +64,17 @@ namespace CMLeonOS { throw new Exception("No network devices are available."); } + var netDevice = NetworkDevice.Devices[0]; using var dhcp = new DHCPClient(); + if (netDevice.Ready == true) { + ShowSuccess("Network device ready."); + } + else + { + ShowError("Network device is not ready."); + } dhcp.SendDiscoverPacket(); + Console.WriteLine($"Local IP: {NetworkConfiguration.CurrentAddress.ToString()}"); ShowSuccess("Network started."); } catch (Exception ex) @@ -102,6 +115,22 @@ namespace CMLeonOS System.IO.File.WriteAllText(envFilePath, "Test=123"); ShowSuccess("Created env.dat with Test=123"); } + + // 输出系统启动-初始化完成后的时间 + TimeSpan uptime = DateTime.Now - Kernel.SystemStartTime; + + // Console.WriteLine("System started: " + Kernel.SystemStartTime.ToString("yyyy-MM-dd HH:mm:ss")); + // Console.WriteLine("Current time: " + DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); + // Console.WriteLine(); + + // 格式化运行时间 + int days = uptime.Days; + int hours = uptime.Hours; + int minutes = uptime.Minutes; + int seconds = uptime.Seconds; + + Console.WriteLine($"System uptime: {days} days, {hours} hours, {minutes} minutes, {seconds} seconds"); + Console.WriteLine($"Total uptime: {uptime.TotalHours:F2} hours"); // 循环直到登录成功或退出 while (true) diff --git a/UserSystem.cs b/UserSystem.cs index 95cdfbc..623f17b 100644 --- a/UserSystem.cs +++ b/UserSystem.cs @@ -226,7 +226,7 @@ namespace CMLeonOS Thread.Sleep(1000); } - Console.WriteLine("\rRestarting now! "); + Console.WriteLine("\rRestarting now!"); Sys.Power.Reboot(); } catch (Exception ex)