mirror of
https://github.com/Leonmmcoset/CMLeonOS.git
synced 2026-04-21 19:24:00 +00:00
改壁纸+exportbackground命令+似乎修复但没完全修复一些bug
This commit is contained in:
@@ -66,10 +66,10 @@ namespace CMLeonOS
|
|||||||
bool userDatExists = UserDatExists();
|
bool userDatExists = UserDatExists();
|
||||||
int optionIndex = 0;
|
int optionIndex = 0;
|
||||||
|
|
||||||
PrintOption("Normal Boot", selIdx == optionIndex++);
|
PrintOption("CMLeonOS (Shell)", selIdx == optionIndex++);
|
||||||
if (userDatExists)
|
if (userDatExists)
|
||||||
{
|
{
|
||||||
PrintOption("GUI Boot", selIdx == optionIndex++);
|
PrintOption("CMLeonOS (Desktop)", selIdx == optionIndex++);
|
||||||
}
|
}
|
||||||
PrintOption("Reboot", selIdx == optionIndex++);
|
PrintOption("Reboot", selIdx == optionIndex++);
|
||||||
PrintOption("Shutdown", selIdx == optionIndex++);
|
PrintOption("Shutdown", selIdx == optionIndex++);
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
2026-03-08 20:08:00
|
2026-03-08 22:18:30
|
||||||
@@ -1 +1 @@
|
|||||||
b878cc7
|
2138a4b
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 627 KiB After Width: | Height: | Size: 627 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 3.9 MiB After Width: | Height: | Size: 3.9 MiB |
@@ -330,8 +330,8 @@ namespace CMLeonOS.Gui.UILib
|
|||||||
|
|
||||||
private List<string> lines = new List<string>() { string.Empty };
|
private List<string> lines = new List<string>() { string.Empty };
|
||||||
|
|
||||||
private int markedLinesBegin = 0;
|
private int markedLinesBegin = -1;
|
||||||
private int markedLinesEnd = 0;
|
private int markedLinesEnd = -1;
|
||||||
|
|
||||||
private const int fontWidth = 8;
|
private const int fontWidth = 8;
|
||||||
private const int fontHeight = 16;
|
private const int fontHeight = 16;
|
||||||
@@ -363,14 +363,8 @@ namespace CMLeonOS.Gui.UILib
|
|||||||
|
|
||||||
AutoScroll();
|
AutoScroll();
|
||||||
|
|
||||||
int startLine = markedLinesBegin;
|
int startLine = (scrollY / fontHeight);
|
||||||
int endLine = markedLinesEnd;
|
int endLine = Math.Min(lines.Count - 1, ((scrollY + Height) / fontHeight));
|
||||||
|
|
||||||
if (startLine == -1 || endLine == -1)
|
|
||||||
{
|
|
||||||
startLine = (scrollY / fontHeight);
|
|
||||||
endLine = Math.Min(lines.Count - 1, ((scrollY + Height) / fontHeight));
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = startLine; i <= endLine; i++)
|
for (int i = startLine; i <= endLine; i++)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -239,6 +239,9 @@ namespace CMLeonOS.shell
|
|||||||
case "unalias":
|
case "unalias":
|
||||||
shell.ProcessUnalias(args);
|
shell.ProcessUnalias(args);
|
||||||
break;
|
break;
|
||||||
|
case "exportbackground":
|
||||||
|
shell.ProcessExportBackground(args);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
shell.ShowError($"Unknown command: {command}");
|
shell.ShowError($"Unknown command: {command}");
|
||||||
break;
|
break;
|
||||||
|
|||||||
50
shell/Commands/ExportBackgroundCommand.cs
Normal file
50
shell/Commands/ExportBackgroundCommand.cs
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
// 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 <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
using System;
|
||||||
|
using System.IO;
|
||||||
|
using Cosmos.System.Graphics;
|
||||||
|
using IL2CPU.API.Attribs;
|
||||||
|
|
||||||
|
namespace CMLeonOS.Commands
|
||||||
|
{
|
||||||
|
public static class ExportBackgroundCommand
|
||||||
|
{
|
||||||
|
[ManifestResourceStream(ResourceName = "CMLeonOS.Gui.Resources.Wallpaper_1280_800.bmp")]
|
||||||
|
private static byte[] wallpaperBytes;
|
||||||
|
|
||||||
|
public static void ExportBackground(string outputPath)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (wallpaperBytes == null || wallpaperBytes.Length == 0)
|
||||||
|
{
|
||||||
|
Console.WriteLine("Error: No wallpaper found in embedded resources.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
string destinationPath = string.IsNullOrEmpty(outputPath) ? @"0:\background.bmp" : outputPath;
|
||||||
|
|
||||||
|
File.WriteAllBytes(destinationPath, wallpaperBytes);
|
||||||
|
Console.WriteLine($"Background exported successfully to: {destinationPath}");
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"Error exporting background: {ex.Message}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -425,7 +425,7 @@ namespace CMLeonOS
|
|||||||
"cpass", "hostname", "ipconfig", "setdns", "setgateway", "nslookup",
|
"cpass", "hostname", "ipconfig", "setdns", "setgateway", "nslookup",
|
||||||
"ping", "wget", "ftp", "tcpserver", "tcpclient", "lua", "lua2cla", "cla",
|
"ping", "wget", "ftp", "tcpserver", "tcpclient", "lua", "lua2cla", "cla",
|
||||||
"branswe", "beep", "env", "whoami", "uptime", "alias",
|
"branswe", "beep", "env", "whoami", "uptime", "alias",
|
||||||
"unalias", "base64", "testgui", "ps", "kill", "hex"
|
"unalias", "base64", "testgui", "ps", "kill", "hex", "exportbackground"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1694,6 +1694,11 @@ namespace CMLeonOS
|
|||||||
Commands.AliasCommand.RemoveAlias(name);
|
Commands.AliasCommand.RemoveAlias(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void ProcessExportBackground(string args)
|
||||||
|
{
|
||||||
|
Commands.ExportBackgroundCommand.ExportBackground(args);
|
||||||
|
}
|
||||||
|
|
||||||
public void SetDnsServer(string args)
|
public void SetDnsServer(string args)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(args))
|
if (string.IsNullOrWhiteSpace(args))
|
||||||
|
|||||||
Reference in New Issue
Block a user