-
Notifications
You must be signed in to change notification settings - Fork 0
/
Config.ps1
69 lines (63 loc) · 2.46 KB
/
Config.ps1
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
function global:DownloadDS4Windows()
{
start "https://ryochan7.github.io/ds4windows-site/"
}
function global:DownloadDS4WindowsCMD()
{
start "https://github.com/mika-n/DS4WindowsCmd"
}
function global:ConfigurePaths()
{
$DS4CMDExecutablePath = $PlayniteApi.Dialogs.SelectFile("DS4WindowsCMD|DS4WindowsCMD.exe")
if (!$DS4CMDExecutablePath)
{
exit
}
$PlayniteApi.Dialogs.ShowMessage($DS4CMDExecutablePath)
@{DS4CMDLocation = $DS4CMDExecutablePath} | ConvertTo-Json | Out-File "$CurrentExtensionDataPath\config.json"
}
function global:UpdateCheck()
{
<#$releasesUrl = "https://api.github.com/repos/turtleship69/DS4WindowsWrapper/releases"
$releaseResponse = Invoke-RestMethod -Uri $releasesUrl
$releaseResponsejson = $releaseResponse | ConvertTo-Json
$releaseResponsejson.tag_name
if ($releaseResponse.tag_name -gt [version]'0.1.1')
{
$PlayniteApi.Dialogs.ShowMessage("New version " + $releaseResponse.tag_name + " available!")
start "https://github.com/turtleship69/DS4WindowsWrapper/releases"
}
else
{
$PlayniteApi.Dialogs.ShowMessage("You're on the lastest version!")
}#>
try {
$releasesUrl = "https://api.github.com/repos/turtleship69/DS4WindowsWrapper/releases"
$releaseResponse = Invoke-RestMethod -Uri $releasesUrl
$releaseResponsejson = $releaseResponse | ConvertTo-Json
$releaseResponsejson.tag_name
if ($releaseResponse.tag_name -gt [version]'1.0.1')
{
$PlayniteApi.Dialogs.ShowMessage("New version " + $releaseResponse.tag_name + " available!")
start "https://github.com/turtleship69/DS4WindowsWrapper/releases"
}
else
{
$PlayniteApi.Dialogs.ShowMessage("You're on the lastest version!")
}
} catch {
$errorMessage = $_.Exception.Message
$PlayniteApi.Dialogs.ShowMessage("Error during update check. Error: {0}" -f $errorMessage)
$__logger.Error("DS4Windows| $errorMessage")
}
}
function global:debug()
{
$config = Get-Content "$CurrentExtensionDataPath\config.json"| ConvertFrom-Json
$DS4CMDExecutablePath = ($config.DS4CMDLocation -split '=')[-1]
$PlayniteApi.Dialogs.ShowMessage($DS4CMDExecutablePath)
$DS4ExecutablePath = $config.DS4CMDLocation -replace 'cmd',''
$PlayniteApi.Dialogs.ShowMessage($DS4ExecutablePath)
$directory = & pwd
$PlayniteApi.Dialogs.ShowMessage($directory)
}