<?xml version="1.0" encoding="UTF-8"?>
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
     xmlns:util="http://schemas.microsoft.com/wix/UtilExtension" >

  <?include $(sys.CURRENTDIR)\Common.wxi?>

  <?define ImageResizerAssetsFiles=?>
  <?define ImageResizerAssetsFilesPath=$(var.BinDir)Assets\ImageResizer\?>

  <Fragment>
    <DirectoryRef Id="BaseApplicationsAssetsFolder">
      <Directory Id="ImageResizerAssetsFolder" Name="ImageResizer" />
    </DirectoryRef>

    <DirectoryRef Id="ImageResizerAssetsFolder" FileSource="$(var.ImageResizerAssetsFilesPath)">
    <!-- Generated by generateFileComponents.ps1 -->
    <!--ImageResizerAssetsFiles_Component_Def-->

      <Component Id="Module_ImageResizer_Registry" Win64="yes">
        <RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\CLSID\{51B4D7E5-7568-4234-B4BB-47FB3C016A69}\InprocServer32">
          <RegistryValue Value="[INSTALLFOLDER]PowerToys.ImageResizerExt.dll" Type="string" />
          <RegistryValue Name="ThreadingModel" Value="Apartment" Type="string" />
        </RegistryKey>

        <RegistryValue Root="$(var.RegistryScope)"
                        Key="SOFTWARE\Classes\Directory\ShellEx\DragDropHandlers\ImageResizer"
                        Value="{51B4D7E5-7568-4234-B4BB-47FB3C016A69}"
                        Type="string" />
        <!-- Registry Keys for the context menu handler for each of the following image formats: bmp, dib, gif, jfif, jpe, jpeg, jpg, jxr, png, rle, tif, tiff, wdp  -->
        <RegistryValue Root="$(var.RegistryScope)"
                          Key="SOFTWARE\Classes\SystemFileAssociations\.bmp\ShellEx\ContextMenuHandlers\ImageResizer"
                          Value="{51B4D7E5-7568-4234-B4BB-47FB3C016A69}"
                          Type="string" />
        <RegistryValue Root="$(var.RegistryScope)"
                        Key="SOFTWARE\Classes\SystemFileAssociations\.dib\ShellEx\ContextMenuHandlers\ImageResizer"
                        Value="{51B4D7E5-7568-4234-B4BB-47FB3C016A69}"
                        Type="string" />
        <RegistryValue Root="$(var.RegistryScope)"
                        Key="SOFTWARE\Classes\SystemFileAssociations\.gif\ShellEx\ContextMenuHandlers\ImageResizer"
                        Value="{51B4D7E5-7568-4234-B4BB-47FB3C016A69}"
                        Type="string" />
        <RegistryValue Root="$(var.RegistryScope)"
                        Key="SOFTWARE\Classes\SystemFileAssociations\.jfif\ShellEx\ContextMenuHandlers\ImageResizer"
                        Value="{51B4D7E5-7568-4234-B4BB-47FB3C016A69}"
                        Type="string" />
        <RegistryValue Root="$(var.RegistryScope)"
                        Key="SOFTWARE\Classes\SystemFileAssociations\.jpe\ShellEx\ContextMenuHandlers\ImageResizer"
                        Value="{51B4D7E5-7568-4234-B4BB-47FB3C016A69}"
                        Type="string" />
        <RegistryValue Root="$(var.RegistryScope)"
                        Key="SOFTWARE\Classes\SystemFileAssociations\.jpeg\ShellEx\ContextMenuHandlers\ImageResizer"
                        Value="{51B4D7E5-7568-4234-B4BB-47FB3C016A69}"
                        Type="string" />
        <RegistryValue Root="$(var.RegistryScope)"
                        Key="SOFTWARE\Classes\SystemFileAssociations\.jpg\ShellEx\ContextMenuHandlers\ImageResizer"
                        Value="{51B4D7E5-7568-4234-B4BB-47FB3C016A69}"
                        Type="string" />
        <RegistryValue Root="$(var.RegistryScope)"
                        Key="SOFTWARE\Classes\SystemFileAssociations\.jxr\ShellEx\ContextMenuHandlers\ImageResizer"
                        Value="{51B4D7E5-7568-4234-B4BB-47FB3C016A69}"
                        Type="string" />
        <RegistryValue Root="$(var.RegistryScope)"
                        Key="SOFTWARE\Classes\SystemFileAssociations\.png\ShellEx\ContextMenuHandlers\ImageResizer"
                        Value="{51B4D7E5-7568-4234-B4BB-47FB3C016A69}"
                        Type="string" />
        <RegistryValue Root="$(var.RegistryScope)"
                        Key="SOFTWARE\Classes\SystemFileAssociations\.rle\ShellEx\ContextMenuHandlers\ImageResizer"
                        Value="{51B4D7E5-7568-4234-B4BB-47FB3C016A69}"
                        Type="string" />
        <RegistryValue Root="$(var.RegistryScope)"
                        Key="SOFTWARE\Classes\SystemFileAssociations\.tif\ShellEx\ContextMenuHandlers\ImageResizer"
                        Value="{51B4D7E5-7568-4234-B4BB-47FB3C016A69}"
                        Type="string" />
        <RegistryValue Root="$(var.RegistryScope)"
                        Key="SOFTWARE\Classes\SystemFileAssociations\.tiff\ShellEx\ContextMenuHandlers\ImageResizer"
                        Value="{51B4D7E5-7568-4234-B4BB-47FB3C016A69}"
                        Type="string" />
        <RegistryValue Root="$(var.RegistryScope)"
                        Key="SOFTWARE\Classes\SystemFileAssociations\.wdp\ShellEx\ContextMenuHandlers\ImageResizer"
                        Value="{51B4D7E5-7568-4234-B4BB-47FB3C016A69}"
                        Type="string" />
      </Component>

    </DirectoryRef>

    <ComponentGroup Id="ImageResizerComponentGroup">
      <Component Id="RemoveImageResizerFolder" Guid="8E5DE86A-8618-4590-9584-51BCD3A14280" Directory="ImageResizerAssetsFolder" >
        <RegistryKey Root="$(var.RegistryScope)" Key="Software\Classes\powertoys\components">
          <RegistryValue Type="string" Name="RemoveImageResizerFolder" Value="" KeyPath="yes"/>
        </RegistryKey>
        <RemoveFolder Id="RemoveFolderImageResizerAssetsFolder" Directory="ImageResizerAssetsFolder" On="uninstall"/>
      </Component>
      <ComponentRef Id="Module_ImageResizer_Registry" />
    </ComponentGroup>
  </Fragment>
</Wix>
