Skip to content

Commit 43d86f8

Browse files
add installer so the server doesn't have to run as admin
1 parent 9deccc5 commit 43d86f8

File tree

2 files changed

+43
-3
lines changed

2 files changed

+43
-3
lines changed

KnockServer/Program.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ static void Main(string[] args)
3131
Application.EnableVisualStyles();
3232
Application.SetCompatibleTextRenderingDefault(false);
3333

34+
/*
3435
if (!IsRunAsAdmin())
3536
{
3637
ProcessStartInfo proc = new ProcessStartInfo();
@@ -52,11 +53,11 @@ static void Main(string[] args)
5253
}
5354
}
5455
else
55-
{
56+
{*/
5657
Console.WriteLine(Assembly.GetExecutingAssembly().GetName().Version.ToString());
5758

5859
Application.Run(new CustomApplicationContext());
59-
}
60+
//}
6061

6162
}
6263

@@ -143,7 +144,7 @@ public CustomApplicationContext()
143144
WebServiceHost hostWeb = new WebServiceHost(restServiceInstance);
144145
*/
145146
hostWeb = new WebServiceHost(typeof(RestService));
146-
ServiceEndpoint ep = hostWeb.AddServiceEndpoint(typeof(KnockServer.IService), new WebHttpBinding(), "");
147+
ServiceEndpoint ep = hostWeb.AddServiceEndpoint(typeof(IService), new WebHttpBinding(), "");
147148
ServiceDebugBehavior stp = hostWeb.Description.Behaviors.Find<ServiceDebugBehavior>();
148149
stp.HttpHelpPageEnabled = false;
149150
hostWeb.Open();

KnockServer/VRKnockServer.iss

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
2+
[Setup]
3+
#define AppVersion GetFileVersion("bin\Release\KnockServer.exe")
4+
#define AppName "VRKnockServer"
5+
6+
AppName={#AppName}
7+
AppVersion={#AppVersion}
8+
AppVerName={#AppName} {#AppVersion}
9+
VersionInfoVersion={#AppVersion}
10+
WizardStyle=modern
11+
DefaultDirName={autopf}\{#AppName}
12+
DefaultGroupName={#AppName}
13+
UninstallDisplayIcon={app}\KnockServer.exe
14+
Compression=lzma2
15+
SolidCompression=yes
16+
SourceDir="bin\Release"
17+
OutputDir="Installer"
18+
OutputBaseFilename={#AppName}_{#AppVersion}_setup
19+
20+
[Files]
21+
Source: "KnockServer.exe"; DestDir: "{app}"
22+
Source: "KnockServer.exe.config"; DestDir: "{app}"
23+
Source: "manifest.vrmanifest"; DestDir: "{app}"
24+
Source: "openvr_api.dll"; DestDir: "{app}"
25+
Source: "QRCoder.dll"; DestDir: "{app}"
26+
Source: "Resources\*"; DestDir: "{app}"
27+
28+
[Code]
29+
function UserDomainAndName(Param: String): String;
30+
begin
31+
Result := GetEnv('UserDomain') + '\' + GetEnv('UserName');
32+
end;
33+
34+
[Run]
35+
Filename: "netsh.exe"; Parameters: "http add urlacl url=http://+:16945/ user={code:UserDomainAndName}"
36+
37+
38+
[Icons]
39+
Name: "{group}\VRKnockServer"; Filename: "{app}\KnockServer.exe"

0 commit comments

Comments
 (0)