Skip to content

Commit

Permalink
Custom action used in msi installer to cope with the new package stru…
Browse files Browse the repository at this point in the history
…cture
  • Loading branch information
torakiki committed Feb 2, 2023
1 parent f87dc3a commit 5b26660
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 15 deletions.
Binary file modified pdfsam-basic/src/msi/AddLine.CA.dll
Binary file not shown.
11 changes: 7 additions & 4 deletions pdfsam-basic/src/msi/CA/AddLine/AddLine/AddLine.csproj
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
Expand All @@ -11,9 +11,9 @@
<RootNamespace>AddLine</RootNamespace>
<AssemblyName>AddLine</AssemblyName>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<TargetFrameworkProfile>
</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
<WixCATargetsPath Condition=" '$(WixCATargetsPath)' == '' ">$(MSBuildExtensionsPath)\Microsoft\WiX\v3.x\Wix.CA.targets</WixCATargetsPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
Expand All @@ -24,6 +24,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
Expand All @@ -33,6 +34,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup>
<StartupObject />
Expand All @@ -57,5 +59,6 @@
<Target Name="AfterBuild">
</Target>
-->
<Import Project="$(WixCATargetsPath)" />
<Import Project="$(WixCATargetsPath)" Condition=" '$(WixCATargetsPath)' != '' " />
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets" Condition=" '$(WixCATargetsPath)' == '' AND Exists('$(MSBuildExtensionsPath32)\Microsoft\WiX\v3.x\Wix.CA.targets') " />
</Project>
22 changes: 11 additions & 11 deletions pdfsam-basic/src/msi/CA/AddLine/AddLine/CustomAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,29 @@ public class CustomActions
public static ActionResult AddLine(Session session)
{
try{
string path = session.CustomActionData["folder"] + "pdfsam.l4j.ini";
string path = session.CustomActionData["folder"] + "app/pdfsam.cfg";
if (File.Exists(@path))
{
session.Log("AddLine to existing " + session.CustomActionData["folder"] + "pdfsam.l4j.ini");
File.AppendAllText(path, Environment.NewLine + "-Dorg.pdfsam.default.checkforupdate=" + session.CustomActionData["updates"] + Environment.NewLine);
session.Log("AddLine to existing " + session.CustomActionData["folder"] + "app/pdfsam.cfg");
File.AppendAllText(path, "java-options=-Dorg.pdfsam.default.checkforupdate=" + session.CustomActionData["updates"] + Environment.NewLine);
session.Log("Added -Dorg.pdfsam.default.checkforupdate=" + session.CustomActionData["updates"]);
File.AppendAllText(path, "-Dorg.pdfsam.default.donate.notification=" + session.CustomActionData["donate"] + Environment.NewLine);
File.AppendAllText(path, "java-options=-Dorg.pdfsam.default.donate.notification=" + session.CustomActionData["donate"] + Environment.NewLine);
session.Log("Added -Dorg.pdfsam.default.donate.notification=" + session.CustomActionData["donate"]);
File.AppendAllText(path, "-Dorg.pdfsam.default.locale=" + session.CustomActionData["locale"] + Environment.NewLine);
File.AppendAllText(path, "java-options=-Dorg.pdfsam.default.locale=" + session.CustomActionData["locale"] + Environment.NewLine);
session.Log("Added -Dorg.pdfsam.default.locale=" + session.CustomActionData["locale"]);
File.AppendAllText(path, "-Dorg.pdfsam.default.checkfornews=" + session.CustomActionData["news"] + Environment.NewLine);
File.AppendAllText(path, "java-options=-Dorg.pdfsam.default.checkfornews=" + session.CustomActionData["news"] + Environment.NewLine);
session.Log("Added -Dorg.pdfsam.default.checkfornews=" + session.CustomActionData["news"]);
File.AppendAllText(path, "-Dorg.pdfsam.default.play.sounds=" + session.CustomActionData["sounds"] + Environment.NewLine);
File.AppendAllText(path, "java-options=-Dorg.pdfsam.default.play.sounds=" + session.CustomActionData["sounds"] + Environment.NewLine);
session.Log("Added -Dorg.pdfsam.default.play.sounds=" + session.CustomActionData["sounds"]);
File.AppendAllText(path, "-Dorg.pdfsam.default.fetch.premium.modules=" + session.CustomActionData["premium"] + Environment.NewLine);
File.AppendAllText(path, "java-options=-Dorg.pdfsam.default.fetch.premium.modules=" + session.CustomActionData["premium"] + Environment.NewLine);
session.Log("Added -Dorg.pdfsam.default.fetch.premium.modules=" + session.CustomActionData["premium"]);
File.AppendAllText(path, "-Dorg.pdfsam.default.compression=" + session.CustomActionData["compression"] + Environment.NewLine);
File.AppendAllText(path, "java-options=-Dorg.pdfsam.default.compression=" + session.CustomActionData["compression"] + Environment.NewLine);
session.Log("Added -Dorg.pdfsam.default.compression=" + session.CustomActionData["compression"]);
File.AppendAllText(path, "-Dorg.pdfsam.default.output.overwrite=" + session.CustomActionData["overwrite"] + Environment.NewLine);
File.AppendAllText(path, "java-options=-Dorg.pdfsam.default.output.overwrite=" + session.CustomActionData["overwrite"] + Environment.NewLine);
session.Log("Added -Dorg.pdfsam.default.output.overwrite=" + session.CustomActionData["overwrite"]);
}else
{
session.Log("Unable to find l4j ini file");
session.Log("Unable to find config file");
}
}catch (Exception){
return ActionResult.Failure;
Expand Down

0 comments on commit 5b26660

Please sign in to comment.