PackUriHelper.Create 메서드

정의

새 팩 URI를 만듭니다.

오버로드

Name Description
Create(Uri)

패키지를 가리키는 새 팩 URI를 만듭니다.

Create(Uri, Uri)

패키지에 있는 파트의 URI 및 URI가 지정된 Package 팩 URI를 만듭니다.

Create(Uri, Uri, String)

URI, 패키지에 있는 Package 파트의 URI 및 추가할 "#" 조각이 지정된 팩 URI를 만듭니다.

설명

다음 표에서는 메서드에 대한 Create 샘플 사례를 보여 줍니다.

packageUri partUri fragment 반환된 팩 URI
http://www.proseware.com/mypackage.pkg /page1.xaml #intro pack://http:,,www.proseware.com,mypackage.pkg/page1.xaml#intro
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 /a/page5.xaml #summary pack://http:,,www.proseware.com,mypackage.pkg/a/page5.xaml#summary
http://www.proseware.com/packages.aspx?pkg04 /page1.xaml #intro pack://http:,,www.proseware.com,packages.aspx%3fpkg04/page1.xaml#intro
http://www.proseware.com/mypackage.pkg 없음 없음 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 #xref pack://file:,,,d:,packages,mypackage2.pkg/a/bar.xaml#xref

팩 URI 작성은 다단계 프로세스입니다. 예를 들어 팩 URI를 구성하는 한 단계는 쉼표(,)로 슬래시(/) 문자를 packageUri 바꾸는 것입니다.

문자열 변환 및 팩 URI가 형성되는 방법에 대한 자세한 내용은 사양 및 라이선스 다운로드에서 다운로드할 수 있는 오픈 패키징 규칙 사양의 부록 A.4 "문자열 변환 예제" 및 부록 B.3 "Pack URI 작성"을 참조하세요.

Create(Uri)

Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs

패키지를 가리키는 새 팩 URI를 만듭니다.

public:
 static Uri ^ Create(Uri ^ packageUri);
public static Uri Create(Uri packageUri);
static member Create : Uri -> Uri
Public Shared Function Create (packageUri As Uri) As Uri

매개 변수

packageUri
Uri

참조된 PackageURI입니다.

반품

Uri

지정된 Package에서 참조하는 packageUri 팩 URI입니다.

예외

packageUrinull입니다.

packageUri 는 절대 URI가 아닙니다.

예제

다음 예제에서는 메서드를 사용하여 Create 패키지를 참조하는 팩 URI를 정의하는 방법을 보여 줍니다.

// ------------------------ GetFixedDocument --------------------------
/// <summary>
///   Returns the fixed document at a given URI within
///   the currently open XPS package.</summary>
/// <param name="fixedDocUri">
///   The URI of the fixed document to return.</param>
/// <returns>
///   The fixed document at a given URI
///   within the current XPS package.</returns>
private FixedDocument GetFixedDocument(Uri fixedDocUri)
{
    FixedDocument fixedDocument = null;

    // Create the URI for the fixed document within the package. The URI
    // is used to set the Parser context so fonts & other items can load.
    Uri tempUri = new Uri(_xpsDocumentPath, UriKind.RelativeOrAbsolute);
    ParserContext parserContext = new ParserContext();
    parserContext.BaseUri = PackUriHelper.Create(tempUri);

    // Retrieve the fixed document.
    PackagePart fixedDocPart = _xpsPackage.GetPart(fixedDocUri);
    if (fixedDocPart != null)
    {
        object fixedObject =
            XamlReader.Load(fixedDocPart.GetStream(), parserContext);
        if (fixedObject != null)
            fixedDocument = fixedObject as FixedDocument;
    }

    return fixedDocument;
}// end:GetFixedDocument()
' ------------------------ GetFixedDocument --------------------------
''' <summary>
'''   Returns the fixed document at a given URI within
'''   the currently open XPS package.</summary>
''' <param name="fixedDocUri">
'''   The URI of the fixed document to return.</param>
''' <returns>
'''   The fixed document at a given URI
'''   within the current XPS package.</returns>
Private Function GetFixedDocument(ByVal fixedDocUri As Uri) As FixedDocument
    Dim fixedDocument As FixedDocument = Nothing

    ' Create the URI for the fixed document within the package. The URI
    ' is used to set the Parser context so fonts & other items can load.
    Dim tempUri As New Uri(_xpsDocumentPath, UriKind.RelativeOrAbsolute)
    Dim parserContext As New ParserContext()
    parserContext.BaseUri = PackUriHelper.Create(tempUri)

    ' Retrieve the fixed document.
    Dim fixedDocPart As PackagePart = _xpsPackage.GetPart(fixedDocUri)
    If fixedDocPart IsNot Nothing Then
        Dim fixedObject As Object = XamlReader.Load(fixedDocPart.GetStream(), parserContext)
        If fixedObject IsNot Nothing Then
            fixedDocument = TryCast(fixedObject, FixedDocument)
        End If
    End If

    Return fixedDocument
End Function ' end:GetFixedDocument()

설명

packageUri 로 지정 null 하거나 비워 둘 수 없습니다.

다음 표에서는 .에 대한 Create샘플 사례를 보여 줍니다.

packageUri 반환된 팩 URI
http://www.proseware.com/mypackage.pkg pack://http:,,www.proseware.com,mypackage.pkg
ftp://ftp.proseware.com/packages/mypackage1.abc pack://ftp:,,ftp.proseware.com,packages,mypackage1.abc
file:///d:/packages/mypackage2.pkg pack://file:,,,d:,packages,mypackage2.pkg

팩 URI 작성은 다단계 프로세스입니다. 예를 들어 팩 URI를 구성하는 한 단계는 쉼표(,)로 슬래시(/) 문자를 packageUri 바꾸는 것입니다.

문자열 변환 및 팩 URI가 형성되는 방법에 대한 자세한 내용은 사양 및 라이선스 다운로드에서 다운로드할 수 있는 오픈 패키징 규칙 사양의 부록 A.4 "문자열 변환 예제" 및 부록 B.3 "Pack URI 작성"을 참조하세요.

추가 정보

적용 대상

Create(Uri, Uri)

Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs

패키지에 있는 파트의 URI 및 URI가 지정된 Package 팩 URI를 만듭니다.

public:
 static Uri ^ Create(Uri ^ packageUri, Uri ^ partUri);
public static Uri Create(Uri packageUri, Uri? partUri);
public static Uri Create(Uri packageUri, Uri partUri);
static member Create : Uri * Uri -> Uri
Public Shared Function Create (packageUri As Uri, partUri As Uri) As Uri

매개 변수

packageUri
Uri

의 URI입니다 Package.

partUri
Uri

패키지 내의 PackagePart URI입니다.

반품

Uri

지정된 PackagePartURI의 pack URI입니다.

예외

packageUrinull입니다.

packageUri 는 절대 URI가 아닙니다.

-또는-

partUri 가 유효한 부분 URI 구문이 아닌 경우

예제

다음 예제에서는 메서드를 사용하여 Create(Uri) 패키지를 참조하는 팩 URI를 정의하는 방법을 보여 줍니다.

// ------------------------ GetFixedDocument --------------------------
/// <summary>
///   Returns the fixed document at a given URI within
///   the currently open XPS package.</summary>
/// <param name="fixedDocUri">
///   The URI of the fixed document to return.</param>
/// <returns>
///   The fixed document at a given URI
///   within the current XPS package.</returns>
private FixedDocument GetFixedDocument(Uri fixedDocUri)
{
    FixedDocument fixedDocument = null;

    // Create the URI for the fixed document within the package. The URI
    // is used to set the Parser context so fonts & other items can load.
    Uri tempUri = new Uri(_xpsDocumentPath, UriKind.RelativeOrAbsolute);
    ParserContext parserContext = new ParserContext();
    parserContext.BaseUri = PackUriHelper.Create(tempUri);

    // Retrieve the fixed document.
    PackagePart fixedDocPart = _xpsPackage.GetPart(fixedDocUri);
    if (fixedDocPart != null)
    {
        object fixedObject =
            XamlReader.Load(fixedDocPart.GetStream(), parserContext);
        if (fixedObject != null)
            fixedDocument = fixedObject as FixedDocument;
    }

    return fixedDocument;
}// end:GetFixedDocument()
' ------------------------ GetFixedDocument --------------------------
''' <summary>
'''   Returns the fixed document at a given URI within
'''   the currently open XPS package.</summary>
''' <param name="fixedDocUri">
'''   The URI of the fixed document to return.</param>
''' <returns>
'''   The fixed document at a given URI
'''   within the current XPS package.</returns>
Private Function GetFixedDocument(ByVal fixedDocUri As Uri) As FixedDocument
    Dim fixedDocument As FixedDocument = Nothing

    ' Create the URI for the fixed document within the package. The URI
    ' is used to set the Parser context so fonts & other items can load.
    Dim tempUri As New Uri(_xpsDocumentPath, UriKind.RelativeOrAbsolute)
    Dim parserContext As New ParserContext()
    parserContext.BaseUri = PackUriHelper.Create(tempUri)

    ' Retrieve the fixed document.
    Dim fixedDocPart As PackagePart = _xpsPackage.GetPart(fixedDocUri)
    If fixedDocPart IsNot Nothing Then
        Dim fixedObject As Object = XamlReader.Load(fixedDocPart.GetStream(), parserContext)
        If fixedObject IsNot Nothing Then
            fixedDocument = TryCast(fixedObject, FixedDocument)
        End If
    End If

    Return fixedDocument
End Function ' end:GetFixedDocument()

설명

packageUri 은 null 또는 empty로 지정되지 않을 수 있습니다.

partUri경우 null 반환된 팩 URI는 패키지를 가리킵니다.

다음 표에서는 메서드에 대한 Create 샘플 사례를 보여 줍니다.

packageUri partUri 반환된 팩 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 없음 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

팩 URI 작성은 다단계 프로세스입니다. 예를 들어 팩 URI를 구성하는 한 단계는 쉼표(,)로 슬래시(/) 문자를 packageUri 바꾸는 것입니다.

문자열 변환 및 팩 URI가 형성되는 방법에 대한 자세한 내용은 사양 및 라이선스 다운로드에서 다운로드할 수 있는 오픈 패키징 규칙 사양의 부록 A.4 "문자열 변환 예제" 및 부록 B.3 "Pack URI 작성"을 참조하세요.

추가 정보

적용 대상

Create(Uri, Uri, String)

Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs
Source:
PackUriHelper.PackUriScheme.cs

URI, 패키지에 있는 Package 파트의 URI 및 추가할 "#" 조각이 지정된 팩 URI를 만듭니다.

public:
 static Uri ^ Create(Uri ^ packageUri, Uri ^ partUri, System::String ^ fragment);
public static Uri Create(Uri packageUri, Uri? partUri, string? fragment);
public static Uri Create(Uri packageUri, Uri partUri, string fragment);
static member Create : Uri * Uri * string -> Uri
Public Shared Function Create (packageUri As Uri, partUri As Uri, fragment As String) As Uri

매개 변수

packageUri
Uri

의 URI입니다 Package.

partUri
Uri

패키지 내의 PackagePart URI입니다.

fragment
String

패키지 파트 내의 요소를 식별하는 "#" 참조입니다.

반품

Uri

지정된 패키지, 패키지 파트 및 조각을 식별하는 팩 URI입니다.

예외

packageUrinull입니다.

packageUri 는 절대 URI가 아닙니다.

-또는-

partUri 가 유효한 부분 URI 구문이 아닌 경우

-또는-

fragment 가 비어 있거나 "#"으로 시작합니다.

예제

다음 예제에서는 메서드를 사용하여 Create(Uri) 패키지를 참조하는 팩 URI를 정의하는 방법을 보여 줍니다.

// ------------------------ GetFixedDocument --------------------------
/// <summary>
///   Returns the fixed document at a given URI within
///   the currently open XPS package.</summary>
/// <param name="fixedDocUri">
///   The URI of the fixed document to return.</param>
/// <returns>
///   The fixed document at a given URI
///   within the current XPS package.</returns>
private FixedDocument GetFixedDocument(Uri fixedDocUri)
{
    FixedDocument fixedDocument = null;

    // Create the URI for the fixed document within the package. The URI
    // is used to set the Parser context so fonts & other items can load.
    Uri tempUri = new Uri(_xpsDocumentPath, UriKind.RelativeOrAbsolute);
    ParserContext parserContext = new ParserContext();
    parserContext.BaseUri = PackUriHelper.Create(tempUri);

    // Retrieve the fixed document.
    PackagePart fixedDocPart = _xpsPackage.GetPart(fixedDocUri);
    if (fixedDocPart != null)
    {
        object fixedObject =
            XamlReader.Load(fixedDocPart.GetStream(), parserContext);
        if (fixedObject != null)
            fixedDocument = fixedObject as FixedDocument;
    }

    return fixedDocument;
}// end:GetFixedDocument()
' ------------------------ GetFixedDocument --------------------------
''' <summary>
'''   Returns the fixed document at a given URI within
'''   the currently open XPS package.</summary>
''' <param name="fixedDocUri">
'''   The URI of the fixed document to return.</param>
''' <returns>
'''   The fixed document at a given URI
'''   within the current XPS package.</returns>
Private Function GetFixedDocument(ByVal fixedDocUri As Uri) As FixedDocument
    Dim fixedDocument As FixedDocument = Nothing

    ' Create the URI for the fixed document within the package. The URI
    ' is used to set the Parser context so fonts & other items can load.
    Dim tempUri As New Uri(_xpsDocumentPath, UriKind.RelativeOrAbsolute)
    Dim parserContext As New ParserContext()
    parserContext.BaseUri = PackUriHelper.Create(tempUri)

    ' Retrieve the fixed document.
    Dim fixedDocPart As PackagePart = _xpsPackage.GetPart(fixedDocUri)
    If fixedDocPart IsNot Nothing Then
        Dim fixedObject As Object = XamlReader.Load(fixedDocPart.GetStream(), parserContext)
        If fixedObject IsNot Nothing Then
            fixedDocument = TryCast(fixedObject, FixedDocument)
        End If
    End If

    Return fixedDocument
End Function ' end:GetFixedDocument()

설명

packageUri 로 지정 null 하거나 비워 둘 수 없습니다.

partUri경우 null 반환된 팩 URI는 패키지를 가리킵니다.

fragment 은 빈 문자열일 수 없지만 .로 null지정할 수 있습니다. 문자열로 null지정하지 않으면 문자열이 fragment '#' 문자로 시작해야 합니다. 참조 구문에 대한 자세한 내용은 fragment 섹션 3.5 "조각"을 참조하세요.

다음 표에서는 메서드에 대한 Create 샘플 사례를 보여 줍니다.

packageUri partUri fragment 반환된 팩 URI
http://www.proseware.com/mypackage.pkg /page1.xaml #intro pack://http:,,www.proseware.com,mypackage.pkg/page1.xaml#intro
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 /a/page5.xaml #summary pack://http:,,www.proseware.com,mypackage.pkg/a/page5.xaml#summary
http://www.proseware.com/packages.aspx?pkg04 /page1.xaml #intro pack://http:,,www.proseware.com,packages.aspx%3fpkg04/page1.xaml#intro
http://www.proseware.com/mypackage.pkg 없음 없음 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 #xref pack://file:,,,d:,packages,mypackage2.pkg/a/bar.xaml#xref

팩 URI 작성은 다단계 프로세스입니다. 예를 들어 팩 URI를 구성하는 한 단계는 쉼표(,)로 슬래시(/) 문자를 packageUri 바꾸는 것입니다.

문자열 변환 및 팩 URI가 형성되는 방법에 대한 자세한 내용은 사양 및 라이선스 다운로드에서 다운로드할 수 있는 오픈 패키징 규칙 사양의 부록 A.4 "문자열 변환 예제" 및 부록 B.3 "Pack URI 작성"을 참조하세요.

추가 정보

적용 대상