Removed the DEM file system dependency
This commit is contained in:
@@ -12,6 +12,22 @@
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
function Show-Notification {
|
||||
param([string]$Title, [string]$Body)
|
||||
try {
|
||||
[Windows.UI.Notifications.ToastNotificationManager, Windows.UI.Notifications, ContentType = WindowsRuntime] | Out-Null
|
||||
[Windows.Data.Xml.Dom.XmlDocument, Windows.Data.Xml.Dom.XmlDocument, ContentType = WindowsRuntime] | Out-Null
|
||||
$xml = [Windows.Data.Xml.Dom.XmlDocument]::new()
|
||||
$escaped = [System.Security.SecurityElement]::Escape($Body)
|
||||
$xml.LoadXml("<toast><visual><binding template='ToastGeneric'><text>$Title</text><text>$escaped</text></binding></visual></toast>")
|
||||
$toast = [Windows.UI.Notifications.ToastNotification]::new($xml)
|
||||
[Windows.UI.Notifications.ToastNotificationManager]::CreateToastNotifier('IT Screen Recorder').Show($toast)
|
||||
}
|
||||
catch {
|
||||
[System.Windows.Forms.MessageBox]::Show($Body, $Title, [System.Windows.Forms.MessageBoxButtons]::OK) | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
$saveScript = Join-Path $PSScriptRoot 'Invoke-ReplaySave.ps1'
|
||||
|
||||
# --- Tray icon ---
|
||||
@@ -33,10 +49,10 @@ $saveItem.Add_Click({
|
||||
$result = & powershell.exe -ExecutionPolicy Bypass -NonInteractive -File $saveScript
|
||||
|
||||
if ($result -eq $true) {
|
||||
$tray.ShowBalloonTip(4000, 'IT Screen Recorder', 'Replay saved.', [System.Windows.Forms.ToolTipIcon]::Info)
|
||||
Show-Notification -Title 'IT Screen Recorder' -Body 'Replay saved.'
|
||||
}
|
||||
else {
|
||||
$tray.ShowBalloonTip(4000, 'IT Screen Recorder', 'Could not save replay. Please contact the helpdesk.', [System.Windows.Forms.ToolTipIcon]::Error)
|
||||
Show-Notification -Title 'IT Screen Recorder' -Body 'Could not save replay. Please contact the helpdesk.'
|
||||
}
|
||||
|
||||
$saveItem.Text = 'Save Replay'
|
||||
|
||||
@@ -15,6 +15,19 @@ $ErrorActionPreference = 'Stop'
|
||||
$configPath = Join-Path $PSScriptRoot '..\config.psd1'
|
||||
$config = Import-PowerShellDataFile -Path $configPath
|
||||
|
||||
# --- Verify required project files are accessible ---
|
||||
$requiredPaths = @(
|
||||
(Join-Path $PSScriptRoot '..\obs-config\global.ini')
|
||||
(Join-Path $PSScriptRoot '..\obs-config\plugin_config\obs-websocket\config.json')
|
||||
(Join-Path $PSScriptRoot 'Show-ReplayTray.ps1')
|
||||
$config.OBSExecutable
|
||||
)
|
||||
foreach ($path in $requiredPaths) {
|
||||
if (-not (Test-Path -Path $path)) {
|
||||
exit 1
|
||||
}
|
||||
}
|
||||
|
||||
# --- Skip if OBS is already running (handles reconnect scenarios) ---
|
||||
if (Get-Process -Name 'obs64' -ErrorAction SilentlyContinue) {
|
||||
exit 0
|
||||
@@ -32,6 +45,16 @@ $screen = [System.Windows.Forms.Screen]::PrimaryScreen
|
||||
$width = $screen.Bounds.Width
|
||||
$height = $screen.Bounds.Height
|
||||
|
||||
# --- Deploy global OBS config and WebSocket plugin config ---
|
||||
$obsConfigRoot = "$env:APPDATA\obs-studio"
|
||||
$sourceConfig = Join-Path $PSScriptRoot '..\obs-config'
|
||||
|
||||
Copy-Item -Path "$sourceConfig\global.ini" -Destination "$obsConfigRoot\global.ini" -Force
|
||||
|
||||
$wsConfigDir = "$obsConfigRoot\plugin_config\obs-websocket"
|
||||
New-Item -ItemType Directory -Path $wsConfigDir -Force | Out-Null
|
||||
Copy-Item -Path "$sourceConfig\plugin_config\obs-websocket\config.json" -Destination "$wsConfigDir\config.json" -Force
|
||||
|
||||
# --- Write OBS profile (basic.ini) ---
|
||||
$profileDir = "$env:APPDATA\obs-studio\basic\profiles\$($config.ProfileName)"
|
||||
New-Item -ItemType Directory -Path $profileDir -Force | Out-Null
|
||||
@@ -70,8 +93,10 @@ $obsArgs = @(
|
||||
'--minimize-to-tray'
|
||||
'--startreplaybuffer'
|
||||
'--disable-updater'
|
||||
"--profile `"$($config.ProfileName)`""
|
||||
"--collection `"$($config.SceneCollection)`""
|
||||
'--profile'
|
||||
$config.ProfileName
|
||||
'--collection'
|
||||
$config.SceneCollection
|
||||
)
|
||||
|
||||
Start-Process -FilePath $config.OBSExecutable -ArgumentList $obsArgs -WindowStyle Hidden
|
||||
|
||||
Reference in New Issue
Block a user