Skip to content

Commit 8da7da7

Browse files
committed
added installer "start over" feature
1 parent 7e35088 commit 8da7da7

File tree

6 files changed

+73
-4
lines changed

6 files changed

+73
-4
lines changed

eFormAPI/Installation/AllowMultipleVersionsBundle/Program.cs

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
using System.Linq;
55
using System.Security;
66
using Microsoft.Win32;
7+
using System.Reflection;
78

89
namespace AlowMultipleVersionsBundle
910
{
@@ -27,7 +28,25 @@ static void Main(string[] args)
2728
SetupIIS();
2829

2930
string path = Path.Combine(Path.GetTempPath(), "Eform Angular Frontend.exe");
30-
File.WriteAllBytes(path, Resources.Eform_Angular_Frontend);
31+
32+
try
33+
{
34+
File.WriteAllBytes(path, Resources.Eform_Angular_Frontend);
35+
}
36+
catch
37+
{
38+
// in case if installer already running, there is no need to write its sources
39+
}
40+
41+
var drive = DriveInfo.GetDrives().First(t => t.DriveType == DriveType.Fixed).Name;
42+
var tmpDir = Path.Combine(drive, "tmp");
43+
if (Directory.Exists(tmpDir))
44+
Directory.Delete(tmpDir, true);
45+
46+
var dirInfo = Directory.CreateDirectory(tmpDir);
47+
dirInfo.Attributes = FileAttributes.Directory | FileAttributes.Hidden;
48+
File.WriteAllText(dirInfo.FullName + "\\config.txt", Assembly.GetExecutingAssembly().Location);
49+
3150
Process.Start(path);
3251
}
3352
catch (SecurityException e)

eFormAPI/Installation/CustomActions/CustomAction.cs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -438,6 +438,27 @@ public static ActionResult RemoveCA(Session session)
438438

439439
}
440440

441+
[CustomAction]
442+
public static ActionResult RestartInstallerCA(Session session)
443+
{
444+
try
445+
{
446+
var drive = DriveInfo.GetDrives().First(t => t.DriveType == DriveType.Fixed).Name;
447+
var tmpDir = Path.Combine(drive, "tmp", "config.txt");
448+
449+
var location = File.ReadAllText(tmpDir);
450+
Process.Start(location);
451+
452+
return ActionResult.Success;
453+
}
454+
catch (Exception ex)
455+
{
456+
457+
MessageBox.Show(ex.Message + " " + ex.StackTrace);
458+
return ActionResult.Failure;
459+
}
460+
}
461+
441462
private static long GetSiteId(string uiName)
442463
{
443464
using (var serverManager = new ServerManager())
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi">
4+
<Fragment>
5+
<UI>
6+
<Dialog Id="ExitDlgModified" Width="370" Height="270" Title="!(loc.ExitDialog_Title)">
7+
<Control Id="Finish" Type="PushButton" X="248" Y="243" Width="56" Height="17" Default="yes" Cancel="yes" Text="!(loc.WixUIFinish)" />
8+
<Control Id="Bitmap" Type="Bitmap" X="0" Y="0" Width="370" Height="234" TabSkip="no" Text="!(loc.ExitDialogBitmap)" />
9+
<Control Id="StartOver" Type="PushButton" X="309" Y="243" Width="56" Height="17" Cancel="yes" Text="Start over" >
10+
<Publish Event="DoAction" Value="RestartInstaller">1</Publish>
11+
</Control>
12+
<Control Id="BottomLine" Type="Line" X="0" Y="234" Width="370" Height="0" />
13+
<Control Id="Description" Type="Text" X="135" Y="70" Width="220" Height="40" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogDescription)" />
14+
<Control Id="Title" Type="Text" X="135" Y="20" Width="220" Height="60" Transparent="yes" NoPrefix="yes" Text="!(loc.ExitDialogTitle)" />
15+
</Dialog>
16+
17+
<InstallUISequence>
18+
<Show Dialog="ExitDlgModified" OnExit="success" Overridable="yes" />
19+
</InstallUISequence>
20+
21+
<AdminUISequence>
22+
<Show Dialog="ExitDlgModified" OnExit="success" Overridable="yes" />
23+
</AdminUISequence>
24+
</UI>
25+
</Fragment>
26+
</Wix>

eFormAPI/Installation/MainInstaller/MainInstaller.wixproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
</PropertyGroup>
2525
<ItemGroup>
2626
<Compile Include="ApiFileList.wxs" />
27+
<Compile Include="ExitDlgModified.wxs" />
2728
<Compile Include="DomainNameDlg.wxs" />
2829
<Compile Include="EmptyFIieldDlg.wxs" />
2930
<Compile Include="ClientFileList.wxs" />

eFormAPI/Installation/MainInstaller/Product.wxs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,8 @@
6464
<Fragment>
6565
<CustomAction Id="GetAPIsList" BinaryKey="BinaryCA" DllEntry="GetAPIsListCA" Execute="immediate" />
6666
<CustomAction Id="TryFindConfigs" BinaryKey="BinaryCA" DllEntry="TryFindConfigs" Execute="immediate"/>
67-
67+
<CustomAction Id="RestartInstaller" BinaryKey="BinaryCA" DllEntry="RestartInstallerCA" Execute="immediate" />
68+
6869
<CustomAction Id="Install" BinaryKey="BinaryCA" DllEntry="InstallCA" Execute="deferred" Impersonate="no" />
6970
<CustomAction Id="UpdateService" BinaryKey="BinaryCA" DllEntry="UpdateCA" Execute="deferred" Impersonate="no" />
7071
<CustomAction Id="RemoveService" BinaryKey="BinaryCA" DllEntry="RemoveCA" Execute="deferred" Impersonate="no" />

eFormAPI/Installation/MainInstaller/WixUI_InstallDirModified.wxs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020
<DialogRef Id="ResumeDlg" />
2121
<DialogRef Id="UserExit" />
2222

23-
<Publish Dialog="ExitDialog" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
23+
<Publish Dialog="ExitDlgModified" Control="Finish" Event="EndDialog" Value="Return" Order="999">1</Publish>
24+
<Publish Dialog="ExitDlgModified" Control="StartOver" Event="EndDialog" Value="Return" Order="999">1</Publish>
2425

2526
<Publish Dialog="WelcomeDlgModified" Control="Next" Event="NewDialog" Value="MaintenanceTypeModifiedDlg">1</Publish>
26-
27+
2728
<Publish Dialog="MaintenanceTypeModifiedDlg" Control="Update" Event="NewDialog" Value="DomainNameSelectDlg">1</Publish>
2829
<Publish Dialog="MaintenanceTypeModifiedDlg" Control="Remove" Event="NewDialog" Value="DomainNameSelectDlg">1</Publish>
2930
<Publish Dialog="MaintenanceTypeModifiedDlg" Control="Install" Event="NewDialog" Value="LicenseAgreementDlg">1</Publish>

0 commit comments

Comments
 (0)