<?xml version='1.0' encoding='utf-8'?>
<!-- PasswordSafe MSI package source code for WIX -->
<!-- Granted to the public domain by xenophonf -->
<!--
  How to build installer from script. Run from repo root directory.
  
  install\windows\BuildWixInstall x.xx [x86|x64]
  
  x.xx = pwsafe version (e.g. 3.41.1)
  x86 = build 32-bit installer
  x64 = build 64-bit installer
-->
<Wix xmlns='http://schemas.microsoft.com/wix/2006/wi'>

  <!-- Product name as you want it to appear in Add/Remove Programs-->
  <?if $(var.Platform) = x64 ?>
    <?define ProductName = "Password Safe $(var.PWSAFE_VERSION) for Windows (64 bit)" ?>
    <?define Win64 = "yes" ?>
    <?define PlatformProgramFilesFolder = "ProgramFiles64Folder" ?>
    <?define Architecture = "64-bit" ?>
    <?define BinDir = "out\build\x64-Release\Release" ?>
    <?define LangDir = "out/build/x64-Release/I18N/" ?>
  <?else ?>
    <?define ProductName = "Password Safe $(var.PWSAFE_VERSION) for Windows (32 bit)" ?>
    <?define Win64 = "no" ?>
    <?define PlatformProgramFilesFolder = "ProgramFilesFolder" ?>
    <?define Architecture = "32-bit" ?>
    <?define BinDir = "out\build\x86-Release\Release" ?>
    <?define LangDir = "out/build/x86-Release/I18N" ?>
  <?endif ?>

  <Product Id='c2a02857-d138-446b-b181-442dee20c8e6'
	   UpgradeCode='6dbf5233-ad08-4345-9ac7-746f32614a43'
	   Name='Password Safe $(var.PWSAFE_VERSION) for Windows ($(var.Architecture))'
	   Version='$(var.PWSAFE_VERSION)'
	   Language='1033'
	   Manufacturer='Rony Shapiro'>

    <Package
	     Description='Password Safe $(var.PWSAFE_VERSION) is an Open Source utility for simply and securely managing passwords for multiple accounts.' 
	     Comments='MSI package courtesy of Matthew X. Economou.'
	     Manufacturer='Rony Shapiro'
	     InstallerVersion='200'
	     Compressed='yes'
	     />

    <UIRef Id='WixUI_InstallDir' />
    <UIRef Id="WixUI_ErrorProgressText" />
    <WixVariable Id='WixUILicenseRtf' Value='docs\LICENSE.rtf' />

    <Media Id='1' Cabinet='pwsafe.cab' EmbedCab='yes' />

    <Property Id='WIXUI_INSTALLDIR' Value='PASSWORDSAFEPRODUCTDIR' />

    <Directory Id='TARGETDIR' Name='SourceDir'>
      <Directory Id="DesktopFolder" Name="Desktop" />
      <Directory Id='$(var.PlatformProgramFilesFolder)' Name='PFiles'>
	<Directory Id='PASSWORDSAFEPRODUCTDIR' Name='Password Safe'
	ShortName='pwsafe'>
	  <Component Id='Documentation' Guid='5787ed38-5d7f-4242-aa89-87d94f2077ed'>
	    <File Id='file0' Name='ChangeLog.txt' DiskId='1'
	    Source='docs\ChangeLog.txt' /> 
	    <File Id='file1' Name='LICENSE' DiskId='1' Source='LICENSE' />
	    <File Id='file2' Name='README.md' DiskId='1' Source='README.md' />
	    <File Id='file3' Name='ReleaseNotes.md' DiskId='1'
	    Source='docs\ReleaseNotes.md' />
	    <File Id='file5' Name='pwsafe.chm' DiskId='1'
	    Source='help\default\pwsafe.chm' /> 
	    <File Id='file6' Name='pwsafeDE.chm' DiskId='1'
	    Source='help\pwsafeDE\pwsafeDE.chm' /> 
	    <File Id='file7' Name='pwsafeES.chm' DiskId='1'
	    Source='help\pwsafeES\pwsafeES.chm' /> 
	    <File Id='file8' Name='pwsafefr.chm' DiskId='1'
	    Source='help\pwsafeFR\pwsafefr.chm' /> 
<!--
	    <File Id='file9' Name='pwsafePL.chm' DiskId='1'
	    Source='help\pwsafePL\pwsafePL.chm' /> 
-->
	    <File Id='file10' Name='pwsaferu.chm' DiskId='1'
	    Source='help\pwsafeRU\pwsaferu.chm' /> 
	    <File Id='file11' Name='pwsafeZH.chm' DiskId='1'
	    Source='help\pwsafeZH\pwsafeZH.chm' /> 
	  </Component>
	  <Component Id='MainProgram' Win64='$(var.Win64)'
	  Guid='25c2da5c-d483-4ca7-84f6-d28e17a59188'>
	    <File Id='file12' Name='pwsafe.exe' DiskId='1' KeyPath='yes'
	      Source='$(var.BinDir)\pwsafe.exe' Vital='yes'> 
	      <Shortcut 
          Id='StartMenuShortCut' 
          Directory='ProgramMenuFolder'
          Name='Password Safe' 
          ShortName='pwsafe'
          WorkingDirectory="PASSWORDSAFEPRODUCTDIR" 
          Icon='pwsafe.exe' 
          IconIndex='0' 
          Advertise='yes' />
        <Shortcut
          Id="DesktopShortcut"
          Directory="DesktopFolder"
          Name="Password Safe"
          ShortName='pwsafe'
          WorkingDirectory="PASSWORDSAFEPRODUCTDIR" 
          Icon='pwsafe.exe' 
          IconIndex='0' 
          Advertise='yes' />	    
      </File>
	    <File Id='file13' Name='pws_at.dll' DiskId='1'
	      Source='$(var.BinDir)\pws_at.dll' Vital='yes'> 
	    </File>
	    <File Id='file14' Name='pws_osk.dll' DiskId='1'
	      Source='$(var.BinDir)\pws_osk.dll' Vital='yes'> 
	    </File>
	    <File Id='file15' Name='pwsafeDE.dll' DiskId='1'
	      Source='$(var.LangDir)\pwsafeDE.dll' Vital='yes'> 
	    </File>
	    <File Id='file16' Name='pwsafeES.dll' DiskId='1'
	      Source='$(var.LangDir)\pwsafeES.dll' Vital='yes'> 
	    </File>
	    <File Id='file17' Name='pwsafeIT.dll' DiskId='1'
	      Source='$(var.LangDir)\pwsafeIT.dll' Vital='yes'> 
	    </File>
	    <File Id='file18' Name='pwsafePL.dll' DiskId='1'
	      Source='$(var.LangDir)\pwsafePL.dll' Vital='yes'> 
	    </File>
	    <File Id='file19' Name='pwsafeRU.dll' DiskId='1'
	      Source='$(var.LangDir)\pwsafeRU.dll' Vital='yes'> 
	    </File>
	    <File Id='file20' Name='pwsafeSV.dll' DiskId='1'
	      Source='$(var.LangDir)\pwsafeSV.dll' Vital='yes'> 
	    </File>
	    <File Id='file21' Name='pwsafeZH.dll' DiskId='1'
	      Source='$(var.LangDir)\pwsafeZH.dll' Vital='yes'> 
	    </File>
	    <File Id='file22' Name='pwsafeKR.dll' DiskId='1'
	      Source='$(var.LangDir)\pwsafeKR.dll' Vital='yes'> 
	    </File>
	    <File Id='file23' Name='pwsafeNL.dll' DiskId='1'
	      Source='$(var.LangDir)\pwsafeNL.dll' Vital='yes'> 
	    </File>
	    <File Id='file24' Name='pwsafeDK.dll' DiskId='1'
	      Source='$(var.LangDir)\pwsafeDK.dll' Vital='yes'> 
	    </File>
	    <File Id='file25' Name='pwsafeFR.dll' DiskId='1'
	      Source='$(var.LangDir)\pwsafeFR.dll' Vital='yes'> 
	    </File>
		<File Id='file26' Name='pwsafeAR.dll' DiskId='1'
	      Source='$(var.LangDir)\pwsafeAR.dll' Vital='yes'> 
	    </File>
	  </Component>
	  <Component Id='SupportingFiles'
	    Guid='2cb36029-a029-4f15-9838-4acacb823ce7'> 
	    <File Id='file27' Name='pwsafe.xsd' DiskId='1'
	    Source='xml\pwsafe.xsd' Vital='yes' />
	    <File Id='file28' Name='pwsafe.xsl' DiskId='1'
	    Source='xml\pwsafe.xsl' Vital='yes' />
	    <File Id='file29' Name='pwsafe_filter.xsd' DiskId='1'
	    Source='xml\pwsafe_filter.xsd' Vital='yes' />
	    <File Id='file30' Name='KPV1_to_PWS.xslt' DiskId='1'
	    Source='xml\KPV1_to_PWS.xslt' Vital='yes' />
	    <File Id='file31' Name='KPV2_to_PWS.xslt' DiskId='1'
	    Source='xml\KPV2_to_PWS.xslt' Vital='yes' />
	  </Component>
	</Directory>
      </Directory>
      <Directory Id='ProgramMenuFolder' Name='Programs' />
    </Directory>

    <Icon Id='pwsafe.exe' SourceFile='$(var.BinDir)\pwsafe.exe' />

    <Feature Id='Complete' Level='1'>
      <ComponentRef Id='Documentation' />
      <ComponentRef Id='MainProgram' />
      <ComponentRef Id='SupportingFiles' />
    </Feature>

    <CustomAction Id='AssignAllusersProperty' Property='ALLUSERS'
    Value='1' />

    <InstallExecuteSequence>
      <Custom Action='AssignAllusersProperty'
      After='LaunchConditions'>Privileged</Custom>
    </InstallExecuteSequence>

  </Product>

</Wix>
