feat: 增加暂存区
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
use std::sync::Mutex;
|
||||
|
||||
use crate::{app_error::AppError, app_state::AppState, pe_parse::pe::ReadOnlyPE};
|
||||
use serde::Serialize;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::{json, Value};
|
||||
use tauri::{AppHandle, Manager, State};
|
||||
|
||||
@@ -209,6 +209,25 @@ pub fn command_write_data(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command(async)]
|
||||
pub fn command_write_data_list(
|
||||
app_state: State<'_, Mutex<AppState>>,
|
||||
data_list: Vec<EditData>,
|
||||
) -> Result<(), AppError> {
|
||||
let mut app_state = app_state.lock().unwrap();
|
||||
for edit_data in data_list {
|
||||
app_state.write_data(edit_data.offset, &edit_data.data)?;
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize)]
|
||||
pub struct EditData{
|
||||
offset: usize,
|
||||
data: Vec<u8>,
|
||||
}
|
||||
|
||||
|
||||
// 命令,添加节
|
||||
#[tauri::command(async)]
|
||||
pub fn command_add_section(
|
||||
|
||||
@@ -26,6 +26,7 @@ pub fn run() {
|
||||
commands::command_get_pe_data_section_headers,
|
||||
commands::command_get_pe_data_import_directory,
|
||||
commands::command_write_data,
|
||||
commands::command_write_data_list,
|
||||
commands::command_add_section,
|
||||
commands::command_test,
|
||||
])
|
||||
|
||||
Reference in New Issue
Block a user