-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.txt
187 lines (153 loc) · 5.16 KB
/
main.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#colorama使用说明:
#Fore.xxx 前景色(字体颜色)
#Back.xxx 背景色
#Fore常用颜色:
#Fore.GREEN
#Fore.CYAN
#Fore.BLUE
#Fore.RED
#Fore.MAGENTA
#Fore.BLACK
#Fore.YELLOW
#详情请在Py控制台导入colorama并输入help(Fore)
#系统颜色表示说明:
#绿色:提示,正确
#红色:警告,错误
#黄色:警告,错误(比红色弱一点)
#浅蓝色:信息,属性
#紫红色:暂定
#黑色:无(黑色哪看得见?)
import wget
import json
import requests
import os,sys
import time
import base64
from time import sleep
from colorama import Fore, Back, init
import tkinter as tk
import tkinter.ttk as ttk
import tkinter.messagebox
root = tk.Tk()
def show():
for i in range(100):
# 每次更新加1
progressbarOne['value'] = i + 1
# 更新画面
root.update()
time.sleep(0.01)
Update = json.loads(requests.get("https://buelie.github.io/MayDOS/config.json").text)
code = "0.0.1"
if Update["latest"]["default"] != code:
Y_N_U = tkinter.messagebox.askyesno(title='更新提示',message=f'有可用更新,是否下载?\n当前版本:0.0.1 -> {Update["latest"]["default"]}')
if Y_N_U == True:
root.withdraw()
else:
root.withdraw()
root.withdraw()
else:
root.withdraw()
Label = ttk.Label(root,text="检查更新中").pack()
progressbarOne = tkinter.ttk.Progressbar(root)
progressbarOne.pack(pady=20)
progressbarOne['maximum'] = 100
progressbarOne['value'] = 0
progressbarOne['length'] = 200
show()
init(autoreset=True)
def cls():
os.system('cls')
error_version_file_not_found = False
error_account_file_not_found = False
try:
ver_open= open('important/Version.ver',mode='r')
Ver = ver_open.readline()
except FileNotFoundError:
error_version_file_not_found = True
try:
account_open = open('important/account.user',mode='r')
account_info = account_open.readlines()
un_username = account_info[0]
username = un_username[0:-1]
un_password = account_info[1]
password = un_password[0:-1]
account_open.close()
try:
username = str(base64.b64decode(username),'utf-8')
password = str(base64.b64decode(password),'utf-8')
except Exception as e:
print(Fore.RED + 'ERROR: 账户信息加载失败,账户文件可能损坏,请尝试注销并重新注册')
print(Fore.RED + 'ERROR_INFOMATION')
print(e)
sleep(10)
quit()
except FileNotFoundError:
error_account_file_not_found = True
if error_account_file_not_found == True and error_version_file_not_found == False:
print(Fore.RED + '未注册或账户文件异常丢失')
input('按下回车键退出...')
quit()
elif error_version_file_not_found == True and error_account_file_not_found == False:
print(Fore.RED + '系统版本文件被移动或异常丢失,请尝试联系我们以修复')
input('按下回车键退出...')
quit()
elif error_account_file_not_found and error_version_file_not_found == True:
print(Fore.RED + '未找到系统版本文件及账户文件')
print(Fore.RED + '请确认是否注册并尝试联系我们')
input('按下回车键退出...')
quit()
if username == 'TEST':
print(account_info)
print(Fore.GREEN + 'Welcome!')
while True:
if username == 'TEST':
print(Fore.BLUE + 'test_account_auto_login')
else:
print(Fore.CYAN + f'登录{username}的电脑')
if username == 'TEST':
break
else:
userspassword = input('密码>')
if userspassword == password:
print(Fore.GREEN + '密码正确')
break
else:
print(Fore.RED + '密码错误!')
pass
sleep(1)
cls()
print(Fore.GREEN + '正在准备你的MayDOS命令行......')
print(Fore.GREEN + '请输入"usebook"以打开MayDOS0.1的使用手册和帮助')
time.sleep(1.5)
while Update_DOS == 0:
cmd = input('MayDOS/Root>>>')
if cmd == 'calc':
os.system('python important/Applications/calc.py')
elif cmd[0:3] == 'sof':
os.system(f'python important/Applications/{cmd[4:-1]}')
elif cmd == "":
pass
elif cmd == 'usebook':
print(Fore.GREEN + '键入"calc"以打开计算器')
print(Fore.GREEN + '键入"close"以关闭PyDOS0.1')
print(Fore.GREEN + '键入"notepad"以打开记事本程序')
print(Fore.GREEN + '键入"explorer"以打开资源管理器')
print(Fore.GREEN + '键入"cls"以清屏')
print(Fore.GREEN + '键入"sysver"以查看系统版本')
print(Fore.GREEN + '键入"sof <程序名称>"以打开第三方应用程序')
elif cmd == 'close':
quit()
elif cmd == 'notepad':
cls()
os.system('python important/Applications/Notepad.py')
elif cmd == 'explorer':
cls()
os.system('python important/Applications/Explorer.py')
elif cmd == 'cls':
cls()
elif cmd =='sysver':
print(f'系统版本:MayDOS{Ver}')
print('开发:MayDOS开发团队 版权所有2023(C)')
else:
print(Fore.YELLOW + "未定义的指令",cmd,Fore.YELLOW + ",请输入'usebook'以查看使用手册和帮助")
root.mainloop()