-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from AOSXAP/main
better version
- Loading branch information
Showing
12 changed files
with
2,954 additions
and
1,953 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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
if [ "$1" == "" ]; then | ||
if [ "$OSTYPE" == "win32" ] || [ "$OSTYPE" == "msys" ]; then | ||
g++ core.cpp -o core.exe -I C:/OpenSSL/include -L C:/OpenSSL/lib -lssl -lcrypto -lws2_32 -lgdi32 && ./core.exe | ||
else | ||
g++ core.cpp -o core -lssl -lcrypto && ./core | ||
fi | ||
if [ "$OSTYPE" == "win32" ] || [ "$OSTYPE" == "msys" ]; then | ||
g++ -g core.cpp -o core.exe -I C:/OpenSSL/include -L C:/OpenSSL/lib -lssl -lcrypto -lws2_32 -lgdi32 && ./core.exe | ||
else | ||
g++ -g core.cpp -o core -lssl -lcrypto && ./core | ||
fi | ||
elif [ "$1" == "code" ]; then | ||
if [ "$2" == "original" ]; then | ||
git ls-files | grep -v -E "package.json|package-lock.json|node/build|.gitignore" | xargs wc -l | ||
else | ||
git ls-files | xargs wc -l | ||
fi | ||
fi | ||
if [ "$2" == "original" ]; then | ||
git ls-files | grep -v -E "package.json|package-lock.json|node/build|.gitignore" | xargs wc -l | ||
else | ||
git ls-files | xargs wc -l | ||
fi | ||
fi |
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,70 +1,58 @@ | ||
#pragma once | ||
|
||
#include <ostream> | ||
#include <iostream> | ||
#include <unordered_map> | ||
#include <ostream> | ||
#include <sstream> | ||
#include <unordered_map> | ||
|
||
namespace Color | ||
{ | ||
std::unordered_map<std::string, int> ColorMapLinux | ||
({ | ||
{"red" , 31}, | ||
{"blue" , 34}, | ||
{"green" , 32}, | ||
{"original", 39} | ||
}); | ||
std::unordered_map<std::string, int> ColorMapWin | ||
({ | ||
{"red" , 12}, | ||
{"blue" , 9}, | ||
{"green" , 10}, | ||
{"original", 14} | ||
}); | ||
|
||
#if defined(_WIN32) | ||
void CPRINT(std::string color , std::string print) | ||
{ | ||
int color_code; | ||
|
||
std::unordered_map<std::string,int>::iterator itr = ColorMapWin.find(color); | ||
|
||
if(itr == ColorMapWin.end()) color_code = 14; | ||
else color_code = itr->second; | ||
|
||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); | ||
SetConsoleTextAttribute(hConsole, color_code); | ||
cout << print << endl; | ||
SetConsoleTextAttribute(hConsole, 7); | ||
} | ||
#else | ||
std::string reset = "\033[0;39m\033[0m\n\n"; | ||
|
||
template <class T> | ||
void PREPSTREAMS | ||
( | ||
std::stringstream &s, std::stringstream &b , std::stringstream &e, | ||
int color_code , T print | ||
) | ||
{ | ||
b << s.rdbuf() << ";" << color_code << "m" << print; | ||
e << s.rdbuf() << "m"; b << e.rdbuf(); | ||
} | ||
|
||
template <class T> | ||
void CPRINT(std::string color , T print) | ||
{ | ||
int color_code; | ||
|
||
std::unordered_map<std::string,int>::iterator itr = ColorMapLinux.find(color); | ||
|
||
if(itr == ColorMapLinux.end()) color_code = 39; | ||
else color_code = itr->second; | ||
|
||
std::stringstream ss("\033[0") , begin , end; | ||
PREPSTREAMS(ss , begin , end , color_code , print); | ||
|
||
std::cout << begin.rdbuf() << reset; | ||
} | ||
#endif | ||
} | ||
namespace Color { | ||
std::unordered_map<std::string, int> | ||
ColorMapLinux({{"red", 31}, {"blue", 34}, {"green", 32}, {"original", 39}}); | ||
std::unordered_map<std::string, int> | ||
ColorMapWin({{"red", 12}, {"blue", 9}, {"green", 10}, {"original", 14}}); | ||
|
||
#if defined(_WIN32) | ||
void CPRINT(std::string color, std::string print) { | ||
int color_code; | ||
|
||
std::unordered_map<std::string, int>::iterator itr = ColorMapWin.find(color); | ||
|
||
if (itr == ColorMapWin.end()) | ||
color_code = 14; | ||
else | ||
color_code = itr->second; | ||
|
||
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE); | ||
SetConsoleTextAttribute(hConsole, color_code); | ||
cout << print << endl; | ||
SetConsoleTextAttribute(hConsole, 7); | ||
} | ||
#else | ||
std::string reset = "\033[0;39m\033[0m\n\n"; | ||
|
||
template <class T> | ||
void PREPSTREAMS(std::stringstream &s, std::stringstream &b, | ||
std::stringstream &e, int color_code, T print) { | ||
b << s.rdbuf() << ";" << color_code << "m" << print; | ||
e << s.rdbuf() << "m"; | ||
b << e.rdbuf(); | ||
} | ||
|
||
template <class T> void CPRINT(std::string color, T print) { | ||
int color_code; | ||
|
||
std::unordered_map<std::string, int>::iterator itr = | ||
ColorMapLinux.find(color); | ||
|
||
if (itr == ColorMapLinux.end()) | ||
color_code = 39; | ||
else | ||
color_code = itr->second; | ||
|
||
std::stringstream ss("\033[0"), begin, end; | ||
PREPSTREAMS(ss, begin, end, color_code, print); | ||
|
||
std::cout << begin.rdbuf() << reset; | ||
} | ||
#endif | ||
} // namespace Color |
Oops, something went wrong.