<#
.SYNOPSIS 
    PTB_MATH_VerRoVer C# class builder
.Description
    Helper script to download xml schemas for the PTB_MATH_VerRoVer test and build the according C# classes
#>
# set path to the xsd.exe tool
[string] $xsd_name = ${Env:ProgramFiles(x86)}+'\Microsoft SDKs\Windows\v8.0A\bin\NETFX 4.0 Tools\xsd.exe'
# remove old cs-files
rm "*.cs"
# download all schema files needed from the tracim server
$client = new-object System.Net.WebClient

$client.DownloadFile("http://192.168.56.101:8080/tracim/api/schema/PTB_MATH_VerRoVer_v1_test.xsd","PTB_MATH_VerRoVer_v1_test.xsd")
$client.DownloadFile("http://192.168.56.101:8080/tracim/api/schema/PTB_MATH_VerRoVer_v1_result.xsd","PTB_MATH_VerRoVer_v1_result.xsd")
$client.DownloadFile("http://192.168.56.101:8080/tracim/api/schema/tracim.xsd","tracim.xsd")

# start building of classes
$ps = new-object System.Diagnostics.Process
$ps.StartInfo.Filename = $xsd_name
$ps.StartInfo.Arguments = 'tracim.xsd PTB_MATH_VerRoVer_v1_test.xsd PTB_MATH_VerRoVer_v1_result.xsd /classes /namespace:tracimPTB_VerRoVer /language:CS'
$ps.StartInfo.RedirectStandardOutput = $True
$ps.StartInfo.UseShellExecute = $false
$ps.start()
$ps.WaitForExit()
[string] $Out = $ps.StandardOutput.ReadToEnd();
# move and rename created class file to the project directory
[string] $csfile = dir "*.cs"
mv $csfile "..\tracimPTB_VerRoVer.cs" -confirm -force
