🎨 code fmt

This commit is contained in:
BTMuli
2026-01-16 19:39:27 +08:00
parent 79ead78eaf
commit e3f3a038f4
8 changed files with 14 additions and 18 deletions

View File

@@ -82,7 +82,7 @@ pub fn is_in_admin() -> bool {
{
use windows_sys::Win32::Foundation::{CloseHandle, HANDLE};
use windows_sys::Win32::Security::{
GetTokenInformation, TokenElevation, TOKEN_ELEVATION, TOKEN_QUERY,
GetTokenInformation, TOKEN_ELEVATION, TOKEN_QUERY, TokenElevation,
};
use windows_sys::Win32::System::Threading::{GetCurrentProcess, OpenProcessToken};

View File

@@ -4,8 +4,8 @@
use chrono::DateTime;
use log::LevelFilter;
use std::time::SystemTime;
use tauri::plugin::TauriPlugin;
use tauri::Runtime;
use tauri::plugin::TauriPlugin;
use tauri_plugin_log::{Builder, Target, TargetKind, TimezoneStrategy};
// 获取当前日期 yyyy-mm-dd

View File

@@ -6,8 +6,8 @@ use tauri::{AppHandle, Emitter};
use widestring::U16CString;
use windows_sys::Win32::Foundation::ERROR_SUCCESS;
use windows_sys::Win32::System::Registry::{
RegNotifyChangeKeyValue, RegOpenKeyExW, HKEY, HKEY_CURRENT_USER, KEY_NOTIFY, KEY_READ,
REG_NOTIFY_CHANGE_LAST_SET,
HKEY, HKEY_CURRENT_USER, KEY_NOTIFY, KEY_READ, REG_NOTIFY_CHANGE_LAST_SET,
RegNotifyChangeKeyValue, RegOpenKeyExW,
};
pub fn init(app: AppHandle) {

View File

@@ -10,8 +10,8 @@ pub fn read_text_scale_factor() -> Result<f64, String> {
}
#[cfg(target_os = "windows")]
{
use winreg::enums::*;
use winreg::RegKey;
use winreg::enums::*;
let hkcu = RegKey::predef(HKEY_CURRENT_USER);
// 如果打开失败,直接返回默认值 1.0
let key = match hkcu.open_subkey("Software\\Microsoft\\Accessibility") {

View File

@@ -8,7 +8,7 @@ use tauri::AppHandle;
use widestring::U16CString;
use windows_sys::Win32::Foundation::{HANDLE, HWND};
use windows_sys::Win32::Storage::FileSystem::SYNCHRONIZE;
use windows_sys::Win32::System::Threading::{OpenProcess, WaitForSingleObject, INFINITE};
use windows_sys::Win32::System::Threading::{INFINITE, OpenProcess, WaitForSingleObject};
use windows_sys::Win32::UI::Shell::ShellExecuteW;
use windows_sys::Win32::UI::WindowsAndMessaging::SW_SHOWNORMAL;
@@ -37,11 +37,7 @@ fn shell_runas_with_args(args: &str) -> Result<(), String> {
if cwd_wide.len() > 1 { cwd_wide.as_ptr() } else { null_mut() },
SW_SHOWNORMAL,
);
if (result as usize) > 32 {
Ok(())
} else {
Err("ShellExecuteW runas 启动失败".into())
}
if (result as usize) > 32 { Ok(()) } else { Err("ShellExecuteW runas 启动失败".into()) }
}
}

View File

@@ -8,19 +8,19 @@ use windows_sys::Win32::Foundation::{CloseHandle, FreeLibrary, HANDLE, INVALID_H
use windows_sys::Win32::Storage::FileSystem::PIPE_ACCESS_DUPLEX;
use windows_sys::Win32::System::Diagnostics::Debug::WriteProcessMemory;
use windows_sys::Win32::System::Diagnostics::ToolHelp::{
CreateToolhelp32Snapshot, Module32FirstW, Module32NextW, MODULEENTRY32W, TH32CS_SNAPMODULE,
CreateToolhelp32Snapshot, MODULEENTRY32W, Module32FirstW, Module32NextW, TH32CS_SNAPMODULE,
TH32CS_SNAPMODULE32,
};
use windows_sys::Win32::System::LibraryLoader::{
GetModuleHandleA, GetProcAddress, LoadLibraryExW, DONT_RESOLVE_DLL_REFERENCES,
DONT_RESOLVE_DLL_REFERENCES, GetModuleHandleA, GetProcAddress, LoadLibraryExW,
};
use windows_sys::Win32::System::Memory::{VirtualAllocEx, MEM_COMMIT, PAGE_READWRITE};
use windows_sys::Win32::System::Memory::{MEM_COMMIT, PAGE_READWRITE, VirtualAllocEx};
use windows_sys::Win32::System::Pipes::{
CreateNamedPipeW, PIPE_READMODE_MESSAGE, PIPE_TYPE_MESSAGE, PIPE_UNLIMITED_INSTANCES, PIPE_WAIT,
};
use windows_sys::Win32::System::Threading::{
CreateProcessW, CreateRemoteThread, WaitForSingleObject, INFINITE, PROCESS_INFORMATION,
STARTUPINFOW,
CreateProcessW, CreateRemoteThread, INFINITE, PROCESS_INFORMATION, STARTUPINFOW,
WaitForSingleObject,
};
/// 创建命名管道

View File

@@ -3,9 +3,9 @@
#![cfg(target_os = "windows")]
use crate::yae::read_conf;
use prost::encoding::{decode_key, WireType};
use prost::DecodeError;
use prost::Message;
use prost::encoding::{WireType, decode_key};
use serde::Serialize;
use std::collections::HashMap;
use std::io::{Cursor, Read};

View File

@@ -2,8 +2,8 @@
//! @since Beta v0.9.0
#![cfg(target_os = "windows")]
use prost::encoding::{decode_key, decode_varint, WireType};
use prost::DecodeError;
use prost::encoding::{WireType, decode_key, decode_varint};
use serde::ser::SerializeMap;
use serde::{Deserialize, Serialize, Serializer};
use std::collections::HashMap;