You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
Rust
48 lines
1.3 KiB
Rust
use crate::cli_args::UninstallerArgs;
|
|
use clean_flash_common::{uninstaller, redirection, update_checker, ProgressCallback, InstallError};
|
|
|
|
struct SilentProgressCallback {
|
|
silent: bool,
|
|
}
|
|
|
|
impl ProgressCallback for SilentProgressCallback {
|
|
fn update_progress_label(&self, text: &str, _tick: bool) {
|
|
if !self.silent {
|
|
eprintln!("[*] {}", text);
|
|
}
|
|
}
|
|
|
|
fn tick_progress(&self) {}
|
|
}
|
|
|
|
pub fn run_silent_uninstall(args: &UninstallerArgs) -> Result<(), Box<dyn std::error::Error>> {
|
|
let version = update_checker::FLASH_VERSION;
|
|
|
|
if !args.silent {
|
|
eprintln!("Clean Flash Player {} - Silent Uninstall", version);
|
|
}
|
|
|
|
let callback = SilentProgressCallback {
|
|
silent: args.silent,
|
|
};
|
|
|
|
let redir = redirection::disable_redirection();
|
|
let result: Result<(), InstallError> = uninstaller::uninstall(&callback);
|
|
redirection::enable_redirection(redir);
|
|
|
|
match result {
|
|
Ok(()) => {
|
|
if !args.silent {
|
|
eprintln!("[+] Uninstallation completed successfully.");
|
|
}
|
|
Ok(())
|
|
}
|
|
Err(e) => {
|
|
if !args.silent {
|
|
eprintln!("[!] Uninstallation failed: {}", e);
|
|
}
|
|
std::process::exit(1);
|
|
}
|
|
}
|
|
}
|