شائع شدہ سورس
سورس ZIP ڈاؤن لوڈ کریں
CH-J SM Mobile
ایپلیکیشن کی کسی مخصوص ریلیز کی ڈائریکٹریز اور فائلیں دیکھیں۔
CH-J / SM Mobile
175 فائلیں
sm-mobile-20261016T185235Z-8e93ecc1b59a
شامل کیا گیا: · بلڈ کیا گیا:
1
/// Parses the text values produced by [LinuxMonitor] into numbers for2
/// display. Anything that does not match stays null, and the UI then shows3
/// the original text instead of a guess.4
class MetricValues {5
final double? cpu, ramPercent, diskPercent, uptimeSeconds;6
final int? ramUsedBytes, ramTotalBytes, diskUsedBytes, diskTotalBytes;7
final List<double>? load;8
const MetricValues({9
this.cpu,10
this.ramPercent,11
this.ramUsedBytes,12
this.ramTotalBytes,13
this.diskPercent,14
this.diskUsedBytes,15
this.diskTotalBytes,16
this.uptimeSeconds,17
this.load,18
});20
static final _percent = RegExp(r'^\s*([0-9]+(?:\.[0-9]+)?)\s*%');21
static final _ram = RegExp(r'\((\d+) / (\d+) MiB\)');22
static final _disk = RegExp(r'\((\d+) / (\d+) KiB\)');24
factory MetricValues.parse(Map<String, String> m) {25
double? percent(String? v) =>26
v == null ? null : double.tryParse(_percent.firstMatch(v)?[1] ?? '');27
final ram = _ram.firstMatch(m['ram'] ?? '');28
final disk = _disk.firstMatch(m['disk'] ?? '');29
final load = (m['load'] ?? '')30
.trim()31
.split(RegExp(r'\s+'))32
.map(double.tryParse)33
.toList();34
final uptime = double.tryParse((m['uptime'] ?? '').trim());35
return MetricValues(36
cpu: percent(m['cpu']),37
ramPercent: percent(m['ram']),38
ramUsedBytes: ram == null ? null : int.parse(ram[1]!) * 1024 * 1024,39
ramTotalBytes: ram == null ? null : int.parse(ram[2]!) * 1024 * 1024,40
diskPercent: percent(m['disk']),41
diskUsedBytes: disk == null ? null : int.parse(disk[1]!) * 1024,42
diskTotalBytes: disk == null ? null : int.parse(disk[2]!) * 1024,43
uptimeSeconds: uptime != null && uptime >= 0 ? uptime : null,44
load: load.length == 3 && load.every((v) => v != null && v >= 0)45
? load.cast<double>()46
: null,47
);48
}49
}51
/// Whole days, hours and minutes of an uptime in seconds.52
({int days, int hours, int minutes}) splitUptime(double seconds) {53
final total = seconds.floor() ~/ 60;54
return (days: total ~/ 1440, hours: total % 1440 ~/ 60, minutes: total % 60);55
}57
/// Binary (IEC) units, as reported by the kernel: 1 KiB = 1024 bytes.58
/// [decimal] formats the number for the locale, e.g. "1,9" in Czech.59
String formatBytes(int bytes, String Function(double, int digits) decimal) {60
const units = ['B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB'];61
var value = bytes.toDouble();62
var unit = 0;63
while (value >= 1024 && unit < units.length - 1) {64
value /= 1024;65
unit++;66
}67
final digits = unit == 0 || value >= 100 ? 0 : 1;68
return '${decimal(value, digits)} ${units[unit]}';69
}SHA-256
bb70afc39ac23c03164c6f1e9b7d76cf25249eaa6b013d432570d58f35f2a31dCH-J Proprietary Software License 1.14 · سورس CH-J Proprietary Software License 1.14 کے تحت فراہم کیا جاتا ہے۔ اس کی دستیابی لائسنس کی شرائط نہیں بدلتی اور نہ ہی اضافی حقوق دیتی ہے۔
آرکائیو کا SHA-256
46e427a43e87af091004f36145590bda8fe90086dfb0f631afeb5029fb0b5655