62 lines
1.1 KiB
Python
62 lines
1.1 KiB
Python
import configparser
|
|
|
|
from pathlib import Path
|
|
|
|
#declare default vars
|
|
class Config():
|
|
|
|
|
|
AccountKey = "NK"
|
|
AccountID = "NA"
|
|
version = 01.02
|
|
|
|
|
|
#declare files
|
|
config = configparser.ConfigParser()
|
|
configPath = Path("Config.ini")
|
|
|
|
|
|
def makeConfig():
|
|
config['DEFAULT'] = {'Version': version}
|
|
config['ACCOUNT'] = {'KEY': "NK"}
|
|
config['ACCOUNT'] = {'ID': "NK"}
|
|
|
|
with open('Config.ini', 'w') as configfile:
|
|
config.write(configfile)
|
|
|
|
|
|
def loadConfig():
|
|
try:
|
|
config.read(configPath)
|
|
Config.version = config["DEFAULT"]["Version"]
|
|
Config.AccountID = config["ACCOUNT"]["ID"]
|
|
Config.AccountID = config["ACCOUNT"]["KEY"]
|
|
except Exception as e:
|
|
print(f"An Error Occured , Check : {e}")
|
|
|
|
def checkConfig():
|
|
if configPath.exists():
|
|
print("The Config file exists.")
|
|
loadConfig()
|
|
|
|
else:
|
|
print("The file Config does not exist. - Creating")
|
|
makeConfig()
|
|
|
|
|
|
|
|
|
|
def showIntroText():
|
|
print("Tiropit Launcher CLI - Release Branch")
|
|
print(f"[TCLI]===========================[{Config.version}]")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#Begin
|
|
|
|
checkConfig()
|
|
|
|
showIntroText() |