mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 07:34:36 +01:00
lint
This commit is contained in:
@@ -37,7 +37,7 @@ pub fn dir_delete(path: &str) {
|
||||
|
||||
#[tauri::command]
|
||||
pub fn are_files_identical(path1: &str, path2: &str) -> bool {
|
||||
return diff(path1, path2);
|
||||
diff(path1, path2)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
@@ -88,10 +88,12 @@ pub fn copy_file_with_new_name(path: String, new_path: String, new_name: String)
|
||||
#[tauri::command]
|
||||
pub fn delete_file(path: String) -> bool {
|
||||
match std::fs::remove_file(path) {
|
||||
Ok(_) => return true,
|
||||
Ok(_) => true,
|
||||
Err(e) => {
|
||||
println!("Failed to delete file: {}", e);
|
||||
return false
|
||||
false
|
||||
}
|
||||
};
|
||||
|
||||
false
|
||||
}
|
||||
@@ -55,7 +55,8 @@ pub fn patch_metadata(metadata_folder: &str) -> bool {
|
||||
};
|
||||
|
||||
file.write_all(&encrypted).unwrap();
|
||||
return true;
|
||||
|
||||
true
|
||||
}
|
||||
|
||||
fn decrypt_metadata(file_path: &str) -> Vec<u8> {
|
||||
@@ -81,16 +82,18 @@ fn decrypt_metadata(file_path: &str) -> Vec<u8> {
|
||||
match dll_decrypt_global_metadata(data.as_mut_ptr(), data.len().try_into().unwrap()) {
|
||||
Ok(_) => {
|
||||
println!("Successfully decrypted global-metadata");
|
||||
return data;
|
||||
data
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Failed to decrypt global-metadata: {}", e);
|
||||
return Vec::new();
|
||||
Vec::new()
|
||||
}
|
||||
};
|
||||
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
fn replace_keys(data: &Vec<u8>) -> Vec<u8> {
|
||||
fn replace_keys(data: &[u8]) -> Vec<u8> {
|
||||
let mut new_data = String::new();
|
||||
|
||||
unsafe {
|
||||
@@ -107,10 +110,10 @@ fn replace_keys(data: &Vec<u8>) -> Vec<u8> {
|
||||
|
||||
if i == 2 {
|
||||
println!("Replacing password key");
|
||||
new_data = replace_rsa_key(&data_str, &key, "passwordKey.txt");
|
||||
new_data = replace_rsa_key(&data_str, key, "passwordKey.txt");
|
||||
} else if i == 3 {
|
||||
println!("Replacing dispatch key");
|
||||
new_data = replace_rsa_key(&new_data, &key, "dispatchKey.txt");
|
||||
new_data = replace_rsa_key(&new_data, key, "dispatchKey.txt");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -133,22 +136,24 @@ fn replace_rsa_key(old_data: &str, to_replace: &str, file_name: &str) -> String
|
||||
let new_key = String::from_utf8_unchecked(key_data.to_vec());
|
||||
|
||||
// Replace old key with new key
|
||||
return old_data.replace(to_replace, &new_key);
|
||||
old_data.replace(to_replace, &new_key)
|
||||
}
|
||||
}
|
||||
|
||||
fn encrypt_metadata(old_data: &Vec<u8>) -> Vec<u8> {
|
||||
fn encrypt_metadata(old_data: &[u8]) -> Vec<u8> {
|
||||
let mut data = old_data.to_vec();
|
||||
match dll_encrypt_global_metadata(data.as_mut_ptr(), data.len().try_into().unwrap()) {
|
||||
Ok(_) => {
|
||||
println!("Successfully encrypted global-metadata");
|
||||
return data;
|
||||
data
|
||||
}
|
||||
Err(e) => {
|
||||
println!("Failed to encrypt global-metadata: {}", e);
|
||||
return Vec::new();
|
||||
Vec::new()
|
||||
}
|
||||
};
|
||||
|
||||
Vec::new()
|
||||
}
|
||||
|
||||
fn do_vecs_match<T: PartialEq>(a: &Vec<T>, b: &Vec<T>) -> bool {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import { invoke } from '@tauri-apps/api'
|
||||
import { dataDir } from '@tauri-apps/api/path'
|
||||
import { getConfig } from './configuration'
|
||||
import DownloadHandler from './download'
|
||||
import { getGameExecutable, getGameFolder } from './game'
|
||||
|
||||
@@ -9,8 +8,6 @@ export async function patchMetadata() {
|
||||
path: await getGameMetadataPath() + '\\global-metadata.dat'
|
||||
})
|
||||
|
||||
console.log(await getGameMetadataPath())
|
||||
|
||||
if (!metadataExists) {
|
||||
return false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user