mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 07:14:28 +01:00
#43 new: bsd base support
This commit is contained in:
34
lib/data/model/server/system.dart
Normal file
34
lib/data/model/server/system.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'package:toolbox/data/model/app/shell_func.dart';
|
||||
|
||||
enum SystemType {
|
||||
linux._(linuxSign),
|
||||
bsd._(bsdSign),
|
||||
;
|
||||
|
||||
final String value;
|
||||
|
||||
const SystemType._(this.value);
|
||||
|
||||
static SystemType? parse(String? value) {
|
||||
if (value == null) return null;
|
||||
switch (value) {
|
||||
case linuxSign:
|
||||
return SystemType.linux;
|
||||
case bsdSign:
|
||||
return SystemType.bsd;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
bool isSegmentsLenMatch(int len) {
|
||||
switch (this) {
|
||||
case SystemType.linux:
|
||||
return len == StatusCmdType.values.length;
|
||||
case SystemType.bsd:
|
||||
return len == BSDStatusCmdType.values.length;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const linuxSign = 'linux';
|
||||
const bsdSign = 'bsd';
|
||||
Reference in New Issue
Block a user