fix: Unable to obtain Windows server information (#963)

* fix: FormatException: Unexpected extension byte (at offset 8) error

* fix: PowerShell script error repair, Windows data parsing repair

* fix: Unable to obtain network card information

* fix: Unable to obtain system startup time

* fix conversation as resolved.
This commit is contained in:
lxdklp
2025-11-22 19:17:40 +08:00
committed by GitHub
parent ca4e65d7a5
commit 75d1a59e77
12 changed files with 455 additions and 215 deletions

View File

@@ -37,27 +37,39 @@ class Fifo<T> extends ListBase<T> {
}
}
abstract class TimeSeq<T extends List<TimeSeqIface>> extends Fifo<T> {
abstract class TimeSeq<T extends TimeSeqIface<T>> extends Fifo<List<T>> {
/// Due to the design, at least two elements are required, otherwise [pre] /
/// [now] will throw.
TimeSeq(T init1, T init2, {super.capacity}) : super(list: [init1, init2]);
TimeSeq(List<T> init1, List<T> init2, {super.capacity}) : super(list: [init1, init2]);
T get pre {
List<T> get pre {
return _list[length - 2];
}
T get now {
List<T> get now {
return _list[length - 1];
}
void onUpdate();
void update(T new_) {
void update(List<T> new_) {
add(new_);
if (pre.length != now.length) {
pre.removeWhere((e) => now.any((el) => e.same(el)));
pre.addAll(now.where((e) => pre.every((el) => !e.same(el))));
final previous = pre.toList(growable: false);
final remaining = previous.toList(growable: true);
final aligned = <T>[];
for (final current in now) {
final matchIndex = remaining.indexWhere((item) => item.same(current));
if (matchIndex >= 0) {
aligned.add(remaining.removeAt(matchIndex));
} else {
aligned.add(current);
}
}
_list[length - 2] = aligned;
}
onUpdate();