update 2024/9/26

This commit is contained in:
Dengrb 2024-09-26 18:01:24 +08:00
parent 0f74c8fc48
commit 0a237f6f40
6 changed files with 94 additions and 101 deletions

View File

@ -1,36 +0,0 @@
# Python_flie
#### Description
{**When you're done, you can delete the content in this README and update the file with details for others getting started with your repository**}
#### Software Architecture
Software architecture description
#### Installation
1. xxxx
2. xxxx
3. xxxx
#### Instructions
1. xxxx
2. xxxx
3. xxxx
#### Contribution
1. Fork the repository
2. Create Feat_xxx branch
3. Commit your code
4. Create Pull Request
#### Gitee Feature
1. You can use Readme\_XXX.md to support different languages, such as Readme\_en.md, Readme\_zh.md
2. Gitee blog [blog.gitee.com](https://blog.gitee.com)
3. Explore open source project [https://gitee.com/explore](https://gitee.com/explore)
4. The most valuable open source project [GVP](https://gitee.com/gvp)
5. The manual of Gitee [https://gitee.com/help](https://gitee.com/help)
6. The most popular members [https://gitee.com/gitee-stars/](https://gitee.com/gitee-stars/)

View File

@ -1 +1,3 @@
**_本仓库为私人仓库_**
**b667c019058732967262412c7aee4475** **b667c019058732967262412c7aee4475**

View File

@ -1,65 +0,0 @@
import ctypes
import sys
import os
from time import sleep
import shelve
path = os.getcwd()
with shelve.open('main.db') as db:
bin_name = db['bin_name']
db.close()
print(path)
def is_admin():
# 检查当前是否有管理员权限
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
if is_admin():
# 如果已经是管理员,执行主要的逻辑
while True:
print("已获得管理员权限")
print(f"当前模式(1为cs原版,2为csso):{bin_name}")
print("请选择模式")
print("1.改为csso 2.改回原版 3.退出")
ip = input(int('>>>'))
# 逻辑系统bin2为csso文件 bin1为cs原版文件 bin为现在使用的游戏文件
if ip == int(1):
if bin_name == int(1):
print('错误,你已是原版')
sleep(1.5)
sys.exit()
os.system(f"ren {path}/bin {path}/bin1")
os.system(f"ren {path}/bin2 {path}/bin")
with shelve.open('main.db') as db:
db['bin_name'] = int(1)
db.close()
print("完成!")
sleep(1.85)
sys.exit()
elif ip == int(2):
if bin_name == int(2):
print("错误,你已是csso!")
sleep(1.5)
sys.exit()
os.system(f"ren {path}/bin {path}/bin2")
os.system(f"ren {path}/bin1 {path}/bin")
with shelve.open('main.db') as db:
db['bin_name'] = int(2)
db.close()
print("完成!")
sleep(1.55)
sys.exit()
elif ip == int(3):
sys.exit()
else:
print("输入错误!")
else:
# 如果没有管理员权限,重新以管理员权限运行脚本
print("请求管理员权限...")
# 使用 `ctypes` 模块提升权限,重新运行脚本
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1)

74
change/change.py Normal file
View File

@ -0,0 +1,74 @@
import ctypes
import sys
import os
from time import sleep
import shelve
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)) # 返回实际路径
path = os.getcwd()
with shelve.open('main.db') as db:
bin_name = db['bin_name']
if bin_name == None:
os.startfile(get_path('load.exe'))
db.close()
print(path)
def is_admin():
# 检查当前是否有管理员权限
try:
return ctypes.windll.shell32.IsUserAnAdmin()
except:
return False
if is_admin():
# 如果已经是管理员,执行主要的逻辑
print("已获得管理员权限")
print(f"当前模式(1为cs原版,2为csso):{bin_name}")
print("请选择模式")
print("1.改为csso 2.改回原版 3.退出")
ip = input('>>>')
# 逻辑系统bin2为csso文件 bin1为cs原版文件 bin为现在使用的游戏文件
if ip == '1':
if bin_name == '1':
print('错误,你已是原版')
sleep(1.5)
sys.exit()
os.system(f"ren {path}/bin {path}/bin1")
os.system(f"ren {path}/bin2 {path}/bin")
with shelve.open('main.db') as db:
db['bin_name'] = '1'
db.close()
print("完成!")
sleep(1.85)
sys.exit()
elif ip == '2':
if bin_name == '2':
print("错误,你已是csso!")
sleep(1.5)
sys.exit()
os.system(f"ren {path}/bin {path}/bin2")
os.system(f"ren {path}/bin1 {path}/bin")
with shelve.open('main.db') as db:
db['bin_name'] = '2'
db.close()
print("完成!")
sleep(1.55)
sys.exit()
elif ip == '3':
sys.exit()
else:
print("输入错误!")
else:
# 如果没有管理员权限,重新以管理员权限运行脚本
print("请求管理员权限...")
# 使用 `ctypes` 模块提升权限,重新运行脚本
ctypes.windll.shell32.ShellExecuteW(None, "runas", sys.executable, " ".join(sys.argv), None, 1)

8
change/load.py Normal file
View File

@ -0,0 +1,8 @@
import shelve
#初始化数据库文件
with shelve.open('main') as db:
db['bin_name'] = 1
db.close()
exit()

10
pyinstaller_sys.py Normal file
View File

@ -0,0 +1,10 @@
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)) # 返回实际路径