Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxLHy0424 committed Sep 11, 2024
1 parent bf437c7 commit 115202c
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 26 deletions.
8 changes: 4 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ auto main(i32 argc,i8 *argv[])->i32{
if(IsUserAnAdmin()){
ui.push(
" > 极域电子教室 ",Mod::op,
new Mod::ArgvOp{'C',Mod::rule.mythware.exe,Mod::rule.mythware.svc}
new Mod::ArgvOp{'c',Mod::rule.mythware.exe,Mod::rule.mythware.svc}
);
if(opt.viewWide){
ui.push("\0");
}
ui.push(
" > 联想云教室 ",Mod::op,
new Mod::ArgvOp{'C',Mod::rule.lenovo.exe,Mod::rule.lenovo.svc}
new Mod::ArgvOp{'c',Mod::rule.lenovo.exe,Mod::rule.lenovo.svc}
);
}else{
ui.push(" (i) 需要提权.");
Expand All @@ -74,14 +74,14 @@ auto main(i32 argc,i8 *argv[])->i32{
if(IsUserAnAdmin()){
ui.push(
" > 极域电子教室 ",Mod::op,
new Mod::ArgvOp{'R',Mod::rule.mythware.exe,Mod::rule.mythware.svc}
new Mod::ArgvOp{'r',Mod::rule.mythware.exe,Mod::rule.mythware.svc}
);
if(opt.viewWide){
ui.push("\0");
}
ui.push(
" > 联想云教室 ",Mod::op,
new Mod::ArgvOp{'R',Mod::rule.lenovo.exe,Mod::rule.lenovo.svc}
new Mod::ArgvOp{'r',Mod::rule.lenovo.exe,Mod::rule.lenovo.svc}
);
}else{
ui.push(" (i) 需要提权.");
Expand Down
22 changes: 11 additions & 11 deletions src/mod.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,27 +85,27 @@ namespace Mod{
auto op(Data data){
std::string cmd;
switch(((ArgvOp*)data.argv)->m){
case 'C':{
for(const auto &i:((ArgvOp*)data.argv)->exe){
case 'c':{
for(const auto &ref:((ArgvOp*)data.argv)->exe){
cmd="reg add \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution options\\"
+(std::string)i+".exe\" /f /t reg_sz /v debugger /d ?";
+(std::string)ref+".exe\" /f /t reg_sz /v debugger /d ?";
system(cmd.c_str());
cmd="taskKill /f /im "+(std::string)i+".exe";
cmd="taskKill /f /im "+(std::string)ref+".exe";
system(cmd.c_str());
}
for(const auto &i:((ArgvOp*)data.argv)->svc){
cmd="net stop "+(std::string)i+" /y";
for(const auto &ref:((ArgvOp*)data.argv)->svc){
cmd="net stop "+(std::string)ref+" /y";
system(cmd.c_str());
}
break;
}case 'R':{
for(const auto &i:((ArgvOp*)data.argv)->exe){
}case 'r':{
for(const auto &ref:((ArgvOp*)data.argv)->exe){
cmd="reg delete \"HKLM\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Image File Execution options\\"
+(std::string)i+".exe\" /f";
+(std::string)ref+".exe\" /f";
system(cmd.c_str());
}
for(const auto &i:((ArgvOp*)data.argv)->svc){
cmd="net start "+(std::string)i;
for(const auto &ref:((ArgvOp*)data.argv)->svc){
cmd="net start "+(std::string)ref;
system(cmd.c_str());
}
break;
Expand Down
22 changes: 11 additions & 11 deletions src/ui.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ class CUI final{
~Item(){}
auto setColor(i8 m){
switch(m){
case 'D':{
case 'd':{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),colorDef);
colorLast=colorDef;
break;
}case 'H':{
}case 'h':{
SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),colorHighlight);
colorLast=colorHighlight;
break;
Expand All @@ -62,10 +62,10 @@ class CUI final{
CONSOLE_CURSOR_INFO cursorInfo;
GetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE),&cursorInfo);
switch(m){
case 'H':{
case 'h':{
cursorInfo.bVisible=false;
break;
}case 'S':{
}case 's':{
cursorInfo.bVisible=true;
break;
}
Expand Down Expand Up @@ -140,18 +140,18 @@ class CUI final{
cls();
for(auto &ref:uiItem){
ref.pos=getCursor();
ref.setColor('D');
ref.setColor('d');
write(ref.text,true);
}
}
auto refresh(COORD &hangPos){
for(auto &ref:uiItem){
if((ref==hangPos)&&(ref.colorLast!=ref.colorHighlight)){
ref.setColor('H');
ref.setColor('h');
rewrite(ref);
}
if((ref!=hangPos)&&(ref.colorLast!=ref.colorDef)){
ref.setColor('D');
ref.setColor('d');
rewrite(ref);
}
}
Expand All @@ -163,12 +163,12 @@ class CUI final{
if(ref.fn!=nullptr){
system("cls");
cls();
ref.setColor('D');
ref.setColor('d');
opAttrs('+');
opCursor('S');
opCursor('s');
isExit=ref.fn(Data{mouseEvent,this,ref.argv});
opAttrs('-');
opCursor('H');
opCursor('h');
initPos();
}
break;
Expand All @@ -194,7 +194,7 @@ class CUI final{
}
auto show(){
opAttrs('-');
opCursor('H');
opCursor('h');
MOUSE_EVENT_RECORD mouseEvent;
Sleep(50);
initPos();
Expand Down

0 comments on commit 115202c

Please sign in to comment.