#!/bin/bash
#
# This script will generate SWF.cs.target from our System.Windows.Forms.dll.sources
#
#

exec > SWF2k5.csproj

Source=System.Windows.Forms.dll.sources
Resource=System.Windows.Forms.dll.resources

SWFhead()
{
    cat <<EOF
﻿<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  <PropertyGroup>
    <ProjectType>Local</ProjectType>
    <ProductVersion>8.0.50727</ProductVersion>
    <SchemaVersion>2.0</SchemaVersion>
    <ProjectGuid>{5E6430B2-6B9F-4E76-802E-20207EF80391}</ProjectGuid>
    <Configuration Condition=" '\$(Configuration)' == '' ">Debug</Configuration>
    <Platform Condition=" '\$(Platform)' == '' ">AnyCPU</Platform>
    <ApplicationIcon>
    </ApplicationIcon>
    <AssemblyKeyContainerName>
    </AssemblyKeyContainerName>
    <AssemblyName>System.Windows.Forms</AssemblyName>
    <AssemblyOriginatorKeyFile>
    </AssemblyOriginatorKeyFile>
    <DefaultClientScript>JScript</DefaultClientScript>
    <DefaultHTMLPageLayout>Grid</DefaultHTMLPageLayout>
    <DefaultTargetSchema>IE50</DefaultTargetSchema>
    <DelaySign>false</DelaySign>
    <OutputType>Library</OutputType>
    <RootNamespace>
    </RootNamespace>
    <RunPostBuildEvent>OnBuildSuccess</RunPostBuildEvent>
    <StartupObject>
    </StartupObject>
    <FileUpgradeFlags>
    </FileUpgradeFlags>
    <UpgradeBackupLocation>
    </UpgradeBackupLocation>
  </PropertyGroup>
  <PropertyGroup Condition=" '\$(Configuration)|\$(Platform)' == 'Debug|AnyCPU' ">
    <OutputPath>bin\Debug\</OutputPath>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <BaseAddress>285212672</BaseAddress>
    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
    <ConfigurationOverrideFile>
    </ConfigurationOverrideFile>
    <DefineConstants>NET_1_1 NET_2_0 MWF_ON_MSRUNTIME</DefineConstants>
    <DocumentationFile>
    </DocumentationFile>
    <DebugSymbols>true</DebugSymbols>
    <FileAlignment>4096</FileAlignment>
    <NoStdLib>false</NoStdLib>
    <NoWarn>612,618,3021</NoWarn>
    <Optimize>false</Optimize>
    <RegisterForComInterop>false</RegisterForComInterop>
    <RemoveIntegerChecks>false</RemoveIntegerChecks>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    <WarningLevel>3</WarningLevel>
    <DebugType>full</DebugType>
    <ErrorReport>prompt</ErrorReport>
    <OutputType>Library</OutputType> 
    <AssemblyName>System.Windows.Forms</AssemblyName>     
  </PropertyGroup>
  <PropertyGroup Condition=" '\$(Configuration)|\$(Platform)' == 'Release|AnyCPU' ">
    <OutputPath>bin\Release\</OutputPath>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <BaseAddress>285212672</BaseAddress>
    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
    <ConfigurationOverrideFile>
    </ConfigurationOverrideFile>
    <DefineConstants>NET_1_1 NET_2_0 MWF_ON_MSRUNTIME</DefineConstants>
    <DocumentationFile>
    </DocumentationFile>
    <DebugSymbols>false</DebugSymbols>
    <FileAlignment>4096</FileAlignment>
    <NoStdLib>false</NoStdLib>
    <NoWarn>612,618,3021</NoWarn>
    <Optimize>false</Optimize>
    <RegisterForComInterop>false</RegisterForComInterop>
    <RemoveIntegerChecks>false</RemoveIntegerChecks>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    <WarningLevel>3</WarningLevel>
    <DebugType>none</DebugType>
    <ErrorReport>prompt</ErrorReport>
    <OutputType>Library</OutputType> 
    <AssemblyName>System.Windows.Forms</AssemblyName>     
  </PropertyGroup>
  <PropertyGroup Condition=" '\$(Configuration)|\$(Platform)' == 'Debug 1.1|AnyCPU' ">
    <OutputPath>bin\Debug\</OutputPath>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <BaseAddress>285212672</BaseAddress>
    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
    <ConfigurationOverrideFile>
    </ConfigurationOverrideFile>
    <DefineConstants>NET_1_1 ONLY_1_1 MWF_ON_MSRUNTIME</DefineConstants>
    <DocumentationFile>
    </DocumentationFile>
    <DebugSymbols>true</DebugSymbols>
    <FileAlignment>4096</FileAlignment>
    <NoStdLib>false</NoStdLib>
    <NoWarn>612,618,3021</NoWarn>
    <Optimize>false</Optimize>
    <RegisterForComInterop>false</RegisterForComInterop>
    <RemoveIntegerChecks>false</RemoveIntegerChecks>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    <WarningLevel>3</WarningLevel>
    <DebugType>full</DebugType>
    <ErrorReport>prompt</ErrorReport>
    <OutputType>Library</OutputType> 
    <AssemblyName>System.Windows.Forms</AssemblyName>     
  </PropertyGroup>
  <PropertyGroup Condition=" '\$(Configuration)|\$(Platform)' == 'Release 1.1|AnyCPU' ">
    <OutputPath>bin\Release\</OutputPath>
    <AllowUnsafeBlocks>true</AllowUnsafeBlocks>
    <BaseAddress>285212672</BaseAddress>
    <CheckForOverflowUnderflow>false</CheckForOverflowUnderflow>
    <ConfigurationOverrideFile>
    </ConfigurationOverrideFile>
    <DefineConstants>NET_1_1 ONLY_1_1 MWF_ON_MSRUNTIME</DefineConstants>
    <DocumentationFile>
    </DocumentationFile>
    <DebugSymbols>false</DebugSymbols>
    <FileAlignment>4096</FileAlignment>
    <NoStdLib>false</NoStdLib>
    <NoWarn>612,618,3021</NoWarn>
    <Optimize>false</Optimize>
    <RegisterForComInterop>false</RegisterForComInterop>
    <RemoveIntegerChecks>false</RemoveIntegerChecks>
    <TreatWarningsAsErrors>false</TreatWarningsAsErrors>
    <WarningLevel>3</WarningLevel>
    <DebugType>none</DebugType>
    <ErrorReport>prompt</ErrorReport>
    <OutputType>Library</OutputType> 
    <AssemblyName>System.Windows.Forms</AssemblyName>     
  </PropertyGroup>
  <ItemGroup>
    <Reference Include="Accessibility">
      <Name>Accessibility</Name>
    </Reference>
    <Reference Include="System">
      <Name>System</Name>
    </Reference>
    <Reference Include="System.configuration" />
    <Reference Include="System.Data">
      <Name>System.Data</Name>
    </Reference>
    <Reference Include="System.Data">
      <Name>System.Data</Name>
    </Reference>
    <Reference Include="System.Drawing">
      <Name>System.Drawing</Name>
    </Reference>
    <Reference Include="System.Xml">
      <Name>System.Xml</Name>
    </Reference>
    <Reference Include="Mono.WebBrowser2K5">
      <Name>Mono.WebBrowser2K5</Name>
    </Reference>
  </ItemGroup>
  <ItemGroup>
    <ProjectReference Include="..\Mono.WebBrowser\Mono.WebBrowser2K5.csproj">
      <Project>{5E6C996A-007F-40CE-B244-006EFCFB77D2}</Project>
      <Name>Mono.WebBrowser2K5</Name>
    </ProjectReference>
  </ItemGroup>
EOF
}

SWFtail()
{
    cat <<EOF
  <ItemGroup>
    <None Include="System.Windows.Forms\ChangeLog" />
  </ItemGroup>
  <ItemGroup>
    <None Include="ChangeLog" />
  </ItemGroup>
  <Import Project="\$(MSBuildBinPath)\Microsoft.CSharp.targets" />
  <PropertyGroup>
    <PreBuildEvent>
    </PreBuildEvent>
    <PostBuildEvent>
    </PostBuildEvent>
  </PropertyGroup>
</Project>
EOF
}

SWFfilelist()
{
echo "  <ItemGroup>"
cat $Source | while read SRC; do
# Don't do AssemblyInfo, it's got signing requests and such that we don't want
if [ "x$SRC" != "xAssembly/AssemblyInfo.cs" ] ; then
SRC=`echo $SRC | sed 's/..\/..\/build\///'`
SRC=`echo $SRC | tr '/' '\\\\'`
cat <<EOF
    <Compile Include="$SRC" />
EOF
fi
done
echo "  </ItemGroup>"
}

SWFresourcelist()
{
echo "  <ItemGroup>"
    cat $Resource | while read SRC; do
	CUSTOMTOOLNAMESPACE=""

	# strip out that -resource:
	SRC=`echo $SRC | sed 's/-resource://'`

	CUSTOMTOOLNAMESPACE=`echo $SRC | awk -F, '{print $2}'`

	INCLUDE=`echo $SRC | awk -F, '{print $1}'`

	if test -f $INCLUDE.prebuilt; then
	    INCLUDE=$INCLUDE.prebuilt
	fi

	# strip off the path from the name of the resource and the .prebuilt if there is one
	LOGICALNAME=`echo $INCLUDE | sed 's/resources\///;s/.prebuilt//'`

	# convert all /'s to \\'s
	INCLUDE=`echo $INCLUDE | sed 's/\//\\\\/'`

	echo "    <EmbeddedResource Include=\"$INCLUDE\">"
	if test "x$CUSTOMTOOLNAMESPACE" != "x"; then
		echo "      <LogicalName>$CUSTOMTOOLNAMESPACE</LogicalName>"
	else
		echo "      <LogicalName>$LOGICALNAME</LogicalName>"
	fi
	echo "    </EmbeddedResource>"
    done
echo "  </ItemGroup>"
}

SWFhead
SWFfilelist
SWFresourcelist
SWFtail
