This commit is contained in:
Alessandro Autiero
2024-05-20 17:24:00 +02:00
parent 7c2caed16c
commit 9f5590d41c
562 changed files with 3303 additions and 156787 deletions

View File

@@ -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);
}

View File

@@ -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"]
);
}

View File

@@ -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
};
}