Skip to content

Commit 1066537

Browse files
committed
Now unlocker can update old dlcs + some fixes
1 parent cd78722 commit 1066537

File tree

7 files changed

+258
-49
lines changed

7 files changed

+258
-49
lines changed

Libs/MD5Check.py

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import os
2+
import hashlib
3+
import requests
4+
5+
class MD5:
6+
def __init__(self, game_path, url):
7+
self.game_path = game_path
8+
self.url = url
9+
self.prefix_to_remove = f"files/www/{url}/unlocker/files/"
10+
self.hashes_url = f"https://{url}/unlocker/hashes.txt"
11+
self.server_hashes = self._load_server_hashes()
12+
13+
def _load_server_hashes(self):
14+
try:
15+
response = requests.get(self.hashes_url)
16+
response.raise_for_status()
17+
if not response.text.strip():
18+
return None
19+
20+
lines = response.text.splitlines()
21+
hashes = {}
22+
for line in lines:
23+
server_hash, file_path = line.split()
24+
clean_path = file_path.replace(self.prefix_to_remove, "")
25+
hashes[clean_path] = server_hash
26+
return hashes
27+
except (requests.RequestException, ValueError):
28+
return None
29+
30+
def calculate_md5(self, file_path):
31+
hash_md5 = hashlib.md5()
32+
with open(file_path, "rb") as f:
33+
for chunk in iter(lambda: f.read(4096), b""):
34+
hash_md5.update(chunk)
35+
return hash_md5.hexdigest()
36+
37+
def check_files(self):
38+
if self.server_hashes is None:
39+
return []
40+
41+
mismatched_folders = []
42+
43+
for relative_path, server_hash in self.server_hashes.items():
44+
local_path = os.path.join(self.game_path, relative_path)
45+
46+
if os.path.isfile(local_path):
47+
local_hash = self.calculate_md5(local_path)
48+
if local_hash != server_hash:
49+
folder = os.path.dirname(relative_path)
50+
if folder not in mismatched_folders:
51+
mismatched_folders.append(folder)
52+
53+
return mismatched_folders

UI/translations/ru_RU.qm

2.09 KB
Binary file not shown.

UI/translations/ru_RU.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,26 @@ The program will assume that the launcher has already been reinstalled before</o
194194
<source>Close</source>
195195
<translation>Закрыть</translation>
196196
</message>
197+
<message>
198+
<location filename="ui_main.ui" line="2541"/>
199+
<source>Update old DLCs</source>
200+
<translatorcomment>Update old DLCs button</translatorcomment>
201+
<translation>Обновить DLC</translation>
202+
</message>
203+
<message>
204+
<location filename="ui_main.ui" line="2577"/>
205+
<source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
206+
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
207+
p, li { white-space: pre-wrap; }
208+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Segoe UI&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
209+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:12pt; color:#ff0000;&quot;&gt;Old DLCs detected! &lt;/span&gt;&lt;span style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:12pt; color:#ffffff;&quot;&gt;You can just update it while unlocking&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
210+
<translatorcomment>Update old DLCs text</translatorcomment>
211+
<translation>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
212+
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
213+
p, li { white-space: pre-wrap; }
214+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Segoe UI&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
215+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:12pt; color:#ff0000;&quot;&gt;Обнаружены старые DLC! &lt;/span&gt;&lt;span style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:12pt; color:#ffffff;&quot;&gt;Можно обновить их вместе с разблокировкой&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
216+
</message>
197217
<message>
198218
<location filename="../../UI_logic/MainWindow.py" line="88"/>
199219
<source>Exit Unlocker?</source>

UI/translations/zh_CN.qm

2 KB
Binary file not shown.

UI/translations/zh_CN.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,26 @@ p, li { white-space: pre-wrap; }
191191
<location filename="../../UI_logic/MainWindow.py" line="91"/>
192192
<source>Close</source>
193193
<translation>关闭</translation>
194+
</message>
195+
<message>
196+
<location filename="ui_main.ui" line="2541"/>
197+
<source>Update old DLCs</source>
198+
<translatorcomment>Update old DLCs button</translatorcomment>
199+
<translation>更新旧的DLCs</translation>
200+
</message>
201+
<message>
202+
<location filename="ui_main.ui" line="2577"/>
203+
<source>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
204+
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
205+
p, li { white-space: pre-wrap; }
206+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Segoe UI&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
207+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:12pt; color:#ff0000;&quot;&gt;Old DLCs detected! &lt;/span&gt;&lt;span style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:12pt; color:#ffffff;&quot;&gt;You can just update it while unlocking&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</source>
208+
<translatorcomment>Update old DLCs text</translatorcomment>
209+
<translation>&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.0//EN&quot; &quot;http://www.w3.org/TR/REC-html40/strict.dtd&quot;&gt;
210+
&lt;html&gt;&lt;head&gt;&lt;meta name=&quot;qrichtext&quot; content=&quot;1&quot; /&gt;&lt;style type=&quot;text/css&quot;&gt;
211+
p, li { white-space: pre-wrap; }
212+
&lt;/style&gt;&lt;/head&gt;&lt;body style=&quot; font-family:&apos;Segoe UI&apos;; font-size:8.25pt; font-weight:400; font-style:normal;&quot;&gt;
213+
&lt;p style=&quot; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;&quot;&gt;&lt;span style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:12pt; color:#ff0000;&quot;&gt;检测到旧的DLCs! &lt;/span&gt;&lt;span style=&quot; font-family:&apos;MS Shell Dlg 2&apos;; font-size:12pt; color:#ffffff;&quot;&gt;你可以在解锁的时候更新它&lt;/span&gt;&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;</translation>
194214
</message>
195215
<message>
196216
<location filename="../../UI_logic/MainWindow.py" line="91"/>

UI/ui_main.py

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -414,7 +414,7 @@ def setupUi(self, MainWindow):
414414
self.label_4.setStyleSheet("QLabel {\n"
415415
" color:rgb(255,255,255);\n"
416416
"}")
417-
self.label_4.setText("简中")
417+
self.label_4.setText("简体")
418418
self.label_4.setAlignment(QtCore.Qt.AlignBottom|QtCore.Qt.AlignHCenter)
419419
self.label_4.setObjectName("label_4")
420420
self.gridLayout_3.addWidget(self.label_4, 0, 3, 1, 1)
@@ -620,13 +620,13 @@ def setupUi(self, MainWindow):
620620
self.lab_bullet3 = QtWidgets.QLabel(self.frame_bug_main)
621621
self.lab_bullet3.setMaximumSize(QtCore.QSize(5, 16777215))
622622
self.lab_bullet3.setText("")
623-
self.lab_bullet3.setPixmap(QtGui.QPixmap("UI\\Minimalistic-Flat-Modern-GUI-Template-master/icons/1x/bulletAsset 54.png"))
623+
self.lab_bullet3.setPixmap(QtGui.QPixmap("UI\\../../../Desktop/unlocker-v2_design/Minimalistic-Flat-Modern-GUI-Template-master/icons/1x/bulletAsset 54.png"))
624624
self.lab_bullet3.setObjectName("lab_bullet3")
625625
self.gridLayout.addWidget(self.lab_bullet3, 3, 0, 1, 1)
626626
self.lab_bullet = QtWidgets.QLabel(self.frame_bug_main)
627627
self.lab_bullet.setMaximumSize(QtCore.QSize(5, 16777215))
628628
self.lab_bullet.setText("")
629-
self.lab_bullet.setPixmap(QtGui.QPixmap("UI\\Minimalistic-Flat-Modern-GUI-Template-master/icons/1x/bulletAsset 54.png"))
629+
self.lab_bullet.setPixmap(QtGui.QPixmap("UI\\../../../Desktop/unlocker-v2_design/Minimalistic-Flat-Modern-GUI-Template-master/icons/1x/bulletAsset 54.png"))
630630
self.lab_bullet.setAlignment(QtCore.Qt.AlignCenter)
631631
self.lab_bullet.setObjectName("lab_bullet")
632632
self.gridLayout.addWidget(self.lab_bullet, 0, 0, 1, 1)
@@ -695,7 +695,7 @@ def setupUi(self, MainWindow):
695695
self.lab_bullet2 = QtWidgets.QLabel(self.frame_bug_main)
696696
self.lab_bullet2.setMaximumSize(QtCore.QSize(5, 16777215))
697697
self.lab_bullet2.setText("")
698-
self.lab_bullet2.setPixmap(QtGui.QPixmap("UI\\Minimalistic-Flat-Modern-GUI-Template-master/icons/1x/bulletAsset 54.png"))
698+
self.lab_bullet2.setPixmap(QtGui.QPixmap("UI\\../../../Desktop/unlocker-v2_design/Minimalistic-Flat-Modern-GUI-Template-master/icons/1x/bulletAsset 54.png"))
699699
self.lab_bullet2.setObjectName("lab_bullet2")
700700
self.gridLayout.addWidget(self.lab_bullet2, 1, 0, 1, 1)
701701
self.horizontalLayout_8 = QtWidgets.QHBoxLayout()
@@ -1122,6 +1122,62 @@ def setupUi(self, MainWindow):
11221122
self.horizontalLayout_21 = QtWidgets.QHBoxLayout()
11231123
self.horizontalLayout_21.setContentsMargins(-1, 10, -1, -1)
11241124
self.horizontalLayout_21.setObjectName("horizontalLayout_21")
1125+
self.formLayout_2 = QtWidgets.QFormLayout()
1126+
self.formLayout_2.setContentsMargins(-1, -1, 10, -1)
1127+
self.formLayout_2.setObjectName("formLayout_2")
1128+
self.old_dlc_text = QtWidgets.QTextEdit(self.work_page)
1129+
self.old_dlc_text.setEnabled(False)
1130+
self.old_dlc_text.setMinimumSize(QtCore.QSize(590, 0))
1131+
self.old_dlc_text.setMaximumSize(QtCore.QSize(16777215, 40))
1132+
font = QtGui.QFont()
1133+
font.setFamily("Segoe UI")
1134+
self.old_dlc_text.setFont(font)
1135+
self.old_dlc_text.setInputMethodHints(QtCore.Qt.ImhNone)
1136+
self.old_dlc_text.setFrameShape(QtWidgets.QFrame.NoFrame)
1137+
self.old_dlc_text.setUndoRedoEnabled(False)
1138+
self.old_dlc_text.setTextInteractionFlags(QtCore.Qt.NoTextInteraction)
1139+
self.old_dlc_text.setObjectName("old_dlc_text")
1140+
self.formLayout_2.setWidget(1, QtWidgets.QFormLayout.LabelRole, self.old_dlc_text)
1141+
self.update_dlc_button = QtWidgets.QCheckBox(self.work_page)
1142+
self.update_dlc_button.setMinimumSize(QtCore.QSize(300, 25))
1143+
font = QtGui.QFont()
1144+
font.setFamily("Segoe UI")
1145+
font.setPointSize(13)
1146+
self.update_dlc_button.setFont(font)
1147+
self.update_dlc_button.setCursor(QtGui.QCursor(QtCore.Qt.PointingHandCursor))
1148+
self.update_dlc_button.setStyleSheet("QCheckBox {\n"
1149+
" color:rgb(255,255,255);\n"
1150+
"}\n"
1151+
"\n"
1152+
"QCheckBox::indicator {\n"
1153+
" width: 12px;\n"
1154+
" height: 12px;\n"
1155+
"}\n"
1156+
"\n"
1157+
"QCheckBox::indicator:unchecked {\n"
1158+
" border:2px solid rgb(51,51,51);\n"
1159+
" background:rgb(91,90,90);\n"
1160+
"}\n"
1161+
"\n"
1162+
"QCheckBox::indicator:unchecked:pressed {\n"
1163+
" border:2px solid rgb(51,51,51);\n"
1164+
" background:rgb(0,143,170);\n"
1165+
"}\n"
1166+
"\n"
1167+
"QCheckBox::indicator:checked {\n"
1168+
" background-color:rgb(0,143,150);\n"
1169+
" border: 2px solid rgb(51,51,51);\n"
1170+
"}\n"
1171+
"\n"
1172+
"QCheckBox::indicator:checked:pressed {\n"
1173+
" border:2px solid rgb(51,51,51);\n"
1174+
" background:rgb(91,90,90);\n"
1175+
"}\n"
1176+
"")
1177+
self.update_dlc_button.setChecked(True)
1178+
self.update_dlc_button.setObjectName("update_dlc_button")
1179+
self.formLayout_2.setWidget(0, QtWidgets.QFormLayout.LabelRole, self.update_dlc_button)
1180+
self.horizontalLayout_21.addLayout(self.formLayout_2)
11251181
spacerItem16 = QtWidgets.QSpacerItem(40, 20, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
11261182
self.horizontalLayout_21.addItem(spacerItem16)
11271183
self.verticalLayout_10 = QtWidgets.QVBoxLayout()
@@ -1335,7 +1391,7 @@ def retranslateUi(self, MainWindow):
13351391
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\';\"> Follow the installer instructions. Installation is almost entirely automatic. <br /></span></p>\n"
13361392
"<p align=\"center\" style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-weight:600; text-decoration: underline; color:#008f96;\">Terms Of Use</span></p>\n"
13371393
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:\'MS Shell Dlg 2\'; color:#0000ff;\"><br /></p>\n"
1338-
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\';\">1. This unlocker is distributed absolutely free of charge. Any commercial use of this unlocker is prohibited. If you purchased from any source, please refund and give a negative review.</span></p>\n"
1394+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\';\">1. This unlocker is distributed absolutely free of charge. Any commercial use of this unlocker is prohibited.</span></p>\n"
13391395
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
13401396
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\';\">2. THIS UNLOCKER IS PROVIDED &quot;AS IS&quot;. NO WARRANTIES ARE PROVIDED OR IMPLIED. YOU USE THIS MODIFICATION OF THE ORIGINAL GAME AT YOUR OWN RISK. THE AUTHORS OF THE MODIFICATION WILL NOT BE LIABLE FOR ANY LOSSES OR DATA CORRUPTION, ANY LOST PROFITS IN THE PROCESS OF USE OR MISUSE OF THIS MODIFICATION.</span></p>\n"
13411397
"<p style=\"-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><br /></p>\n"
@@ -1363,6 +1419,12 @@ def retranslateUi(self, MainWindow):
13631419
self.copy_files_radio.setText(_translate("MainWindow", "Copy files"))
13641420
self.dlc_download_label.setText(_translate("MainWindow", "DLC Download progress"))
13651421
self.current_dlc_label.setText(_translate("MainWindow", "Current DLC progress"))
1422+
self.old_dlc_text.setHtml(_translate("MainWindow", "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0//EN\" \"http://www.w3.org/TR/REC-html40/strict.dtd\">\n"
1423+
"<html><head><meta name=\"qrichtext\" content=\"1\" /><style type=\"text/css\">\n"
1424+
"p, li { white-space: pre-wrap; }\n"
1425+
"</style></head><body style=\" font-family:\'Segoe UI\'; font-size:8.25pt; font-weight:400; font-style:normal;\">\n"
1426+
"<p style=\" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;\"><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:12pt; color:#ff0000;\">Old DLCs detected! </span><span style=\" font-family:\'MS Shell Dlg 2\'; font-size:12pt; color:#ffffff;\">You can just update it while unlocking</span></p></body></html>"))
1427+
self.update_dlc_button.setText(_translate("MainWindow", "Update old DLCs"))
13661428
self.lauch_game_checkbox.setText(_translate("MainWindow", "Launch game"))
13671429
self.done_button.setText(_translate("MainWindow", "Done"))
13681430
self.bug_page_title.setText(_translate("MainWindow", "Log"))

0 commit comments

Comments
 (0)