mirror of
https://ghfast.top/https://github.com/StarCitizenToolBox/app.git
synced 2025-06-28 09:04:45 +08:00
限速器
This commit is contained in:
@ -62,8 +62,7 @@ class Aria2cManager {
|
||||
"--save-session=${sessionFile.absolute.path.trim()}",
|
||||
"--save-session-interval=60",
|
||||
"--file-allocation=trunc",
|
||||
// TODO for debug
|
||||
"--max-overall-download-limit=100k"
|
||||
"--seed-time=0",
|
||||
],
|
||||
workingDirectory: _aria2cDir);
|
||||
p.stdout.transform(utf8.decoder).listen((event) {
|
||||
@ -88,4 +87,20 @@ class Aria2cManager {
|
||||
await Future.delayed(const Duration(milliseconds: 100));
|
||||
}
|
||||
}
|
||||
|
||||
static int textToByte(String text) {
|
||||
if (text.length == 1) {
|
||||
return 0;
|
||||
}
|
||||
if (int.tryParse(text) != null) {
|
||||
return int.parse(text);
|
||||
}
|
||||
if (text.endsWith("k")) {
|
||||
return int.parse(text.substring(0, text.length - 1)) * 1024;
|
||||
}
|
||||
if (text.endsWith("m")) {
|
||||
return int.parse(text.substring(0, text.length - 1)) * 1024 * 1024;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user