delete
This commit is contained in:
parent
541d50655c
commit
2d0570fdb8
126
change/change.py
126
change/change.py
@ -1,126 +0,0 @@
|
|||||||
import ctypes
|
|
||||||
import winreg
|
|
||||||
import shutil
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
from time import sleep
|
|
||||||
import shelve
|
|
||||||
|
|
||||||
|
|
||||||
# 检查并创建cmd文件的函数
|
|
||||||
def check_and_create_cmd_files(path):
|
|
||||||
csso_cmd_path = os.path.join(path, 'csso.cmd')
|
|
||||||
css_cmd_path = os.path.join(path, 'css.cmd')
|
|
||||||
|
|
||||||
if not os.path.isfile(csso_cmd_path):
|
|
||||||
with open(csso_cmd_path, 'w') as csso_file:
|
|
||||||
csso_file.write('@echo off\n')
|
|
||||||
csso_file.write('ren bin bin1\n')
|
|
||||||
csso_file.write('ren bin2 bin\n')
|
|
||||||
|
|
||||||
if not os.path.isfile(css_cmd_path):
|
|
||||||
with open(css_cmd_path, 'w') as css_file:
|
|
||||||
css_file.write('@echo off\n')
|
|
||||||
css_file.write('ren bin bin2\n')
|
|
||||||
css_file.write('ren bin1 bin\n')
|
|
||||||
|
|
||||||
def get_steam_path():
|
|
||||||
try:
|
|
||||||
# 从注册表读取 Steam 安装路径
|
|
||||||
with winreg.OpenKey(winreg.HKEY_CURRENT_USER, r"Software\Valve\Steam") as key:
|
|
||||||
steam_path, _ = winreg.QueryValueEx(key, "SteamPath")
|
|
||||||
return steam_path
|
|
||||||
except FileNotFoundError:
|
|
||||||
print("未能找到 Steam 安装路径。")
|
|
||||||
return None
|
|
||||||
|
|
||||||
def delete_csso_folder(steam_path):
|
|
||||||
target_folder = os.path.join(steam_path, "steamapps", "sourcemods", "csso")
|
|
||||||
|
|
||||||
if os.path.exists(target_folder):
|
|
||||||
print(f"正在删除文件夹: {target_folder}")
|
|
||||||
shutil.rmtree(target_folder) # 递归删除文件夹及其内容
|
|
||||||
print("文件夹已删除。")
|
|
||||||
else:
|
|
||||||
print(f"文件夹不存在: {target_folder}")
|
|
||||||
|
|
||||||
with shelve.open('main') as db:
|
|
||||||
# 如果数据库中没有 'bin_name',返回 '1'(默认值)
|
|
||||||
bin_name = db.get('bin_name', '1')
|
|
||||||
|
|
||||||
if bin_name is None:
|
|
||||||
bin_name = '1' # 这里设为字符串以保持一致
|
|
||||||
db['bin_name'] = bin_name
|
|
||||||
|
|
||||||
def is_admin():
|
|
||||||
"""检查当前是否有管理员权限"""
|
|
||||||
try:
|
|
||||||
return ctypes.windll.shell32.IsUserAnAdmin()
|
|
||||||
except:
|
|
||||||
return False
|
|
||||||
|
|
||||||
if is_admin():
|
|
||||||
# 如果已经是管理员,执行主要的逻辑
|
|
||||||
print("已获得管理员权限")
|
|
||||||
|
|
||||||
path = os.getcwd() # 获取当前工作目录的实际路径
|
|
||||||
# 检查并创建cmd文件
|
|
||||||
check_and_create_cmd_files(path)
|
|
||||||
|
|
||||||
print(f"当前模式(1为CS原版, 2为CS:SO): {bin_name}")
|
|
||||||
print("请选择模式")
|
|
||||||
print("1. 改为CS:SO\n2. 改回原版\n3. 删除CSSO并删除程序\n4. 退出")
|
|
||||||
|
|
||||||
choice = input('>>> ')
|
|
||||||
|
|
||||||
if choice == '1':
|
|
||||||
if bin_name == '2':
|
|
||||||
print('错误,你已是CS:SO!')
|
|
||||||
sleep(1.5)
|
|
||||||
sys.exit()
|
|
||||||
# 启动 csso.cmd
|
|
||||||
os.startfile(os.path.join(path, 'csso.cmd'))
|
|
||||||
with shelve.open('main') as db:
|
|
||||||
db['bin_name'] = '2' # 切换至 CS:SO
|
|
||||||
print("完成!")
|
|
||||||
sleep(1.85)
|
|
||||||
sys.exit()
|
|
||||||
elif choice == '2':
|
|
||||||
if bin_name == '1':
|
|
||||||
print("错误,你已是原版!")
|
|
||||||
sleep(1.5)
|
|
||||||
sys.exit()
|
|
||||||
# 启动 css.cmd
|
|
||||||
os.startfile(os.path.join(path, 'css.cmd'))
|
|
||||||
with shelve.open('main') as db:
|
|
||||||
db['bin_name'] = '1' # 切换至 CS 原版
|
|
||||||
print("完成!")
|
|
||||||
sleep(1.55)
|
|
||||||
sys.exit()
|
|
||||||
elif choice == '3':
|
|
||||||
if input('确定吗?\n 1.确定 2.不确定\n>>>') == '1':
|
|
||||||
with open('del.cmd','w') as d:
|
|
||||||
d.write('@echo off\n')
|
|
||||||
d.write('timeout /t 2 /nobreak > nul\n')
|
|
||||||
d.write('del /Q csso.cmd css.cmd change.exe main.bak main.dat main.dir\n')
|
|
||||||
d.write('del "%~f0"')
|
|
||||||
|
|
||||||
if bin_name != '1':
|
|
||||||
os.startfile(path,'css.cmd')
|
|
||||||
steam_path = get_steam_path()
|
|
||||||
if steam_path:
|
|
||||||
delete_csso_folder(steam_path)
|
|
||||||
os.rmdir(f'{path}\\bin2')
|
|
||||||
os.startfile(os.path.join(path , 'del.cmd'))
|
|
||||||
else:
|
|
||||||
sys.exit()
|
|
||||||
elif choice == '4':
|
|
||||||
sys.exit()
|
|
||||||
else:
|
|
||||||
print("输入错误!")
|
|
||||||
|
|
||||||
else:
|
|
||||||
# 如果没有管理员权限,重新以管理员权限运行脚本
|
|
||||||
print("请求管理员权限...")
|
|
||||||
# 使用 `ctypes` 模块提升权限,重新运行脚本
|
|
||||||
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1)
|
|
@ -1,19 +0,0 @@
|
|||||||
#include<iostream>
|
|
||||||
#include<iomanip>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
int main(){
|
|
||||||
double e = 1.0;
|
|
||||||
double factorial = 1.0;
|
|
||||||
|
|
||||||
for (int i = 1; i <= 20; i++)
|
|
||||||
{
|
|
||||||
factorial *= i;
|
|
||||||
e += 1.0 / factorial;
|
|
||||||
}
|
|
||||||
|
|
||||||
cout << fixed << setprecision(3) << e << endl;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,29 +0,0 @@
|
|||||||
//分子序列求和
|
|
||||||
#include<iostream>
|
|
||||||
#include<iomanip>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
int main(){
|
|
||||||
int n;
|
|
||||||
double a=2,b=1,c,d;
|
|
||||||
cin >>n;
|
|
||||||
|
|
||||||
if (n > 100)
|
|
||||||
{
|
|
||||||
cout <<"输入的数字太大了!"<<endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
double sum=0;
|
|
||||||
for (int i = 1; i <= n; i++)
|
|
||||||
{
|
|
||||||
sum += a/b;
|
|
||||||
c = a;
|
|
||||||
d = b;
|
|
||||||
a = a+d;
|
|
||||||
b = c;
|
|
||||||
}
|
|
||||||
cout <<fixed<<setprecision(2)<<sum<<endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
int main(){
|
|
||||||
int n,m,x;
|
|
||||||
|
|
||||||
cout << "请输入两个数:";
|
|
||||||
cin >> n >> m;
|
|
||||||
|
|
||||||
if (m>n)
|
|
||||||
{
|
|
||||||
x = n;
|
|
||||||
}else
|
|
||||||
{
|
|
||||||
x = m;
|
|
||||||
}
|
|
||||||
|
|
||||||
while ( n%x!=0 || m%x!=0)
|
|
||||||
{
|
|
||||||
x--;
|
|
||||||
}
|
|
||||||
|
|
||||||
cout << "最大公约数为:" << x << endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
BIN
dist/change.exe
vendored
BIN
dist/change.exe
vendored
Binary file not shown.
@ -1,13 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
// 遍历1到200的所有数
|
|
||||||
for (int i = 1; i <= 200; i++) {
|
|
||||||
// 判断该数是否满足"3721"数的条件
|
|
||||||
if (i % 3 == 2 && i % 7 == 1) {
|
|
||||||
cout << i << " "; // 输出满足条件的数
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
@ -1,10 +0,0 @@
|
|||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
def get_path(relative_path):
|
|
||||||
try:
|
|
||||||
base_path = sys._MEIPASS # pyinstaller打包后的路径
|
|
||||||
except AttributeError:
|
|
||||||
base_path = os.path.abspath(".") # 当前工作目录的路径
|
|
||||||
|
|
||||||
return os.path.normpath(os.path.join(base_path, relative_path)) # 返回实际路径
|
|
25
test.cpp
25
test.cpp
@ -1,25 +0,0 @@
|
|||||||
#include <iostream>
|
|
||||||
|
|
||||||
using namespace std;
|
|
||||||
|
|
||||||
// 函数:计算最大公约数
|
|
||||||
int gcd(int a, int b) {
|
|
||||||
while (b != 0) {
|
|
||||||
int temp = b;
|
|
||||||
b = a % b;
|
|
||||||
a = temp;
|
|
||||||
}
|
|
||||||
return a;
|
|
||||||
}
|
|
||||||
|
|
||||||
// 函数:计算最小公倍数
|
|
||||||
int lcm(int a, int b) {
|
|
||||||
return (a / gcd(a, b)) * b;
|
|
||||||
}
|
|
||||||
|
|
||||||
int main() {
|
|
||||||
int M, N;
|
|
||||||
cin >> M >> N;
|
|
||||||
cout << lcm(M, N) << endl;
|
|
||||||
return 0;
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user