Skip to content

Commit

Permalink
v5.23 增加版本确认稳定性
Browse files Browse the repository at this point in the history
  • Loading branch information
ZYX committed Aug 27, 2023
1 parent b845082 commit 6ee3e43
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 5 deletions.
7 changes: 6 additions & 1 deletion states.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,12 @@ def __init__(self, find, debug, show_map, speed, unlock=False, bonus=False, upda
lowest=requests.get("https://chnzyx.github.io/asu_version_check/",timeout=8).text.strip()
log.info("版本下限:v"+lowest)
except:
log.info("网络异常,强制退出")
log.info("网络异常,尝试备用网址")
try:
lowest=requests.get("https://api.github.com/repos/CHNZYX/Auto_Simulated_Universe/releases/latest").json()["name"].split('lowest')[1].strip().strip('v')
log.info("版本下限:v"+lowest)
except:
log.info("网络异常,强制退出")
ves = version[1:].split(' ')[0]
try:
if float(lowest)>float(ves):
Expand Down
16 changes: 12 additions & 4 deletions update.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,18 +81,26 @@ def main_operation():
try:
version_remote = info['tag_name'].strip('v').split(' ')[0]
except:
operation_label.config(text="网络异常")
return
try:
info = dict()
info['tag_name']= 'v'+requests.get("https://chnzyx.github.io/asu_version_latest/").text.strip()
version_remote = info['tag_name'].strip('v').split(' ')[0]
operation_label.config(text=f"网络异常,当前可用最高版本:{info['tag_name']}")
except:
operation_label.config(text=f"网络异常")
return

strInfoPath = u'\\StringFileInfo\\000004B0\\FileVersion'
try:
version_local = win32api.GetFileVersionInfo('gui.exe', strInfoPath)
except:
version_local = '不存在'
if version_remote == version_local:
version_local = "0.0"
if float(version_remote) <= float(version_local):
operation_label.config(text="当前已是最新版本")
return

if version_local == "0.0":
version_local = "不存在"
global popup
popup = tk.Toplevel(root)
popup.title("版本信息")
Expand Down

0 comments on commit 6ee3e43

Please sign in to comment.