37 lines
1.1 KiB
Rust
37 lines
1.1 KiB
Rust
use dirs::{data_local_dir, desktop_dir};
|
|
use rfd::FileDialog;
|
|
use std::{fs::File, io::Read, io::Write, path::PathBuf};
|
|
|
|
pub fn get_dat_data() -> Option<Vec<u8>> {
|
|
if let Some(path) = prompt_input_path() {
|
|
let mut file: File = File::open(path).unwrap();
|
|
let mut data: Vec<u8> = Vec::new();
|
|
file.read_to_end(&mut data).unwrap();
|
|
return Some(data);
|
|
}
|
|
None
|
|
}
|
|
|
|
pub fn prompt_input_path() -> Option<PathBuf> {
|
|
FileDialog::new()
|
|
.set_title("Select Geometry Dash Save")
|
|
.set_file_name("CCGameManager.dat")
|
|
.add_filter("Geometry Dash Save", &["dat"])
|
|
.set_directory(data_local_dir().unwrap())
|
|
.pick_file()
|
|
}
|
|
|
|
pub fn prompt_output_path() -> Option<PathBuf> {
|
|
FileDialog::new()
|
|
.set_title("Select Output Location")
|
|
.set_file_name("CCGameManager.xml")
|
|
.add_filter("Geometry Dash Decrypted Save", &["xml"])
|
|
.set_directory(desktop_dir().unwrap())
|
|
.save_file()
|
|
}
|
|
|
|
pub fn write_decrypted_data(data: &[u8], output_path: PathBuf) {
|
|
let mut output_file: File = File::create(output_path).unwrap();
|
|
output_file.write_all(data).unwrap()
|
|
}
|