#!/usr/bin/bash
#
# This scripts copies the files for a distribution to a zipfile.
#
# Usage: createDistribution VERSION
#
# where VERSION is the version of the distribution.
#
# The files are copied to a new directory named SNFMultiSDK_Windows,
# which is zipped to create the zipfile.
#
############################################################################

# Name of the directory.
DirName=SNFMultiSDK_Windows

# Get the version.
if [ "$#" -ne 1 ]
then
    echo Usage:  $0 VERSION
    echo where VERSION is the version of the distribution to create
    exit -1
fi

VERSION=$1

ZipFile="$DirName"_$VERSION.zip

# Create the directory.
rm -rf $DirName

cp --archive SNFMultiSDK_Windows_Base $DirName

for dir in 32bitDll 64bitDLL CPPSample include VS2019CPPSample VS2019CSSample VS2019VBSample
do
    mkdir $DirName/$dir
done

# Copy 32-bit DLL files
for file in IMPORTANT.txt libgcc_s_sjlj-1.dll libstdc++-6.dll libwinpthread-1.dll snfmulti.def snfmulti.dll vs2019_snfmulti.exp vs2019_snfmulti.lib
do
    cp 32bitDLL/$file $DirName/32bitDLL
done

# Copy 64-bit DLL files
for file in IMPORTANT.txt  libgcc_s_seh-1.dll  libstdc++-6.dll  libwinpthread-1.dll  snfmulti.def  snfmulti.dll  vs2019_snfmulti.exp  vs2019_snfmulti.lib
do
    cp 64bitDLL/$file $DirName/64bitDLL
done

# Copy CPP sample files.
for file in main.cpp main.cpp.html README.txt
do
    cp CPPSample/$file $DirName/CPPSample
done

for file in README VS2019CPPSample.sln VS2019CPPSample.vcxproj VS2019CPPSample.vcxproj.filters VS2019CPPSample.vcxproj.user
do
    cp VS2019CPPSample/$file $DirName/VS2019CPPSample
done

# Copy C# sample files.
for file in main.cs README VS2019CSSample.csproj VS2019CSSample.csproj.user VS2019CSSample.sln
do
    cp VS2019CSSample/$file $DirName/VS2019CSSample
done

# Copy VB sample files.
for file in main.vb README VS2019VBSample.sln  VS2019VBSample.vbproj  VS2019VBSample.vbproj.user
do
    cp VS2019VBSample/$file $DirName/VS2019VBSample
done

# Copy include file.
cp include/snfmultidll.h include/snfmultidll.h.html $DirName/include

# Create the zipfile.
jzip -p -r $ZipFile $DirName

echo Created zipfile $ZipFile