Skip to content

Commit 2491b4b

Browse files
committed
Reinstate SetNetworkPermissions executable and adapt to run on 32and 64bit OS. - Fixes can't change network bug.
1 parent 142f7a8 commit 2491b4b

6 files changed

Lines changed: 51 additions & 24 deletions

File tree

BuildRemote.cmd

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,25 @@ msbuild /t:rebuild /p:configuration=Release;Platform="Any CPU"
1919
cd %RemoteDirectory%
2020
rmdir /s /q "publish"
2121
@echo Publishing ASCOM Remote x86
22-
dotnet publish "remote server\remote server.csproj" --runtime win-x86 --self-contained -p:Configuration=Debug -p:Platform="x86" -p:publishsinglefile=true -o publish\x86\
22+
dotnet publish "remote server\remote server.csproj" --runtime win-x86 --self-contained -p:Configuration=Debug -p:Platform="x86" -p:publishsinglefile=true -o publish\remote\x86\
23+
2324
@echo Publishing ASCOM Remote x64
24-
dotnet publish "remote server\remote server.csproj" --runtime win-x64 --self-contained -p:Configuration=Debug -p:Platform="Any CPU" -p:publishsinglefile=true -o publish\x64\
25+
dotnet publish "remote server\remote server.csproj" --runtime win-x64 --self-contained -p:Configuration=Debug -p:Platform="Any CPU" -p:publishsinglefile=true -o publish\remote\x64\
26+
27+
@echo Publishing Set Network Permissions x86
28+
dotnet publish "SetNetworkPermissions\SetNetworkPermissions.csproj" --runtime win-x86 --self-contained -p:Configuration=Debug -p:Platform="x86" -p:publishsinglefile=true -o publish\permissions\x86\
2529

26-
@echo Publishing ASCOM Remote x86 - Needs Support Library
27-
dotnet publish "remote server\remote server.csproj" --runtime win-x86 -p:Configuration=Debug --self-contained false -p:Platform="x86" -p:publishsinglefile=true -o publish\x86NeedsCoreInstall\
28-
@echo Publishing ASCOM Remote x64 - Needs Support Library
29-
dotnet publish "remote server\remote server.csproj" --runtime win-x64 -p:Configuration=Debug --self-contained false -p:Platform="Any CPU" -p:publishsinglefile=true -o publish\x64NeedsCoreInstall\
30+
rem @echo Publishing Set Network Permissions x64
31+
rem dotnet publish "SetNetworkPermissions\SetNetworkPermissions.csproj" --runtime win-x64 --self-contained -p:Configuration=Debug -p:Platform="Any CPU" -p:publishsinglefile=true -o publish\permissions\x64\
32+
33+
rem @echo Publishing ASCOM Remote x86 - Needs Support Library
34+
rem dotnet publish "remote server\remote server.csproj" --runtime win-x86 -p:Configuration=Debug --self-contained false -p:Platform="x86" -p:publishsinglefile=true -o publish\x86NeedsCoreInstall\
35+
rem @echo Publishing ASCOM Remote x64 - Needs Support Library
36+
rem dotnet publish "remote server\remote server.csproj" --runtime win-x64 -p:Configuration=Debug --self-contained false -p:Platform="Any CPU" -p:publishsinglefile=true -o publish\x64NeedsCoreInstall\
3037

3138
@echo *** Creating Windows installer
3239
cd Setup
3340
"C:\Program Files (x86)\Inno Script Studio\isstudio.exe" -compile "ASCOM Remote Setup.iss"
3441
cd ..
35-
42+
@echo *** Finsihed!
3643
pause

Remote Server/Remote Server.csproj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@
2929
<!-- Set version numbers -->
3030
<ProductMajor>6</ProductMajor>
3131
<ProductMinor>7</ProductMinor>
32-
<ProductPatch>0</ProductPatch>
32+
<ProductPatch>1</ProductPatch>
3333

3434
<!-- Set the pre-release string without a leading minus e.g. rc.1 -->
35-
<ProductPreRelease></ProductPreRelease>
35+
<ProductPreRelease>rc-1</ProductPreRelease>
3636

3737
<!--Create a dynamic revision number based on time of build
3838

Remote Server/ServerForm.cs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public partial class ServerForm : Form
160160
internal const string CONFIRM_EXIT_PROFILENAME = "Confirm Exit"; public const bool CONFIRM_EXIT_DEFAULT = false;
161161
internal const string MINIMISE_ON_START_PROFILENAME = "Minimise On Start"; public const bool MINIMISE_ON_START_DEFAULT = false;
162162
internal const string CHECK_FOR_UPDATES = "Check For Updates"; public const bool CHECK_FOR_UPDATES_DEFAULT = true;
163-
internal const string CHECK_FOR_PRE_RELEASE = "Check For Pre-release Updates"; public const bool CHECK_FOR_PRE_RELEASE_DEFAULT = false;
163+
internal const string CHECK_FOR_PRE_RELEASE = "Check For Pre-release Updates"; public const bool CHECK_FOR_PRE_RELEASE_DEFAULT = true;
164164

165165
// Minimise behaviour strings
166166
internal const string MINIMISE_TO_SYSTEM_TRAY_KEY = "Minimise to system tray";
@@ -632,7 +632,19 @@ private void StartRESTServer()
632632

633633
try
634634
{
635-
string setNetworkPermissionsPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + SharedConstants.SET_NETWORK_PERMISSIONS_EXE_PATH;
635+
string setNetworkPermissionsPath;
636+
637+
// Set the path to the permissions exe depending on whether we are a 32 or 64bit application
638+
if (Environment.Is64BitProcess) // 64bit application
639+
{
640+
// Use the Program Files (x86) folder (32bit folder on a 64bit OS)
641+
setNetworkPermissionsPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFilesX86) + SharedConstants.SET_NETWORK_PERMISSIONS_EXE_PATH;
642+
}
643+
else
644+
{
645+
// Use the Program Files folder (32bit folder on a 32bit OS)
646+
setNetworkPermissionsPath = Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles) + SharedConstants.SET_NETWORK_PERMISSIONS_EXE_PATH;
647+
}
636648
LogMessage(0, 0, 0, "StartRESTServer", string.Format("SetNetworkPermissionspath: {0}", setNetworkPermissionsPath));
637649

638650
// Check that the SetNetworkPermissions EXE exists

Remote Server/Shared Constants.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public static class SharedConstants
8888
public const string BROWSER_URL_SETUP = "setup";
8989

9090
// Constants used to set network permissions
91-
public const string SET_NETWORK_PERMISSIONS_EXE_PATH = @"\ASCOM\Remote\ASCOM.SetNetworkPermissions.exe"; //Relative path of the SetNetworkPermissions exe from C:\Program Files (or x86 on 64bit OS). Must match the location where the installer puts the exe!
91+
public const string SET_NETWORK_PERMISSIONS_EXE_PATH = @"\ASCOM\RemoteServer\SetNetworkPermissions\ASCOM.SetNetworkPermissions.exe"; //Relative path of the SetNetworkPermissions exe from C:\Program Files (or x86 on 64bit OS). Must match the location where the installer puts the exe!
9292
public const string ENABLE_REMOTE_SERVER_MANAGEMENT_URI_COMMAND_NAME = "setremoteservermanagementuriacl";
9393
public const string ENABLE_ALPACA_DEVICE_MANAGEMENT_URI_COMMAND_NAME = "setalpacamanagementurl";
9494
public const string ENABLE_ALPACA_SETUP_URI_COMMAND_NAME = "setalpacasetupurl";

SetNetworkPermissions/SetNetworkPermissions.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
<RootNamespace>ASCOM.Remote</RootNamespace>
55
<AssemblyName>ASCOM.SetNetworkPermissions</AssemblyName>
66
<TargetFramework>net7.0-windows</TargetFramework>
7-
<UseWindowsForms>true</UseWindowsForms>
87
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
98
<AssemblyTitle>Set Network Permissions</AssemblyTitle>
109
<Product>SetNetworkPemissions</Product>

Setup/ASCOM Remote Setup.iss

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22
; Script to install the ASCOM Remote Server
33
;
44

5-
;; Pre-define ISPP variables
5+
; Pre-define ISPP variables
66
#define FileHandle
77
#define FileLine
88
#define MyInformationVersion
99

1010
; Read the informational SEMVER version string from the file created by the build process
11-
#define FileHandle = FileOpen("..\publish\InformationVersion.txt");
11+
#define FileHandle = FileOpen("..\publish\remote\InformationVersion.txt");
1212
#define FileLine = FileRead(FileHandle)
1313
#pragma message "Informational version number: " + FileLine
1414

@@ -100,19 +100,28 @@ Name: "ukrainian"; MessagesFile: "compiler:Languages\Ukrainian.isl"
100100

101101
[Files]
102102
; 64bit OS - Install the 64bit app
103-
Source: "..\publish\x64\*.exe"; DestDir: "{app}"; Flags: ignoreversion signonce; Check: Is64BitInstallMode
104-
Source: "..\publish\x64\*.dll"; DestDir: "{app}"; Flags: ignoreversion signonce; Check: Is64BitInstallMode
105-
Source: "..\publish\x64\*"; DestDir: "{app}"; Flags: ignoreversion; Excludes:"*.exe,*.dll"; Check: Is64BitInstallMode
103+
Source: "..\publish\remote\x64\*.exe"; DestDir: "{app}"; Flags: ignoreversion signonce; Check: Is64BitInstallMode
104+
Source: "..\publish\remote\x64\*.dll"; DestDir: "{app}"; Flags: ignoreversion signonce; Check: Is64BitInstallMode
105+
Source: "..\publish\remote\x64\*"; DestDir: "{app}"; Flags: ignoreversion; Excludes:"*.exe,*.dll"; Check: Is64BitInstallMode
106106

107107
; 64bit OS - Install the 32bit app
108-
Source: "..\publish\x86\*.exe"; DestDir: "{app}\32bit"; Flags: ignoreversion signonce; Check: Is64BitInstallMode
109-
Source: "..\publish\x86\*.dll"; DestDir: "{app}\32bit"; Flags: ignoreversion signonce; Check: Is64BitInstallMode
110-
Source: "..\publish\x86\*"; DestDir: "{app}\32bit"; Flags: ignoreversion; Excludes:"*.exe,*.dll"; Check: Is64BitInstallMode
108+
Source: "..\publish\remote\x86\*.exe"; DestDir: "{app}\32bit"; Flags: ignoreversion signonce; Check: Is64BitInstallMode
109+
Source: "..\publish\remote\x86\*.dll"; DestDir: "{app}\32bit"; Flags: ignoreversion signonce; Check: Is64BitInstallMode
110+
Source: "..\publish\remote\x86\*"; DestDir: "{app}\32bit"; Flags: ignoreversion; Excludes:"*.exe,*.dll"; Check: Is64BitInstallMode
111111

112112
; 32bit OS - Install the 32bit app
113-
Source: "..\publish\x86\*.exe"; DestDir: "{app}"; Flags: ignoreversion signonce; Check: not Is64BitInstallMode
114-
Source: "..\publish\x86\*.dll"; DestDir: "{app}"; Flags: ignoreversion signonce; Check: not Is64BitInstallMode
115-
Source: "..\publish\x86\*"; DestDir: "{app}"; Flags: ignoreversion; Excludes:"*.exe,*.dll"; Check: not Is64BitInstallMode
113+
Source: "..\publish\remote\x86\*.exe"; DestDir: "{app}"; Flags: ignoreversion signonce; Check: not Is64BitInstallMode
114+
Source: "..\publish\remote\x86\*.dll"; DestDir: "{app}"; Flags: ignoreversion signonce; Check: not Is64BitInstallMode
115+
Source: "..\publish\remote\x86\*"; DestDir: "{app}"; Flags: ignoreversion; Excludes:"*.exe,*.dll"; Check: not Is64BitInstallMode
116+
117+
;Source: "..\publish\permissions\x64\*.exe"; DestDir: "{app}\SetNetworkPermissions"; Flags: ignoreversion signonce; Check: Is64BitInstallMode
118+
;Source: "..\publish\permissions\x64\*.dll"; DestDir: "{app}\SetNetworkPermissions"; Flags: ignoreversion signonce; Check: Is64BitInstallMode
119+
;Source: "..\publish\permissions\x64\*"; DestDir: "{app}\SetNetworkPermissions"; Flags: ignoreversion; Excludes:"*.exe,*.dll"; Check: Is64BitInstallMode
120+
121+
; Install the 32bit exe into the 32bit program files folder structure
122+
Source: "..\publish\permissions\x86\*.exe"; DestDir: "{autopf32}\{#MyInstallFolder}\SetNetworkPermissions"; Flags: ignoreversion signonce;
123+
Source: "..\publish\permissions\x86\*.dll"; DestDir: "{autopf32}\{#MyInstallFolder}\SetNetworkPermissions"; Flags: ignoreversion signonce;
124+
Source: "..\publish\permissions\x86\*"; DestDir: "{autopf32}\{#MyInstallFolder}\SetNetworkPermissions"; Flags: ignoreversion; Excludes:"*.exe,*.dll";
116125

117126
; DOCUMENTATION
118127
Source: "..\Documentation\{#ASCOMRemoteDocumentationFileName}"; DestDir: "{app}"; Flags: ignoreversion

0 commit comments

Comments
 (0)