Add BCD parsing logic
This commit is contained in:
parent
5ba30e626f
commit
9f0ecb9baf
2 changed files with 59 additions and 2 deletions
|
|
@ -55,8 +55,8 @@ use tokio::sync::mpsc;
|
|||
use tracing::{debug, info};
|
||||
|
||||
use crate::diags::{
|
||||
DiagGroup, Type as DiagType, get_diag_type, parse_bitlocker, parse_chkdsk, parse_dism,
|
||||
parse_system_files,
|
||||
DiagGroup, Type as DiagType, get_diag_type, parse_bcd, parse_bitlocker, parse_chkdsk,
|
||||
parse_dism, parse_system_files,
|
||||
};
|
||||
|
||||
pub struct App {
|
||||
|
|
@ -453,6 +453,11 @@ impl App {
|
|||
parse_bitlocker(current_group, task_result.clone());
|
||||
}
|
||||
}
|
||||
DiagType::BootConfigData => {
|
||||
if let Some(task_result) = &task.result {
|
||||
parse_bcd(current_group, task_result.clone());
|
||||
}
|
||||
}
|
||||
DiagType::CheckDisk => {
|
||||
if let Some(task_result) = &task.result {
|
||||
parse_chkdsk(current_group, task_result.clone());
|
||||
|
|
|
|||
|
|
@ -154,6 +154,58 @@ pub fn get_diag_type(label: &str) -> Type {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn parse_bcd(diag_group: &mut DiagGroup, task_result: TaskResult) {
|
||||
if !cfg!(windows) {
|
||||
sleep(Duration::from_millis(500));
|
||||
return ();
|
||||
}
|
||||
match task_result {
|
||||
TaskResult::Error(err) => {
|
||||
diag_group.passed.push(false);
|
||||
diag_group.result = String::from("Error");
|
||||
diag_group.logs.push(Log {
|
||||
label: String::from("BCD"),
|
||||
summary: vec![DVLine {
|
||||
line_parts: vec![String::from("BCD: "), String::from("Error")],
|
||||
line_colors: vec![Color::Reset, Color::Red],
|
||||
}],
|
||||
raw: err,
|
||||
});
|
||||
}
|
||||
TaskResult::Output(stdout, stderr, passed) => {
|
||||
let output_text = if stderr.is_empty() {
|
||||
stdout.clone()
|
||||
} else {
|
||||
format!("{stdout}\n\n-------\n\n{stderr}")
|
||||
};
|
||||
|
||||
if passed {
|
||||
diag_group.passed.push(true);
|
||||
diag_group.result = String::from("OK");
|
||||
diag_group.logs.push(Log {
|
||||
label: String::from("BCD"),
|
||||
summary: vec![DVLine {
|
||||
line_parts: vec![String::from("BCD: "), String::from("OK")],
|
||||
line_colors: vec![Color::Reset, Color::Green],
|
||||
}],
|
||||
raw: output_text,
|
||||
});
|
||||
} else {
|
||||
diag_group.passed.push(false);
|
||||
diag_group.result = String::from("Unknown");
|
||||
diag_group.logs.push(Log {
|
||||
label: String::from("BCD"),
|
||||
summary: vec![DVLine {
|
||||
line_parts: vec![String::from("BCD: "), String::from("Unknown")],
|
||||
line_colors: vec![Color::Reset, Color::Yellow],
|
||||
}],
|
||||
raw: output_text,
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn parse_bitlocker(diag_group: &mut DiagGroup, task_result: TaskResult) {
|
||||
if !cfg!(windows) {
|
||||
sleep(Duration::from_millis(500));
|
||||
|
|
|
|||
Loading…
Reference in a new issue