@echo off

set DLLs_DIR=D:\Visual Studio 2005\Projects\ArchTeam\FrameworkAssembly
set TARGET_DLLs=Framework.Web.dll Framework.DataAccessHelper.dll

rem transform type ('vs2005' or 'Prototype')
set TRANSFORM=vs2005
set HHC_DIR=C:\Program Files\HTML Help Workshop


cd "%DLLs_DIR%"
if errorlevel 1 goto error

rem run MRefBuilder
MRefBuilder %TARGET_DLLs% /out:reflection.org
if errorlevel 1 goto error

rem Transform the output
rem XslTransform /xsl:"%DXROOT%\ProductionTransforms\AddOverloads.xsl" reflection.org /xsl:"%DXROOT%\ProductionTransforms\AddGuidFilenames.xsl" /out:reflection.xml
XslTransform /xsl:"%DXROOT%\ProductionTransforms\AddOverloads.xsl" reflection.org /out:reflection.org2
XslTransform /xsl:"%DXROOT%\ProductionTransforms\AddGuidFilenames.xsl" reflection.org2 /out:reflection.xml
if errorlevel 1 goto error

rem Generate a topic manifest
XslTransform /xsl:"%DXROOT%\ProductionTransforms\ReflectionToManifest.xsl" reflection.xml /out:manifest.xml
if errorlevel 1 goto error

rem Create an output directory structure
rem call "%DXROOT%\Presentation\%TRANSFORM%\copyOutput.bat"
if not exist Output mkdir Output
if not exist Output\html mkdir Output\html
if not exist Output\icons mkdir Output\icons
if not exist Output\scripts mkdir Output\scripts
if not exist Output\styles mkdir Output\styles
if not exist Output\media mkdir Output\media
copy "%DXROOT%\Presentation\vs2005\icons\*" Output\icons
copy "%DXROOT%\Presentation\vs2005\scripts\*" Output\scripts
copy "%DXROOT%\Presentation\vs2005\styles\*" Output\styles
if not exist Intellisense mkdir Intellisense

pause

rem Run BuildAssembler to generate topic files in HTM
BuildAssembler /config:"%DXROOT%\Presentation\%TRANSFORM%\Configuration\sandcastle.config" manifest.xml
if errorlevel 1 goto error

rem Generate HTML help project
XslTransform /xsl:"%DXROOT%\ProductionTransforms\ReflectionToChmProject.xsl" reflection.xml /out:Output\test.hhp
if errorlevel 1 goto error

rem Generate table of contents for HTML help project
XslTransform /xsl:"%DXROOT%\ProductionTransforms\ReflectionToChmContents.xsl" reflection.xml /arg:html=Output\html /out:Output\test.hhc
if errorlevel 1 goto error

rem Generate Index information
XslTransform /xsl:"%DXROOT%\ProductionTransforms\ReflectionToChmIndex.xsl" reflection.xml /out:Output\test.hhk
if errorlevel 1 goto error

rem Run hhc (HTML Help 1.x Compiler) to generate Chm
rem cd Output
call "%HHC_DIR%\hhc.exe" Output\test.hhp
if errorlevel 1 goto error

call Output\test.chm

goto end

:error
echo エラーで終了しました。

:end
