Skip to content

Commit

Permalink
new injector
Browse files Browse the repository at this point in the history
  • Loading branch information
TIMER-err committed Oct 19, 2024
1 parent 3616d84 commit eca9a56
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 19 deletions.
2 changes: 1 addition & 1 deletion YBuild.xml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
<file>build/loader.jar</file>
<file>deps/yapeteam/hooker.jar</file>
<files platform="windows">deps/yapeteam/dll</files>
<files platform="windows">yolbi_injector/api/libapi.dll</files>
<file platform="windows">yolbi_injector/api/libapi.dll</file>
<file>build/ymixin.jar</file>
<!--agent 注入尚未完善-->
<!--<file>build/agent.jar</file>-->
Expand Down
20 changes: 2 additions & 18 deletions yolbi_injector/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ use std::io::{Cursor, Write};
use std::os::windows::ffi::OsStrExt;
use std::path::{Path, PathBuf};
use std::{env, io};
use std::fs::File;
use zip::result::ZipError;
use zip::ZipArchive;

Expand All @@ -17,24 +16,9 @@ fn release_resources(yolbi_path: PathBuf) -> Result<(), ZipError> {
std::fs::create_dir_all(&yolbi_path)?;

let mut zip = ZipArchive::new(Cursor::new(included_zip))?;
let total_files = zip.len();
zip.extract(&yolbi_path)?;

for i in 0..total_files {
let mut file = zip.by_index(i)?;
let file_name = file.name().to_owned();
let out_path = yolbi_path.join(&file_name);

println!("Extract: {}", out_path.display());

if file_name.ends_with('/') {
std::fs::create_dir_all(&out_path)?;
} else {
let mut out_file = File::create(&out_path)?;
io::copy(&mut file, &mut out_file)?;
}
}

println!("Done extracting files.");
println!("resources released at: {}", yolbi_path.display());
Ok(())
}

Expand Down

0 comments on commit eca9a56

Please sign in to comment.