From 1bf0066b1fac437ce1e73431e3ee08f93c63135c Mon Sep 17 00:00:00 2001 From: LanShui <2031845258@qq.com> Date: Mon, 6 May 2024 02:27:06 +0800 Subject: [PATCH] first commit --- __pycache__/apps.cpython-310.pyc | Bin 0 -> 7487 bytes __pycache__/module.cpython-310.pyc | Bin 0 -> 1056 bytes apps.py | 233 ++++++++++++++++++++++++ config_app/login_user.json | 1 + config_app/server_list_config.db | Bin 0 -> 16384 bytes main.py | 282 +++++++++++++++++++++++++++++ module.py | 19 ++ style/exit.png | Bin 0 -> 625 bytes style/message.qss | 1 + style/style.qss | 25 +++ style/zxh.png | Bin 0 -> 269 bytes 11 files changed, 561 insertions(+) create mode 100644 __pycache__/apps.cpython-310.pyc create mode 100644 __pycache__/module.cpython-310.pyc create mode 100644 apps.py create mode 100644 config_app/login_user.json create mode 100644 config_app/server_list_config.db create mode 100644 main.py create mode 100644 module.py create mode 100644 style/exit.png create mode 100644 style/message.qss create mode 100644 style/style.qss create mode 100644 style/zxh.png diff --git a/__pycache__/apps.cpython-310.pyc b/__pycache__/apps.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..d9f83bb1cd596c94f58bbf912ab89d55576ceca6 GIT binary patch literal 7487 zcmbtZ&2t-9a-S~@J_vx|x2R88YbS;y@k5gBwXI4_QJ~E%#ZOpTO_apW#`v#1|;~QwNn|? z^t{)vr(gGb-97ypZYGnGa6SCD4=caTOVV$t(|c*?e2Uxq6#$c%T$O6FA zs-ZHC#T?ntm~O;a+>ZUT#1g+y4V@*8I7=A`)@LMH+DNgC(Z{kz+Rm_kJ6lm$jt%T< zuVka24cb{Y1f0f(*~q?Tz_C*qA-=N;L-2zr@DT9~b>0^e?k3=wGpiF+PI+ zRdx;iYxXGmW9<5xRJd^jsilG(#8;Nqx9qZyru<%OV0Lxp_F8fEad9<2yD(o|EVa_J zZr!)*{_WCk!*1oQMx*MKE#GnLlUtr!H}aLK5AJ#LN=x&Lv#Z5N&@qS!>at905?x>=C2-H;_C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oK%GF}wrWz!)MW~-QMD-2 zCQK2g2{VLQ!W?0qus~QOED@FoD}+_T8eyHVLD+P#RXx_WBDD>_7OY@4R?I2dXd8Ui z?r(^*)G))5K}~-Z+^~l>AX9Bob?qC^Ke>(BNDm9ch1w=>LlD%ze|l=4 zIuicu^&g*}<7sznhH`XzB0oB#uhNfw!P&^1qRa}x_VclgpIqoqeOIP;9Co}Ff5U&` O$3g60{#s7Ic>e)6F(%sp literal 0 HcmV?d00001 diff --git a/apps.py b/apps.py new file mode 100644 index 0000000..8c67771 --- /dev/null +++ b/apps.py @@ -0,0 +1,233 @@ +from PySide2.QtCore import QObject +from module import * + +window_title_apps_name = "CRA-SERVER CLIENT" + +login_headers = {"Content-Type": "application/json"} +login_user_key = "f0649fc2aeb411eda71f00163e095b49" +aotu_user_url = f"https://auth.mc-user.com:233/{login_user_key}/" +cra_mc_server_api = "" + +server_list_configfile = "config_app/server_list_config.db" + +login_json_file = "config_app/login_user.json" + +window_size_int = (950, 560) + +style_qss_stylesheet_body_file_dir = "style/style.qss" + +id_key_sqlite = "INTEGER PRIMARY KEY AUTOINCREMENT" + +@staticmethod +def readQSS(style: str): + with open(file=style, mode='r', encoding="UTF-8") as f: + return f.read() + +def sqlite_shell(sql_db: str, sql_code: str): + sqlite_connect = sqlite3.connect(sql_db) + sqlite_cursor = sqlite_connect.cursor() + sqlite_cursor.execute(sql_code) + print_sql = sqlite_cursor.fetchall() + sqlite_cursor.close() + sqlite_connect.commit() + sqlite_connect.close() + return print_sql + +class Message_ok(QMessageBox): + def __init__(self, message: str): + super().__init__() + self.draggable = False + self.offset = None + self.setWindowFlags(Qt.FramelessWindowHint) + self.setWindowTitle(window_title_apps_name) + self.setText(message) + self.setStandardButtons(QMessageBox.Ok) + button_yes = self.button(QMessageBox.Ok) + button_yes.setText("好的") + + self.exec_() + + def mousePressEvent(self, event): + if event.button() == Qt.LeftButton: + self.draggable = True + self.offset = event.pos() + + def mouseMoveEvent(self, event): + if self.draggable: + self.move(event.globalPos() - self.offset) + + def mouseReleaseEvent(self, event): + if event.button() == Qt.LeftButton: + self.draggable = False + +class Message_yes_no(QMessageBox): + def __init__(self, message: str): + super().__init__() + self.draggable = False + self.offset = None + self.setWindowFlags(Qt.FramelessWindowHint) + self.setWindowTitle(window_title_apps_name) + self.setText(message) + self.setStandardButtons(QMessageBox.Yes | QMessageBox.No) + self.button_yes = self.button(QMessageBox.Yes) + self.button_yes.setText("确定") + button_no = self.button(QMessageBox.No) + button_no.setText("取消") + self.exec_() + + def value(self): + if self.clickedButton() == self.button_yes: + return True + return False + + def mousePressEvent(self, event): + if event.button() == Qt.LeftButton: + self.draggable = True + self.offset = event.pos() + + def mouseMoveEvent(self, event): + if self.draggable: + self.move(event.globalPos() - self.offset) + + def mouseReleaseEvent(self, event): + if event.button() == Qt.LeftButton: + self.draggable = False + +class Thread_appcode_login_user(QThread): + data_th = Signal(dict) + def __init__(self): + super(Thread_appcode_login_user, self).__init__() + + def run(self): + data = dict() + code = int(0) + + if os.path.isfile(server_list_configfile) is False: + data_serverlistdbfile = [ + f''' + CREATE TABLE SERVER_LIST ( + ID {id_key_sqlite}, + NAME TEXT, + SERVER_FILE_NAME TEXT, + SERVER_TEST TEXT, + IMAGE TEXT + ); + ''', + ''' + CREATE TABLE SERVER_PLAY ( + NAME TEXT, + VERSION TEXT + ); + ''', + ''' + INSERT INTO SERVER_LIST ( + NAME, SERVER_FILE_NAME, SERVER_TEST, IMAGE + ) VALUES ( + "CRA-MC", "cramc", "HELLO WORLD", "https://s21.ax1x.com/2024/05/06/pkEPVmV.jpg" + ); + ''', + ''' + INSERT INTO SERVER_PLAY ( + VERSION + ) VALUES ( + "v1.0" + ); + ''' + ] + sql_file_config = sqlite3.connect(server_list_configfile) + sql_file_config_csr = sql_file_config.cursor() + for i_db in data_serverlistdbfile: + sql_file_config_csr.execute(i_db) + sql_file_config_csr.close() + sql_file_config.commit() + sql_file_config.close() + + if os.system("ping www.baidu.com -n 1") == 1: + data = dict() + code = int(2) + data_config = { + "data_config": data, + "code": code + } + return self.data_th.emit(data_config) + + with open(file=login_json_file, mode='r', encoding="UTF-8", newline='') as f_read: + login_json_user = json.load(f_read) + + login_user = { + "accessToken": login_json_user.get("accessToken"), + "clientToken": login_json_user.get("clientToken") + } + json_login_crauser = requests.post(url=aotu_user_url + "authserver/validate", headers=login_headers, json=login_user) + + if json_login_crauser.status_code != 204: + ref_login_key = requests.post(url=aotu_user_url + "authserver/refresh", headers=login_headers, json=login_user) + if ref_login_key.status_code != 204: + data = dict() + code = int(1) + data_config = { + "data_config": data, + "code": code + } + return self.data_th.emit(data_config) + url_https_mc_login_json = requests.post(url=aotu_user_url + "authserver/refresh", headers=login_headers, json=login_user) + data_login_file = { + "accessToken": url_https_mc_login_json.get("accessToken"), + "clientToken": url_https_mc_login_json.get("clientToken"), + "id": url_https_mc_login_json["selectedProfile"]["id"], + "name": url_https_mc_login_json["selectedProfile"]["name"] + } + with open(file=login_json_file, mode='w', encoding="UTF-8", newline='') as dump_f: + json.dump(data_login_file, dump_f) + + print_server_list = sqlite_shell(sql_db=server_list_configfile, sql_code="SELECT * FROM SERVER_LIST;") + data_server_list_dicts = list() + for dict_server_list in print_server_list: + data_server_list_dict = dict() + data_server_list_dict["name"] = dict_server_list[1] + data_server_list_dict["server_file_name"] = dict_server_list[2] + data_server_list_dict["server_test"] = dict_server_list[3] + req_image = requests.get(url=dict_server_list[4]) + image_print = req_image.content + data_server_list_dict["image"] = image_print + data_server_list_dicts.append(data_server_list_dict) + + data = { + "name": login_json_user.get("name"), + "server_list": data_server_list_dicts + } + + data_config = { + "data_config": data, + "code": code + } + return self.data_th.emit(data_config) + +class customQListWidgetItem(QListWidgetItem): + def __init__(self, image, names: str, tests: str): + super().__init__() + self.item_widget = QWidget() + + images = QImage.fromData(image) + + image = QLabel() + image.setPixmap(QPixmap.fromImage(images).scaled(144, 60)) + + name = QLabel() + name.setText(str(names)) + + test = QLabel() + test.setText(str(tests)) + + vbox_server_test = QVBoxLayout() + vbox_server_test.addWidget(name, alignment=Qt.AlignLeft | Qt.AlignTop) + vbox_server_test.addWidget(test, alignment=Qt.AlignTop | Qt.AlignLeft) + + hb_box = QHBoxLayout() + hb_box.setSpacing(10) + hb_box.setContentsMargins(0, 0, 0, 0) + hb_box.addWidget(image, alignment=Qt.AlignLeft | Qt.AlignLeft) + hb_box.addLayout(vbox_server_test) + hb_box.addStretch(1) + self.item_widget.setLayout(hb_box) + self.setSizeHint(self.item_widget.sizeHint()) diff --git a/config_app/login_user.json b/config_app/login_user.json new file mode 100644 index 0000000..bbf9c8e --- /dev/null +++ b/config_app/login_user.json @@ -0,0 +1 @@ +{"accessToken": "336491270a1611ef92c5e252f2c508d4", "clientToken": "32cbdf4d-0a16-11ef-92c5-e252f2c508d4", "id": "a6143eb7a7883daab9a05dbe052879a1", "name": "GameDaBai"} \ No newline at end of file diff --git a/config_app/server_list_config.db b/config_app/server_list_config.db new file mode 100644 index 0000000000000000000000000000000000000000..4d1c7d777bc2c0ce1973ee8fd724d014517fe7ed GIT binary patch literal 16384 zcmeI&Jx{_w7zgk>YA~7zE(YB$VUd6>;LG4-#S z(~rOpPl?Dboe~LBjFQ+>>_I%xAOHafKmY;|fB*y_009U<;6DU9acMk}Owx`QI0xsR z#my==>lIzCg}P$}ldCpowz{r!77DQWNj9JvYDpyXeLFKSELO0zveC`xOGs5B(L_2; zYu){{Tj%0@T5o%;EAPVfz6_;L`}z``zi@mnBi>Bi&C+g-_c!4hbMQ*Z+sg+c-#}Q|00Izz00bZa W0SG_<0uX?}ND7QoiOgK* None: + self.destroy() + return sys.exit(0) + +class Login_users_window_app(QWidget): + def __init__(self): + super().__init__() + self.setWindowFlags(Qt.FramelessWindowHint) + self.setFixedSize(apps.window_size_int[0], apps.window_size_int[1]) + self.setWindowTitle(apps.window_title_apps_name + " - 登录") + self.draggable = False + self.offset = None + + window_box = QGridLayout() + + title_hbox = QHBoxLayout() + title_hbox.addWidget(QLabel(apps.window_title_apps_name), alignment=Qt.AlignLeft | Qt.AlignTop) + close_app_button = QToolButton() + close_app_button.setIcon(QIcon("style/exit.png")) + close_app_button.clicked.connect(self.close_apps_button_ttols) + title_hbox.addWidget(close_app_button, alignment=Qt.AlignRight | Qt.AlignTop) + + login_user_box_hbox = QVBoxLayout() + login_user_box_hbox.setContentsMargins(250, 0, 250, 0) + + login_user_box = QGridLayout() + login_user_box.setSpacing(15) + login_user_box.addWidget(QLabel(text="用户名:"), 0, 0, alignment=Qt.AlignTop) + self.username = QLineEdit() + login_user_box.addWidget(self.username, 0, 1, alignment=Qt.AlignTop) + login_user_box.addWidget(QLabel(text="密码:"), 1, 0, alignment=Qt.AlignTop) + self.password = QLineEdit() + self.password.setEchoMode(QLineEdit.Password) + login_user_box.addWidget(self.password, 1, 1, alignment=Qt.AlignTop) + login_user_button = QPushButton(text="登录") + login_user_button.clicked.connect(self.login_users_mcgames) + login_user_box.addWidget(login_user_button, 2, 0, 1, 0) + register_user = QToolButton(text="注册") + reload_password = QToolButton(text="忘记密码?") + login_user_box.addWidget(register_user, 3, 0, alignment=Qt.AlignTop | Qt.AlignLeft) + login_user_box.addWidget(reload_password, 3, 1, alignment=Qt.AlignTop | Qt.AlignRight) + login_user_box_hbox.addLayout(login_user_box) + + window_box.addLayout(title_hbox, 0, 0, alignment=Qt.AlignTop) + window_box.addLayout(login_user_box_hbox, 1, 0, alignment=Qt.AlignTop | Qt.AlignCenter) + + self.setLayout(window_box) + + def login_users_mcgames(self): + if self.username.text() == "" or self.password.text() == "": + return apps.Message_ok(message="请填写完整的账号信息用户名和密码") + login_json = { + "username": self.username.text(), + "password": self.password.text() + } + url_https_mc_login = requests.post(url=apps.aotu_user_url + "authserver/authenticate", headers=apps.login_headers, json=login_json) + url_https_mc_login_json = url_https_mc_login.json() + if url_https_mc_login_json.get("error") == "ForbiddenOperationException": + return apps.Message_ok(message=url_https_mc_login_json.get("errorMessage")) + data_login_file = { + "accessToken": url_https_mc_login_json.get("accessToken"), + "clientToken": url_https_mc_login_json.get("clientToken"), + "id": url_https_mc_login_json["selectedProfile"]["id"], + "name": url_https_mc_login_json["selectedProfile"]["name"] + } + with open(file=apps.login_json_file, mode='w', encoding="UTF-8", newline='') as f_write: + json.dump(data_login_file, f_write) + self.destroy() + self.start_craserver_client_window = My_APP_Window(data=data_login_file, code=0) + self.start_craserver_client_window.show() + return None + + def mousePressEvent(self, event): + if event.button() == Qt.LeftButton: + self.draggable = True + self.offset = event.pos() + + def mouseMoveEvent(self, event): + if self.draggable: + self.move(event.globalPos() - self.offset) + + def mouseReleaseEvent(self, event): + if event.button() == Qt.LeftButton: + self.draggable = False + + def closeEvent(self, event: QCloseEvent) -> None: + self.destroy() + return sys.exit(0) + + def close_apps_button_ttols(self): + self.destroy() + return sys.exit(0) + +class My_APP_Window(QTabWidget): + def __init__(self, data: dict, code: int): + super().__init__() + self.data = data + self.code = code + self.server_list_dict = self.data.get("server_list") + self.setWindowFlags(Qt.FramelessWindowHint) + self.setFixedSize(apps.window_size_int[0], apps.window_size_int[1]) + self.setWindowTitle(apps.window_title_apps_name) + self.draggable = False + self.offset = None + + self.run_my_gui() + + def run_my_gui(self): + gui_box_grid = QGridLayout() + gui_box_grid.setColumnMinimumWidth(0, 0) + + title_name = QLabel(text=apps.window_title_apps_name) + gui_box_grid.addWidget(title_name, 0, 0, alignment=Qt.AlignTop | Qt.AlignLeft) + + zxh_button = QToolButton() + zxh_button.setIcon(QIcon("style/zxh.png")) + zxh_button.clicked.connect(self.zxh_apps) + + exit_button = QToolButton() + exit_button.setIcon(QIcon("style/exit.png")) + exit_button.clicked.connect(self.exit_window_apps) + + window_header_gridbox = QHBoxLayout() + window_header_gridbox.setContentsMargins(0, 0, 0, 0) + window_header_gridbox.addStretch(0) + window_header_gridbox.addWidget(zxh_button, alignment=Qt.AlignTop | Qt.AlignRight) + window_header_gridbox.addWidget(exit_button, alignment=Qt.AlignTop | Qt.AlignRight) + + gui_box_grid.addLayout(window_header_gridbox, 0, 1) + + self.index_home = QWidget() + self.craserver_client_settings = Craserver_client_settings() + self.craserver_client_game_settings = QWidget() + self.craserver_client_user_settings = QWidget() + + self.header_tab = QTabWidget() + self.header_tab.setContentsMargins(0, 0, 0, 0) + self.header_tab.addTab(self.index_home, "主页") + self.header_tab.addTab(self.craserver_client_settings, "管理") + self.header_tab.addTab(self.craserver_client_game_settings, "设置") + self.header_tab.addTab(self.craserver_client_user_settings, "CRA-USER") + + gui_box_grid.addWidget(self.header_tab, 1, 0, 1, 0) + + self.setLayout(gui_box_grid) + + self.index_home_page() + self.craserver_client_game_settings_page() + self.craserver_client_user_settings_page() + + def craserver_client_user_settings_page(self): + pass + + def craserver_client_game_settings_page(self): + pass + + def index_home_page(self): + index_home_grid_box = QGridLayout() + + self.server_list = QListWidget() + + self.start_game_button = QPushButton(text="启动CRA-SERVER") + self.start_game_button.clicked.connect(self.start_games_apps) + self.start_game_button.setFixedSize(200, 55) + index_home_grid_box.addWidget(self.server_list, 0, 0) + index_home_grid_box.addWidget(self.start_game_button, 1, 0, alignment=Qt.AlignRight | Qt.AlignBottom) + + for i_server_list in self.server_list_dict: + item = apps.customQListWidgetItem(image=i_server_list.get("image"), names=i_server_list.get("name"), tests=i_server_list.get("server_test")) + self.server_list.addItem(item) + self.server_list.setItemWidget(item, item.item_widget) + + self.index_home.setLayout(index_home_grid_box) + + def start_games_apps(self): + if self.server_list.currentRow() == -1: + return apps.Message_ok(message="请先选择需要加入的服务器") + return None + + def zxh_apps(self): + return self.showMinimized() + + def exit_window_apps(self): + self.destroy() + return sys.exit(0) + + def mousePressEvent(self, event): + if event.button() == Qt.LeftButton: + self.draggable = True + self.offset = event.pos() + + def mouseMoveEvent(self, event): + if self.draggable: + self.move(event.globalPos() - self.offset) + + def mouseReleaseEvent(self, event): + if event.button() == Qt.LeftButton: + self.draggable = False + + def closeEvent(self, event: QCloseEvent) -> None: + self.destroy() + return sys.exit(0) + +class Craserver_client_settings(QTabWidget): + def __init__(self): + super().__init__() + self.mods_settings = QWidget() + self.sh_settings = QWidget() + + self.addTab(self.mods_settings, "MODS列表") + self.addTab(self.sh_settings, "光影管理") + + self.mods_settings_page() + self.sh_settings_page() + + def mods_settings_page(self): + pass + + def sh_settings_page(self): + pass + +if __name__ == '__main__': + is_json_none = False + QGuiApplication.setHighDpiScaleFactorRoundingPolicy( + Qt.HighDpiScaleFactorRoundingPolicy.PassThrough + ) + QCoreApplication.setAttribute(Qt.AA_EnableHighDpiScaling) + app = QApplication() + if os.path.exists("config_app") is False: + os.mkdir("config_app") + if os.path.isfile(apps.login_json_file) is False: + window = Login_users_window_app() + if os.path.isfile(apps.login_json_file) is True: + with open(file=apps.login_json_file, mode='r', encoding="UTF-8", newline='') as f_read: + json_test = json.load(f_read) + is_json_none = all(json_test) + if is_json_none is False: + window = Login_users_window_app() + if os.path.isfile(apps.login_json_file) is True & is_json_none is True: + window = Login_Window_app() + window.show() + sys.exit(app.exec_()) diff --git a/module.py b/module.py new file mode 100644 index 0000000..197f288 --- /dev/null +++ b/module.py @@ -0,0 +1,19 @@ +from PySide2.QtWidgets import QWidget, QTabWidget, QApplication, QHBoxLayout, QVBoxLayout, QGridLayout +from PySide2.QtGui import QGuiApplication, QPixmap, QImage, QIcon +from PySide2.QtCore import QCoreApplication, Qt, QThread, QSettings, Signal +from PySide2.QtWidgets import ( + QPushButton, QToolButton, QListWidget, QLineEdit, QLabel, QTableWidget, QCheckBox, QComboBox, QMessageBox, QSlider, QProgressBar, + QFileDialog, QListWidgetItem +) +import sys +import os +import queue +import requests +import json +import datetime +import sqlite3 +from time import sleep +import zipfile +from shutil import rmtree +import subprocess +import apps diff --git a/style/exit.png b/style/exit.png new file mode 100644 index 0000000000000000000000000000000000000000..1e5aa6ca10d50d472cabbbbc67a6f6c23d96dd6f GIT binary patch literal 625 zcmV-%0*?KOP)Px%D@jB_RCr$Pno&-}Fbsz6TkyEugxv&A0=oroa1+K!;E`K|S!$)IS~okjf3r4~ z_J91YW|Dcn+5AY!M)~ z#rpW9NVotm@jxk4ES&X zS_xV35COL&oC}z*s-CZFEOTKqDbQ4ZHrE2G*{eY_1=KGQJzSUz0uRf85pYJrlph8U z7jR`ej1r*mSpw=FUcLIV9p2DAM%WoJto|JQC<5A9f@Z*#Pu=tkfJ%U5z_suE(8*2f zF@_7!{F9T}V+<9bfxq#I4Brl60xa;E5<&#Dz-LKt7qA3ALxQUS4|uc$HvyjTNC_?i zBH&RH77K`kM@U#C00AE@p;-VDK2k!HfDHI331$JA@Cpe>X8y3W>skazIdG* znJb`}c^@WV=B04>8=0_=z9jW>4&ZgD700000 LNkvXXu0mjff2al| literal 0 HcmV?d00001 diff --git a/style/message.qss b/style/message.qss new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/style/message.qss @@ -0,0 +1 @@ + diff --git a/style/style.qss b/style/style.qss new file mode 100644 index 0000000..2af2540 --- /dev/null +++ b/style/style.qss @@ -0,0 +1,25 @@ +QWidget { + font-family: "Microsoft YaHei"; + outline: none; + background-color: #111; + color: #f5f5f5; + border: none; +} + +QTabWidget { + font-family: "Microsoft YaHei"; + outline: none; + background-color: #111; + color: #f5f5f5; + border: none; +} + +QToolButton { + border: none; + color: none; + background-color: none; +} + +QLineEdit { + height: 25px; +} diff --git a/style/zxh.png b/style/zxh.png new file mode 100644 index 0000000000000000000000000000000000000000..9e748253f4a9ea573fcd32a37541360da6e7b7cb GIT binary patch literal 269 zcmeAS@N?(olHy`uVBq!ia0vp^4j|0I1|(Ny7TyC=jKx9jP7LeL$-D$|j(fT|hE&A8 zy>^h7*^r0%VDNueYuO|0GWIQM?;R4tytO~;{6F*Q{(pu84NqA@5_U4kIf@1}LYV6s zxKo*HpuK=et3a{foaNaGY0uU_z0SpOfI;*FTLnuu=MJX$ z^9dh6#k=nR$6sN(^oKWth`zqiTt>m3qs|fmd-iygu(=qB@h3Wb{G@bIQs7{OO$+1E m)7>uV4lKzZ1=#Q?uJ=8m;8<|#+!>&k7(8A5T-G@yGywn!K3_5b literal 0 HcmV?d00001