#Requires -Version 5.1 <# .SYNOPSIS Shows a WPF notification popup for the OBS Replay Buffer tool. Must be launched via Start-Process with powershell.exe -STA. .PARAMETER Type 'BufferStarted' — shown at logon when the replay buffer is active. 'ReplaySaved' — shown after a successful replay save. #> param( [Parameter(Mandatory)] [ValidateSet('BufferStarted', 'ReplaySaved')] [string]$Type, [string]$ContactNumber = '', [int]$BufferMinutes = 0, [string]$FileName = '', [double]$FileSizeMB = 0 ) $ErrorActionPreference = 'Stop' Add-Type -AssemblyName PresentationFramework Add-Type -AssemblyName WindowsBase Add-Type -AssemblyName System.Drawing Add-Type -TypeDefinition @" using System; using System.Runtime.InteropServices; public class GdiHelper { [DllImport("gdi32.dll")] public static extern bool DeleteObject(IntPtr hObject); } "@ $hBitmap = [System.Drawing.SystemIcons]::Shield.ToBitmap().GetHbitmap() $wpfShield = [System.Windows.Interop.Imaging]::CreateBitmapSourceFromHBitmap( $hBitmap, [IntPtr]::Zero, [System.Windows.Int32Rect]::Empty, [System.Windows.Media.Imaging.BitmapSizeOptions]::FromEmptyOptions() ) [GdiHelper]::DeleteObject($hBitmap) | Out-Null $hBitmap = [System.Drawing.SystemIcons]::Warning.ToBitmap().GetHbitmap() $wpfWarning = [System.Windows.Interop.Imaging]::CreateBitmapSourceFromHBitmap( $hBitmap, [IntPtr]::Zero, [System.Windows.Int32Rect]::Empty, [System.Windows.Media.Imaging.BitmapSizeOptions]::FromEmptyOptions() ) [GdiHelper]::DeleteObject($hBitmap) | Out-Null if ($Type -eq 'BufferStarted') { [xml]$xaml = @"