-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Microwin] dedicated Function folder (#2888)
* move Microwin related stuff to own Folder under "Functions" * update runspace function gathering logic * update Recall logic (from main repo) * change to easier naming scheme - rename files - rename function names * remove unneeded comment (after @CodingWonders's suggestion)
- Loading branch information
1 parent
ce1ef2a
commit e0889d5
Showing
19 changed files
with
858 additions
and
879 deletions.
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
class ErroredPackage { | ||
[string]$PackageName | ||
[string]$ErrorMessage | ||
ErroredPackage() { $this.Init(@{} )} | ||
# Constructor for packages that have errored out | ||
ErroredPackage([string]$pkgName, [string]$reason) { | ||
$this.PackageName = $pkgName | ||
$this.ErrorMessage = $reason | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function Microwin-CopyToUSB([string]$fileToCopy) { | ||
foreach ($volume in Get-Volume) { | ||
if ($volume -and $volume.FileSystemLabel -ieq "ventoy") { | ||
$destinationPath = "$($volume.DriveLetter):\" | ||
#Copy-Item -Path $fileToCopy -Destination $destinationPath -Force | ||
# Get the total size of the file | ||
$totalSize = (Get-Item "$fileToCopy").length | ||
|
||
Copy-Item -Path "$fileToCopy" -Destination "$destinationPath" -Verbose -Force -Recurse -Container -PassThru | | ||
ForEach-Object { | ||
# Calculate the percentage completed | ||
$completed = ($_.BytesTransferred / $totalSize) * 100 | ||
|
||
# Display the progress bar | ||
Write-Progress -Activity "Copying File" -Status "Progress" -PercentComplete $completed -CurrentOperation ("{0:N2} MB / {1:N2} MB" -f ($_.BytesTransferred / 1MB), ($totalSize / 1MB)) | ||
} | ||
|
||
Write-Host "File copied to Ventoy drive $($volume.DriveLetter)" | ||
return | ||
} | ||
} | ||
Write-Host "Ventoy USB Key is not inserted" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
function Microwin-GetLangFromCulture { | ||
|
||
param ( | ||
[Parameter(Mandatory, Position = 0)] [string]$langName | ||
) | ||
|
||
switch -Wildcard ($langName) | ||
{ | ||
"ar*" { return "Arabic" } | ||
"pt-BR" { return "Brazilian Portuguese" } | ||
"bg*" { return "Bulgarian" } | ||
{($_ -eq "zh-CH") -or ($_ -like "zh-Hans*") -or ($_ -eq "zh-SG") -or ($_ -eq "zh-CHS")} { return "Chinese (Simplified)" } | ||
{($_ -eq "zh") -or ($_ -eq "zh-Hant") -or ($_ -eq "zh-HK") -or ($_ -eq "zh-MO") -or ($_ -eq "zh-TW") -or ($_ -eq "zh-CHT")} { return "Chinese (Traditional)" } | ||
"hr*" { return "Croatian" } | ||
"cs*" { return "Czech" } | ||
"da*" { return "Danish" } | ||
"nl*" { return "Dutch" } | ||
"en-US" { return "English" } | ||
{($_ -like "en*") -and ($_ -ne "en-US")} { return "English International" } | ||
"et*" { return "Estonian" } | ||
"fi*" { return "Finnish" } | ||
{($_ -like "fr*") -and ($_ -ne "fr-CA")} { return "French" } | ||
"fr-CA" { return "French Canadian" } | ||
"de*" { return "German" } | ||
"el*" { return "Greek" } | ||
"he*" { return "Hebrew" } | ||
"hu*" { return "Hungarian" } | ||
"it*" { return "Italian" } | ||
"ja*" { return "Japanese" } | ||
"ko*" { return "Korean" } | ||
"lv*" { return "Latvian" } | ||
"lt*" { return "Lituanian" } | ||
"nb*" { return "Norwegian" } | ||
"pl*" { return "Polish" } | ||
{($_ -like "pt*") -and ($_ -ne "pt-BR")} { return "Portuguese" } | ||
"ro*" { return "Romanian" } | ||
"ru*" { return "Russian" } | ||
"sr-Latn*" { return "Serbian Latin" } | ||
"sk*" { return "Slovak" } | ||
"sl*" { return "Slovenian" } | ||
{($_ -like "es*") -and ($_ -ne "es-MX")} { return "Spanish" } | ||
"es-MX" { return "Spanish (Mexico)" } | ||
"sv*" { return "Swedish" } | ||
"th*" { return "Thai" } | ||
"tr*" { return "Turkish" } | ||
"uk*" { return "Ukrainian" } | ||
default { return "English" } | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
function Microwin-GetLocalizedUsers | ||
{ | ||
<# | ||
.SYNOPSIS | ||
Gets a localized user group representation for ICACLS commands (Port from DISMTools PE Helper) | ||
.PARAMETER admins | ||
Determines whether to get a localized user group representation for the Administrators user group | ||
.OUTPUTS | ||
A string containing the localized user group | ||
.EXAMPLE | ||
Microwin-GetLocalizedUsers -admins $true | ||
#> | ||
param ( | ||
[Parameter(Mandatory = $true, Position = 0)] [bool]$admins | ||
) | ||
if ($admins) { | ||
return (Get-LocalGroup | Where-Object { $_.SID.Value -like "S-1-5-32-544" }).Name | ||
} else { | ||
return (Get-LocalGroup | Where-Object { $_.SID.Value -like "S-1-5-32-545" }).Name | ||
} | ||
} |
4 changes: 2 additions & 2 deletions
4
functions/private/Get-Oscdimg.ps1 → functions/microwin/Microwin-GetOscdimg.ps1
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
Oops, something went wrong.