# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'CNC.ui'
#
# Created: Fri Aug 18 21:20:40 2017
#      by: PyQt5 UI code generator 5.3
#
# WARNING! All changes made in this file will be lost!

from PyQt5 import QtCore, QtGui, QtWidgets
import os, easygui, urllib.request, zipfile, win32ui, time

class Ui_CattleandCropsLauncher(object):
    def setupUi(self, CattleandCropsLauncher):
        CattleandCropsLauncher.setObjectName("CattleandCropsLauncher")
        CattleandCropsLauncher.resize(820, 650)
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(CattleandCropsLauncher.sizePolicy().hasHeightForWidth())
        CattleandCropsLauncher.setSizePolicy(sizePolicy)
        CattleandCropsLauncher.setMinimumSize(QtCore.QSize(820, 650))
        CattleandCropsLauncher.setMaximumSize(QtCore.QSize(820, 650))
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(240, 128, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(240, 128, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(240, 128, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
        CattleandCropsLauncher.setPalette(palette)
        icon = QtGui.QIcon()
        icon.addPixmap(QtGui.QPixmap("Download.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
        CattleandCropsLauncher.setWindowIcon(icon)
        self.centralwidget = QtWidgets.QWidget(CattleandCropsLauncher)
        self.centralwidget.setObjectName("centralwidget")
        self.horizontalLayout = QtWidgets.QHBoxLayout(self.centralwidget)
        self.horizontalLayout.setObjectName("horizontalLayout")
        self.tabWidget = QtWidgets.QTabWidget(self.centralwidget)
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
        self.tabWidget.setPalette(palette)
        self.tabWidget.setFocusPolicy(QtCore.Qt.NoFocus)
        self.tabWidget.setContextMenuPolicy(QtCore.Qt.NoContextMenu)
        self.tabWidget.setObjectName("tabWidget")
        self.tab = QtWidgets.QWidget()
        self.tab.setObjectName("tab")
        self.webView_4 = QtWebKitWidgets.QWebView(self.tab)
        self.webView_4.setGeometry(QtCore.QRect(0, 0, 801, 591))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.webView_4.sizePolicy().hasHeightForWidth())
        self.webView_4.setSizePolicy(sizePolicy)
        self.webView_4.setUrl(QtCore.QUrl("https://images.cattleandcrops.com/cattle-and-crops/camera-team_cnc.jpg"))
        self.webView_4.setZoomFactor(1.5)
        self.webView_4.setObjectName("webView_4")
        self.progressBar = QtWidgets.QProgressBar(self.tab)
        self.progressBar.setGeometry(QtCore.QRect(-3, 0, 801, 31))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.progressBar.sizePolicy().hasHeightForWidth())
        self.progressBar.setSizePolicy(sizePolicy)
        self.progressBar.setProperty("value", 0)
        self.progressBar.setTextVisible(False)
        self.progressBar.setOrientation(QtCore.Qt.Horizontal)
        self.progressBar.setInvertedAppearance(True)
        self.progressBar.setObjectName("progressBar")
        self.play = QtWidgets.QPushButton(self.tab)
        self.play.setGeometry(QtCore.QRect(680, 520, 121, 51))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.play.sizePolicy().hasHeightForWidth())
        self.play.setSizePolicy(sizePolicy)
        font = QtGui.QFont()
        font.setPointSize(8)
        font.setBold(True)
        font.setWeight(75)
        self.play.setFont(font)
        icon1 = QtGui.QIcon()
        icon1.addPixmap(QtGui.QPixmap("axion-850-810-hrc.png"), QtGui.QIcon.Active, QtGui.QIcon.On)
        self.play.setIcon(icon1)
        self.play.setIconSize(QtCore.QSize(40, 40))
        self.play.setObjectName("play")
        self.update = QtWidgets.QPushButton(self.tab)
        self.update.setGeometry(QtCore.QRect(0, 520, 111, 51))
        sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding)
        sizePolicy.setHorizontalStretch(0)
        sizePolicy.setVerticalStretch(0)
        sizePolicy.setHeightForWidth(self.update.sizePolicy().hasHeightForWidth())
        self.update.setSizePolicy(sizePolicy)
        palette = QtGui.QPalette()
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Midlight, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Dark, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Mid, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Active, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(0, 0, 0))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(227, 227, 227))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Midlight, brush)
        brush = QtGui.QBrush(QtGui.QColor(160, 160, 160))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Dark, brush)
        brush = QtGui.QBrush(QtGui.QColor(160, 160, 160))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Mid, brush)
        brush = QtGui.QBrush(QtGui.QColor(240, 240, 240))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Inactive, QtGui.QPalette.Window, brush)
        brush = QtGui.QBrush(QtGui.QColor(120, 120, 120))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.WindowText, brush)
        brush = QtGui.QBrush(QtGui.QColor(85, 255, 255))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Button, brush)
        brush = QtGui.QBrush(QtGui.QColor(247, 247, 247))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Midlight, brush)
        brush = QtGui.QBrush(QtGui.QColor(160, 160, 160))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Dark, brush)
        brush = QtGui.QBrush(QtGui.QColor(160, 160, 160))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Mid, brush)
        brush = QtGui.QBrush(QtGui.QColor(240, 240, 240))
        brush.setStyle(QtCore.Qt.SolidPattern)
        palette.setBrush(QtGui.QPalette.Disabled, QtGui.QPalette.Window, brush)
        self.update.setPalette(palette)
        font = QtGui.QFont()
        font.setBold(True)
        font.setWeight(75)
        self.update.setFont(font)
        self.update.setIcon(icon1)
        self.update.setIconSize(QtCore.QSize(40, 40))
        self.update.setShortcut("")
        self.update.setCheckable(False)
        self.update.setAutoDefault(False)
        self.update.setDefault(False)
        self.update.setFlat(False)
        self.update.setObjectName("update")
        self.login = QtWidgets.QLabel(self.tab)
        self.login.setGeometry(QtCore.QRect(0, 30, 71, 16))
        font = QtGui.QFont()
        font.setBold(True)
        font.setUnderline(True)
        font.setWeight(75)
        font.setStrikeOut(False)
        self.login.setFont(font)
        self.login.setInputMethodHints(QtCore.Qt.ImhNone)
        self.login.setOpenExternalLinks(False)
        self.login.setObjectName("login")
        self.tabWidget.addTab(self.tab, "")
        self.tab_4 = QtWidgets.QWidget()
        self.tab_4.setObjectName("tab_4")
        self.webView_6 = QtWebKitWidgets.QWebView(self.tab_4)
        self.webView_6.setGeometry(QtCore.QRect(0, -1, 801, 571))
        self.webView_6.setUrl(QtCore.QUrl("http://forum.cattleandcrops.com/"))
        self.webView_6.setObjectName("webView_6")
        self.tabWidget.addTab(self.tab_4, "")
        self.tab_5 = QtWidgets.QWidget()
        self.tab_5.setObjectName("tab_5")
        self.path = QtWidgets.QLineEdit(self.tab_5)
        self.path.setGeometry(QtCore.QRect(20, 160, 231, 20))
        self.path.setObjectName("path")
        self.groupBox = QtWidgets.QGroupBox(self.tab_5)
        self.groupBox.setGeometry(QtCore.QRect(20, 90, 231, 61))
        self.groupBox.setObjectName("groupBox")
        self.version = QtWidgets.QComboBox(self.groupBox)
        self.version.setGeometry(QtCore.QRect(20, 20, 191, 22))
        self.version.setObjectName("version")
        self.groupBox_2 = QtWidgets.QGroupBox(self.tab_5)
        self.groupBox_2.setGeometry(QtCore.QRect(420, 90, 371, 80))
        self.groupBox_2.setObjectName("groupBox_2")
        self.user_pass_2 = QtWidgets.QLineEdit(self.groupBox_2)
        self.user_pass_2.setGeometry(QtCore.QRect(10, 50, 331, 20))
        self.user_pass_2.setInputMethodHints(QtCore.Qt.ImhNoAutoUppercase|QtCore.Qt.ImhNoPredictiveText|QtCore.Qt.ImhSensitiveData)
        self.user_pass_2.setEchoMode(QtWidgets.QLineEdit.PasswordEchoOnEdit)
        self.user_pass_2.setReadOnly(True)
        self.user_pass_2.setObjectName("user_pass_2")
        self.user = QtWidgets.QLineEdit(self.groupBox_2)
        self.user.setGeometry(QtCore.QRect(10, 20, 331, 20))
        self.user.setReadOnly(True)
        self.user.setObjectName("user")
        self.groupBox_3 = QtWidgets.QGroupBox(self.tab_5)
        self.groupBox_3.setGeometry(QtCore.QRect(420, 190, 371, 80))
        self.groupBox_3.setObjectName("groupBox_3")
        self.pass_media = QtWidgets.QLineEdit(self.groupBox_3)
        self.pass_media.setGeometry(QtCore.QRect(10, 50, 331, 20))
        self.pass_media.setInputMethodHints(QtCore.Qt.ImhNoAutoUppercase|QtCore.Qt.ImhNoPredictiveText|QtCore.Qt.ImhSensitiveData)
        self.pass_media.setEchoMode(QtWidgets.QLineEdit.PasswordEchoOnEdit)
        self.pass_media.setReadOnly(True)
        self.pass_media.setObjectName("pass_media")
        self.user_media = QtWidgets.QLineEdit(self.groupBox_3)
        self.user_media.setGeometry(QtCore.QRect(10, 20, 331, 20))
        self.user_media.setReadOnly(True)
        self.user_media.setObjectName("user_media")
        self.groupBox_4 = QtWidgets.QGroupBox(self.tab_5)
        self.groupBox_4.setGeometry(QtCore.QRect(420, 300, 371, 80))
        self.groupBox_4.setObjectName("groupBox_4")
        self.user_pass = QtWidgets.QLineEdit(self.groupBox_4)
        self.user_pass.setGeometry(QtCore.QRect(10, 50, 331, 20))
        self.user_pass.setInputMethodHints(QtCore.Qt.ImhNoAutoUppercase|QtCore.Qt.ImhNoPredictiveText|QtCore.Qt.ImhSensitiveData)
        self.user_pass.setEchoMode(QtWidgets.QLineEdit.PasswordEchoOnEdit)
        self.user_pass.setReadOnly(True)
        self.user_pass.setObjectName("user_pass")
        self.user_modder = QtWidgets.QLineEdit(self.groupBox_4)
        self.user_modder.setGeometry(QtCore.QRect(10, 20, 331, 20))
        self.user_modder.setReadOnly(True)
        self.user_modder.setObjectName("user_modder")
        self.tabWidget.addTab(self.tab_5, "")
        self.tab_2 = QtWidgets.QWidget()
        self.tab_2.setObjectName("tab_2")
        self.webView_2 = QtWebKitWidgets.QWebView(self.tab_2)
        self.webView_2.setGeometry(QtCore.QRect(0, 180, 801, 541))
        self.webView_2.setUrl(QtCore.QUrl("https://images.cattleandcrops.com/cattle-and-crops/cattle-and-crops-harbor.jpg"))
        self.webView_2.setObjectName("webView_2")
        self.webView_3 = QtWebKitWidgets.QWebView(self.tab_2)
        self.webView_3.setGeometry(QtCore.QRect(0, 0, 801, 181))
        self.webView_3.setMaximumSize(QtCore.QSize(16777215, 600))
        self.webView_3.setUrl(QtCore.QUrl("https://www.cattleandcrops.com/changelog"))
        self.webView_3.setObjectName("webView_3")
        self.tabWidget.addTab(self.tab_2, "")
        self.tab_3 = QtWidgets.QWidget()
        self.tab_3.setObjectName("tab_3")
        self.webView = QtWebKitWidgets.QWebView(self.tab_3)
        self.webView.setGeometry(QtCore.QRect(0, 0, 801, 571))
        self.webView.setUrl(QtCore.QUrl("https://www.cattleandcrops.com/mediapartner/sign_up"))
        self.webView.setObjectName("webView")
        self.tabWidget.addTab(self.tab_3, "")
        self.tab_6 = QtWidgets.QWidget()
        self.tab_6.setObjectName("tab_6")
        self.webView_5 = QtWebKitWidgets.QWebView(self.tab_6)
        self.webView_5.setGeometry(QtCore.QRect(0, 0, 801, 571))
        self.webView_5.setUrl(QtCore.QUrl("https://www.cattleandcrops.com/modder/sign_up"))
        self.webView_5.setObjectName("webView_5")
        self.tabWidget.addTab(self.tab_6, "")
        self.tab_7 = QtWidgets.QWidget()
        self.tab_7.setObjectName("tab_7")
        self.webView_8 = QtWebKitWidgets.QWebView(self.tab_7)
        self.webView_8.setGeometry(QtCore.QRect(0, 0, 801, 571))
        self.webView_8.setUrl(QtCore.QUrl("https://www.cattleandcrops.com/mods"))
        self.webView_8.setObjectName("webView_8")
        self.tabWidget.addTab(self.tab_7, "")
        self.horizontalLayout.addWidget(self.tabWidget)
        CattleandCropsLauncher.setCentralWidget(self.centralwidget)
        self.menubar = QtWidgets.QMenuBar(CattleandCropsLauncher)
        self.menubar.setGeometry(QtCore.QRect(0, 0, 820, 21))
        self.menubar.setObjectName("menubar")
        CattleandCropsLauncher.setMenuBar(self.menubar)
        self.statusbar = QtWidgets.QStatusBar(CattleandCropsLauncher)
        self.statusbar.setObjectName("statusbar")
        CattleandCropsLauncher.setStatusBar(self.statusbar)

        self.play.clicked.connect(self.Play)
        self.update.clicked.connect(self.Update)

        self.retranslateUi(CattleandCropsLauncher)
        self.tabWidget.setCurrentIndex(0)
        QtCore.QMetaObject.connectSlotsByName(CattleandCropsLauncher)

    def retranslateUi(self, CattleandCropsLauncher):
        _translate = QtCore.QCoreApplication.translate
        CattleandCropsLauncher.setWindowTitle(_translate("CattleandCropsLauncher", "Cattle and Crops Launcher"))
        self.play.setText(_translate("CattleandCropsLauncher", "Spielen"))
        self.update.setText(_translate("CattleandCropsLauncher", "Update"))
        self.login.setText(_translate("CattleandCropsLauncher", "Abgemeldet"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab), _translate("CattleandCropsLauncher", "Download/Spiel"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_4), _translate("CattleandCropsLauncher", "Forum"))
        self.path.setPlaceholderText(_translate("CattleandCropsLauncher", "Speicherort"))
        self.groupBox.setTitle(_translate("CattleandCropsLauncher", "Version"))
        self.groupBox_2.setTitle(_translate("CattleandCropsLauncher", "Spiel Account"))
        self.user_pass_2.setPlaceholderText(_translate("CattleandCropsLauncher", "Passwort"))
        self.user.setPlaceholderText(_translate("CattleandCropsLauncher", "Benutzername"))
        self.groupBox_3.setTitle(_translate("CattleandCropsLauncher", "Mediapartner"))
        self.pass_media.setPlaceholderText(_translate("CattleandCropsLauncher", "Passwort"))
        self.user_media.setPlaceholderText(_translate("CattleandCropsLauncher", "Benutzername"))
        self.groupBox_4.setTitle(_translate("CattleandCropsLauncher", "Modder"))
        self.user_pass.setPlaceholderText(_translate("CattleandCropsLauncher", "Passwort"))
        self.user_modder.setPlaceholderText(_translate("CattleandCropsLauncher", "Benutzername"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_5), _translate("CattleandCropsLauncher", "Einstellungen"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_2), _translate("CattleandCropsLauncher", "Changelog"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_3), _translate("CattleandCropsLauncher", "Mediapartner"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_6), _translate("CattleandCropsLauncher", "Modder"))
        self.tabWidget.setTabText(self.tabWidget.indexOf(self.tab_7), _translate("CattleandCropsLauncher", "Mods"))

    def Play(self, o):
        versionIndex = self.version.currentIndex()
        currentVersion = version[versionIndex].split("|")

        try:
            urllib.request.urlretrieve("https://www.flo210500.com/CnC-update/version1.cnc", "./cVersion.cnc")
        except:
            easygui.msgbox("Bitte Überprüfe deine Internet Verbindung")
        
        file = open("./version.cnc", "r")
        cncVersion =  file.read().split("|")
        file.close()
        
        file = open("./cVersion.cnc", "r")
        currentCncVersion =  file.read()
        file.close()
        if cncVersion[0] == currentCncVersion:
            self.progressBar.setValue(100)
            file = open("./CattleAndCrops.bat")
            startcommand = file.read()
            file.close()
        else:
            self.play.setEnabled(False)
            self.update.setEnabled(True)

        os.popen(startcommand)
        time.sleep(10)
        sys.exit()
        
    def Update(self, p):
        versionIndex = self.version.currentIndex()
        currentVersion = version[versionIndex].split("|")

        self.progressBar.setValue(100)
        file = open("./CnC-Update.bat")
        updatecommand = file.read()
        file.close()
        os.popen(updatecommand)
        time.sleep(10)
        sys.exit()

from PyQt5 import QtWebKitWidgets

if __name__ == "__main__":
    import sys
    app = QtWidgets.QApplication(sys.argv)
    CattleandCropsLauncher = QtWidgets.QMainWindow()
    ui = Ui_CattleandCropsLauncher()
    ui.setupUi(CattleandCropsLauncher)
    CattleandCropsLauncher.show()

    #VersionList Download
    try:
        urllib.request.urlretrieve("https://flo210500.com/CnC-update/version.cnc", "./version.cnc")
    except:
        easygui.msgbox("Bitte Überprüfe deine Internet Verbindung")

    file = open("./version.cnc")
    version = file.read()
    file.close()

    version = version.split("\n")
    versionNames = []

    for i in version:
        versionNames.append(i.split("|")[0])

    ui.version.addItems(versionNames)

    versionIndex = ui.version.currentIndex()
    currentVersion = version[versionIndex].split("|")


    file = open("./version.cnc", "r")
    cncVersion =  file.read().split("|")
    file.close()

    file = open("./cVersion.cnc", "r")
    currentCncVersion =  file.read()
    file.close()
    if cncVersion[0] == currentCncVersion:
        ui.update.setEnabled(False)
    else:
        ui.play.setEnabled(False)
        urllib.request.urlretrieve("https://www.flo210500.com/CnC-update/version1.cnc", "./cVersion.cnc")
        

    



        
    sys.exit(app.exec_())

