Add-Type -AssemblyName PresentationFramework, PresentationCore, WindowsBase, System.Windows.Forms if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) { Write-Output "Depth needs to be run as Administrator. Attempting to relaunch." $script = if ($PSCommandPath) { "& { & `'$($PSCommandPath)`' $($argList -join ' ') }" } else { "&([ScriptBlock]::Create((irm https://depth.narwal.llc))) $($argList -join ' ')" } $powershellCmd = "powershell" $processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { "$powershellCmd" } if ($processCmd -eq "wt.exe") { Start-Process $processCmd -ArgumentList "$powershellCmd -ExecutionPolicy Bypass -NoProfile -Command `"$script`"" -Verb RunAs } else { Start-Process $processCmd -ArgumentList "-ExecutionPolicy Bypass -NoProfile -Command `"$script`"" -Verb RunAs } break } # --- THE CLEANING FUNCTION --- # This makes it easy to load any XAML from Visual Studio function Load-VisualStudioXaml { param([string]$RawXaml) $Cleaned = $RawXaml -replace 'mc:Ignorable="d"','' ` -replace "x:Class.*?[^\x20]*",' ' ` -replace "xmlns:local.*?[^\x20]*",' ' ` -replace '\s+d:[a-zA-Z]+=".*?"',' ' ` -replace 'd:ItemsSource=".*?"',' ' ` -replace 'd:SampleData=".*?"',' ' ` -replace 'd:DesignHeight=".*?"',' ' ` -replace 'd:DesignWidth=".*?"',' ' ` -replace '�','©' [xml]$xml = $Cleaned $reader = New-Object System.Xml.XmlNodeReader $xml return [Windows.Markup.XamlReader]::Load($reader) } # --- SPLASH XAML --- $splashXML = @" "@ # --- MAIN XAML --- $mainXML = @"