Reboot v3

This commit is contained in:
Alessandro Autiero
2023-06-03 18:30:50 +02:00
parent 5eafcae616
commit 30f1b0f162
44 changed files with 1041 additions and 613 deletions

View File

@@ -12,8 +12,8 @@ final File rebootDllFile = File("${assetsDirectory.path}\\dlls\\reboot.dll");
Future<int> downloadRebootDll(String url, int? lastUpdateMs) async {
Directory? outputDir;
var now = DateTime.now();
try {
var now = DateTime.now();
var lastUpdate = await _getLastUpdate(lastUpdateMs);
var exists = await rebootDllFile.exists();
if (lastUpdate != null && now.difference(lastUpdate).inHours <= 24 && exists) {
@@ -32,6 +32,12 @@ Future<int> downloadRebootDll(String url, int? lastUpdateMs) async {
return now.millisecondsSinceEpoch;
}catch(message) {
if(url == rebootDownloadUrl){
var asset = File('${assetsDirectory.path}\\dlls\\reboot.dll');
await rebootDllFile.writeAsBytes(asset.readAsBytesSync());
return now.millisecondsSinceEpoch;
}
throw Exception("Cannot download reboot.zip, invalid zip: $message");
}finally{
if(outputDir != null) {