mirror of
https://github.com/lollipopkit/flutter_server_box.git
synced 2025-12-17 23:34:24 +01:00
Remove SFTP download
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import 'dart:math';
|
||||
import 'package:toolbox/core/extension/numx.dart';
|
||||
|
||||
class NetSpeedPart {
|
||||
String device;
|
||||
@@ -27,45 +27,31 @@ class NetSpeed {
|
||||
|
||||
String speedIn({String? device}) {
|
||||
if (old[0].device == '' || now[0].device == '') return '0kb/s';
|
||||
int idx = 0;
|
||||
if (device != null) {
|
||||
for (var item in now) {
|
||||
if (item.device == device) {
|
||||
idx = now.indexOf(item);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
final idx = deviceIdx(device);
|
||||
final speedInBytesPerSecond =
|
||||
(now[idx].bytesIn - old[idx].bytesIn) / timeDiff;
|
||||
int squareTimes = 0;
|
||||
for (; speedInBytesPerSecond / pow(1024, squareTimes) > 1024;) {
|
||||
if (squareTimes >= suffixs.length - 1) break;
|
||||
squareTimes++;
|
||||
}
|
||||
return '${(speedInBytesPerSecond / pow(1024, squareTimes)).toStringAsFixed(1)} ${suffixs[squareTimes]}';
|
||||
return buildStandardOutput(speedInBytesPerSecond);
|
||||
}
|
||||
|
||||
String speedOut({String? device}) {
|
||||
if (old[0].device == '' || now[0].device == '') return '0kb/s';
|
||||
int idx = 0;
|
||||
final idx = deviceIdx(device);
|
||||
final speedInBytesPerSecond =
|
||||
(now[idx].bytesOut - old[idx].bytesOut) / timeDiff;
|
||||
return buildStandardOutput(speedInBytesPerSecond);
|
||||
}
|
||||
|
||||
int deviceIdx(String? device) {
|
||||
if (device != null) {
|
||||
for (var item in now) {
|
||||
if (item.device == device) {
|
||||
idx = now.indexOf(item);
|
||||
break;
|
||||
return now.indexOf(item);
|
||||
}
|
||||
}
|
||||
}
|
||||
final speedInBytesPerSecond =
|
||||
(now[idx].bytesOut - old[idx].bytesOut) / timeDiff;
|
||||
int squareTimes = 0;
|
||||
for (; speedInBytesPerSecond / pow(1024, squareTimes) > 1024;) {
|
||||
if (squareTimes >= suffixs.length - 1) break;
|
||||
squareTimes++;
|
||||
}
|
||||
return '${(speedInBytesPerSecond / pow(1024, squareTimes)).toStringAsFixed(1)} ${suffixs[squareTimes]}';
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
const suffixs = ['b/s', 'kb/s', 'mb/s', 'gb/s'];
|
||||
String buildStandardOutput(double speed) =>
|
||||
'${speed.convertBytes.toLowerCase()}/s';
|
||||
}
|
||||
|
||||
@@ -2,9 +2,9 @@
|
||||
|
||||
class BuildData {
|
||||
static const String name = "ServerBox";
|
||||
static const int build = 108;
|
||||
static const int build = 109;
|
||||
static const String engine =
|
||||
"Flutter 2.10.3 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision 7e9793dee1 (8 days ago) • 2022-03-02 11:23:12 -0600\nEngine • revision bd539267b4\nTools • Dart 2.16.1 • DevTools 2.9.2\n";
|
||||
static const String buildAt = "2022-03-10 15:25:32.032568";
|
||||
static const int modifications = 0;
|
||||
"Flutter 2.10.4 • channel stable • https://github.com/flutter/flutter.git\nFramework • revision c860cba910 (12 days ago) • 2022-03-25 00:23:12 -0500\nEngine • revision 57d3bac3dd\nTools • Dart 2.16.2 • DevTools 2.9.2\n";
|
||||
static const String buildAt = "2022-04-06 13:00:26.954649";
|
||||
static const int modifications = 7;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user