mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2026-02-03 14:54:56 +01:00
Fix get mem failed in chinese
This commit is contained in:
@@ -296,22 +296,27 @@ class ServerProvider extends BusyProvider {
|
||||
}
|
||||
|
||||
void _getMem(ServerPrivateInfo spi, String raw) {
|
||||
const memPrefixies = ['Mem:', '内存:'];
|
||||
final info = _servers.firstWhere((e) => e.info == spi);
|
||||
for (var item in raw.split('\n')) {
|
||||
if (item.contains('Mem:') || item.contains('内存:')) {
|
||||
var split = item.replaceFirst('Mem:', '');
|
||||
split = split.replaceFirst('内存:', '');
|
||||
split = split.split(' ');
|
||||
split.removeWhere((e) => e == '');
|
||||
final memList = split.map((e) => int.parse(e)).toList();
|
||||
info.status.memory = Memory(
|
||||
total: memList[0],
|
||||
used: memList[1],
|
||||
free: memList[2],
|
||||
shared: memList[3],
|
||||
cache: memList[4],
|
||||
avail: memList[5]);
|
||||
var found = false;
|
||||
for (var memPrefix in memPrefixies) {
|
||||
if (item.contains(memPrefix)) {
|
||||
found = true;
|
||||
final split = item.replaceFirst(memPrefix, '').split(' ');
|
||||
split.removeWhere((e) => e == '');
|
||||
final memList = split.map((e) => int.parse(e)).toList();
|
||||
info.status.memory = Memory(
|
||||
total: memList[0],
|
||||
used: memList[1],
|
||||
free: memList[2],
|
||||
shared: memList[3],
|
||||
cache: memList[4],
|
||||
avail: memList[5]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 98;
|
||||
static const int build = 101;
|
||||
static const String engine =
|
||||
"╔════════════════════════════════════════════════════════════════════════════╗\n║ A new version of Flutter is available! ║\n║ ║\n║ To update to the latest version, run \"flutter upgrade\". ║\n╚════════════════════════════════════════════════════════════════════════════╝\n\nFlutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 77d935af4d (9 weeks ago) • 2021-12-16 08:37:33 -0800\nEngine • revision 890a5fca2e\nTools • Dart 2.15.1\n";
|
||||
static const String buildAt = "2022-02-18 13:28:18.254386";
|
||||
static const int modifications = 5;
|
||||
"Flutter 2.8.1 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 77d935af4d (3 months ago) • 2021-12-16 08:37:33 -0800\nEngine • revision 890a5fca2e\nTools • Dart 2.15.1\n";
|
||||
static const String buildAt = "2022-03-02 11:12:07.958841";
|
||||
static const int modifications = 4;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user