Skip to content

Commit ed51cd9

Browse files
committed
Remove installer code
The service is installed via MSI Wix script. GitHub: #24 Signed-off-by: Lev Stipakov <[email protected]>
1 parent 10921dd commit ed51cd9

File tree

5 files changed

+12
-346
lines changed

5 files changed

+12
-346
lines changed

OpenVpnService.csproj

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -96,12 +96,6 @@
9696
<Compile Include="OpenVPNChild.cs" />
9797
<Compile Include="OpenVPNServiceConfiguration.cs" />
9898
<Compile Include="Program.cs" />
99-
<Compile Include="ProjectInstaller.cs">
100-
<SubType>Component</SubType>
101-
</Compile>
102-
<Compile Include="ProjectInstaller.Designer.cs">
103-
<DependentUpon>ProjectInstaller.cs</DependentUpon>
104-
</Compile>
10599
<Compile Include="Service.cs">
106100
<SubType>Component</SubType>
107101
</Compile>
@@ -115,9 +109,6 @@
115109
<Reference Include="System.ServiceProcess" />
116110
</ItemGroup>
117111
<ItemGroup>
118-
<EmbeddedResource Include="ProjectInstaller.resx">
119-
<DependentUpon>ProjectInstaller.cs</DependentUpon>
120-
</EmbeddedResource>
121112
<EmbeddedResource Include="Service.resx">
122113
<DependentUpon>Service.cs</DependentUpon>
123114
</EmbeddedResource>

Program.cs

Lines changed: 12 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -11,57 +11,22 @@ internal class Program
1111
{
1212
public static int Main(string[] args)
1313
{
14-
if (args.Length == 0)
14+
if (!Environment.UserInteractive)
1515
{
16-
if (!Environment.UserInteractive)
17-
{
18-
// Running as a Windows Service
19-
ServiceBase.Run(new OpenVpnService());
20-
}
21-
else
22-
{
23-
// Running as a console application
24-
Console.WriteLine("Running in console mode...");
25-
var runner = new OpenVPNServiceRunner(null);
26-
runner.Start(args);
27-
28-
Console.WriteLine("Press Enter to stop...");
29-
Console.ReadLine();
30-
31-
runner.Stop();
32-
}
33-
}
34-
else if (args[0] == "-install")
35-
{
36-
try
37-
{
38-
ProjectInstaller.Install();
39-
}
40-
catch (Exception e)
41-
{
42-
Console.Error.WriteLine(e.Message);
43-
Console.Error.WriteLine(e.StackTrace);
44-
return 1;
45-
}
46-
}
47-
else if (args[0] == "-remove")
48-
{
49-
try
50-
{
51-
ProjectInstaller.Stop();
52-
ProjectInstaller.Uninstall();
53-
}
54-
catch (Exception e)
55-
{
56-
Console.Error.WriteLine(e.Message);
57-
Console.Error.WriteLine(e.StackTrace);
58-
return 1;
59-
}
16+
// Running as a Windows Service
17+
ServiceBase.Run(new OpenVpnService());
6018
}
6119
else
6220
{
63-
Console.Error.WriteLine("Unknown command: " + args[0]);
64-
return 1;
21+
// Running as a console application
22+
Console.WriteLine("Running in console mode...");
23+
var runner = new OpenVPNServiceRunner(null);
24+
runner.Start(args);
25+
26+
Console.WriteLine("Press Enter to stop...");
27+
Console.ReadLine();
28+
29+
runner.Stop();
6530
}
6631
return 0;
6732
}

ProjectInstaller.Designer.cs

Lines changed: 0 additions & 61 deletions
This file was deleted.

ProjectInstaller.cs

Lines changed: 0 additions & 100 deletions
This file was deleted.

ProjectInstaller.resx

Lines changed: 0 additions & 129 deletions
This file was deleted.

0 commit comments

Comments
 (0)