@trillboards/edge-sdk 0.2.56 → 0.2.58
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deploy/branding/SenseAnythingConnector.icns +0 -0
- package/deploy/branding/SenseAnythingConnector.ico +0 -0
- package/deploy/branding/SenseAnythingConnector.png +0 -0
- package/deploy/macos/build-macos-pkg.sh +5 -1
- package/deploy/windows/build-windows.ps1 +2 -1
- package/deploy/windows/bundle-windows-installer.ps1 +11 -1
- package/deploy/windows/installer.nsi +10 -1
- package/deploy/windows/set-executable-icon.ps1 +354 -0
- package/dist/EdgeAgent.js +1 -1
- package/dist/diagnose.d.ts +1 -1
- package/dist/diagnose.js +1 -1
- package/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -433,8 +433,11 @@ fi
|
|
|
433
433
|
# AppKit keeps the installer small and gives customers a real application window
|
|
434
434
|
# while the existing, proven setup engine runs invisibly in the background.
|
|
435
435
|
SETUP_APP_MACOS="$SETUP_APP/Contents/MacOS"
|
|
436
|
+
SETUP_APP_RESOURCES="$SETUP_APP/Contents/Resources"
|
|
436
437
|
SETUP_APP_BIN="$SETUP_APP_MACOS/Trillboards CCTV Setup"
|
|
437
|
-
mkdir -p "$SETUP_APP_MACOS"
|
|
438
|
+
mkdir -p "$SETUP_APP_MACOS" "$SETUP_APP_RESOURCES"
|
|
439
|
+
cp "$PKG_ROOT/deploy/branding/SenseAnythingConnector.icns" \
|
|
440
|
+
"$SETUP_APP_RESOURCES/SenseAnythingConnector.icns"
|
|
438
441
|
log "Building native Trillboards CCTV Setup.app…"
|
|
439
442
|
if [ "$UNIVERSAL" -eq 1 ]; then
|
|
440
443
|
clang -fobjc-arc -Wall -Wextra -Werror -O2 -mmacosx-version-min=12.0 -arch arm64 -arch x86_64 -framework Cocoa \
|
|
@@ -466,6 +469,7 @@ cat > "$SETUP_APP/Contents/Info.plist" <<PLIST
|
|
|
466
469
|
<key>CFBundleDisplayName</key><string>Trillboards CCTV Setup</string>
|
|
467
470
|
<key>CFBundleExecutable</key><string>Trillboards CCTV Setup</string>
|
|
468
471
|
<key>CFBundleIdentifier</key><string>com.trillboards.cctv-setup</string>
|
|
472
|
+
<key>CFBundleIconFile</key><string>SenseAnythingConnector</string>
|
|
469
473
|
<key>CFBundleInfoDictionaryVersion</key><string>6.0</string>
|
|
470
474
|
<key>CFBundleName</key><string>Trillboards CCTV Setup</string>
|
|
471
475
|
<key>CFBundlePackageType</key><string>APPL</string>
|
|
@@ -241,8 +241,9 @@ if (-not $makensis) { Die "makensis not found on PATH (install NSIS: choco insta
|
|
|
241
241
|
$InnerDir = Join-Path $DistDir "inner"
|
|
242
242
|
New-Item -ItemType Directory -Force -Path $InnerDir | Out-Null
|
|
243
243
|
$out = Join-Path $InnerDir "TrillboardsEdgeSetup-core-$Version-x64.exe"
|
|
244
|
+
$appIcon = (Resolve-Path -LiteralPath (Join-Path $Here "..\branding\SenseAnythingConnector.ico")).Path
|
|
244
245
|
Log "Compiling inner NSIS connector installer…"
|
|
245
|
-
& $makensis "/DPAYLOAD_DIR=$Payload" "/DAPP_VERSION=$Version" "/DOUT_FILE=$out" "$Here\installer.nsi"
|
|
246
|
+
& $makensis "/DPAYLOAD_DIR=$Payload" "/DAPP_VERSION=$Version" "/DAPP_ICON=$appIcon" "/DOUT_FILE=$out" "$Here\installer.nsi"
|
|
246
247
|
if ($LASTEXITCODE -ne 0) { Die "makensis failed (code $LASTEXITCODE)" }
|
|
247
248
|
if (-not (Test-Path $out)) { Die "installer .exe not produced at $out" }
|
|
248
249
|
$sizeMb = [math]::Round((Get-Item $out).Length / 1MB, 1)
|
|
@@ -18,7 +18,8 @@ param(
|
|
|
18
18
|
[string]$ModelUrl = "https://huggingface.co/litert-community/gemma-4-E2B-it-litert-lm/resolve/main/gemma-4-E2B-it.litertlm",
|
|
19
19
|
[string]$ModelSha256 = "181938105e0eefd105961417e8da75903eacda102c4fce9ce90f50b97139a63c",
|
|
20
20
|
[string]$SevenZipSdkUrl = "https://www.7-zip.org/a/lzma2602.7z",
|
|
21
|
-
[string]$SevenZipSdkSha256 = "2878c85f5f43a4a4e0952b1fd4e5fe097c1c143997a8047c7e1e788892aa9357"
|
|
21
|
+
[string]$SevenZipSdkSha256 = "2878c85f5f43a4a4e0952b1fd4e5fe097c1c143997a8047c7e1e788892aa9357",
|
|
22
|
+
[string]$IconPath = ""
|
|
22
23
|
)
|
|
23
24
|
|
|
24
25
|
$ErrorActionPreference = "Stop"
|
|
@@ -27,6 +28,10 @@ $DistDir = Join-Path $Here "dist-installer"
|
|
|
27
28
|
$Scratch = Join-Path $DistDir "bundle-scratch"
|
|
28
29
|
$Stage = Join-Path $Scratch "payload"
|
|
29
30
|
$ModelId = "gemma-4-E2B-it.litertlm"
|
|
31
|
+
if ([string]::IsNullOrWhiteSpace($IconPath)) {
|
|
32
|
+
$IconPath = Join-Path $Here "..\branding\SenseAnythingConnector.ico"
|
|
33
|
+
}
|
|
34
|
+
$IconPath = (Resolve-Path -LiteralPath $IconPath).Path
|
|
30
35
|
|
|
31
36
|
function Log([string]$Message) { Write-Host "[bundle] $Message" -ForegroundColor Blue }
|
|
32
37
|
function Fail([string]$Message) { throw "[bundle] $Message" }
|
|
@@ -79,6 +84,11 @@ if ($LASTEXITCODE -ne 0) { Fail "could not extract the LZMA SDK" }
|
|
|
79
84
|
$sfxModule = Get-ChildItem -LiteralPath $sfxTools -Recurse -File -Filter "7zSD.sfx" | Select-Object -First 1
|
|
80
85
|
if (-not $sfxModule) { Fail "official 7zSD.sfx installer module was not found" }
|
|
81
86
|
|
|
87
|
+
# Brand the executable module before appending the config and archive. This
|
|
88
|
+
# keeps the SFX overlay byte-for-byte intact and the final Authenticode signing
|
|
89
|
+
# step covers both the application icon and the customer payload.
|
|
90
|
+
& (Join-Path $Here "set-executable-icon.ps1") -ExecutablePath $sfxModule.FullName -IconPath $IconPath
|
|
91
|
+
|
|
82
92
|
$innerName = "TrillboardsEdgeSetup-core.exe"
|
|
83
93
|
Copy-Item -LiteralPath $InnerInstaller -Destination (Join-Path $Stage $innerName) -Force
|
|
84
94
|
$sevenZipNotice = @'
|
|
@@ -20,10 +20,15 @@
|
|
|
20
20
|
!ifndef OUT_FILE
|
|
21
21
|
!define OUT_FILE "TrillboardsEdgeSetup.exe"
|
|
22
22
|
!endif
|
|
23
|
+
!ifndef APP_ICON
|
|
24
|
+
!error "APP_ICON not defined (pass /DAPP_ICON=...)"
|
|
25
|
+
!endif
|
|
23
26
|
|
|
24
27
|
!define APP_NAME "Trillboards Edge - CCTV Connector"
|
|
25
28
|
!define TASK_NAME "TrillboardsEdge"
|
|
26
29
|
!define LITERT_TASK_NAME "TrillboardsLiteRtLm"
|
|
30
|
+
!define MUI_ICON "${APP_ICON}"
|
|
31
|
+
!define MUI_UNICON "${APP_ICON}"
|
|
27
32
|
|
|
28
33
|
Var ModelSource
|
|
29
34
|
; -- Unattended (MDM/Intune/SCCM) parameters --------------------------------
|
|
@@ -42,6 +47,8 @@ OutFile "${OUT_FILE}"
|
|
|
42
47
|
Unicode True
|
|
43
48
|
RequestExecutionLevel user ; per-user, no admin/UAC
|
|
44
49
|
InstallDir "$LOCALAPPDATA\Trillboards\edge"
|
|
50
|
+
Icon "${APP_ICON}"
|
|
51
|
+
UninstallIcon "${APP_ICON}"
|
|
45
52
|
SetCompressor /SOLID lzma
|
|
46
53
|
ShowInstDetails show
|
|
47
54
|
BrandingText "Trillboards"
|
|
@@ -176,6 +183,7 @@ Section "Install"
|
|
|
176
183
|
Abort
|
|
177
184
|
${EndIf}
|
|
178
185
|
SetOutPath "$INSTDIR"
|
|
186
|
+
File /oname=SenseAnythingConnector.ico "${APP_ICON}"
|
|
179
187
|
|
|
180
188
|
; The outer signed self-extractor passes its checksum-pinned model here. This
|
|
181
189
|
; is synchronous and required: pairing is never offered while AI is absent or
|
|
@@ -226,7 +234,7 @@ Section "Install"
|
|
|
226
234
|
|
|
227
235
|
; Start Menu shortcuts.
|
|
228
236
|
CreateDirectory "$SMPROGRAMS\Trillboards"
|
|
229
|
-
CreateShortcut "$SMPROGRAMS\Trillboards\Trillboards CCTV Setup.lnk" "$WINDIR\System32\wscript.exe" '$\"$INSTDIR\bin\trillboards-setup.vbs$\"'
|
|
237
|
+
CreateShortcut "$SMPROGRAMS\Trillboards\Trillboards CCTV Setup.lnk" "$WINDIR\System32\wscript.exe" '$\"$INSTDIR\bin\trillboards-setup.vbs$\"' "$INSTDIR\SenseAnythingConnector.ico" 0
|
|
230
238
|
CreateShortcut "$SMPROGRAMS\Trillboards\Uninstall Trillboards Edge.lnk" "$INSTDIR\uninstall.exe"
|
|
231
239
|
|
|
232
240
|
; Uninstaller + Add/Remove Programs entry (per-user hive).
|
|
@@ -235,6 +243,7 @@ Section "Install"
|
|
|
235
243
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TrillboardsEdge" "UninstallString" "$\"$INSTDIR\uninstall.exe$\""
|
|
236
244
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TrillboardsEdge" "DisplayVersion" "${APP_VERSION}"
|
|
237
245
|
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TrillboardsEdge" "Publisher" "Trillboards"
|
|
246
|
+
WriteRegStr HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TrillboardsEdge" "DisplayIcon" "$INSTDIR\SenseAnythingConnector.ico"
|
|
238
247
|
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TrillboardsEdge" "NoModify" 1
|
|
239
248
|
WriteRegDWORD HKCU "Software\Microsoft\Windows\CurrentVersion\Uninstall\TrillboardsEdge" "NoRepair" 1
|
|
240
249
|
SectionEnd
|
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
<#
|
|
2
|
+
.SYNOPSIS
|
|
3
|
+
Replaces every application icon group in a Windows executable.
|
|
4
|
+
|
|
5
|
+
.DESCRIPTION
|
|
6
|
+
The customer installer uses the official 7-Zip SFX module, whose generic
|
|
7
|
+
icon would otherwise become the icon customers see in Explorer. This helper
|
|
8
|
+
updates that module before the installer payload is appended and signed.
|
|
9
|
+
#>
|
|
10
|
+
[CmdletBinding()]
|
|
11
|
+
param(
|
|
12
|
+
[Parameter(Mandatory = $true)][string]$ExecutablePath,
|
|
13
|
+
[Parameter(Mandatory = $true)][string]$IconPath
|
|
14
|
+
)
|
|
15
|
+
|
|
16
|
+
$ErrorActionPreference = "Stop"
|
|
17
|
+
|
|
18
|
+
if ([Environment]::OSVersion.Platform -ne [PlatformID]::Win32NT) {
|
|
19
|
+
throw "set-executable-icon.ps1 must run on Windows"
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
$ExecutablePath = (Resolve-Path -LiteralPath $ExecutablePath).Path
|
|
23
|
+
$IconPath = (Resolve-Path -LiteralPath $IconPath).Path
|
|
24
|
+
|
|
25
|
+
Add-Type -TypeDefinition @'
|
|
26
|
+
using System;
|
|
27
|
+
using System.Collections.Generic;
|
|
28
|
+
using System.ComponentModel;
|
|
29
|
+
using System.IO;
|
|
30
|
+
using System.Runtime.InteropServices;
|
|
31
|
+
|
|
32
|
+
namespace SenseAnything.Build
|
|
33
|
+
{
|
|
34
|
+
public static class ExecutableIcon
|
|
35
|
+
{
|
|
36
|
+
private const uint LoadLibraryAsDataFile = 0x00000002;
|
|
37
|
+
private const int ResourceTypeIcon = 3;
|
|
38
|
+
private const int ResourceTypeGroupIcon = 14;
|
|
39
|
+
private const int ResourceTypeNotFound = 1813;
|
|
40
|
+
private const int ResourceLanguageNotFound = 1815;
|
|
41
|
+
private const ushort DefaultLanguage = 1033;
|
|
42
|
+
private const ushort FirstReplacementIconId = 50000;
|
|
43
|
+
|
|
44
|
+
private sealed class IconImage
|
|
45
|
+
{
|
|
46
|
+
public byte Width;
|
|
47
|
+
public byte Height;
|
|
48
|
+
public byte ColorCount;
|
|
49
|
+
public byte Reserved;
|
|
50
|
+
public ushort Planes;
|
|
51
|
+
public ushort BitCount;
|
|
52
|
+
public byte[] Data;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
private sealed class ResourceGroup
|
|
56
|
+
{
|
|
57
|
+
public bool IsInteger;
|
|
58
|
+
public ushort IntegerName;
|
|
59
|
+
public string StringName;
|
|
60
|
+
public readonly List<ushort> Languages = new List<ushort>();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
private delegate bool EnumResourceNameProc(
|
|
64
|
+
IntPtr module,
|
|
65
|
+
IntPtr type,
|
|
66
|
+
IntPtr name,
|
|
67
|
+
IntPtr parameter);
|
|
68
|
+
|
|
69
|
+
private delegate bool EnumResourceLanguageProc(
|
|
70
|
+
IntPtr module,
|
|
71
|
+
IntPtr type,
|
|
72
|
+
IntPtr name,
|
|
73
|
+
ushort language,
|
|
74
|
+
IntPtr parameter);
|
|
75
|
+
|
|
76
|
+
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
77
|
+
private static extern IntPtr LoadLibraryExW(
|
|
78
|
+
string fileName,
|
|
79
|
+
IntPtr file,
|
|
80
|
+
uint flags);
|
|
81
|
+
|
|
82
|
+
[DllImport("kernel32.dll", SetLastError = true)]
|
|
83
|
+
[return: MarshalAs(UnmanagedType.Bool)]
|
|
84
|
+
private static extern bool FreeLibrary(IntPtr module);
|
|
85
|
+
|
|
86
|
+
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
87
|
+
[return: MarshalAs(UnmanagedType.Bool)]
|
|
88
|
+
private static extern bool EnumResourceNamesW(
|
|
89
|
+
IntPtr module,
|
|
90
|
+
IntPtr type,
|
|
91
|
+
EnumResourceNameProc callback,
|
|
92
|
+
IntPtr parameter);
|
|
93
|
+
|
|
94
|
+
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, EntryPoint = "EnumResourceLanguagesW", SetLastError = true)]
|
|
95
|
+
[return: MarshalAs(UnmanagedType.Bool)]
|
|
96
|
+
private static extern bool EnumResourceLanguagesById(
|
|
97
|
+
IntPtr module,
|
|
98
|
+
IntPtr type,
|
|
99
|
+
IntPtr name,
|
|
100
|
+
EnumResourceLanguageProc callback,
|
|
101
|
+
IntPtr parameter);
|
|
102
|
+
|
|
103
|
+
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, EntryPoint = "EnumResourceLanguagesW", SetLastError = true)]
|
|
104
|
+
[return: MarshalAs(UnmanagedType.Bool)]
|
|
105
|
+
private static extern bool EnumResourceLanguagesByName(
|
|
106
|
+
IntPtr module,
|
|
107
|
+
IntPtr type,
|
|
108
|
+
string name,
|
|
109
|
+
EnumResourceLanguageProc callback,
|
|
110
|
+
IntPtr parameter);
|
|
111
|
+
|
|
112
|
+
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
113
|
+
private static extern IntPtr BeginUpdateResourceW(
|
|
114
|
+
string fileName,
|
|
115
|
+
[MarshalAs(UnmanagedType.Bool)] bool deleteExistingResources);
|
|
116
|
+
|
|
117
|
+
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, EntryPoint = "UpdateResourceW", SetLastError = true)]
|
|
118
|
+
[return: MarshalAs(UnmanagedType.Bool)]
|
|
119
|
+
private static extern bool UpdateResourceById(
|
|
120
|
+
IntPtr update,
|
|
121
|
+
IntPtr type,
|
|
122
|
+
IntPtr name,
|
|
123
|
+
ushort language,
|
|
124
|
+
byte[] data,
|
|
125
|
+
uint dataSize);
|
|
126
|
+
|
|
127
|
+
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, EntryPoint = "UpdateResourceW", SetLastError = true)]
|
|
128
|
+
[return: MarshalAs(UnmanagedType.Bool)]
|
|
129
|
+
private static extern bool UpdateResourceByName(
|
|
130
|
+
IntPtr update,
|
|
131
|
+
IntPtr type,
|
|
132
|
+
string name,
|
|
133
|
+
ushort language,
|
|
134
|
+
byte[] data,
|
|
135
|
+
uint dataSize);
|
|
136
|
+
|
|
137
|
+
[DllImport("kernel32.dll", CharSet = CharSet.Unicode, SetLastError = true)]
|
|
138
|
+
[return: MarshalAs(UnmanagedType.Bool)]
|
|
139
|
+
private static extern bool EndUpdateResourceW(
|
|
140
|
+
IntPtr update,
|
|
141
|
+
[MarshalAs(UnmanagedType.Bool)] bool discard);
|
|
142
|
+
|
|
143
|
+
public static void Replace(string executablePath, string iconPath)
|
|
144
|
+
{
|
|
145
|
+
List<IconImage> images = ReadIcon(iconPath);
|
|
146
|
+
List<ResourceGroup> groups = ReadIconGroups(executablePath);
|
|
147
|
+
if (groups.Count == 0)
|
|
148
|
+
{
|
|
149
|
+
ResourceGroup group = new ResourceGroup();
|
|
150
|
+
group.IsInteger = true;
|
|
151
|
+
group.IntegerName = 101;
|
|
152
|
+
group.Languages.Add(DefaultLanguage);
|
|
153
|
+
groups.Add(group);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
HashSet<ushort> languages = new HashSet<ushort>();
|
|
157
|
+
foreach (ResourceGroup group in groups)
|
|
158
|
+
{
|
|
159
|
+
if (group.Languages.Count == 0)
|
|
160
|
+
group.Languages.Add(DefaultLanguage);
|
|
161
|
+
foreach (ushort language in group.Languages)
|
|
162
|
+
languages.Add(language);
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
IntPtr update = BeginUpdateResourceW(executablePath, false);
|
|
166
|
+
if (update == IntPtr.Zero)
|
|
167
|
+
throw new Win32Exception(Marshal.GetLastWin32Error(), "Could not open the executable resources");
|
|
168
|
+
|
|
169
|
+
bool committed = false;
|
|
170
|
+
try
|
|
171
|
+
{
|
|
172
|
+
foreach (ushort language in languages)
|
|
173
|
+
{
|
|
174
|
+
for (int index = 0; index < images.Count; index++)
|
|
175
|
+
{
|
|
176
|
+
ushort imageId = checked((ushort)(FirstReplacementIconId + index));
|
|
177
|
+
IconImage image = images[index];
|
|
178
|
+
Require(UpdateResourceById(
|
|
179
|
+
update,
|
|
180
|
+
MakeResource(ResourceTypeIcon),
|
|
181
|
+
MakeResource(imageId),
|
|
182
|
+
language,
|
|
183
|
+
image.Data,
|
|
184
|
+
(uint)image.Data.Length),
|
|
185
|
+
"Could not write an icon image resource");
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
byte[] groupData = BuildGroupData(images);
|
|
190
|
+
foreach (ResourceGroup group in groups)
|
|
191
|
+
{
|
|
192
|
+
foreach (ushort language in group.Languages)
|
|
193
|
+
{
|
|
194
|
+
bool result = group.IsInteger
|
|
195
|
+
? UpdateResourceById(
|
|
196
|
+
update,
|
|
197
|
+
MakeResource(ResourceTypeGroupIcon),
|
|
198
|
+
MakeResource(group.IntegerName),
|
|
199
|
+
language,
|
|
200
|
+
groupData,
|
|
201
|
+
(uint)groupData.Length)
|
|
202
|
+
: UpdateResourceByName(
|
|
203
|
+
update,
|
|
204
|
+
MakeResource(ResourceTypeGroupIcon),
|
|
205
|
+
group.StringName,
|
|
206
|
+
language,
|
|
207
|
+
groupData,
|
|
208
|
+
(uint)groupData.Length);
|
|
209
|
+
Require(result, "Could not write an icon group resource");
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
Require(EndUpdateResourceW(update, false), "Could not commit the executable icon");
|
|
214
|
+
committed = true;
|
|
215
|
+
}
|
|
216
|
+
finally
|
|
217
|
+
{
|
|
218
|
+
if (!committed)
|
|
219
|
+
EndUpdateResourceW(update, true);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
private static List<ResourceGroup> ReadIconGroups(string executablePath)
|
|
224
|
+
{
|
|
225
|
+
IntPtr module = LoadLibraryExW(executablePath, IntPtr.Zero, LoadLibraryAsDataFile);
|
|
226
|
+
if (module == IntPtr.Zero)
|
|
227
|
+
throw new Win32Exception(Marshal.GetLastWin32Error(), "Could not read the executable resources");
|
|
228
|
+
|
|
229
|
+
List<ResourceGroup> groups = new List<ResourceGroup>();
|
|
230
|
+
try
|
|
231
|
+
{
|
|
232
|
+
EnumResourceNameProc nameCallback = delegate(IntPtr callbackModule, IntPtr type, IntPtr name, IntPtr parameter)
|
|
233
|
+
{
|
|
234
|
+
ResourceGroup group = new ResourceGroup();
|
|
235
|
+
group.IsInteger = IsIntegerResource(name);
|
|
236
|
+
if (group.IsInteger)
|
|
237
|
+
group.IntegerName = unchecked((ushort)name.ToInt64());
|
|
238
|
+
else
|
|
239
|
+
group.StringName = Marshal.PtrToStringUni(name);
|
|
240
|
+
|
|
241
|
+
EnumResourceLanguageProc languageCallback = delegate(IntPtr languageModule, IntPtr languageType, IntPtr languageName, ushort language, IntPtr languageParameter)
|
|
242
|
+
{
|
|
243
|
+
group.Languages.Add(language);
|
|
244
|
+
return true;
|
|
245
|
+
};
|
|
246
|
+
|
|
247
|
+
bool languageResult = group.IsInteger
|
|
248
|
+
? EnumResourceLanguagesById(callbackModule, type, MakeResource(group.IntegerName), languageCallback, IntPtr.Zero)
|
|
249
|
+
: EnumResourceLanguagesByName(callbackModule, type, group.StringName, languageCallback, IntPtr.Zero);
|
|
250
|
+
int languageError = Marshal.GetLastWin32Error();
|
|
251
|
+
if (!languageResult && languageError != ResourceLanguageNotFound)
|
|
252
|
+
throw new Win32Exception(languageError, "Could not enumerate icon resource languages");
|
|
253
|
+
|
|
254
|
+
groups.Add(group);
|
|
255
|
+
return true;
|
|
256
|
+
};
|
|
257
|
+
|
|
258
|
+
bool result = EnumResourceNamesW(
|
|
259
|
+
module,
|
|
260
|
+
MakeResource(ResourceTypeGroupIcon),
|
|
261
|
+
nameCallback,
|
|
262
|
+
IntPtr.Zero);
|
|
263
|
+
int error = Marshal.GetLastWin32Error();
|
|
264
|
+
if (!result && error != ResourceTypeNotFound)
|
|
265
|
+
throw new Win32Exception(error, "Could not enumerate executable icon groups");
|
|
266
|
+
}
|
|
267
|
+
finally
|
|
268
|
+
{
|
|
269
|
+
FreeLibrary(module);
|
|
270
|
+
}
|
|
271
|
+
return groups;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
private static List<IconImage> ReadIcon(string iconPath)
|
|
275
|
+
{
|
|
276
|
+
using (FileStream stream = File.OpenRead(iconPath))
|
|
277
|
+
using (BinaryReader reader = new BinaryReader(stream))
|
|
278
|
+
{
|
|
279
|
+
ushort reserved = reader.ReadUInt16();
|
|
280
|
+
ushort type = reader.ReadUInt16();
|
|
281
|
+
ushort count = reader.ReadUInt16();
|
|
282
|
+
if (reserved != 0 || type != 1 || count == 0)
|
|
283
|
+
throw new InvalidDataException("The application icon is not a valid ICO file");
|
|
284
|
+
|
|
285
|
+
List<IconImage> images = new List<IconImage>();
|
|
286
|
+
for (int index = 0; index < count; index++)
|
|
287
|
+
{
|
|
288
|
+
IconImage image = new IconImage();
|
|
289
|
+
image.Width = reader.ReadByte();
|
|
290
|
+
image.Height = reader.ReadByte();
|
|
291
|
+
image.ColorCount = reader.ReadByte();
|
|
292
|
+
image.Reserved = reader.ReadByte();
|
|
293
|
+
image.Planes = reader.ReadUInt16();
|
|
294
|
+
image.BitCount = reader.ReadUInt16();
|
|
295
|
+
uint byteCount = reader.ReadUInt32();
|
|
296
|
+
uint offset = reader.ReadUInt32();
|
|
297
|
+
|
|
298
|
+
long returnPosition = stream.Position;
|
|
299
|
+
if ((long)offset + byteCount > stream.Length)
|
|
300
|
+
throw new InvalidDataException("An ICO image points outside the file");
|
|
301
|
+
stream.Position = offset;
|
|
302
|
+
image.Data = reader.ReadBytes(checked((int)byteCount));
|
|
303
|
+
stream.Position = returnPosition;
|
|
304
|
+
images.Add(image);
|
|
305
|
+
}
|
|
306
|
+
return images;
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
private static byte[] BuildGroupData(List<IconImage> images)
|
|
311
|
+
{
|
|
312
|
+
using (MemoryStream stream = new MemoryStream())
|
|
313
|
+
using (BinaryWriter writer = new BinaryWriter(stream))
|
|
314
|
+
{
|
|
315
|
+
writer.Write((ushort)0);
|
|
316
|
+
writer.Write((ushort)1);
|
|
317
|
+
writer.Write(checked((ushort)images.Count));
|
|
318
|
+
for (int index = 0; index < images.Count; index++)
|
|
319
|
+
{
|
|
320
|
+
IconImage image = images[index];
|
|
321
|
+
writer.Write(image.Width);
|
|
322
|
+
writer.Write(image.Height);
|
|
323
|
+
writer.Write(image.ColorCount);
|
|
324
|
+
writer.Write(image.Reserved);
|
|
325
|
+
writer.Write(image.Planes);
|
|
326
|
+
writer.Write(image.BitCount);
|
|
327
|
+
writer.Write((uint)image.Data.Length);
|
|
328
|
+
writer.Write(checked((ushort)(FirstReplacementIconId + index)));
|
|
329
|
+
}
|
|
330
|
+
return stream.ToArray();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
private static bool IsIntegerResource(IntPtr value)
|
|
335
|
+
{
|
|
336
|
+
return (value.ToInt64() >> 16) == 0;
|
|
337
|
+
}
|
|
338
|
+
|
|
339
|
+
private static IntPtr MakeResource(int value)
|
|
340
|
+
{
|
|
341
|
+
return new IntPtr(value & 0xffff);
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
private static void Require(bool result, string message)
|
|
345
|
+
{
|
|
346
|
+
if (!result)
|
|
347
|
+
throw new Win32Exception(Marshal.GetLastWin32Error(), message);
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
'@
|
|
352
|
+
|
|
353
|
+
[SenseAnything.Build.ExecutableIcon]::Replace($ExecutablePath, $IconPath)
|
|
354
|
+
Write-Host "[icon] applied Sense Anything icon to $ExecutablePath" -ForegroundColor Green
|
package/dist/EdgeAgent.js
CHANGED
|
@@ -44,7 +44,7 @@ const edge_ads_1 = require("@trillboards/edge-ads");
|
|
|
44
44
|
const CommandRouter_1 = require("./CommandRouter");
|
|
45
45
|
const config_1 = require("./config");
|
|
46
46
|
const dataDir_1 = require("./dataDir");
|
|
47
|
-
const SDK_VERSION = '0.2.
|
|
47
|
+
const SDK_VERSION = '0.2.58';
|
|
48
48
|
class EdgeAgent extends events_1.EventEmitter {
|
|
49
49
|
constructor(config, deps) {
|
|
50
50
|
super();
|
package/dist/diagnose.d.ts
CHANGED
|
@@ -31,7 +31,7 @@ export interface DiagnosticReport {
|
|
|
31
31
|
skipped: number;
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
declare const SDK_VERSION = "0.2.
|
|
34
|
+
declare const SDK_VERSION = "0.2.58";
|
|
35
35
|
declare function checkNodeVersion(): CheckResult;
|
|
36
36
|
declare function checkPlatform(): CheckResult;
|
|
37
37
|
declare function checkMemory(): CheckResult;
|
package/dist/diagnose.js
CHANGED
|
@@ -63,7 +63,7 @@ const localNetworkAccess_1 = require("./localNetworkAccess");
|
|
|
63
63
|
// ---------------------------------------------------------------------------
|
|
64
64
|
// SDK version — mirrors package.json; kept in sync by CI
|
|
65
65
|
// ---------------------------------------------------------------------------
|
|
66
|
-
const SDK_VERSION = '0.2.
|
|
66
|
+
const SDK_VERSION = '0.2.58';
|
|
67
67
|
exports._SDK_VERSION = SDK_VERSION;
|
|
68
68
|
// ---------------------------------------------------------------------------
|
|
69
69
|
// ANSI helpers (no external deps)
|