diff --git a/app-runner/Private/DeviceProviders/DeviceProvider.ps1 b/app-runner/Private/DeviceProviders/DeviceProvider.ps1 index 8570926..b9bafbc 100644 --- a/app-runner/Private/DeviceProviders/DeviceProvider.ps1 +++ b/app-runner/Private/DeviceProviders/DeviceProvider.ps1 @@ -554,6 +554,14 @@ SDK Path: $($this.SdkPath) return "$($this.Platform) ($(Get-Date -Format 'HH:mm:ss'))" } + [void] ExportSettings([string]$OutputFile) { + $this.LogNotImplemented('ExportSettings') + } + + [void] ImportSettings([string]$InputFile) { + $this.LogNotImplemented('ImportSettings') + } + [bool] TestInternetConnection() { Write-Debug "$($this.Platform): Testing internet connection" $this.LogNotImplemented('TestInternetConnection') diff --git a/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 b/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 index 891ce65..112e1a6 100644 --- a/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 +++ b/app-runner/Private/DeviceProviders/PlayStation5Provider.ps1 @@ -45,6 +45,7 @@ class PlayStation5Provider : DeviceProvider { 'ipconfig' = @($this.TargetControlTool, 'network ip-config') 'natinfo' = @($this.TargetControlTool, 'network get-nat-traversal-info') 'settingsexport' = @($this.TargetControlTool, 'settings export "{0}"') + 'settingsimport' = @($this.TargetControlTool, 'settings import "{0}"') 'processlist' = @($this.TargetControlTool, 'process list', { $Input | ConvertFrom-Yaml }) # Target management commands for DetectAndSetDefaultTarget() 'get-default-target' = @($this.TargetControlTool, 'target get-default') @@ -147,6 +148,16 @@ class PlayStation5Provider : DeviceProvider { }) } + [void] ExportSettings([string]$OutputFile) { + Write-Debug "$($this.Platform): Exporting settings to: $OutputFile" + $this.InvokeCommand('settingsexport', @($OutputFile)) + } + + [void] ImportSettings([string]$InputFile) { + Write-Debug "$($this.Platform): Importing settings from: $InputFile" + $this.InvokeCommand('settingsimport', @($InputFile)) + } + [hashtable] GetDiagnostics([string]$OutputDirectory) { # Call base implementation to collect standard diagnostics $results = ([DeviceProvider]$this).GetDiagnostics($OutputDirectory) @@ -190,7 +201,7 @@ class PlayStation5Provider : DeviceProvider { # Run prospero-ctrl settings export try { $settingsFile = Join-Path $OutputDirectory "$datePrefix-settings.xml" - $this.InvokeCommand('settingsexport', @($settingsFile)) + $this.ExportSettings($settingsFile) $results.Files += $settingsFile Write-Debug "Settings exported to: $settingsFile" } catch { diff --git a/app-runner/Public/Export-DeviceSettings.ps1 b/app-runner/Public/Export-DeviceSettings.ps1 new file mode 100644 index 0000000..ce1fd10 --- /dev/null +++ b/app-runner/Public/Export-DeviceSettings.ps1 @@ -0,0 +1,33 @@ +function Export-DeviceSettings { + <# + .SYNOPSIS + Exports the settings of the connected device to a file. + + .DESCRIPTION + Exports the current settings of the connected device to an XML file. + Uses the current device session. + + .PARAMETER OutputFile + Path to the output XML file where settings will be saved. + + .EXAMPLE + Connect-Device -Platform "PlayStation5" + Export-DeviceSettings -OutputFile "settings.xml" + #> + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string]$OutputFile + ) + + Assert-DeviceSession + + Write-Debug "Exporting device settings: $($script:CurrentSession.Platform)" + Write-Debug "Output file: $OutputFile" + + $provider = $script:CurrentSession.Provider + $provider.ExportSettings($OutputFile) + + Write-Output "Settings exported to: $OutputFile" +} diff --git a/app-runner/Public/Import-DeviceSettings.ps1 b/app-runner/Public/Import-DeviceSettings.ps1 new file mode 100644 index 0000000..1bdafb2 --- /dev/null +++ b/app-runner/Public/Import-DeviceSettings.ps1 @@ -0,0 +1,33 @@ +function Import-DeviceSettings { + <# + .SYNOPSIS + Imports settings from a file to the connected device. + + .DESCRIPTION + Imports settings from an XML file to the connected device. + Uses the current device session. + + .PARAMETER InputFile + Path to the input XML file containing settings to import. + + .EXAMPLE + Connect-Device -Platform "PlayStation5" + Import-DeviceSettings -InputFile "settings.xml" + #> + [CmdletBinding()] + param( + [Parameter(Mandatory = $true)] + [ValidateNotNullOrEmpty()] + [string]$InputFile + ) + + Assert-DeviceSession + + Write-Debug "Importing device settings: $($script:CurrentSession.Platform)" + Write-Debug "Input file: $InputFile" + + $provider = $script:CurrentSession.Provider + $provider.ImportSettings($InputFile) + + Write-Output "Settings imported from: $InputFile" +} diff --git a/app-runner/SentryAppRunner.psd1 b/app-runner/SentryAppRunner.psd1 index eeafe27..ccc8aef 100644 --- a/app-runner/SentryAppRunner.psd1 +++ b/app-runner/SentryAppRunner.psd1 @@ -32,6 +32,8 @@ 'Connect-Device', 'Copy-DeviceItem', 'Disconnect-Device', + 'Export-DeviceSettings', + 'Import-DeviceSettings', 'Get-DeviceDiagnostics', 'Get-DeviceLogs', 'Get-DeviceScreenshot', diff --git a/app-runner/SentryAppRunner.psm1 b/app-runner/SentryAppRunner.psm1 index a910624..ef00a35 100644 --- a/app-runner/SentryAppRunner.psm1 +++ b/app-runner/SentryAppRunner.psm1 @@ -74,5 +74,9 @@ Export-ModuleMember -Function @( 'Get-DeviceLogs', 'Get-DeviceScreenshot', 'Get-DeviceDiagnostics', - 'Copy-DeviceItem' + 'Copy-DeviceItem', + + # Settings Management + 'Export-DeviceSettings', + 'Import-DeviceSettings' )