diff --git a/change.cpp b/change.cpp index 570607b..6604fd6 100644 --- a/change.cpp +++ b/change.cpp @@ -7,53 +7,53 @@ 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 +bool renameFolder(const std::string& oldName, const std::string& newName); // 浣跨敤 MoveFile -int main() { +int main(){ const std::string configFile = "config.ini"; - // 检查 config.ini 是否存在 + // 妫鏌 config.ini 鏄惁瀛樺湪 if (!fileExists(configFile)) { - cout << "未检测到 " << configFile << " 文件,正在创建默认配置..." << endl; + cout << "鏈娴嬪埌 " << configFile << " 鏂囦欢锛屾鍦ㄥ垱寤洪粯璁ら厤缃..." << endl; if (createDefaultConfig(configFile)) { - cout << "默认配置文件创建成功。" << endl; + cout << "榛樿閰嶇疆鏂囦欢鍒涘缓鎴愬姛銆" << endl; } else { - cout << "创建默认配置文件失败。" << endl; - return 1; // 退出程序,因为无法创建配置文件 + cout << "鍒涘缓榛樿閰嶇疆鏂囦欢澶辫触銆" << endl; + return 1; // 閫鍑虹▼搴忥紝鍥犱负鏃犳硶鍒涘缓閰嶇疆鏂囦欢 } } - // 初始化INI文件 + // 鍒濆鍖朓NI鏂囦欢 CSimpleIniA ini; ini.SetUnicode(); ini.SetMultiKey(true); SI_Error rc = ini.LoadFile(configFile.c_str()); if (rc < 0) { - cout << "无法加载配置文件 " << configFile << endl; + cout << "鏃犳硶鍔犺浇閰嶇疆鏂囦欢 " << configFile << endl; return 1; } const char* name = ini.GetValue("User", "name", "0"); - cout << "欢迎使用CSSO与CS起源切换程序" << endl; - cout << "当前模式: " << name <<"(0为CSSO,1为CS起源)"<< endl; - cout << "请选择操作:" << endl; + cout << "娆㈣繋浣跨敤CSSO涓嶤S璧锋簮鍒囨崲绋嬪簭" << endl; + cout << "褰撳墠妯″紡: " << name <<"(0涓篊SSO锛1涓篊S璧锋簮)"<< endl; + cout << "璇烽夋嫨鎿嶄綔:" << endl; cout << "1. CSSO" << endl; - cout << "2. CS起源" << endl; - cout << "3. 退出" << endl; + cout << "2. CS璧锋簮" << endl; + cout << "3. 閫鍑" << endl; int choice; cin >> choice; if (choice == 1) { if (strcmp(name, "0") == 0) { - cout << "你已是CSSO模式!" << endl; + cout << "浣犲凡鏄疌SSO妯″紡!" << endl; } else { - // 切换到CSSO模式 + // 鍒囨崲鍒癈SSO妯″紡 bool result1 = renameFolder("bin", "bin_backup"); bool result2 = renameFolder("bin2", "bin"); @@ -61,21 +61,21 @@ int main() { ini.SetValue("User", "name", "0"); SI_Error saveRc = ini.SaveFile(configFile.c_str()); if (saveRc >= 0) { - cout << "成功切换到CSSO模式!" << endl; + cout << "鎴愬姛鍒囨崲鍒癈SSO妯″紡!" << endl; } else { - cout << "保存配置文件失败!" << endl; + cout << "淇濆瓨閰嶇疆鏂囦欢澶辫触!" << endl; } } else { - cout << "切换失败!检查文件路径或权限。" << endl; + cout << "鍒囨崲澶辫触锛佹鏌ユ枃浠惰矾寰勬垨鏉冮檺銆" << endl; } Sleep(1500); } } else if (choice == 2) { if (strcmp(name, "1") == 0) { - cout << "你已是CS起源模式!" << endl; + cout << "浣犲凡鏄疌S璧锋簮妯″紡!" << endl; } else { - // 切换到CS起源模式 + // 鍒囨崲鍒癈S璧锋簮妯″紡 bool result1 = renameFolder("bin", "bin2"); bool result2 = renameFolder("bin_backup", "bin"); @@ -83,56 +83,56 @@ int main() { ini.SetValue("User", "name", "1"); SI_Error saveRc = ini.SaveFile(configFile.c_str()); if (saveRc >= 0) { - cout << "成功切换到CS起源模式!" << endl; + cout << "鎴愬姛鍒囨崲鍒癈S璧锋簮妯″紡!" << endl; } else { - cout << "保存配置文件失败!" << endl; + cout << "淇濆瓨閰嶇疆鏂囦欢澶辫触!" << endl; } } else { - cout << "切换失败!检查文件路径或权限。" << endl; + cout << "鍒囨崲澶辫触锛佹鏌ユ枃浠惰矾寰勬垨鏉冮檺銆" << endl; } Sleep(1500); } } else if (choice == 3) { - cout << "退出程序." << endl; + cout << "閫鍑虹▼搴." << endl; Sleep(100); return 0; } else { - cout << "无效的选项,请重新运行程序并选择正确的选项。" << endl; + cout << "鏃犳晥鐨勯夐」锛岃閲嶆柊杩愯绋嬪簭骞堕夋嫨姝g‘鐨勯夐」銆" << endl; } return 0; } -// 检查文件是否存在 +// 妫鏌ユ枃浠舵槸鍚﹀瓨鍦 bool fileExists(const std::string& filename) { std::ifstream infile(filename); return infile.good(); } -// 创建默认的config.ini文件 +// 鍒涘缓榛樿鐨刢onfig.ini鏂囦欢 bool createDefaultConfig(const std::string& filename) { CSimpleIniA ini; ini.SetUnicode(); ini.SetMultiKey(true); - // 设置默认值 + // 璁剧疆榛樿鍊 ini.SetValue("User", "name", "0"); - // 保存INI文件 + // 淇濆瓨INI鏂囦欢 SI_Error rc = ini.SaveFile(filename.c_str()); return (rc >= 0); } -// 使用 MoveFile 重命名文件夹 +// 浣跨敤 MoveFile 閲嶅懡鍚嶆枃浠跺す bool renameFolder(const std::string& oldName, const std::string& newName) { if (MoveFile(oldName.c_str(), newName.c_str())) { - cout << "重命名成功: " << oldName << " -> " << newName << endl; + cout << "閲嶅懡鍚嶆垚鍔: " << oldName << " -> " << newName << endl; return true; } else { DWORD error = GetLastError(); - cout << "重命名失败: " << oldName << " -> " << newName << " (错误代码: " << error << ")" << endl; + cout << "閲嶅懡鍚嶅け璐: " << oldName << " -> " << newName << " (閿欒浠g爜: " << error << ")" << endl; return false; } } diff --git a/dist/change.exe b/dist/change.exe new file mode 100644 index 0000000..241fe5a Binary files /dev/null and b/dist/change.exe differ diff --git a/dist/homework_laster.exe b/dist/homework_laster.exe new file mode 100644 index 0000000..242a277 Binary files /dev/null and b/dist/homework_laster.exe differ