Created
March 24, 2023 13:34
-
-
Save hounsell/6ac3948d4a54d77d22a9b47e54ed2414 to your computer and use it in GitHub Desktop.
Extract MemoryStream resources from a resx file (common in certain Longhorn-era components)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
param([String] $resx_filename) | |
Add-Type -AssemblyName System.Windows.Forms | |
$resx = New-Object -TypeName 'System.Resources.ResXResourceSet' -ArgumentList $resx_filename | |
$root_path = [System.IO.Path]::GetDirectoryName($resx_filename); | |
foreach($item in $resx) | |
{ | |
if ($item.Value.GetType() -Eq [System.IO.MemoryStream]) | |
{ | |
$out_path = [System.IO.Path]::Combine($root_path, $item.Name); | |
[System.IO.File]::WriteAllBytes($out_path, $item.Value.ToArray()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment