From 484cd3656531f56f19d20f969e364e6c8f200285 Mon Sep 17 00:00:00 2001 From: SpikeHD Date: Sun, 4 Sep 2022 14:20:36 -0700 Subject: [PATCH] format --- src-tauri/src/metadata_patcher.rs | 7 +++++-- src/ui/components/ServerLaunchSection.tsx | 18 ++++++++++++------ src/utils/game.ts | 14 ++++++++------ 3 files changed, 25 insertions(+), 14 deletions(-) diff --git a/src-tauri/src/metadata_patcher.rs b/src-tauri/src/metadata_patcher.rs index 7669c3e..bae4220 100644 --- a/src-tauri/src/metadata_patcher.rs +++ b/src-tauri/src/metadata_patcher.rs @@ -1,5 +1,5 @@ use regex::Regex; -use std::{fs, path::Path, fs::File, fs::OpenOptions, io::Read, io::Write}; +use std::{fs, fs::File, fs::OpenOptions, io::Read, io::Write, path::Path}; // For these two functions, a non-zero return value indicates failure. extern "C" { @@ -115,7 +115,10 @@ fn replace_rsa_key(old_data: &str, to_replace: &str, file_name: &str) -> String // Read dispatch key file unsafe { // Get key path from current directory - let key_file_path = std::env::current_dir().unwrap().join("keys").join(file_name); + let key_file_path = std::env::current_dir() + .unwrap() + .join("keys") + .join(file_name); let key_data = match fs::read(&key_file_path) { Ok(file) => file, diff --git a/src/ui/components/ServerLaunchSection.tsx b/src/ui/components/ServerLaunchSection.tsx index b05d422..fe7d705 100644 --- a/src/ui/components/ServerLaunchSection.tsx +++ b/src/ui/components/ServerLaunchSection.tsx @@ -113,18 +113,24 @@ export default class ServerLaunchSection extends React.Component const gameVersion = await getGameVersion() console.log(gameVersion) - if(gameVersion == null) { - alert('Game version could not be determined. Please make sure you have the game correctly selected and try again.') + if (gameVersion == null) { + alert( + 'Game version could not be determined. Please make sure you have the game correctly selected and try again.' + ) return } - if(gameVersion?.major == 2 && gameVersion?.minor < 8) { - alert('Game version is too old for metadata patching. Please disable metadata patching in the settings and try again.') + if (gameVersion?.major == 2 && gameVersion?.minor < 8) { + alert( + 'Game version is too old for metadata patching. Please disable metadata patching in the settings and try again.' + ) return } - if(gameVersion?.major == 3 && gameVersion?.minor >= 1) { - alert('Game version is too new for metadata patching. Please disable metadata patching in the settings to launch the game.\nNOTE: You will require a UA patch to play the game.') + if (gameVersion?.major == 3 && gameVersion?.minor >= 1) { + alert( + 'Game version is too new for metadata patching. Please disable metadata patching in the settings to launch the game.\nNOTE: You will require a UA patch to play the game.' + ) return } diff --git a/src/utils/game.ts b/src/utils/game.ts index 27baadc..748c034 100644 --- a/src/utils/game.ts +++ b/src/utils/game.ts @@ -38,22 +38,24 @@ export async function getGameDataFolder() { } export async function getGameVersion() { - const GameData = await getGameDataFolder(); + const GameData = await getGameDataFolder() if (!GameData) { return null } - const settings = JSON.parse(await invoke('read_file', { - path: GameData + '\\StreamingAssets\\asb_settings.json', - })) + const settings = JSON.parse( + await invoke('read_file', { + path: GameData + '\\StreamingAssets\\asb_settings.json', + }) + ) - const versionRaw = settings.variance.split('.'); + const versionRaw = settings.variance.split('.') const version = { major: parseInt(versionRaw[0]), minor: parseInt(versionRaw[1].split('_')[0]), release: parseInt(versionRaw[1].split('_')[1]), } - return version; + return version }