From ee2ea7f1e4bc1e4c6a4a4db6e71a096310eafce1 Mon Sep 17 00:00:00 2001 From: Juster Zhu Date: Sun, 19 Nov 2023 21:07:28 +0800 Subject: [PATCH] Driver function annotation --- src/c#/GeneralUpdate.Core/Driver/BackupDriverCommand.cs | 3 +++ src/c#/GeneralUpdate.Core/Driver/DriverProcessor.cs | 6 ++++++ src/c#/GeneralUpdate.Core/Driver/InstallDriverCommand.cs | 1 + src/c#/GeneralUpdate.Core/Driver/RestoreDriverCommand.cs | 1 + 4 files changed, 11 insertions(+) diff --git a/src/c#/GeneralUpdate.Core/Driver/BackupDriverCommand.cs b/src/c#/GeneralUpdate.Core/Driver/BackupDriverCommand.cs index f4361aff..e09222ba 100644 --- a/src/c#/GeneralUpdate.Core/Driver/BackupDriverCommand.cs +++ b/src/c#/GeneralUpdate.Core/Driver/BackupDriverCommand.cs @@ -18,6 +18,9 @@ public BackupDriverCommand(DriverInformation information) public void Execute() { + /* + * Back up the specified list of drives. + */ foreach (var driverName in _information.DriverNames) { var command = new StringBuilder("/c dism /online /export-driver /destination:\"") diff --git a/src/c#/GeneralUpdate.Core/Driver/DriverProcessor.cs b/src/c#/GeneralUpdate.Core/Driver/DriverProcessor.cs index e1a65675..8e927c82 100644 --- a/src/c#/GeneralUpdate.Core/Driver/DriverProcessor.cs +++ b/src/c#/GeneralUpdate.Core/Driver/DriverProcessor.cs @@ -2,6 +2,9 @@ namespace GeneralUpdate.Core.Driver { + /// + /// Handle all drive-related. + /// public class DriverProcessor { private List _commands = new List(); @@ -11,6 +14,9 @@ public void AddCommand(IDriverCommand command) _commands.Add(command); } + /// + /// Execute all driver-related commands. + /// public void ProcessCommands() { foreach (var command in _commands) diff --git a/src/c#/GeneralUpdate.Core/Driver/InstallDriverCommand.cs b/src/c#/GeneralUpdate.Core/Driver/InstallDriverCommand.cs index e2a01df8..97ffe13f 100644 --- a/src/c#/GeneralUpdate.Core/Driver/InstallDriverCommand.cs +++ b/src/c#/GeneralUpdate.Core/Driver/InstallDriverCommand.cs @@ -16,6 +16,7 @@ public void Execute() { try { + //Install all drivers in the specified directory, and if the installation fails, restore all the drivers in the backup directory. var command = new StringBuilder("/c pnputil /add-driver \"") .Append(_information.InstallDirectory) .Append("\"") diff --git a/src/c#/GeneralUpdate.Core/Driver/RestoreDriverCommand.cs b/src/c#/GeneralUpdate.Core/Driver/RestoreDriverCommand.cs index 61714069..e24dbc59 100644 --- a/src/c#/GeneralUpdate.Core/Driver/RestoreDriverCommand.cs +++ b/src/c#/GeneralUpdate.Core/Driver/RestoreDriverCommand.cs @@ -13,6 +13,7 @@ public RestoreDriverCommand(DriverInformation information) public void Execute() { + //Restore all drives in the backup directory. var command = new StringBuilder("/c pnputil /add-driver \"") .Append(_information.OutPutDirectory) .Append("\"")