diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index 18ac487..14fdd23 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -36,9 +36,15 @@ jobs:
- run: dart run build_runner build --delete-conflicting-outputs
working-directory: common
- - run: dart compile exe common/bin/main.dart -o revitool.exe
+ - name: Build revitool CLI
+ run: dart compile exe common/bin/main.dart -o revitool.exe
- - run: flutter build windows --build-name=${{ env.NEW_VERSION }} --build-number=1 --obfuscate --split-debug-info=/symbols --dart-define="APP_VERSION=${{ env.NEW_VERSION }}"
+ - name: Enable Administrator Privileges for revitool CLI app
+ run: |
+ mt.exe -manifest common/app.manifest -outputresource:revitool.exe;1
+
+ - name: Build revitool GUI
+ run: flutter build windows --build-name=${{ env.NEW_VERSION }} --build-number=1 --obfuscate --split-debug-info=/symbols --dart-define="APP_VERSION=${{ env.NEW_VERSION }}"
working-directory: gui
- name: Build Installer
diff --git a/.vscode/launch.json b/.vscode/launch.json
deleted file mode 100644
index 74700b9..0000000
--- a/.vscode/launch.json
+++ /dev/null
@@ -1,25 +0,0 @@
-{
- // Use IntelliSense to learn about possible attributes.
- // Hover to view descriptions of existing attributes.
- // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
- "version": "0.2.0",
- "configurations": [
- {
- "name": "revision-tool",
- "request": "launch",
- "type": "dart"
- },
- {
- "name": "revision-tool (profile mode)",
- "request": "launch",
- "type": "dart",
- "flutterMode": "profile"
- },
- {
- "name": "revision-tool (release mode)",
- "request": "launch",
- "type": "dart",
- "flutterMode": "release"
- }
- ]
-}
\ No newline at end of file
diff --git a/common/.gitignore b/common/.gitignore
index da34992..0cede79 100644
--- a/common/.gitignore
+++ b/common/.gitignore
@@ -45,3 +45,5 @@ app.*.map.json
/android/app/debug
/android/app/profile
/android/app/release
+
+*.exe
\ No newline at end of file
diff --git a/common/app.manifest b/common/app.manifest
new file mode 100644
index 0000000..0dac854
--- /dev/null
+++ b/common/app.manifest
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/common/bin/main.dart b/common/bin/main.dart
index 8e208a6..6ee2175 100644
--- a/common/bin/main.dart
+++ b/common/bin/main.dart
@@ -4,23 +4,30 @@ import 'package:args/command_runner.dart';
import 'package:common/common.dart';
Future main(List args) async {
- if (args.isNotEmpty) {
- if (!WinRegistryService.isSupported || !Directory(ameTemp).existsSync()) {
- logger.i(
- 'Unsupported build detected. Please apply ReviOS on your system',
- );
- exit(55);
+ if (!WinRegistryService.isSupported && !Directory(ameTemp).existsSync()) {
+ logger.i('Unsupported build detected. Please apply ReviOS on your system');
+ exit(55);
+ }
+
+ if (args.isEmpty) {
+ final guiPath =
+ "${mainPath.substring(0, mainPath.lastIndexOf("\\"))}\\revitoolw.exe";
+ if (await Directory(guiPath).exists()) {
+ await Process.start('revitoolw', []);
+ exit(0);
}
- final vers =
- const String.fromEnvironment("APP_VERSION").replaceAll(".", "");
- stdout.writeln("Running Revision Tool $vers");
- final runner = CommandRunner("revitool", "Revision Tool CLI")
- ..addCommand(MSStoreCommand())
- ..addCommand(DefenderCommand())
- ..addCommand(WindowsPackageCommand())
- ..addCommand(PlaybookPatchesCommand());
- // ..addCommand(RecommendationCommand());
- await runner.run(args);
- exit(0);
+ exit(1);
}
+
+ logger.i('Revision Tool CLI is starting');
+
+ final runner = CommandRunner("revitool",
+ "Revision Tool CLI v${const String.fromEnvironment('APP_VERSION')}")
+ ..addCommand(MSStoreCommand())
+ ..addCommand(DefenderCommand())
+ ..addCommand(WindowsPackageCommand())
+ ..addCommand(PlaybookPatchesCommand());
+ // ..addCommand(RecommendationCommand());
+ await runner.run(args);
+ exit(0);
}
diff --git a/common/lib/src/utils.dart b/common/lib/src/utils.dart
index 0e068e7..813f61e 100644
--- a/common/lib/src/utils.dart
+++ b/common/lib/src/utils.dart
@@ -13,7 +13,7 @@ final tempReviPath = p.join(Directory.systemTemp.path, 'Revision-Tool', 'Logs');
final logger = Logger(
filter: ProductionFilter(),
- printer: PrettyPrinter(), // Use the PrettyPrinter to format and print log
+ printer: PrettyPrinter(),
output: FileOutput(
overrideExisting: true,
file: File.fromUri(
diff --git a/common/pubspec.lock b/common/pubspec.lock
index c43145e..461f4ac 100644
--- a/common/pubspec.lock
+++ b/common/pubspec.lock
@@ -127,7 +127,7 @@ packages:
source: hosted
version: "4.10.0"
collection:
- dependency: transitive
+ dependency: "direct main"
description:
name: collection
sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
@@ -142,14 +142,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.1.1"
- coverage:
- dependency: transitive
- description:
- name: coverage
- sha256: c1fb2dce3c0085f39dc72668e85f8e0210ec7de05345821ff58530567df345a5
- url: "https://pub.dev"
- source: hosted
- version: "1.9.2"
crypto:
dependency: transitive
description:
@@ -350,14 +342,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.0.6"
- node_preamble:
- dependency: transitive
- description:
- name: node_preamble
- sha256: "6e7eac89047ab8a8d26cf16127b5ed26de65209847630400f9aefd7cd5c730db"
- url: "https://pub.dev"
- source: hosted
- version: "2.0.2"
package_config:
dependency: transitive
description:
@@ -422,22 +406,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.4.1"
- shelf_packages_handler:
- dependency: transitive
- description:
- name: shelf_packages_handler
- sha256: "89f967eca29607c933ba9571d838be31d67f53f6e4ee15147d5dc2934fee1b1e"
- url: "https://pub.dev"
- source: hosted
- version: "3.0.2"
- shelf_static:
- dependency: transitive
- description:
- name: shelf_static
- sha256: c87c3875f91262785dade62d135760c2c69cb217ac759485334c5857ad89f6e3
- url: "https://pub.dev"
- source: hosted
- version: "1.1.3"
shelf_web_socket:
dependency: transitive
description:
@@ -462,22 +430,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.4"
- source_map_stack_trace:
- dependency: transitive
- description:
- name: source_map_stack_trace
- sha256: c0713a43e323c3302c2abe2a1cc89aa057a387101ebd280371d6a6c9fa68516b
- url: "https://pub.dev"
- source: hosted
- version: "2.1.2"
- source_maps:
- dependency: transitive
- description:
- name: source_maps
- sha256: "708b3f6b97248e5781f493b765c3337db11c5d2c81c3094f10904bfa8004c703"
- url: "https://pub.dev"
- source: hosted
- version: "0.10.12"
source_span:
dependency: transitive
description:
@@ -534,14 +486,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.1"
- test:
- dependency: "direct dev"
- description:
- name: test
- sha256: "713a8789d62f3233c46b4a90b174737b2c04cb6ae4500f2aa8b1be8f03f5e67f"
- url: "https://pub.dev"
- source: hosted
- version: "1.25.8"
test_api:
dependency: transitive
description:
@@ -550,14 +494,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.7.3"
- test_core:
- dependency: transitive
- description:
- name: test_core
- sha256: "12391302411737c176b0b5d6491f466b0dd56d4763e347b6714efbaa74d7953d"
- url: "https://pub.dev"
- source: hosted
- version: "0.6.5"
timing:
dependency: transitive
description:
@@ -574,14 +510,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.3.2"
- vm_service:
- dependency: transitive
- description:
- name: vm_service
- sha256: f6be3ed8bd01289b34d679c2b62226f63c0e69f9fd2e50a6b3c1c729a961041b
- url: "https://pub.dev"
- source: hosted
- version: "14.3.0"
watcher:
dependency: transitive
description:
@@ -614,14 +542,6 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.1"
- webkit_inspection_protocol:
- dependency: transitive
- description:
- name: webkit_inspection_protocol
- sha256: "87d3f2333bb240704cd3f1c6b5b7acd8a10e7f0bc28c28dcf14e782014f4a572"
- url: "https://pub.dev"
- source: hosted
- version: "1.2.1"
win32:
dependency: transitive
description:
diff --git a/common/pubspec.yaml b/common/pubspec.yaml
index 81b9dc7..4f80fb2 100644
--- a/common/pubspec.yaml
+++ b/common/pubspec.yaml
@@ -8,8 +8,6 @@ environment:
# Add regular dependencies here.
dependencies:
- args: ^2.4.2
- # collection: ^1.19.0
# Network
dio: ^5.7.0
@@ -22,14 +20,16 @@ dependencies:
logger: ^2.4.0
# Other
+ args: ^2.5.0
path: ^1.9.0
process_run: ^1.2.0+1
win32_registry: ^1.1.5
xml: ^6.5.0
+ collection: ^1.18.0
dev_dependencies:
build_runner: ^2.4.12
freezed: ^2.5.7
json_serializable: ^6.8.0
lints: ^4.0.0
- test: ^1.24.0
+ # test: ^1.24.0
diff --git a/gui/lib/main.dart b/gui/lib/main.dart
index 821dbfd..84f57c6 100644
--- a/gui/lib/main.dart
+++ b/gui/lib/main.dart
@@ -16,10 +16,10 @@ import 'package:system_theme/system_theme.dart';
import 'package:win32_registry/win32_registry.dart';
import 'package:window_plus/window_plus.dart';
-Future main(List args) async {
+Future main() async {
WidgetsFlutterBinding.ensureInitialized();
- logger.i('Revision Tool is starting');
+ logger.i('Revision Tool GUI is starting');
if (WinRegistryService.isSupported) {
logger.i('isSupported is true');
diff --git a/gui/windows/CMakeLists.txt b/gui/windows/CMakeLists.txt
index c63195e..f342b1a 100644
--- a/gui/windows/CMakeLists.txt
+++ b/gui/windows/CMakeLists.txt
@@ -106,3 +106,6 @@ install(DIRECTORY "${PROJECT_BUILD_DIR}/${FLUTTER_ASSET_DIR_NAME}"
install(FILES "${AOT_LIBRARY}" DESTINATION "${INSTALL_BUNDLE_DATA_DIR}"
CONFIGURATIONS Profile;Release
COMPONENT Runtime)
+
+# Run as administrator
+SET_TARGET_PROPERTIES(${BINARY_NAME} PROPERTIES LINK_FLAGS "/MANIFESTUAC:\"level='requireAdministrator' uiAccess='false'\" /SUBSYSTEM:WINDOWS")
\ No newline at end of file
diff --git a/gui/windows/runner/Runner.rc b/gui/windows/runner/Runner.rc
index 5f8ac87..10379be 100644
--- a/gui/windows/runner/Runner.rc
+++ b/gui/windows/runner/Runner.rc
@@ -94,7 +94,7 @@ BEGIN
VALUE "FileVersion", VERSION_AS_STRING "\0"
VALUE "InternalName", "Revision Tool" "\0"
VALUE "LegalCopyright", "Copyright (C) MeetRevision. All rights reserved." "\0"
- VALUE "OriginalFilename", "gui.exe" "\0"
+ VALUE "OriginalFilename", "revitoolw.exe" "\0"
VALUE "ProductName", "Revision Tool" "\0"
VALUE "ProductVersion", VERSION_AS_STRING "\0"
END