chore: drop parseMacRecoveryProgress
This commit is contained in:
parent
f0f02030cc
commit
9d596b6acc
|
|
@ -32,7 +32,6 @@ class Downloader extends StatefulWidget {
|
||||||
class _DownloaderState extends State<Downloader> {
|
class _DownloaderState extends State<Downloader> {
|
||||||
final notificationsClient = NotificationsClient();
|
final notificationsClient = NotificationsClient();
|
||||||
final wgetPattern = RegExp("( [0-9.]+%)");
|
final wgetPattern = RegExp("( [0-9.]+%)");
|
||||||
final macRecoveryPattern = RegExp("([0-9]+\\.[0-9])");
|
|
||||||
final ariaPattern = RegExp("([0-9.]+%)");
|
final ariaPattern = RegExp("([0-9.]+%)");
|
||||||
late final Stream<double> _progressStream;
|
late final Stream<double> _progressStream;
|
||||||
bool _downloadFinished = false;
|
bool _downloadFinished = false;
|
||||||
|
|
@ -67,17 +66,6 @@ class _DownloaderState extends State<Downloader> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void parseMacRecoveryProgress(String line) {
|
|
||||||
var matches = macRecoveryPattern.allMatches(line).toList();
|
|
||||||
if (matches.isNotEmpty) {
|
|
||||||
var size = matches[0].group(1);
|
|
||||||
if (size != null) {
|
|
||||||
var value = double.parse(size);
|
|
||||||
controller.add(value);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Stream<double> progressStream() {
|
Stream<double> progressStream() {
|
||||||
var options = [widget.operatingSystem.code, widget.version.version];
|
var options = [widget.operatingSystem.code, widget.version.version];
|
||||||
if (widget.option != null) {
|
if (widget.option != null) {
|
||||||
|
|
@ -88,10 +76,6 @@ class _DownloaderState extends State<Downloader> {
|
||||||
process.stderr.transform(utf8.decoder).forEach(parseWgetProgress);
|
process.stderr.transform(utf8.decoder).forEach(parseWgetProgress);
|
||||||
} else if (widget.option!.downloader == 'zsync') {
|
} else if (widget.option!.downloader == 'zsync') {
|
||||||
controller.add(-1);
|
controller.add(-1);
|
||||||
} else if (widget.option!.downloader == 'macrecovery') {
|
|
||||||
process.stdout
|
|
||||||
.transform(utf8.decoder)
|
|
||||||
.forEach(parseMacRecoveryProgress);
|
|
||||||
} else if (widget.option!.downloader == 'aria2c') {
|
} else if (widget.option!.downloader == 'aria2c') {
|
||||||
process.stderr.transform(utf8.decoder).forEach(parseAriaProgress);
|
process.stderr.transform(utf8.decoder).forEach(parseAriaProgress);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue