mirror of
https://github.com/Grasscutters/Cultivation.git
synced 2025-12-13 15:44:35 +01:00
format
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
use regex::Regex;
|
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.
|
// For these two functions, a non-zero return value indicates failure.
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -115,7 +115,10 @@ fn replace_rsa_key(old_data: &str, to_replace: &str, file_name: &str) -> String
|
|||||||
// Read dispatch key file
|
// Read dispatch key file
|
||||||
unsafe {
|
unsafe {
|
||||||
// Get key path from current directory
|
// 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) {
|
let key_data = match fs::read(&key_file_path) {
|
||||||
Ok(file) => file,
|
Ok(file) => file,
|
||||||
|
|||||||
@@ -113,18 +113,24 @@ export default class ServerLaunchSection extends React.Component<IProps, IState>
|
|||||||
const gameVersion = await getGameVersion()
|
const gameVersion = await getGameVersion()
|
||||||
console.log(gameVersion)
|
console.log(gameVersion)
|
||||||
|
|
||||||
if(gameVersion == null) {
|
if (gameVersion == null) {
|
||||||
alert('Game version could not be determined. Please make sure you have the game correctly selected and try again.')
|
alert(
|
||||||
|
'Game version could not be determined. Please make sure you have the game correctly selected and try again.'
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gameVersion?.major == 2 && gameVersion?.minor < 8) {
|
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.')
|
alert(
|
||||||
|
'Game version is too old for metadata patching. Please disable metadata patching in the settings and try again.'
|
||||||
|
)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if(gameVersion?.major == 3 && gameVersion?.minor >= 1) {
|
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.')
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -38,22 +38,24 @@ export async function getGameDataFolder() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getGameVersion() {
|
export async function getGameVersion() {
|
||||||
const GameData = await getGameDataFolder();
|
const GameData = await getGameDataFolder()
|
||||||
|
|
||||||
if (!GameData) {
|
if (!GameData) {
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
const settings = JSON.parse(await invoke('read_file', {
|
const settings = JSON.parse(
|
||||||
path: GameData + '\\StreamingAssets\\asb_settings.json',
|
await invoke('read_file', {
|
||||||
}))
|
path: GameData + '\\StreamingAssets\\asb_settings.json',
|
||||||
|
})
|
||||||
|
)
|
||||||
|
|
||||||
const versionRaw = settings.variance.split('.');
|
const versionRaw = settings.variance.split('.')
|
||||||
const version = {
|
const version = {
|
||||||
major: parseInt(versionRaw[0]),
|
major: parseInt(versionRaw[0]),
|
||||||
minor: parseInt(versionRaw[1].split('_')[0]),
|
minor: parseInt(versionRaw[1].split('_')[0]),
|
||||||
release: parseInt(versionRaw[1].split('_')[1]),
|
release: parseInt(versionRaw[1].split('_')[1]),
|
||||||
}
|
}
|
||||||
|
|
||||||
return version;
|
return version
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user