Types/OpenPackage.Part/Write.ps1

<#
.SYNOPSIS
    Writes Open Package Parts
.DESCRIPTION
    Writes Open Package Parts, using the `.Writer` associated with this part.
#>

param(
# The object to write.
[Alias('Input','Content','Text')]
[PSObject]
$InputObject,

<#

Any options used to write the object

Commonly Supported Options:

|Option|Description|
|-|-|
|Depth|The serialization depth|
|Encoding|The text encoding|
|Stream|Optional destination stream|

#>

[Alias('Options')]
[Collections.IDictionary]
$Option = [Ordered]@{}
)

$orderedMethods = @($this.Writer)

if (-not $orderedMethods) {
    Write-Warning "No writer found for $($this.Uri)"
    return
}

$method = $orderedMethods[0]
if ($method) {
    return $method.Invoke($InputObject, $option)
}