GitCorner

Code

ossartcraftgridcraft🌐
1687a9c05b0c
<?xml version="1.0" encoding="utf-8"?>
<Wix xmlns="http://wixtoolset.org/schemas/v4/wxs">
  <?ifndef HasCraftFontLicences ?>
  <?define HasCraftFontLicences=0 ?>
  <?endif?>
  <Package Name="GridCraft" Manufacturer="Learning Machines LLC" Version="$(var.Version)" UpgradeCode="5511327B-F305-41BE-92D0-EB84944E7C4D" Scope="perUserOrMachine" Compressed="yes" Language="1033">
    <SummaryInformation Description="GridCraft spreadsheet" Manufacturer="Learning Machines LLC" />
    <?include $(sys.SOURCEFILEDIR)install-policy.wxi?>
    <!-- Same-version upgrades let successive pre-releases of one X.Y.Z replace each other
         (MSI versions are numeric, so 1.2.3-rc.1 and 1.2.3-rc.2 are both 1.2.3). -->
    <MajorUpgrade AllowSameVersionUpgrades="yes" DowngradeErrorMessage="A newer version of GridCraft is already installed." />
    <MediaTemplate EmbedCab="yes" CompressionLevel="high" />

    <Icon Id="GridcraftIcon.ico" SourceFile="$(var.IconPath)" />
    <Property Id="ARPPRODUCTICON" Value="GridcraftIcon.ico" />
    <Property Id="ARPURLINFOABOUT" Value="https://getartcraft.com/apps/gridcraft" />
    <Property Id="ARPURLUPDATEINFO" Value="https://getartcraft.com/apps/gridcraft" />
    <Property Id="ARPHELPLINK" Value="https://discord.gg/artcraft" />

    <!-- An explicit command-line value wins. Otherwise retain the previous installation's
         choice, defaulting to off for a fresh install. Run only in the first sequence so the
         execute sequence cannot reload the old choice after the user unchecks the box. -->
    <Property Id="DESKTOPSHORTCUT" Secure="yes" />
    <Property Id="SAVEDDESKTOPSHORTCUT" Secure="yes">
      </Property>
    <SetProperty Id="DESKTOPSHORTCUT" Action="LoadDesktopShortcutPreference" Value="1" After="CraftLoadOption1U" Sequence="first" Condition="NOT DESKTOPSHORTCUT AND SAVEDDESKTOPSHORTCUT = &quot;1&quot;" />
    <SetProperty Id="DESKTOPSHORTCUT" Action="DefaultDesktopShortcut" Value="0" After="LoadDesktopShortcutPreference" Sequence="first" Condition="NOT DESKTOPSHORTCUT" />
    <SetProperty Id="DesktopShortcutChoice" Value="1" After="DefaultDesktopShortcut" Sequence="ui" Condition="DESKTOPSHORTCUT = &quot;1&quot;" />

    <Property Id="DefaultUIFont" Value="GridcraftUIFont" />
    <Property Id="ErrorDialog" Value="GridcraftErrorDlg" />
    <EnsureTable Id="ListBox" />
    <UI>
      <TextStyle Id="GridcraftUIFont" FaceName="Segoe UI" Size="9" />
      <Dialog Id="DesktopShortcutDlg" Width="320" Height="150" Title="GridCraft Setup" NoMinimize="yes">
        <Control Id="Heading" Type="Text" X="15" Y="15" Width="290" Height="20" Text="Install GridCraft" />
        <Control Id="Description" Type="Text" X="15" Y="40" Width="290" Height="28" Text="Install GridCraft using the account option you selected." />
        <Control Id="DesktopShortcutCheckbox" Type="CheckBox" X="15" Y="76" Width="290" Height="18" Property="DesktopShortcutChoice" CheckBoxValue="1" Text="Create a &amp;desktop shortcut" />
        <Control Id="Install" Type="PushButton" X="165" Y="118" Width="65" Height="20" Default="yes" DefaultCondition="ALLUSERS = 1" ElevationShield="yes" HideCondition="ALLUSERS &lt;&gt; 1" ShowCondition="ALLUSERS = 1" Text="&amp;Install">
          <!-- An unchecked checkbox clears its property. Publish an explicit zero so the
               elevated execute sequence receives an unambiguous opt-out. -->
          <Publish Property="DESKTOPSHORTCUT" Value="1" Condition="DesktopShortcutChoice" />
          <Publish Property="DESKTOPSHORTCUT" Value="0" Condition="NOT DesktopShortcutChoice" />
          <Publish Event="EndDialog" Value="Return" />
        </Control>
        <Control Id="InstallUser" Type="PushButton" DefaultCondition="ALLUSERS &lt;&gt; 1" HideCondition="ALLUSERS = 1" ShowCondition="ALLUSERS &lt;&gt; 1" X="165" Y="118" Width="65" Height="20" Text="&amp;Install">
          <!-- An unchecked checkbox clears its property. Publish an explicit zero so the
               elevated execute sequence receives an unambiguous opt-out. -->
          <Publish Property="DESKTOPSHORTCUT" Value="1" Condition="DesktopShortcutChoice" />
          <Publish Property="DESKTOPSHORTCUT" Value="0" Condition="NOT DesktopShortcutChoice" />
          <Publish Event="EndDialog" Value="Return" />
        </Control>
        <Control Id="Cancel" Type="PushButton" X="240" Y="118" Width="65" Height="20" Cancel="yes" Text="Cancel">
          <Publish Event="EndDialog" Value="Exit" />
        </Control>
      </Dialog>

      <!-- Windows Installer requires these support dialogs for authored full UI (ICE20).
           They contain only installer messages and standard response controls. -->
      <Dialog Id="GridcraftErrorDlg" Width="320" Height="120" Title="GridCraft Setup" ErrorDialog="yes" NoMinimize="yes">
        <Control Id="ErrorText" Type="Text" X="15" Y="15" Width="290" Height="65" TabSkip="no" />
        <Control Id="A" Type="PushButton" X="15" Y="90" Width="65" Height="20" Text="Abort" TabSkip="yes">
          <Publish Event="EndDialog" Value="ErrorAbort" />
        </Control>
        <Control Id="C" Type="PushButton" X="15" Y="90" Width="65" Height="20" Text="Cancel" TabSkip="yes">
          <Publish Event="EndDialog" Value="ErrorCancel" />
        </Control>
        <Control Id="I" Type="PushButton" X="15" Y="90" Width="65" Height="20" Text="Ignore" TabSkip="yes">
          <Publish Event="EndDialog" Value="ErrorIgnore" />
        </Control>
        <Control Id="N" Type="PushButton" X="15" Y="90" Width="65" Height="20" Text="No" TabSkip="yes">
          <Publish Event="EndDialog" Value="ErrorNo" />
        </Control>
        <Control Id="O" Type="PushButton" X="15" Y="90" Width="65" Height="20" Text="OK" TabSkip="yes">
          <Publish Event="EndDialog" Value="ErrorOk" />
        </Control>
        <Control Id="R" Type="PushButton" X="15" Y="90" Width="65" Height="20" Text="Retry" TabSkip="yes">
          <Publish Event="EndDialog" Value="ErrorRetry" />
        </Control>
        <Control Id="Y" Type="PushButton" X="15" Y="90" Width="65" Height="20" Text="Yes" TabSkip="yes">
          <Publish Event="EndDialog" Value="ErrorYes" />
        </Control>
      </Dialog>
      <Dialog Id="FilesInUse" Width="320" Height="190" Title="GridCraft Setup" NoMinimize="yes">
        <Control Id="Description" Type="Text" X="15" Y="15" Width="290" Height="35" Text="Close the applications listed below, then choose Retry. Ignore may require a restart." />
        <Control Id="Files" Type="ListBox" X="15" Y="55" Width="290" Height="85" Property="FileInUseProcess" />
        <Control Id="Retry" Type="PushButton" X="95" Y="155" Width="65" Height="20" Default="yes" Text="Retry">
          <Publish Event="EndDialog" Value="Retry" />
        </Control>
        <Control Id="Ignore" Type="PushButton" X="167" Y="155" Width="65" Height="20" Text="Ignore">
          <Publish Event="EndDialog" Value="Ignore" />
        </Control>
        <Control Id="Cancel" Type="PushButton" X="240" Y="155" Width="65" Height="20" Cancel="yes" Text="Cancel">
          <Publish Event="EndDialog" Value="Exit" />
        </Control>
      </Dialog>
      <Dialog Id="SetupCompleteDlg" Width="320" Height="110" Title="GridCraft Setup" NoMinimize="yes">
        <Control Id="Message" Type="Text" X="15" Y="20" Width="290" Height="35" Text="GridCraft setup completed." />
        <Control Id="Close" Type="PushButton" X="240" Y="75" Width="65" Height="20" Default="yes" Cancel="yes" Text="Close">
          <Publish Event="EndDialog" Value="Return" />
        </Control>
      </Dialog>
      <Dialog Id="SetupCanceledDlg" Width="320" Height="110" Title="GridCraft Setup" NoMinimize="yes">
        <Control Id="Message" Type="Text" X="15" Y="20" Width="290" Height="35" Text="GridCraft setup was canceled." />
        <Control Id="Close" Type="PushButton" X="240" Y="75" Width="65" Height="20" Default="yes" Cancel="yes" Text="Close">
          <Publish Event="EndDialog" Value="Return" />
        </Control>
      </Dialog>
      <Dialog Id="SetupFailedDlg" Width="320" Height="110" Title="GridCraft Setup" NoMinimize="yes">
        <Control Id="Message" Type="Text" X="15" Y="20" Width="290" Height="35" Text="GridCraft setup could not finish. See the installer message or log for details." />
        <Control Id="Close" Type="PushButton" X="240" Y="75" Width="65" Height="20" Default="yes" Cancel="yes" Text="Close">
          <Publish Event="EndDialog" Value="Return" />
        </Control>
      </Dialog>
    </UI>
    <InstallUISequence>
      <!-- Component conditions must see the choice before costing. Do not show the choice
           during basic/silent installs, repair or uninstall. -->
      <Show Dialog="DesktopShortcutDlg" Before="CostInitialize" Condition="NOT Installed AND NOT REMOVE AND UILevel = 5" />
      <Show Dialog="SetupCompleteDlg" OnExit="success" Condition="UILevel = 5" />
      <Show Dialog="SetupCanceledDlg" OnExit="cancel" Condition="UILevel = 5" />
      <Show Dialog="SetupFailedDlg" OnExit="error" Condition="UILevel = 5" />
    </InstallUISequence>
    <AdminUISequence>
      <Show Dialog="SetupCompleteDlg" OnExit="success" Condition="UILevel = 5" />
      <Show Dialog="SetupCanceledDlg" OnExit="cancel" Condition="UILevel = 5" />
      <Show Dialog="SetupFailedDlg" OnExit="error" Condition="UILevel = 5" />
    </AdminUISequence>

    <StandardDirectory Id="ProgramFiles6432Folder">
      <Directory Id="CraftSuiteFolder" Name="ArtCraft">
        <Directory Id="INSTALLFOLDER" Name="GridCraft" />
      </Directory>
    </StandardDirectory>
    <StandardDirectory Id="ProgramMenuFolder" />
    <StandardDirectory Id="DesktopFolder" />

    <Feature Id="Main" Title="GridCraft" Level="1">
      <?if $(var.HasCraftFontLicences) = 1 ?>
      <ComponentGroupRef Id="CraftFontLicences" />
      <?endif?>
      <ComponentGroupRef Id="GridcraftFiles" />
    </Feature>
  <Property Id="CRAFT_OPTION_1_M" Secure="yes"><RegistrySearch Id="CRAFT_OPTION_1_MSearch" Root="HKLM" Key="Software\GridCraft\Installer" Name="DesktopShortcut" Type="raw" />
    </Property><SetProperty Id="SAVEDDESKTOPSHORTCUT" Action="CraftLoadOption1M" Value="[CRAFT_OPTION_1_M]" After="LaunchConditions" Sequence="both" Condition="ALLUSERS = 1" /><Property Id="CRAFT_OPTION_1_U" Secure="yes"><RegistrySearch Id="CRAFT_OPTION_1_USearch" Root="HKCU" Key="Software\GridCraft\Installer" Name="DesktopShortcut" Type="raw" />
    </Property><SetProperty Id="SAVEDDESKTOPSHORTCUT" Action="CraftLoadOption1U" Value="[CRAFT_OPTION_1_U]" After="CraftLoadOption1M" Sequence="both" Condition="ALLUSERS &lt;&gt; 1" /></Package>

  <Fragment>
    <?if $(var.HasCraftFontLicences) = 1 ?>
    <ComponentGroup Id="CraftFontLicences" Directory="INSTALLFOLDER">
      <Files Include="$(var.DocsDir)\**" />
    </ComponentGroup>
    <?endif?>
    <ComponentGroup Id="GridcraftFiles" Directory="INSTALLFOLDER">
      <Component Id="GridcraftApp" Guid="0507D4B6-12FF-4882-84E1-59083E74A4EB">
        <File Id="GridcraftExe" Source="$(var.BinDir)\gridcraft.exe" KeyPath="yes">
          <Shortcut Id="StartMenuShortcut" Directory="ProgramMenuFolder" Name="GridCraft" Description="GridCraft spreadsheet" WorkingDirectory="INSTALLFOLDER" Advertise="yes" Icon="GridcraftIcon.ico" IconIndex="0" />
        </File>

        <RegistryValue Root="HKMU" Key="Software\Microsoft\Windows\CurrentVersion\App Paths\gridcraft.exe" Value="[#GridcraftExe]" Type="string" />

        <!-- ProgIds: how Explorer opens a file with GridCraft. Nothing here sets HKCR\.<ext>'s
             default value, so the user's current default app is left alone. -->
        <RegistryValue Root="HKMU" Key="Software\Classes\GridCraft.Workbook" Value="GridCraft Workbook" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\Classes\GridCraft.Workbook\DefaultIcon" Value="&quot;[#GridcraftExe]&quot;,0" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\Classes\GridCraft.Workbook\shell\open\command" Value="&quot;[#GridcraftExe]&quot; &quot;%1&quot;" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\Classes\GridCraft.TextData" Value="GridCraft Text Data" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\Classes\GridCraft.TextData\DefaultIcon" Value="&quot;[#GridcraftExe]&quot;,0" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\Classes\GridCraft.TextData\shell\open\command" Value="&quot;[#GridcraftExe]&quot; &quot;%1&quot;" Type="string" />

        <!-- "Open with": Windows reads only the value names under OpenWithProgids; the data is
             ignored (WiX rejects an empty Value, so it repeats the ProgId). -->
        <RegistryValue Root="HKMU" Key="Software\Classes\.xlsx\OpenWithProgids" Name="GridCraft.Workbook" Value="GridCraft.Workbook" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\Classes\.xlsm\OpenWithProgids" Name="GridCraft.Workbook" Value="GridCraft.Workbook" Type="string" />
        <!-- .xlsb and .ods are imported (data only) into a new workbook that saves as .xlsx. -->
        <RegistryValue Root="HKMU" Key="Software\Classes\.xlsb\OpenWithProgids" Name="GridCraft.Workbook" Value="GridCraft.Workbook" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\Classes\.ods\OpenWithProgids" Name="GridCraft.Workbook" Value="GridCraft.Workbook" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\Classes\.csv\OpenWithProgids" Name="GridCraft.TextData" Value="GridCraft.TextData" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\Classes\.tsv\OpenWithProgids" Name="GridCraft.TextData" Value="GridCraft.TextData" Type="string" />

        <!-- Settings > Default apps: lets the user pick GridCraft for these types. -->
        <RegistryValue Root="HKMU" Key="Software\GridCraft\Capabilities" Name="ApplicationName" Value="GridCraft" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\GridCraft\Capabilities" Name="ApplicationDescription" Value="Open-source spreadsheet for .xlsx, CSV and TSV files" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\GridCraft\Capabilities\FileAssociations" Name=".xlsx" Value="GridCraft.Workbook" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\GridCraft\Capabilities\FileAssociations" Name=".xlsm" Value="GridCraft.Workbook" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\GridCraft\Capabilities\FileAssociations" Name=".csv" Value="GridCraft.TextData" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\GridCraft\Capabilities\FileAssociations" Name=".tsv" Value="GridCraft.TextData" Type="string" />
        <RegistryValue Root="HKMU" Key="Software\RegisteredApplications" Name="GridCraft" Value="Software\GridCraft\Capabilities" Type="string" />
      <RegistryValue Root="HKMU" Key="Software\GridCraft" Name="InstallDir" Value="[INSTALLFOLDER]" Type="string" />
      </Component>

      <Component Id="GridcraftCli">
        <File Id="GridcraftCliExe" Source="$(var.BinDir)\gridcraft-cli.exe" KeyPath="yes" />
      </Component>

      <!-- Persist both on and off, independently of the optional shortcut. AppSearch reads
           this before MajorUpgrade removes the previous product. -->
      <Component Id="DesktopShortcutPreference">
        <RegistryValue Root="HKMU" Key="Software\GridCraft\Installer" Name="DesktopShortcut" Value="[DESKTOPSHORTCUT]" Type="string" KeyPath="yes" />
      </Component>
      <Component Id="DesktopShortcutComponent" Directory="DesktopFolder" Condition="DESKTOPSHORTCUT = &quot;1&quot;">
        <Shortcut Id="DesktopShortcut" Name="GridCraft" Description="GridCraft spreadsheet" Target="[#GridcraftExe]" WorkingDirectory="INSTALLFOLDER" Icon="GridcraftIcon.ico" IconIndex="0" />
        <!-- HKMU resolves to HKLM for this per-machine package, so another account can
             uninstall the marker too. MSI root -1 also satisfies ICE43 for this shortcut. -->
        <RegistryValue Root="HKMU" Key="Software\GridCraft\Installer" Name="DesktopShortcutComponent" Value="1" Type="integer" KeyPath="yes" />
      </Component>
    </ComponentGroup>
  </Fragment>
</Wix>