-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProjectInstaller.cs
50 lines (44 loc) · 2.02 KB
/
ProjectInstaller.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using PlayService.Extensions;
using System;
using System.ComponentModel;
using System.Configuration.Install;
namespace PlayService
{
[RunInstaller(true)]
public partial class ProjectInstaller : Installer
{
public ProjectInstaller()
{
InitializeComponent();
Console.WriteLine(Environment.CommandLine);
}
private void ProjectInstaller_BeforeInstall(object sender, InstallEventArgs e)
{
SetParameters();
}
private void ProjectInstaller_BeforeUninstall(object sender, InstallEventArgs e)
{
SetParameters();
}
private void SetParameters()
{
if (!String.IsNullOrEmpty(Context.Parameters["ServiceName"]))
serviceInstaller.ServiceName = Context.Parameters["ServiceName"];
var assemblyPath = Context.Parameters["assemblypath"].Quote();
if (!String.IsNullOrEmpty(Context.Parameters["ServiceName"]))
assemblyPath += " /ServiceName=" + Context.Parameters["ServiceName"].QuoteIfNecessary();
if (!String.IsNullOrEmpty(Context.Parameters["WorkDir"]))
assemblyPath += " /WorkDir=" + Context.Parameters["WorkDir"].QuoteIfNecessary();
if (!String.IsNullOrEmpty(Context.Parameters["ConfigFile"]))
assemblyPath += " /ConfigFile=" + Context.Parameters["ConfigFile"].QuoteIfNecessary();
if (!String.IsNullOrEmpty(Context.Parameters["AppHome"]))
assemblyPath += " /AppHome=" + Context.Parameters["AppHome"].QuoteIfNecessary();
if (!String.IsNullOrEmpty(Context.Parameters["AppName"]))
assemblyPath += " /AppName=" + Context.Parameters["AppName"].QuoteIfNecessary();
if (!String.IsNullOrEmpty(Context.Parameters["Env"]))
assemblyPath += " /Env=" + Context.Parameters["Env"].Quote();
Context.Parameters["assemblypath"] = assemblyPath;
Console.WriteLine($"assemblyPath:{assemblyPath}");
}
}
}