importos
importsubprocess
defoptimize_dns():
subprocess.run(["static""8.8.8.8"defenable_traffic_management():
os.system(
etshwinsockreset"os.system(
etshintipreset"if__name__=="__main__"optimize_dns()
enable_traffic_management()
importplatform
defcheck_system_compatibility():
system_version=platform.version()
if"returnFalse
if__name__=="__main__"ifcheck_system_compatibility():
print("系统兼容"else:
print("系统不兼容"
importpsutil
defclose_background_apps():
forprocinpsutil.process_iter(['pid','name']):
ifproc.info['name']notin['python','system']:
proc.kill()
defclear_cache():
os.system("cleanmgr/sagerun:1"if__name__=="__main__"close_background_apps()
clear_cache()
importshutil
defrepair_cache(cache_path):
ifos.path.exists(cache_path):
shutil.rmtree(cache_path)
os.makedirs(cache_path)
print("成功"else:
print("缓存路径不存在"if__name__=="__main__"repair_cache("C:/Users/Username/AppData/Local/DNF/Cache"
importrequests
defcheck_server_status():
response=requests.get("e:
returnFalse
if__name__=="__main__"ifcheck_server_status():
print("服务器正常"else:
print("服务器维护中"