Skip to content

Commit 84aae7b

Browse files
authored
Merge pull request #6 from KMConner/installer-dll
Installer
2 parents ae74c30 + 9b64d36 commit 84aae7b

File tree

20 files changed

+1573
-29
lines changed

20 files changed

+1573
-29
lines changed

CustomAction/Actions.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Text;
4+
using System.Diagnostics;
5+
using System.Reflection;
6+
using System.IO;
7+
8+
namespace CustomAction
9+
{
10+
static class Actions
11+
{
12+
private const string ServiceName = "TaskbarTweet";
13+
public static void Install()
14+
{
15+
string baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
16+
string pusherPath = Path.Join(baseDir, "Pusher.exe");
17+
string comPath = Path.Join(baseDir, "TaskbarTweet.dll");
18+
Console.WriteLine(pusherPath);
19+
Process.Start("regsvr32.exe", $"/s \"{comPath}\"").WaitForExit();
20+
}
21+
22+
public static void Uninstall()
23+
{
24+
string baseDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
25+
string comPath = Path.Join(baseDir, "TaskbarTweet.dll");
26+
27+
Process.Start("regsvr32.exe", $"/s /u \"{comPath}\"").WaitForExit();
28+
}
29+
}
30+
}

CustomAction/CustomAction.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>netcoreapp3.1</TargetFramework>
6+
<Platforms>AnyCPU;x64</Platforms>
7+
</PropertyGroup>
8+
9+
</Project>

CustomAction/Program.cs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
using System;
2+
3+
namespace CustomAction
4+
{
5+
class Program
6+
{
7+
static int Main(string[] args)
8+
{
9+
if (args.Length != 1)
10+
{
11+
Console.WriteLine("No action specified");
12+
return -1;
13+
}
14+
15+
switch (args[0])
16+
{
17+
case "install":
18+
Actions.Install();
19+
break;
20+
case "uninstall":
21+
Actions.Uninstall();
22+
break;
23+
default:
24+
Console.WriteLine("Invalid action");
25+
return 1;
26+
}
27+
28+
return 0;
29+
}
30+
}
31+
}
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
!*.pubxml
2+
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<!--
3+
https://go.microsoft.com/fwlink/?LinkID=208121.
4+
-->
5+
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
6+
<PropertyGroup>
7+
<Configuration>Release</Configuration>
8+
<Platform>Any CPU</Platform>
9+
<PublishDir>bin\Release\netcoreapp3.1\publish\</PublishDir>
10+
<PublishProtocol>FileSystem</PublishProtocol>
11+
<TargetFramework>netcoreapp3.1</TargetFramework>
12+
<SelfContained>false</SelfContained>
13+
</PropertyGroup>
14+
</Project>

0 commit comments

Comments
 (0)