-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathWingetTools.psm1
58 lines (45 loc) · 1.35 KB
/
WingetTools.psm1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#region define a class
Class wgBase {
[string]$Name
[string]$ID
[string]$Version
[string]$Source = "winget"
[string]$Computername = $env:COMPUTERNAME
}
Class wgPackage:wgBase {
[string]$Moniker
[string]$Description
[string]$Author
[string]$Publisher
[string]$PublisherUrl
[string]$PublisherSupportUrl
[string]$Homepage
}
Class wgInstalled:wgPackage {
[string]$InstalledVersion
}
class wgUpgrade:wgBase {
[string]$Available
[string]$Source = "winget"
wgUpgrade($Name, $ID, $version, $available) {
$this.name = $Name
$this.ID = $ID
$this.version = $version
$this.available = $available
}
}
Update-TypeData -TypeName wgInstalled -MemberType AliasProperty -MemberName OnlineVersion -Value Version -force
#region Main
Get-ChildItem -Path $PSScriptroot\functions\*.ps1 |
ForEach-Object { . $_.Fullname }
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
#endregion
#load localized data
Try {
Import-LocalizedData -BindingVariable localized -FileName localized.psd1 -ErrorAction Stop
# write-host "Imported localized data for $(Get-Culture)" -ForegroundColor green
# $localized | out-string | write-host -ForegroundColor green
}
Catch {
Import-LocalizedData -BindingVariable localized -FileName localized.psd1 -UICulture en-US
}