mirror of
https://github.com/Auties00/Reboot-Launcher.git
synced 2026-01-14 03:32:23 +01:00
9.0.4
This commit is contained in:
@@ -19,9 +19,13 @@ Future<bool> hasRebootDllUpdate(int? lastUpdateMs, {int hours = 24, bool force =
|
||||
|
||||
Future<void> downloadCriticalDll(String name, String outputPath) async {
|
||||
final response = await http.get(Uri.parse("https://github.com/Auties00/reboot_launcher/tree/master/gui/assets/dlls/$name"));
|
||||
if(response.statusCode != 200) {
|
||||
throw Exception("Cannot download $name: status code ${response.statusCode}");
|
||||
}
|
||||
|
||||
final output = File(outputPath);
|
||||
await output.parent.create(recursive: true);
|
||||
await output.writeAsBytes(response.bodyBytes);
|
||||
await output.writeAsBytes(response.bodyBytes, flush: true);
|
||||
}
|
||||
|
||||
Future<int> downloadRebootDll(String url) async {
|
||||
@@ -29,12 +33,16 @@ Future<int> downloadRebootDll(String url) async {
|
||||
final now = DateTime.now();
|
||||
try {
|
||||
final response = await http.get(Uri.parse(url));
|
||||
if(response.statusCode != 200) {
|
||||
throw Exception("Cannot download reboot.zip: status code ${response.statusCode}");
|
||||
}
|
||||
|
||||
outputDir = await installationDirectory.createTemp("reboot_out");
|
||||
final tempZip = File("${outputDir.path}\\reboot.zip");
|
||||
await tempZip.writeAsBytes(response.bodyBytes);
|
||||
await tempZip.writeAsBytes(response.bodyBytes, flush: true);
|
||||
await extractFileToDisk(tempZip.path, outputDir.path);
|
||||
final rebootDll = File(outputDir.listSync().firstWhere((element) => path.extension(element.path) == ".dll").path);
|
||||
await rebootDllFile.writeAsBytes(await rebootDll.readAsBytes());
|
||||
await rebootDllFile.writeAsBytes(await rebootDll.readAsBytes(), flush: true);
|
||||
return now.millisecondsSinceEpoch;
|
||||
} finally{
|
||||
if(outputDir != null) {
|
||||
|
||||
Reference in New Issue
Block a user