-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'early-unstable' into early
- Loading branch information
Showing
5 changed files
with
162 additions
and
86 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,84 +1,137 @@ | ||
function cloud_sync_download_test($emuName){ | ||
if ((Test-Path "$cloud_sync_bin") -and ($cloud_sync_status -eq $true)) { | ||
|
||
$target = "$emulationPath\saves\$emuName\" | ||
if ( Test-Path "$target" ){ | ||
"test" | Set-Content "$target\.temp" -ErrorAction SilentlyContinue -Encoding UTF8 | ||
$fileHash = "$target\.temp" | ||
|
||
|
||
& $cloud_sync_bin -q --log-file "$userFolder/EmuDeck/logs/rclone.log" copyto --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 "$cloud_sync_provider`:Emudeck\saves\$emuName\.temp" "$fileHash" | ||
if ($?) { | ||
echo "<tr><td>$elemento download Status: </td><td class='alert--success'><strong>Success</strong></td></tr>" | ||
}else{ | ||
echo "<tr><td>$elemento download Status: </td><td class='alert--danger'><strong>Failure</strong></td></tr>" | ||
rm -fo -r "$target\.temp" -ErrorAction SilentlyContinue | ||
exit | ||
} | ||
rm -fo -r "$target\.temp" -ErrorAction SilentlyContinue | ||
} | ||
function cloudSyncHealth(){ | ||
|
||
} | ||
} | ||
Write-Host "<div class='is-hidden'>" | ||
$watcherStatus=1 | ||
$upload=1 | ||
$download=1 | ||
|
||
function cloud_sync_upload_test($emuNAme){ | ||
if ((Test-Path "$cloud_sync_bin") -and ($cloud_sync_status -eq $true)) { | ||
$result = yesNoDialog -TitleText "CloudSync Health" -MessageText "Do you use EmulationStation to launch your games?" -OKButtonText "Yes" -CancelButtonText "No" | ||
|
||
$target = "$emulationPath\saves\$emuName\" | ||
if ( Test-Path "$target" ){ | ||
"test" | Set-Content "$target\.temp" -ErrorAction SilentlyContinue -Encoding UTF8 | ||
$fileHash = "$target\.temp" | ||
if ($result -eq "OKButton") { | ||
#Launching ESDE | ||
Start-Process powershell.exe -ArgumentList "-ExecutionPolicy Bypass -File `"$toolsPath/launchers/esde/EmulationStationDE.ps1`" " | ||
|
||
& $cloud_sync_bin -q --log-file "$userFolder/EmuDeck/logs/rclone.log" copyto --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 "$fileHash" "$cloud_sync_provider`:Emudeck\saves\$emuName\.temp" | ||
if ($?) { | ||
echo "<tr><td>$elemento upload Status: </td><td class='alert--success'><strong>Success</strong></td></tr>" | ||
}else{ | ||
echo "<tr><td>$elemento upload Status: </td><td class='alert--danger'><strong>Failure</strong></td></tr>" | ||
rm -fo -r "$target\.temp" -ErrorAction SilentlyContinue | ||
exit | ||
} | ||
rm -fo -r "$target\.temp" -ErrorAction SilentlyContinue | ||
} | ||
} else { | ||
$kill = "RETROARCH" | ||
Start-Process powershell.exe -ArgumentList "-ExecutionPolicy Bypass -File `"$toolsPath/launchers/retroarch.ps1`" " | ||
|
||
} | ||
|
||
if ($kill -eq "RETROARCH") { | ||
while (-not (Get-Process -Name "retroarch" -ErrorAction SilentlyContinue)) { | ||
echo "waiting for RA to open" | ||
Start-Sleep -Seconds 2 | ||
} | ||
}else{ | ||
while (-not (Get-Process -Name "ES-DE" -ErrorAction SilentlyContinue)) { | ||
echo "waiting for ESDE to open" | ||
Start-Sleep -Seconds 2 | ||
} | ||
} | ||
Start-Sleep -Seconds 5 | ||
echo "Creating test file" | ||
echo "testing upload" > "$savesPath/retroarch/test_emudeck.txt" | ||
|
||
} | ||
while (-not (Get-Process -Name "rclone" -ErrorAction SilentlyContinue)) { | ||
echo "waiting for rclone to open" | ||
Start-Sleep -Seconds 1 | ||
} | ||
|
||
function cloudSyncHealth(){ | ||
echo "<table class='table'>" | ||
echo "<tr>" | ||
if ( -not (Test-Path "$toolsPath\rclone\rclone.exe")) { | ||
echo "<td>Executable Status: </td><td class='alert--danger'><strong>Failure, please reinstall</strong></td>" | ||
exit | ||
}else{ | ||
echo "<td>Executable Status: </td><td class='alert--success'><strong>Success</strong></td>" | ||
} | ||
echo "</tr><tr>" | ||
if ( -not (Test-Path "$toolsPath\rclone\rclone.conf")) { | ||
echo "<td>Config file Status: </td><td class='alert--danger'><strong>Failure, please reinstall</strong></td>" | ||
exit | ||
}else{ | ||
echo "<td>Config file Status: </td><td class='alert--success'><strong>Success</strong></td>" | ||
} | ||
echo "</tr><tr>" | ||
if ( $cloud_sync_provider -eq '') { | ||
echo "<td>Provider Status: </td><td class='alert--danger'><strong>Failure, please reinstall</strong></td>" | ||
exit | ||
}else{ | ||
echo "<td>Provider Status: </td><td class='alert--success'><strong>Success</strong></td>" | ||
} | ||
echo "</tr>" | ||
$miArreglo = @("retroarch") | ||
while (Get-Process -Name "rclone" -ErrorAction SilentlyContinue) { | ||
echo "waiting for rclone to finish" | ||
Start-Sleep -Seconds 1 | ||
} | ||
|
||
foreach ($elemento in $miArreglo) { | ||
cloud_sync_upload_test $elemento | ||
} | ||
$result = & $cloud_sync_bin lsf "$cloud_sync_provider`:Emudeck/saves/retroarch/" | Select-String "test_emudeck.txt" | ||
|
||
# Evaluar el resultado | ||
if ($result) { | ||
Write-Host "file exists in the cloud. SUCCESS" | ||
$upload = 0 | ||
} else { | ||
Write-Host "file does not exist in the cloud. FAIL" | ||
} | ||
|
||
|
||
# | ||
##Testing Dowmload | ||
# | ||
|
||
& "$cloud_sync_bin" --progress copyto -L --fast-list --checkers=50 --transfers=50 --low-level-retries 1 --retries 1 "$cloud_sync_provider`:Emudeck/saves/retroarch/test_emudeck.txt" "$savesPath/retroarch/test_emudeck.txt" | ||
|
||
if (Test-Path "$savesPath\retroarch\test_emudeck.txt") { | ||
Write-Host "file exists in local. SUCCESS" | ||
$download = 0 | ||
} else { | ||
Write-Host "file does not exist in local. FAIL" | ||
} | ||
|
||
# Eliminar los directorios y archivos locales | ||
Remove-Item -Recurse -Force "$savesPath\.watching" | ||
Remove-Item -Recurse -Force "$savesPath\retroarch\test_emudeck.txt" | ||
|
||
# Eliminar el archivo remoto | ||
& $cloud_sync_bin delete "$cloud_sync_provider`:Emudeck/saves/retroarch/test_emudeck.txt" | ||
|
||
# Verificar si se debe matar Retroarch o cerrar otra ventana | ||
if ($kill -eq "RETROARCH") { | ||
Stop-Process -Name "RetroArch" -Force | ||
} else { | ||
Stop-Process -Name "ES-DE" -Force | ||
} | ||
|
||
Write-Host "</div>" | ||
|
||
Write-Host "<table class='table'>" | ||
Write-Host "<tr>" | ||
|
||
# Check installation | ||
if (-Not (Test-Path $cloud_sync_bin)) { | ||
Write-Host "<td>Executable Status: </td><td class='alert--danger'><strong>Failure, please reinstall</strong></td></tr></table>" | ||
exit | ||
} else { | ||
Write-Host "<td>Executable Status: </td><td class='alert--success'><strong>Success</strong></td>" | ||
} | ||
Write-Host "</tr><tr>" | ||
|
||
if (-Not (Test-Path $cloud_sync_config_file)) { | ||
Write-Host "<td>Config file Status: </td><td class='alert--danger'><strong>Failure, please reinstall</strong></td></tr></table>" | ||
exit | ||
} else { | ||
Write-Host "<td>Config file Status: </td><td class='alert--success'><strong>Success</strong></td>" | ||
} | ||
Write-Host "</tr><tr>" | ||
|
||
if ([string]::IsNullOrEmpty($cloud_sync_provider)) { | ||
Write-Host "<td>Provider Status: </td><td class='alert--danger'><strong>Failure, please reinstall</strong></td></tr></table>" | ||
exit | ||
} else { | ||
Write-Host "<td>Provider Status: </td><td class='alert--success'><strong>Success</strong></td>" | ||
} | ||
Write-Host "</tr><tr>" | ||
|
||
# Tests upload | ||
Write-Host "<tr>" | ||
if ($upload -eq 0) { | ||
Write-Host "<td>Upload Status: </td><td class='alert--success'><strong>Success</strong></td>" | ||
} else { | ||
Write-Host "<td>Upload Status: </td><td class='alert--danger'><strong>Failure</strong></td>" | ||
Write-Host "</tr></table>" | ||
} | ||
Write-Host "</tr>" | ||
|
||
# Tests download | ||
Write-Host "<tr>" | ||
if ($download -eq 0) { | ||
Write-Host "<td>Download Status: </td><td class='alert--success'><strong>Success</strong></td>" | ||
} else { | ||
Write-Host "<td>Download Status: </td><td class='alert--danger'><strong>Failure</strong></td>" | ||
Write-Host "</tr></table>" | ||
} | ||
Write-Host "</tr>" | ||
|
||
Write-Host "</table>" | ||
Write-Host "<span class='is-hidden'>true</span>" | ||
|
||
foreach ($elemento in $miArreglo) { | ||
cloud_sync_download_test $elemento | ||
} | ||
echo "<td></table>" | ||
Write-Host "<span class='is-hidden'>true</span>" | ||
|
||
} |
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 @@ | ||
powershell -ExecutionPolicy Bypass -NoExit . %APPDATA%\EmuDeck\backend\tools\cloudSync\cloud_sync_force.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
. "$env:USERPROFILE/AppData/Roaming/EmuDeck/backend/functions/allCloud.ps1" | ||
$result = yesNoDialog -TitleText "CloudSync Force" -MessageText "Do you want to force the download or the upload" -OKButtonText "Upload" -CancelButtonText "Download" | ||
|
||
if ($result -eq "OKButton") { | ||
$dialog = steamToast -MessageText "Uploading all systems... don't turn off your device" | ||
cloud_sync_uploadEmuAll | ||
$dialog.Close() | ||
} else { | ||
$dialog = steamToast -MessageText "Downloading all systems... don't turn off your device" | ||
cloud_sync_downloadEmuAll | ||
$dialog.Close() | ||
} |
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