#!/bin/bash
source $HOME/.gamerc

CLIENT_PATCH_DIRECTORY="${HOME}/www/${GAME_TYPE}-TEST/"
LOG_OUTPUT="/tmp/check_translate_file_count_monitor.log"

verify=1
file_cnt_arr=()

if [ -f "${LOG_OUTPUT}" ]; then rm -rf ${LOG_OUTPUT}; fi

cd ${CLIENT_PATCH_DIRECTORY}
for file in $(ls GameDataTranslateFileList_*); do 
	country=$(echo ${file}|sed 's/GameDataTranslateFileList_//;s/.txt//');
	num=$(cat ${file} | head -n 1);
	file_cnt_arr+=("${num}")
	echo "${country} => ${num}" >> ${LOG_OUTPUT} 
done

count_compare=0
for count in "${file_cnt_arr[@]}"; do
	if [ "${count_compare}" == '0' ]; then
		count_compare=${count}
	else
		if [ "${count_compare}" != "${count}" ]; then
			verify=0
		fi
	fi
done

echo ${verify}
