##########################
## Wirtten by: ShuZzle 	##
## Edited by: .Avenue™	##
##########################
import dbg
import app
import os

def RunCheckUp():
	Whitelist = [
		'bgm',
		'download',
		'lib',
		'mark',
		'miles',
		'pack',
		'screenshot',
		'upload',
		'!!!Masuri de Precautie ANTIHACK!!!.rtf',
		'channel.inf',
		'Clientversion.txt',
		'config.exe',
		'darikon_hash.list',
		'DarikonError.log',
		'design.ddf',
		'devil.dll',
		'dsetup.dll',
		'errorlog.exe',
		'ErrorLog.txt',
		'granny_max.dlo',
		'granny2.dll',
		'HsUserUtil.log',
		'locale.cfg',
		'metin2.cfg',
		'Metin2.ico',
		'mouse.cfg',
		'mscoree.dll',
		'MSS32.DLL',
		'MSVCRTD.DLL',
		'patcher_config.ini',
		'python22.dll',
		'python27.dll',
		'Metin2Alternosfera.exe',
		'SpeedTreeRT.dll',
		'Start.bat',
		'syserr.txt',
		'Update.exe'		## No comma (,) in the last line!
		]
	
	path = os.getcwd()
	k = os.listdir(path)
	if k != Whitelist:
		####Starting_Phase01#####
		for item in k:
			if not item in Whitelist:
				dbg.LogBox("Fisierele acestea se vor sterge acum: " + str(item))
				try:
					os.remove(item)
				except:
					dbg.LogBox("Esti rugat sa stergi manual " + str(item) + " pentru a putea juca normal.")
					dbg.LogBox("Clientul va fi inchis!")
					app.Abort()
			else:
				pass
	if Whitelist != k:
		#####-Starting_Phase02#######
		for missing in Whitelist:
			if not missing in k:
				dbg.LogBox("Fisiere lipsa: " + str(missing))
				app.Abort()
			else:
				pass
RunCheckUp()