/*

*
* AUTHOR: paradox
*
* PURPOSE: Recreates some required variables and functions since we are
* running in pre-autorun.
*

*/

//-/~ Include Console Commands
require( 'concommand' )

concommand = _G.concommand

//-/~ File Read
function file.Read( filename, path )
	if ( path == true ) then path = "GAME" end
	if ( path == nil || path == false ) then path = "DATA" end

	local f = file.Open( filename, "rb", path )
	if ( !f ) then return end

	local str = f:Read( f:Size() )

	f:Close()

	if ( !str ) then str = "" end

	return str
end

//-/~ File Write
function file.Write( filename, contents )
	local f = file.Open( filename, "wb", "DATA" )
	if ( !f ) then return end

	f:Write( contents )
	f:Close()
end

//-/~ File Append
function file.Append( filename, contents )
	local f = file.Open( filename, "ab", "DATA" )
	if ( !f ) then return end

	f:Write( contents )
	f:Close()
end

//-/~ Starts With
function string.StartsWith( str, start )
	return string.sub( str, 1, string.len( start ) ) == start
end

string.StartWith = string.StartsWith

//-/~ Color
function Color( r, g, b, a )
    return setmetatable( { r = math.min( tonumber(r), 255 ), g =  math.min( tonumber(g), 255 ), b =  math.min( tonumber(b), 255 ), a =  math.min( tonumber( (a or 255) ), 255 ) }, COLOR )
end

//-/~ Colors
color_red = Color( 255, 0, 0 )
color_green = Color( 0, 255, 0 )
color_blue = Color( 0, 0, 255 )

color_yellow = Color( 255, 255, 0 )
color_purple = Color( 221, 160, 221 )

color_white = Color( 255, 255, 255 )

//--/~ Print Our Load Message
MsgC(color_purple, [[
     _      ____     _  _____ ____  _____  _  ____ 
    / \__/|/  _ \   / |/  __// ___\/__ __\/ \/   _\
    | |\/||| / \|   | ||  \  |    \  / \  | ||  /  
    | |  ||| |-||/\_| ||  /_ \___ |  | |  | ||  \_ 
    \_/  \|\_/ \|\____/\____\\____/  \_/  \_/\____/
]], color_white, '    quality security script by paradox\n' )