mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-13 11:12:23 +01:00
9.0.2
This commit is contained in:
@@ -8,35 +8,18 @@ class GameInstance {
|
||||
final int? eacPid;
|
||||
int? observerPid;
|
||||
bool hosting;
|
||||
bool launched;
|
||||
bool tokenError;
|
||||
bool linkedHosting;
|
||||
GameInstance? child;
|
||||
|
||||
GameInstance(this.versionName, this.gamePid, this.launcherPid, this.eacPid, this.hosting, this.linkedHosting)
|
||||
: tokenError = false,
|
||||
assert(!linkedHosting || !hosting, "Only a game instance can have a linked hosting server");
|
||||
|
||||
GameInstance._fromJson(this.versionName, this.gamePid, this.launcherPid, this.eacPid, this.observerPid,
|
||||
this.hosting, this.tokenError, this.linkedHosting);
|
||||
|
||||
static GameInstance? fromJson(Map<String, dynamic>? json) {
|
||||
if(json == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var gamePid = json["game"];
|
||||
if(gamePid == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var version = json["versionName"];
|
||||
var launcherPid = json["launcher"];
|
||||
var eacPid = json["eac"];
|
||||
var observerPid = json["observer"];
|
||||
var hosting = json["hosting"];
|
||||
var tokenError = json["tokenError"];
|
||||
var linkedHosting = json["linkedHosting"];
|
||||
return GameInstance._fromJson(version, gamePid, launcherPid, eacPid, observerPid, hosting, tokenError, linkedHosting);
|
||||
}
|
||||
GameInstance({
|
||||
required this.versionName,
|
||||
required this.gamePid,
|
||||
required this.launcherPid,
|
||||
required this.eacPid,
|
||||
required this.hosting,
|
||||
required this.child
|
||||
}): tokenError = false, launched = false;
|
||||
|
||||
void kill() {
|
||||
Process.killPid(gamePid, ProcessSignal.sigabrt);
|
||||
@@ -49,16 +32,6 @@ class GameInstance {
|
||||
if(observerPid != null) {
|
||||
Process.killPid(observerPid!, ProcessSignal.sigabrt);
|
||||
}
|
||||
child?.kill();
|
||||
}
|
||||
|
||||
Map<String, dynamic> toJson() => {
|
||||
'versionName': versionName,
|
||||
'game': gamePid,
|
||||
'launcher': launcherPid,
|
||||
'eac': eacPid,
|
||||
'observer': observerPid,
|
||||
'hosting': hosting,
|
||||
'tokenError': tokenError,
|
||||
'linkedHosting': linkedHosting
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user