-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds "devcon install" compatible command and major refactor (#16)
* Reworked error propagation * Update Devcon.cpp * Added API doc * Added MultiStringArray Code clean-up * Added missing namespace * Update Devcon.cpp * Simplifications * Update Devcon.cpp * More conversions * Update Devcon.cpp * Added devcon::update * Enabled C++23 * Used that modern magic * Improving error propagation * Update vcpkg.json * More fancy stuff * Reworked devcon::create * Update Devcon.cpp * Code clean-up Refined API docs * Reworked more functions * Improved utility class * Improved utility class * Update Devcon.cpp * Added GetDeviceRegistryProperty * Reworked devcon::restart_bth_usb_device * Update Devcon.cpp * Reworked devcon::enable_disable_bth_usb_device * Update Devcon.cpp * Reworked uninstall_device_and_driver * Update Devcon.cpp * Reworked devcon::uninstall_device_and_driver * More memory voodoo * Update Devcon.cpp * Update Devcon.cpp * Formatting * Hardened INF path processing * Reworked devcon::inf_default_install * Update Devcon.cpp * Reworked devcon::inf_default_uninstall * Update Devcon.cpp * Update Devcon.cpp * Added INFHandleGuard * Added HDEVINFOHandleGuard * More scope fun * Reworked find_by_hwid * Reworked devcon::find_by_hwid Bugfixes in property reading * Update Devcon.cpp * Improved abstractions * Update NefConUtil.cpp * Update README.md * Update README.md * Update README.md * Update NefConUtil.cpp * Converted filter functions * More modernization * Update Devcon.cpp * Updated docs * Update README.md * Update Devcon.h * Update Devcon.h * Update Devcon.cpp * Update NefConUtil.cpp * Reworking colors in console logger * Color logging overhaul * Removed unused code * Update ColorLogging.hpp * Update ColorLogging.hpp * Update NefConUtil.cpp * Removed duplicate logging to stdout * Started moving shared code to https://github.com/nefarius/neflib * Migrated stuff to neflib * Another migration * Migrated more functions * Migrated more chunks to neflib * Reworked API breaking change * Update vcpkg-configuration.json * Update vcpkg-configuration.json * Update vcpkg-configuration.json * Removed migrated types * Update NefConUtil.cpp * Migrated more functions * Update vcpkg-configuration.json * Update README.md * Update vcpkg-configuration.json * Fixed build issue * Update msbuild.yml * Ported CLI args helper * Updated neflib * Update vcpkg-configuration.json * neflib updates * Update vcpkg-configuration.json * Update vcpkg-configuration.json * Update vcpkg-configuration.json * Update vcpkg-configuration.json * Updated neflib * Update NefConUtil.cpp * Update vcpkg-configuration.json * Update vcpkg-configuration.json * Removed and replaced deprecated code * Updated neflib * Update NefConUtil.cpp * CA fixes * Implemented install command * Update NefConUtil.cpp * Exit code and logging fix * Update README.md * Update README.md * Update vcpkg-configuration.json * Update vcpkg-configuration.json * Update NefConUtil.sln.DotSettings * Update NefConUtil.cpp
- Loading branch information
Showing
19 changed files
with
429 additions
and
2,225 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
{ | ||
"cSpell.words": [ | ||
"devcon", | ||
"nefcon", | ||
"nefconc", | ||
"nefconw", | ||
"pkgs", | ||
"pnputil", | ||
"winget" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,31 @@ | ||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation"> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=attribs/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Bugprone/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=cmdl/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=cppcoreguidelines/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=DEVICEDESC/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=efcon/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=efconc/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=efconw/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=ELPP/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=HDEVINFO/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Hicpp/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Hinf/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=HKEY/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Hoeglinger/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=hwid/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=luid/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=matchstring/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=nefarius/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=nefcon/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=nefconc/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=neflib/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Newdev/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Printf/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=SPDRP/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=Stelzer/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=winapi/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=wstring/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=wstring/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=xxxx/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=xxxxxxxx/@EntryIndexedValue">True</s:Boolean> | ||
<s:Boolean x:Key="/Default/UserDictionary/Words/=xxxxxxxxxxxx/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
#pragma once | ||
|
||
#include <chrono> | ||
#include <map> | ||
#include "colorwin.hpp" | ||
#include <easylogging++.h> | ||
|
||
/** | ||
* Custom log dispatcher printing on the console (terminal) with color support. | ||
* | ||
* @author Benjamin "Nefarius" Hoeglinger-Stelzer | ||
* @date 08.08.2024 | ||
*/ | ||
class ConsoleColorLogDispatchCallback : public el::LogDispatchCallback | ||
{ | ||
std::unordered_map<el::Level, colorwin::CW_COLORS> logLevelToColor = { | ||
{el::Level::Debug, colorwin::white}, | ||
{el::Level::Info, colorwin::green}, | ||
{el::Level::Warning, colorwin::yellow}, | ||
{el::Level::Error, colorwin::red}, | ||
{el::Level::Fatal, colorwin::magenta}, | ||
{el::Level::Verbose, colorwin::white} | ||
}; | ||
|
||
protected: | ||
void handle(const el::LogDispatchData* data) noexcept override | ||
{ | ||
// Extract log message details | ||
const el::LogMessage* logMessage = data->logMessage(); | ||
const auto now = std::chrono::system_clock::now(); | ||
std::string timestamp = std::format("{:%FT%TZ}", std::chrono::time_point_cast<std::chrono::seconds>(now)); | ||
std::string level = logMessage->level() == el::Level::Debug | ||
? "DEBUG" | ||
: logMessage->level() == el::Level::Info | ||
? "INFO" | ||
: logMessage->level() == el::Level::Warning | ||
? "WARNING" | ||
: logMessage->level() == el::Level::Error | ||
? "ERROR" | ||
: logMessage->level() == el::Level::Fatal | ||
? "FATAL" | ||
: "VERBOSE"; | ||
std::string message = logMessage->message(); | ||
|
||
// scoped color | ||
{ | ||
std::cout << timestamp << " " << colorwin::color(logLevelToColor[logMessage->level()]) << level; | ||
} | ||
std::cout << " " << message << '\n'; | ||
} | ||
}; |
Oops, something went wrong.