Files
TiropitLauncher/CLI/Init.py

62 lines
1.1 KiB
Python
Raw Normal View History

2025-09-05 17:59:19 +03:00
import configparser
2025-09-05 17:59:19 +03:00
from pathlib import Path
#declare default vars
class Config():
AccountKey = "NK"
AccountID = "NA"
version = 01.02
2025-09-05 17:59:19 +03:00
#declare files
config = configparser.ConfigParser()
configPath = Path("Config.ini")
def makeConfig():
config['DEFAULT'] = {'Version': version}
config['ACCOUNT'] = {'KEY': "NK"}
config['ACCOUNT'] = {'ID': "NK"}
2025-09-05 17:59:19 +03:00
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}")
2025-09-05 17:59:19 +03:00
def checkConfig():
if configPath.exists():
print("The Config file exists.")
loadConfig()
2025-09-05 17:59:19 +03:00
else:
print("The file Config does not exist. - Creating")
makeConfig()
2025-09-05 17:59:19 +03:00
def showIntroText():
print("Tiropit Launcher CLI - Release Branch")
print(f"[TCLI]===========================[{Config.version}]")
2025-09-05 17:59:19 +03:00
#Begin
2025-09-05 17:59:19 +03:00
checkConfig()
2025-09-05 17:59:19 +03:00
showIntroText()