From 68a4dc5052f221cfa9bbec83da5c7d542b4568f5 Mon Sep 17 00:00:00 2001 From: fuwa Date: Sat, 22 Jun 2019 11:25:42 +0800 Subject: [PATCH] add crypto config --- cyberwow/lib/config.dart | 6 ++++-- cyberwow/lib/config/cyberwow.dart | 28 ++++++++++++++++++++++++++ cyberwow/lib/config/prototype.dart | 30 ++++++++++++++++++++++++++++ cyberwow/lib/controller/running.dart | 2 +- cyberwow/lib/main.dart | 4 ++-- cyberwow/lib/state.dart | 2 +- 6 files changed, 66 insertions(+), 6 deletions(-) create mode 100644 cyberwow/lib/config/cyberwow.dart create mode 100644 cyberwow/lib/config/prototype.dart diff --git a/cyberwow/lib/config.dart b/cyberwow/lib/config.dart index 3aba023..cc28f2c 100644 --- a/cyberwow/lib/config.dart +++ b/cyberwow/lib/config.dart @@ -19,8 +19,10 @@ along with CyberWOW. If not, see . */ -const outputBin = 'wownerod'; -const appPath = 'wownerod'; +import 'config/prototype.dart'; +import 'config/cyberwow.dart' as cryptoConfig; + +final config = cryptoConfig.config; const arch = 'arm64'; // const arch = 'x86_64'; diff --git a/cyberwow/lib/config/cyberwow.dart b/cyberwow/lib/config/cyberwow.dart new file mode 100644 index 0000000..29acf12 --- /dev/null +++ b/cyberwow/lib/config/cyberwow.dart @@ -0,0 +1,28 @@ +/* + +Copyright 2019 fuwa + +This file is part of CyberWOW. + +CyberWOW is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +CyberWOW is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with CyberWOW. If not, see . + +*/ + +import 'prototype.dart'; + +final config = CryptoConfig +( + 'wownerod', + 'wownerod', +); diff --git a/cyberwow/lib/config/prototype.dart b/cyberwow/lib/config/prototype.dart new file mode 100644 index 0000000..087e77a --- /dev/null +++ b/cyberwow/lib/config/prototype.dart @@ -0,0 +1,30 @@ +/* + +Copyright 2019 fuwa + +This file is part of CyberWOW. + +CyberWOW is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +CyberWOW is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with CyberWOW. If not, see . + +*/ + +class CryptoConfig { + final String outputBin; + final String appPath; + CryptoConfig + ( + this.outputBin, + this.appPath, + ); +} diff --git a/cyberwow/lib/controller/running.dart b/cyberwow/lib/controller/running.dart index 36fdc72..8857eeb 100644 --- a/cyberwow/lib/controller/running.dart +++ b/cyberwow/lib/controller/running.dart @@ -34,7 +34,7 @@ Stream runBinary (String name) async* { final appDocDir = await getApplicationDocumentsDirectory(); final appDocPath = appDocDir.path; - final binDir = new Directory(appDocDir.path + "/" + appPath); + final binDir = new Directory(appDocDir.path + "/" + config.appPath); await binDir.create(); diff --git a/cyberwow/lib/main.dart b/cyberwow/lib/main.dart index 26c1dce..b1ac0e5 100644 --- a/cyberwow/lib/main.dart +++ b/cyberwow/lib/main.dart @@ -80,8 +80,8 @@ class _MyHomePageState extends State const loadingText = "Follow the white rabbit."; LoadingState _loadingState = await _blankState.next(loadingText); - const binName = outputBin; - const resourcePath = 'native/output/' + arch + '/' + binName; + final binName = config.outputBin; + final resourcePath = 'native/output/' + arch + '/' + binName; final bundle = DefaultAssetBundle.of(context); final loading = deployBinary(bundle, resourcePath, binName); diff --git a/cyberwow/lib/state.dart b/cyberwow/lib/state.dart index 90c1035..02dbf55 100644 --- a/cyberwow/lib/state.dart +++ b/cyberwow/lib/state.dart @@ -106,7 +106,7 @@ class LoadingState extends HookedState { } } - final outputBinExists = await binaryExists(outputBin); + final outputBinExists = await binaryExists(config.outputBin); if (outputBinExists) { await load(); }