summaryrefslogtreecommitdiff
path: root/converter/converter.cpp
diff options
context:
space:
mode:
authora1xd <[email protected]>2020-12-02 05:25:19 -0500
committera1xd <[email protected]>2020-12-02 05:25:19 -0500
commit7d14daf1d5fce4d09471a3abe2aca49cf7680816 (patch)
tree43411443aadc79d36ad1da8063208cd51fdb15fe /converter/converter.cpp
parentmerge common-install with common (diff)
downloadrawaccel-7d14daf1d5fce4d09471a3abe2aca49cf7680816.tar.xz
rawaccel-7d14daf1d5fce4d09471a3abe2aca49cf7680816.zip
embed version info into assemblies
check app versions against lib, lib against driver add an 'about' dialog which displays version details, accessible from menu refactor error handling + add check for negative offset
Diffstat (limited to 'converter/converter.cpp')
-rw-r--r--converter/converter.cpp28
1 files changed, 21 insertions, 7 deletions
diff --git a/converter/converter.cpp b/converter/converter.cpp
index af2699b..230e1be 100644
--- a/converter/converter.cpp
+++ b/converter/converter.cpp
@@ -192,7 +192,7 @@ bool try_convert(const ia_settings_t& ia_settings) {
auto errors = DriverInterop::GetSettingsErrors(new_settings);
if (!errors->Empty()) {
- Console::WriteLine("Bad settings: " + errors->x->ToArray()[0]);
+ Console::WriteLine("Bad settings: {0}", errors);
return false;
}
@@ -208,8 +208,26 @@ bool try_convert(const ia_settings_t& ia_settings) {
return true;
}
+public ref struct ASSEMBLY {
+ static initonly Version^ VERSION = ASSEMBLY::typeid->Assembly->GetName()->Version;
+};
+
int main()
{
+ auto close_prompt = [] {
+ std::cout << "Press any key to close this window . . ." << std::endl;
+ _getwch();
+ std::exit(0);
+ };
+
+ try {
+ VersionHelper::ValidateAndGetDriverVersion(ASSEMBLY::VERSION);
+ }
+ catch (VersionException^ ex) {
+ Console::WriteLine(ex->Message);
+ close_prompt();
+ }
+
std::optional<fs::path> opt_path;
if (fs::exists(IA_SETTINGS_NAME)) {
@@ -235,11 +253,8 @@ int main()
if (!try_convert(parse_ia_settings(opt_path.value())))
std::cout << "Unable to convert settings.\n";
}
- catch (DriverNotInstalledException^) {
- Console::WriteLine("\nDriver is not installed.");
- }
catch (Exception^ e) {
- Console::WriteLine("\nError: " + e->ToString());
+ Console::WriteLine("\nError: {0}", e);
}
catch (const std::exception& e) {
std::cout << "Error: " << e.what() << '\n';
@@ -251,6 +266,5 @@ int main()
"Then run this program to generate the equivalent Raw Accel settings.\n";
}
- std::cout << "Press any key to close this window . . ." << std::endl;
- _getwch();
+ close_prompt();
}