#!/bin/bash


set -v

echo "Revision number prebuild: $REVISION_NUM"


IFS=$'\n\r'

while read line; 
do 
    read name <<< $(echo $line | awk -F= '{print $1}') 
    read value <<< $(echo $line | awk -F= '{print $2}') 

    command=$name=$value

    echo "$command"
    export "${command?}"

done < ../release_data

echo "Revision copyright: $COPYRIGHT"

mkdir -p Properties
touch -a ./Properties/AssemblyInfo.cs

export OUTPUT_FILE="./Properties/AssemblyInfo.cs"

echo // File generated by prebuild step 			                 > "$OUTPUT_FILE"
echo 'using System.Reflection;' 					                 >> "$OUTPUT_FILE"
echo 'using System.Runtime.CompilerServices;'			             >> "$OUTPUT_FILE"
echo 'using System.Runtime.InteropServices;'			             >> "$OUTPUT_FILE"
echo '[assembly: AssemblyTitle("pteidlib_dotnet")]'	                 >> "$OUTPUT_FILE"
echo '[assembly: AssemblyDescription("")]'			                 >> "$OUTPUT_FILE"
echo '[assembly: AssemblyConfiguration("")]'			             >> "$OUTPUT_FILE"
echo '[assembly: AssemblyCompany("Portuguese Government")]'		     >> "$OUTPUT_FILE"
echo '[assembly: AssemblyProduct("pteidlib_dotnet")]'	             >> "$OUTPUT_FILE"
echo "[assembly: AssemblyCopyright(\""$COPYRIGHT"\")]"	             >> "$OUTPUT_FILE"
echo '[assembly: AssemblyTrademark("")]'				             >> "$OUTPUT_FILE"
echo '[assembly: AssemblyCulture("")]'			 	                 >> "$OUTPUT_FILE"
echo '[assembly: ComVisible(false)]'				                 >> "$OUTPUT_FILE"
echo '[assembly: Guid("a69697fa-c784-4923-8476-2ee828accae8")]'	     >> "$OUTPUT_FILE"
echo "[assembly: AssemblyVersion(\""$PTEID_PRODUCT_VERSION.$REVISION_NUM"\")]"	 >> "$OUTPUT_FILE"
echo "[assembly: AssemblyFileVersion(\""$PTEID_PRODUCT_VERSION.$REVISION_NUM\"")]" >> "$OUTPUT_FILE"
#done