diff --git a/.vscode/c_cpp_properties.json b/.vscode/c_cpp_properties.json deleted file mode 100644 index 89bd7bf..0000000 --- a/.vscode/c_cpp_properties.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "configurations": [ - { - "name": "windows-gcc-x64", - "includePath": [ - "${workspaceFolder}/**" - ], - "compilerPath": "D:/TDM-GCC/bin/gcc.exe", - "cStandard": "${default}", - "cppStandard": "${default}", - "intelliSenseMode": "windows-gcc-x64", - "compilerArgs": [ - "" - ] - } - ], - "version": 4 -} \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json deleted file mode 100644 index 93dc78b..0000000 --- a/.vscode/launch.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "version": "0.2.0", - "configurations": [ - { - "name": "C/C++ Runner: Debug Session", - "type": "cppdbg", - "request": "launch", - "args": [], - "stopAtEntry": false, - "externalConsole": true, - "cwd": "c:/Users/Admin/gitee/code", - "program": "c:/Users/Admin/gitee/code/build/Debug/outDebug", - "MIMode": "gdb", - "miDebuggerPath": "gdb", - "setupCommands": [ - { - "description": "Enable pretty-printing for gdb", - "text": "-enable-pretty-printing", - "ignoreFailures": true - } - ] - } - ] -} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index b9edcdb..70e34ec 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,63 +1,3 @@ { - "C_Cpp_Runner.cCompilerPath": "gcc", - "C_Cpp_Runner.cppCompilerPath": "g++", - "C_Cpp_Runner.debuggerPath": "gdb", - "C_Cpp_Runner.cStandard": "", - "C_Cpp_Runner.cppStandard": "", - "C_Cpp_Runner.msvcBatchPath": "C:/Program Files/Microsoft Visual Studio/VR_NR/Community/VC/Auxiliary/Build/vcvarsall.bat", - "C_Cpp_Runner.useMsvc": false, - "C_Cpp_Runner.warnings": [ - "-Wall", - "-Wextra", - "-Wpedantic", - "-Wshadow", - "-Wformat=2", - "-Wcast-align", - "-Wconversion", - "-Wsign-conversion", - "-Wnull-dereference" - ], - "C_Cpp_Runner.msvcWarnings": [ - "/W4", - "/permissive-", - "/w14242", - "/w14287", - "/w14296", - "/w14311", - "/w14826", - "/w44062", - "/w44242", - "/w14905", - "/w14906", - "/w14263", - "/w44265", - "/w14928" - ], - "C_Cpp_Runner.enableWarnings": true, - "C_Cpp_Runner.warningsAsError": false, - "C_Cpp_Runner.compilerArgs": [], - "C_Cpp_Runner.linkerArgs": [], - "C_Cpp_Runner.includePaths": [], - "C_Cpp_Runner.includeSearch": [ - "*", - "**/*" - ], - "C_Cpp_Runner.excludeSearch": [ - "**/build", - "**/build/**", - "**/.*", - "**/.*/**", - "**/.vscode", - "**/.vscode/**" - ], - "C_Cpp_Runner.useAddressSanitizer": false, - "C_Cpp_Runner.useUndefinedSanitizer": false, - "C_Cpp_Runner.useLeakSanitizer": false, - "C_Cpp_Runner.showCompilationTime": false, - "C_Cpp_Runner.useLinkTimeOptimization": false, - "C_Cpp_Runner.msvcSecureNoWarnings": false, - "files.associations": { - "iosfwd": "cpp", - "ostream": "cpp" - } + "C_Cpp.errorSquiggles": "disabled" } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 2161d88..c275107 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -3,7 +3,7 @@ { "type": "cppbuild", "label": "C/C++: g++.exe 生成活动文件", - "command": "D:\\TDM-GCC\\bin\\g++.exe", + "command": "F:\\TDM-gcc\\bin\\g++.exe", "args": [ "-fdiagnostics-color=always", "-g", diff --git a/change.cpp b/change.cpp index 59c4477..e22a93f 100644 --- a/change.cpp +++ b/change.cpp @@ -2,7 +2,7 @@ #include #include #include -#include // 用于文件存在性检查 +#include #include "SimpleIni.h" using namespace std; @@ -10,6 +10,7 @@ using namespace std; // 函数声明 bool fileExists(const std::string& filename); bool createDefaultConfig(const std::string& filename); +bool renameFolder(const std::string& oldName, const std::string& newName); // 使用 MoveFile int main() { const std::string configFile = "config.ini"; @@ -39,7 +40,7 @@ int main() { const char* name = ini.GetValue("User", "name", "0"); cout << "欢迎使用CSSO与CS起源切换程序" << endl; - cout << "当前模式: " <= 0) { @@ -65,9 +66,9 @@ int main() { cout << "保存配置文件失败!" << endl; } } else { - cout << "切换失败!" << endl; + cout << "切换失败!检查文件路径或权限。" << endl; } - Sleep(100); + Sleep(1500); } } else if (choice == 2) { @@ -75,10 +76,10 @@ int main() { cout << "你已是CS起源模式!" << endl; } else { // 切换到CS起源模式 - int result1 = system("ren bin bin2"); - int result2 = system("ren bin_backup bin"); + bool result1 = renameFolder("bin", "bin2"); + bool result2 = renameFolder("bin_backup", "bin"); - if (result1 == 0 && result2 == 0) { + if (result1 && result2) { ini.SetValue("User", "name", "1"); SI_Error saveRc = ini.SaveFile(configFile.c_str()); if (saveRc >= 0) { @@ -87,9 +88,9 @@ int main() { cout << "保存配置文件失败!" << endl; } } else { - cout << "切换失败!" << endl; + cout << "切换失败!检查文件路径或权限。" << endl; } - Sleep(100); + Sleep(1500); } } else if (choice == 3) { @@ -122,4 +123,16 @@ bool createDefaultConfig(const std::string& filename) { // 保存INI文件 SI_Error rc = ini.SaveFile(filename.c_str()); return (rc >= 0); -} \ No newline at end of file +} + +// 使用 MoveFile 重命名文件夹 +bool renameFolder(const std::string& oldName, const std::string& newName) { + if (MoveFile(oldName.c_str(), newName.c_str())) { + cout << "重命名成功: " << oldName << " -> " << newName << endl; + return true; + } else { + DWORD error = GetLastError(); + cout << "重命名失败: " << oldName << " -> " << newName << " (错误代码: " << error << ")" << endl; + return false; + } +} diff --git a/change.exe b/change.exe index f26045f..0609705 100644 Binary files a/change.exe and b/change.exe differ diff --git a/l.cpp b/l.cpp deleted file mode 100644 index f0f49c8..0000000 --- a/l.cpp +++ /dev/null @@ -1,43 +0,0 @@ -#include - -using namespace std; - -int qian(); -int shi11(); - -int main(){ - cout <<"现在是百数计算"<>number; - ge = number%10; - shi = number/10%10; - bai = number / 100; - number = ge*100 + shi*10 + bai; - cout << number<>number; - ge = number%10; - shi = number /10 ; - number = ge*10 + shi; - cout <>number1; - ge1 = number1 % 10; - shi1 = number1 / 10 % 10; - bai1 = number1 / 100 % 10; - qian1 = number1 /1000; - number1 = ge1*1000 + shi1*100 + bai1 *10 + qian1; - cout <