Update main.ps1
This commit is contained in:
@@ -168,10 +168,11 @@ else{
|
||||
}
|
||||
|
||||
function EnumNotepad{
|
||||
$appDataDir = [Environment]::GetFolderPath('LocalApplicationData')
|
||||
$directoryRelative = "Packages\Microsoft.WindowsNotepad_*\LocalState\TabState"
|
||||
$matchingDirectories = Get-ChildItem -Path (Join-Path -Path $appDataDir -ChildPath 'Packages') -Filter 'Microsoft.WindowsNotepad_*' -Directory
|
||||
foreach ($dir in $matchingDirectories) {
|
||||
|
||||
$appDataDir = [Environment]::GetFolderPath('LocalApplicationData')
|
||||
$directoryRelative = "Packages\Microsoft.WindowsNotepad_*\LocalState\TabState"
|
||||
$matchingDirectories = Get-ChildItem -Path (Join-Path -Path $appDataDir -ChildPath 'Packages') -Filter 'Microsoft.WindowsNotepad_*' -Directory
|
||||
foreach ($dir in $matchingDirectories) {
|
||||
$fullPath = Join-Path -Path $dir.FullName -ChildPath 'LocalState\TabState'
|
||||
$listOfBinFiles = Get-ChildItem -Path $fullPath -Filter *.bin
|
||||
foreach ($fullFilePath in $listOfBinFiles) {
|
||||
@@ -192,23 +193,28 @@ function EnumNotepad{
|
||||
$filename | Out-File -FilePath $outpath -Append
|
||||
$SMseperator | Out-File -FilePath $outpath -Append
|
||||
Get-Content -Path $originalFilename -Raw | Out-File -FilePath $outpath -Append
|
||||
|
||||
} else {
|
||||
"Found an unsaved tab!" | Out-File -FilePath $outpath -Append
|
||||
$filename | Out-File -FilePath $outpath -Append
|
||||
$SMseperator | Out-File -FilePath $outpath -Append
|
||||
$filenameEnding = 0
|
||||
$delimeterStart = [array]::IndexOf($contents, 0, $filenameEnding)
|
||||
$delimeterEnd = [array]::IndexOf($contents, 1, $filenameEnding)
|
||||
|
||||
$delimeterEnd = [array]::IndexOf($contents, 3, $filenameEnding)
|
||||
$fileMarker = $contents[($delimeterStart + 2)..($delimeterEnd - 1)]
|
||||
$fileMarker = -join ($fileMarker | ForEach-Object { [char]$_ })
|
||||
|
||||
$originalFileContents = [System.Text.Encoding]::Unicode.GetString($contents[($delimeterEnd + 4 + $fileMarker.Length)..($contents.Length - 6)])
|
||||
$originalFileContents | Out-File -FilePath $outpath -Append
|
||||
$originalFileBytes = $contents[($delimeterEnd + 9 + $fileMarker.Length)..($contents.Length - 6)]
|
||||
$originalFileContent = ""
|
||||
for ($i = 0; $i -lt $originalFileBytes.Length; $i++) {
|
||||
if ($originalFileBytes[$i] -ne 0) {
|
||||
$originalFileContent += [char]$originalFileBytes[$i]
|
||||
}
|
||||
}
|
||||
$originalFileContent | Out-File -FilePath $outpath -Append
|
||||
}
|
||||
"`n" | Out-File -FilePath $outpath -Append
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$contents = "
|
||||
|
||||
Reference in New Issue
Block a user