-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGenerateIntegerLocalizationKey.ps1
More file actions
76 lines (47 loc) · 1.5 KB
/
Copy pathGenerateIntegerLocalizationKey.ps1
File metadata and controls
76 lines (47 loc) · 1.5 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
<#PSScriptInfo
.VERSION 1.1.1
.GUID 837753cd-b9c6-4c7e-a5aa-49cb20972b57
.AUTHOR Tigran TIKSN Torosyan
.COMPANYNAME
.COPYRIGHT Copyright © Tigran TIKSN Torosyan
.TAGS
.LICENSEURI
.PROJECTURI
.ICONURI
.EXTERNALMODULEDEPENDENCIES
.REQUIREDSCRIPTS
.EXTERNALSCRIPTDEPENDENCIES
.RELEASENOTES
.PRIVATEDATA
#>
#Requires -Module PSFramework
<#
.DESCRIPTION
Generates an integer localization key.
#>
[CmdletBinding()]
param(
[switch]$CopyToClipboard
)
$epochStarts = Get-Date -Year 2024 -Month 1 -Day 1 -Hour 0 -Minute 0 -Second 0 -Millisecond 0
$epochStartsString = $epochStarts | Get-Date -Format 'u'
Write-PSFMessage -Level Verbose -Message "Epoch starts $epochStartsString"
$minimum = 100000000
$maximum = 1000000000
$epochEnds = $epochStarts + [System.TimeSpan]::FromSeconds($maximum - $minimum)
$epochEndsString = $epochEnds | Get-Date -Format 'u'
Write-PSFMessage -Level Verbose -Message "Epoch ends $epochEndsString"
$instantNow = Get-Date
$instantNowString = $instantNow | Get-Date -Format 'u'
Write-PSFMessage -Level Verbose -Message "Now is $instantNowString"
$passed = $instantNow - $epochStarts
$passedTotalSeconds = [int]$passed.TotalSeconds
Write-PSFMessage -Level Verbose -Message "Total $passedTotalSeconds Seconds passed"
$key = $minimum + $passedTotalSeconds
Write-PSFMessage -Level Verbose -Message "Generated key is $key"
if ($CopyToClipboard) {
$key | Set-Clipboard
Write-PSFMessage -Level Important -Message "Copied $key to Clipboard"
}
Write-Output $key
Start-Sleep -Seconds 1