#!/bin/bash
# This script was auto generated using the code-cleanup package http://forumubuntusoftware.info/viewtopic.php?f=23&t=9480
# Do a search and replace for ultimateedition.info followed by a search and replace REPLACEME with the name of your program & delete this line.

# ==============================================================================
# title			:REPLACEME
# description	:YOURDESCRIPTION
# author		:theemahn <theemahn@ultimateedition.info>
# date			:06/12/2025
# version		:1.0
# usage			:REPLACEME --help
# manual		:man REPLACEME
# notes			:See change-log below for further information.
# ==============================================================================
# Change-log: 1.0: unreleased
# ==============================================================================

# Modify the below information to correlate with the software you are designing.
APPNAME="Application-Name"
PROGNAME="REPLACEME"
PROGRAMMER="TheeMahn"
BUILDDATE="06/12/2025"
VERSION="1.0"
DOMAIN="ultimateedition.info"
WEBSITE="http://${DOMAIN}/"
EMAIL="<${PROGRAMMER}@${DOMAIN}>"

# RAMDATA
# mounts loaded to zram:
mounts_zram=''

# mounts ignored:
mounts_null=''

# prompt default:
ps_default=no

# prompt timout:
ps_timeout=32

# minimum MiB free ram:
ram_min=750

# minimum MiB free zram:
zram_min=250

# preferred MiB free ram:
ram_pref=4000

# maximum MiB free zram:
zram_max=1000

# Usage: Encapsulate
# Encapsulate "Repostorm 1.8.7 is entering extraction mode."
# Example: ▒ Repostorm 1.8.7 is entering extraction mode. ▒
Encapsulate () {
	# Verify a message has been sent to this otherwise do squat.
	# Example: Encapsulate ("Repostorm ${REPOVERSION} is entering extraction mode.")
	# ▒ Repostorm 1.7.7 is entering extraction mode.					   ▒

	STP="${1}"
	if [ "${STP}" ]; then
		STRLEN="${#STP}"
		((STRLEN=STRLEN + 3))
		((DISTANCE=COLUMNZ - STRLEN))
		GREPPED=$(echo "${STP}" | grep -E "")
		if [ "${GREPPED}" ]; then
			((STRLEN=STRLEN - 13))
		fi
		if ! [ "${SUPPRESS}" ]; then
			echo -en "${BRIGHT}${BLDWHT}▒ ${BRIGHT}${TXTGRN}${STP}"
		else
			echo "${STP}"
		fi
		if ! [ "${SUPPRESS}" ]; then
			RR=0; while [ "${RR}" -lt "${DISTANCE}" ]; do echo -n " "; ((RR=RR+1)); done; echo "${BRIGHT}${BLDWHT}▒";
		fi
	fi
	echo -en "${TXTRST}"
}

# Center data passed to on screen
# Center data passed to on screen
Center () {
	STP="${1}"
	ERRORRPT="${2}"
	if [ "${STP}" ]; then
		STRLEN="${#STP}"
		((CENTER=STRLEN / 2 ))
		#CENTER=CENTER-1
		((TCENTER=COLUMNZ / 2 ))
		#TCENTER=TCENTER-1
		((DISTANCE=TCENTER - CENTER))
		((DISTANCE=DISTANCE - 2))
		if ! [ "${ERRORRPT}" ]; then
			echo -en ""
		else
			echo -en "${TXTRED}"
		fi
		if ! [ "${SUPPRESS}" ]; then
			RR=0; while [ "${RR}" -lt "${DISTANCE}" ]; do echo -n "${BRIGHT}${BLDWHT}▒"; ((RR=RR+1)); done;
		fi
		if ! [ "${ERRORRPT}" ]; then
			echo -en ""
		else
			echo -en "${TXTRED}"
		fi
		echo -en " ${STP} "
		if ! [ "${SUPPRESS}" ]; then
			TT=0; while [ "${TT}" -lt "${DISTANCE}" ]; do echo -n "${BRIGHT}${BLDWHT}▒"; ((TT=TT+1)); done;
		fi
		((CALC=RR + TT + STRLEN + 2))
		if [ "${CALC}" -lt "${COLUMNZ}" ]; then
			if ! [ "${SUPPRESS}" ]; then
				while [ "${CALC}" -lt "${COLUMNZ}" ]; do echo -n "${BRIGHT}${BLDWHT}▒"; ((CALC=CALC+1)); done; echo;
			fi
		fi
	fi
	# echo "STRING LEN: ${STRLEN} CENTER: $CENTER TOTAL CNTER: $TCENTER RR:${RR} TT:${TT} COLUMNZ: ${COLUMNZ} CALC: ${CALC} DISTANCE: ${DISTANCE}"
	echo -en ""
}

# Draws a bar across the screen based on screen size detected (columnz)
FullBar () {
	if ! [ "${SUPPRESS}" ]; then
		RR=1; while [ "${RR}" -le "${COLUMNZ}" ]; do echo -n "${BRIGHT}${BLDWHT}▒"; ((RR=RR+1)); done; echo;
	fi
}
