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:
@@ -1,18 +0,0 @@
|
||||
import 'dart:io';
|
||||
import 'dart:isolate';
|
||||
|
||||
class ArchiveDownloadProgress {
|
||||
final double progress;
|
||||
final int? minutesLeft;
|
||||
final bool extracting;
|
||||
|
||||
ArchiveDownloadProgress(this.progress, this.minutesLeft, this.extracting);
|
||||
}
|
||||
|
||||
class ArchiveDownloadOptions {
|
||||
String archiveUrl;
|
||||
Directory destination;
|
||||
SendPort port;
|
||||
|
||||
ArchiveDownloadOptions(this.archiveUrl, this.destination, this.port);
|
||||
}
|
||||
@@ -1,6 +1,60 @@
|
||||
import 'dart:io';
|
||||
import 'dart:isolate';
|
||||
|
||||
class FortniteBuild {
|
||||
final String identifier;
|
||||
final String version;
|
||||
final String link;
|
||||
final FortniteBuildSource source;
|
||||
|
||||
FortniteBuild({required this.version, required this.link});
|
||||
FortniteBuild({required this.identifier, required this.version, required this.link, required this.source});
|
||||
}
|
||||
|
||||
enum FortniteBuildSource {
|
||||
manifest,
|
||||
archive
|
||||
}
|
||||
|
||||
class FortniteBuildDownloadProgress {
|
||||
final double progress;
|
||||
final int? minutesLeft;
|
||||
final bool extracting;
|
||||
|
||||
FortniteBuildDownloadProgress(this.progress, this.minutesLeft, this.extracting);
|
||||
}
|
||||
|
||||
class FortniteBuildDownloadOptions {
|
||||
FortniteBuild build;
|
||||
Directory destination;
|
||||
SendPort port;
|
||||
|
||||
FortniteBuildDownloadOptions(this.build, this.destination, this.port);
|
||||
}
|
||||
|
||||
class FortniteBuildManifestChunk {
|
||||
List<int> chunksIds;
|
||||
String file;
|
||||
int fileSize;
|
||||
|
||||
FortniteBuildManifestChunk._internal(this.chunksIds, this.file, this.fileSize);
|
||||
|
||||
factory FortniteBuildManifestChunk.fromJson(json) => FortniteBuildManifestChunk._internal(
|
||||
List<int>.from(json["ChunksIds"] as List),
|
||||
json["File"],
|
||||
json["FileSize"]
|
||||
);
|
||||
}
|
||||
|
||||
class FortniteBuildManifestFile {
|
||||
String name;
|
||||
List<FortniteBuildManifestChunk> chunks;
|
||||
int size;
|
||||
|
||||
FortniteBuildManifestFile._internal(this.name, this.chunks, this.size);
|
||||
|
||||
factory FortniteBuildManifestFile.fromJson(json) => FortniteBuildManifestFile._internal(
|
||||
json["Name"],
|
||||
List<FortniteBuildManifestChunk>.from(json["Chunks"].map((chunk) => FortniteBuildManifestChunk.fromJson(chunk))),
|
||||
json["Size"]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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