chore: replace double quotes to single quotes (https://github.com/flutter/flutter/blob/master/docs/contributing/Style-guide-for-Flutter-repo.md#prefer-single-quotes-for-strings)
This commit is contained in:
@@ -41,18 +41,18 @@ class _ApplicationExitControlState extends State<ApplicationExitControl> {
|
|||||||
|
|
||||||
// Uninstall tap device before exit
|
// Uninstall tap device before exit
|
||||||
final findTapResult = await Process.run(
|
final findTapResult = await Process.run(
|
||||||
"./tools/driver/devcon.exe",
|
'./tools/driver/devcon.exe',
|
||||||
["hwids", "tap0901"],
|
['hwids', 'tap0901'],
|
||||||
);
|
);
|
||||||
if (!findTapResult.stdout
|
if (!findTapResult.stdout
|
||||||
.toString()
|
.toString()
|
||||||
.contains('No matching devices found.')) {
|
.contains('No matching devices found.')) {
|
||||||
// Unstall tap device
|
// Unstall tap device
|
||||||
await Process.run(
|
await Process.run(
|
||||||
"./tools/driver/devcon.exe",
|
'./tools/driver/devcon.exe',
|
||||||
[
|
[
|
||||||
"remove",
|
'remove',
|
||||||
"tap0901",
|
'tap0901',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@@ -147,7 +147,7 @@ class _ControlPageState extends State<ControlPage> {
|
|||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
child: const Text("保存")),
|
child: const Text('保存')),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
@@ -172,13 +172,13 @@ class _ControlPageState extends State<ControlPage> {
|
|||||||
// Turn on firewall
|
// Turn on firewall
|
||||||
if (SharedPrefSingleton().autoFirewall) {
|
if (SharedPrefSingleton().autoFirewall) {
|
||||||
await Process.run(
|
await Process.run(
|
||||||
"netsh.exe",
|
'netsh.exe',
|
||||||
[
|
[
|
||||||
"advfirewall",
|
'advfirewall',
|
||||||
"set",
|
'set',
|
||||||
"allprofiles",
|
'allprofiles',
|
||||||
"state",
|
'state',
|
||||||
"on",
|
'on',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -199,53 +199,53 @@ class _ControlPageState extends State<ControlPage> {
|
|||||||
|
|
||||||
// Check for tap device
|
// Check for tap device
|
||||||
final findTapResult = await Process.run(
|
final findTapResult = await Process.run(
|
||||||
"./tools/driver/devcon.exe",
|
'./tools/driver/devcon.exe',
|
||||||
["hwids", "tap0901"],
|
['hwids', 'tap0901'],
|
||||||
);
|
);
|
||||||
if (findTapResult.stdout
|
if (findTapResult.stdout
|
||||||
.toString()
|
.toString()
|
||||||
.contains('No matching devices found.')) {
|
.contains('No matching devices found.')) {
|
||||||
// Install tap device
|
// Install tap device
|
||||||
EdgeState.instance.logger
|
EdgeState.instance.logger
|
||||||
.addLog("Tap device not found, installing tap");
|
.addLog('Tap device not found, installing tap');
|
||||||
debugPrint("Tap device not found, installing tap");
|
debugPrint('Tap device not found, installing tap');
|
||||||
final installTapResult = await Process.run(
|
final installTapResult = await Process.run(
|
||||||
"./tools/driver/devcon.exe",
|
'./tools/driver/devcon.exe',
|
||||||
[
|
[
|
||||||
"install",
|
'install',
|
||||||
"./tools/driver/OemVista.inf",
|
'./tools/driver/OemVista.inf',
|
||||||
"tap0901",
|
'tap0901',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
if (installTapResult.stdout.toString().contains(
|
if (installTapResult.stdout.toString().contains(
|
||||||
"Tap driver installed successfully.") ||
|
'Tap driver installed successfully.') ||
|
||||||
installTapResult.stdout.toString().contains(
|
installTapResult.stdout.toString().contains(
|
||||||
"Drivers installed successfully.")) {
|
'Drivers installed successfully.')) {
|
||||||
EdgeState.instance.logger
|
EdgeState.instance.logger
|
||||||
.addLog("Tap driver installed successfully.");
|
.addLog('Tap driver installed successfully.');
|
||||||
debugPrint("Tap driver installed successfully.");
|
debugPrint('Tap driver installed successfully.');
|
||||||
} else {
|
} else {
|
||||||
EdgeState.instance.logger
|
EdgeState.instance.logger
|
||||||
.addLog("Tap driver install failed.");
|
.addLog('Tap driver install failed.');
|
||||||
debugPrint("Tap driver install failed.");
|
debugPrint('Tap driver install failed.');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Ignore.
|
// Ignore.
|
||||||
EdgeState.instance.logger
|
EdgeState.instance.logger
|
||||||
.addLog("Tap device already installed");
|
.addLog('Tap device already installed');
|
||||||
debugPrint("Tap device already installed");
|
debugPrint('Tap device already installed');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Close firewall
|
// Close firewall
|
||||||
if (SharedPrefSingleton().autoFirewall) {
|
if (SharedPrefSingleton().autoFirewall) {
|
||||||
await Process.run(
|
await Process.run(
|
||||||
"netsh.exe",
|
'netsh.exe',
|
||||||
[
|
[
|
||||||
"advfirewall",
|
'advfirewall',
|
||||||
"set",
|
'set',
|
||||||
"allprofiles",
|
'allprofiles',
|
||||||
"state",
|
'state',
|
||||||
"off",
|
'off',
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -253,24 +253,24 @@ class _ControlPageState extends State<ControlPage> {
|
|||||||
// Start the edge
|
// Start the edge
|
||||||
// edge -c <community> -k <communityKey> -a <selfAddress> -r -l <remoteSuperNodeAddress>
|
// edge -c <community> -k <communityKey> -a <selfAddress> -r -l <remoteSuperNodeAddress>
|
||||||
Process.start(
|
Process.start(
|
||||||
"./tools/edge/edge.exe",
|
'./tools/edge/edge.exe',
|
||||||
[
|
[
|
||||||
"-l",
|
'-l',
|
||||||
_supernodeController.text,
|
_supernodeController.text,
|
||||||
"-c",
|
'-c',
|
||||||
_communityController.text,
|
_communityController.text,
|
||||||
"-k",
|
'-k',
|
||||||
_keyController.text,
|
_keyController.text,
|
||||||
"-a",
|
'-a',
|
||||||
_selfAddressController.text,
|
_selfAddressController.text,
|
||||||
"-r",
|
'-r',
|
||||||
],
|
],
|
||||||
).then((process) async {
|
).then((process) async {
|
||||||
EdgeState.instance.isRunning = true;
|
EdgeState.instance.isRunning = true;
|
||||||
EdgeState.instance.process = process;
|
EdgeState.instance.process = process;
|
||||||
EdgeState.instance.logger
|
EdgeState.instance.logger
|
||||||
.addLog("edge.exe starting");
|
.addLog('edge.exe starting');
|
||||||
debugPrint("edge.exe starting");
|
debugPrint('edge.exe starting');
|
||||||
setState(() {
|
setState(() {
|
||||||
_edgeConnecting = false;
|
_edgeConnecting = false;
|
||||||
});
|
});
|
||||||
@@ -285,16 +285,16 @@ class _ControlPageState extends State<ControlPage> {
|
|||||||
EdgeState.instance.isRunning = false;
|
EdgeState.instance.isRunning = false;
|
||||||
EdgeState.instance.process = null;
|
EdgeState.instance.process = null;
|
||||||
EdgeState.instance.logger
|
EdgeState.instance.logger
|
||||||
.addLog("edge.exe closing");
|
.addLog('edge.exe closing');
|
||||||
debugPrint("edge.exe closing");
|
debugPrint('edge.exe closing');
|
||||||
if (!mounted) return;
|
if (!mounted) return;
|
||||||
setState(() {});
|
setState(() {});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
child: EdgeState.instance.isRunning
|
child: EdgeState.instance.isRunning
|
||||||
? const Text("断开连接")
|
? const Text('断开连接')
|
||||||
: const Text("开始连接"),
|
: const Text('开始连接'),
|
||||||
),
|
),
|
||||||
TextButton(
|
TextButton(
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
@@ -411,7 +411,7 @@ class _ControlPageState extends State<ControlPage> {
|
|||||||
Navigator.pop(context);
|
Navigator.pop(context);
|
||||||
return;
|
return;
|
||||||
},
|
},
|
||||||
child: const Text("取消"),
|
child: const Text('取消'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
@@ -421,7 +421,7 @@ class _ControlPageState extends State<ControlPage> {
|
|||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: const Text("使用配置")),
|
child: const Text('使用配置')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
|
@@ -27,7 +27,7 @@ class _HomePageState extends State<HomePage> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Must contain a default widget.
|
// Must contain a default widget.
|
||||||
return const Text("Default");
|
return const Text('Default');
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
|
@@ -35,12 +35,12 @@ class _SettingPageState extends State<SettingPage> {
|
|||||||
..removeCurrentSnackBar()
|
..removeCurrentSnackBar()
|
||||||
..showSnackBar(
|
..showSnackBar(
|
||||||
const SnackBar(
|
const SnackBar(
|
||||||
content: Text("功能暂未开发, 敬请期待~"),
|
content: Text('功能暂未开发, 敬请期待~'),
|
||||||
duration: Duration(seconds: 2),
|
duration: Duration(seconds: 2),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
child: const Text("检查更新"),
|
child: const Text('检查更新'),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
|
@@ -9,14 +9,14 @@ class SharedPrefSingleton {
|
|||||||
_pref = await SharedPreferences.getInstance();
|
_pref = await SharedPreferences.getInstance();
|
||||||
}
|
}
|
||||||
|
|
||||||
Future<bool> setAutoFirewall(bool ok) => _pref.setBool("auto_firewall", ok);
|
Future<bool> setAutoFirewall(bool ok) => _pref.setBool('auto_firewall', ok);
|
||||||
bool get autoFirewall => _pref.getBool("auto_firewall") ?? true;
|
bool get autoFirewall => _pref.getBool('auto_firewall') ?? true;
|
||||||
|
|
||||||
Future<bool> setAppTheme(bool ok) => _pref.setBool("app_theme", ok);
|
Future<bool> setAppTheme(bool ok) => _pref.setBool('app_theme', ok);
|
||||||
// false = dark, true = light
|
// false = dark, true = light
|
||||||
bool get appTheme => _pref.getBool("app_theme") ?? false;
|
bool get appTheme => _pref.getBool('app_theme') ?? false;
|
||||||
|
|
||||||
Future<bool> setSavedConnection(String config) =>
|
Future<bool> setSavedConnection(String config) =>
|
||||||
_pref.setString("saved_connection", config);
|
_pref.setString('saved_connection', config);
|
||||||
String get savedConnection => _pref.getString("saved_connection") ?? "[]";
|
String get savedConnection => _pref.getString('saved_connection') ?? '[]';
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user