PackUriHelper.Create Method (Uri, Uri)

 

Creates a pack URI given a Package URI and the URI of a part in the package.

Namespace:   System.IO.Packaging
Assembly:  WindowsBase (in WindowsBase.dll)

static member Create : 
        packageUri:Uri *
        partUri:Uri -> Uri

Parameters

packageUri
Type: System.Uri

The URI of the Package.

partUri
Type: System.Uri

The URI of the PackagePart in the package.

Return Value

Type: System.Uri

The pack URI of the given PackagePart.

Exception Condition
ArgumentNullException

packageUri is null.

ArgumentException

packageUri is not an absolute URI.

-or-

partUri is not a valid part URI syntax.

packageUri may not be specified as null or empty.

If partUri is null, the returned pack URI points to the package.

The following table illustrates sample cases for the Create method.

 packageUri

 partUri

 Returned pack URI

 http://www.proseware.com/mypackage.pkg 

 /page2.xaml 

 pack://http:,,www.proseware.com,mypackage.pkg/page2.xaml 

 http://www.proseware.com/mypackage.pkg 

 /a/page4.xaml 

 pack://http:,,www.proseware.com,mypackage.pkg/a/page4.xaml 

 http://www.proseware.com/mypackage.pkg 

 /%41/%61.xml 

 pack://http:,,www.proseware.com,mypackage.pkg/A/a.xml 

 http://www.proseware.com/mypackage.pkg 

 /%25XY.xml 

 pack://http:,,www.proseware.com,mypackage.pkg/%25XY.xml 

 http://www.proseware.com/mypackage.pkg 

 null 

 pack://http:,,www.proseware.com,mypackage.pkg 

 ftp://ftp.proseware.com/packages/mypackage1.abc 

 /a/mydoc.xaml 

 pack://ftp:,,ftp.proseware.com,packages,mypackage1.abc/a/mydoc.xaml 

 file:///d:/packages/mypackage2.pkg 

 /a/bar.xaml 

 pack://file:,,,d:,packages,mypackage2.pkg/a/bar.xaml 

Composing a pack URI is a multi-step process. For example, one step in forming a pack URI is to replace the forward slash (/) characters of the packageUri with commas (,).

For more information on string conversion and how pack URIs are formed, see Appendix A.4 "String Conversion Examples" and Appendix B.3 "Composing a Pack URI" in the Open Packaging Conventions specification available for download at Specifications and License Downloads.

The following example shows how to use the Create(Uri) method to define a pack URI that references a package.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 3.0
Return to top
Show: