PackUriHelper.Create Yöntem
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
Yeni bir paket URI'si oluşturur.
Aşırı Yüklemeler
| Name | Description |
|---|---|
| Create(Uri) |
Pakete işaret eden yeni bir paket URI'sini oluşturur. |
| Create(Uri, Uri) |
Paketteki bir parçanın URI'sini ve URI'sini verilen Package bir paket URI'sini oluşturur. |
| Create(Uri, Uri, String) |
URI verilen bir Package paket URI'sini, paketteki bir bölümün URI'sini ve eklenecek bir "#" parçasını oluşturur. |
Açıklamalar
Aşağıdaki tabloda yöntemi için örnek durumlar gösterilmektedir Create .
packageUri |
partUri |
fragment |
Döndürülen paket URI'si |
|---|---|---|---|
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 | sıfır | pack://http:,,www.proseware.com,mypackage.pkg/page2.xaml |
http://www.proseware.com/mypackage.pkg |
/a/page4.xaml | sıfır | pack://http:,,www.proseware.com,mypackage.pkg/a/page4.xaml |
http://www.proseware.com/mypackage.pkg |
/%41/%61.xml | sıfır | pack://http:,,www.proseware.com,mypackage.pkg/A/a.xml |
http://www.proseware.com/mypackage.pkg |
/%25XY.xml | sıfır | 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 |
sıfır | sıfır | pack://http:,,www.proseware.com,mypackage.pkg |
ftp://ftp.proseware.com/packages/mypackage1.abc |
/a/mydoc.xaml | sıfır | 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 |
Paket URI'sini oluşturmak çok adımlı bir işlemdir. Örneğin, paket URI'sini oluşturmanın bir adımı, öğesinin eğik çizgi (/) karakterlerini packageUri virgül (,) ile değiştirmektir.
Dize dönüştürme ve paket URI'lerinin nasıl oluşturulduğu hakkında daha fazla bilgi için, Belirtimler ve Lisans İndirmeleri sayfasında indirilebilen Açık Paketleme Kuralları belirtimindeki Ek A.4 "Dize Dönüştürme Örnekleri" ve Ek B.3 "Paket URI'sini Oluşturma" konularına bakın.
Create(Uri)
Pakete işaret eden yeni bir paket URI'sini oluşturur.
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
Parametreler
Döndürülenler
Verilen Packagetarafından başvuruda bulunan için packageUri paket URI'si.
Özel durumlar
packageUri, null'e eşittir.
packageUri mutlak bir URI değildir.
Örnekler
Aşağıdaki örnekte, bir pakete başvuran bir paket URI'sini tanımlamak için yönteminin nasıl kullanılacağı Create gösterilmektedir.
// ------------------------ 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()
Açıklamalar
packageUri veya boş olarak null belirtilmeyebilir.
Aşağıdaki tabloda için Createörnek durumlar gösterilmektedir.
packageUri |
Döndürülen paket URI'si |
|---|---|
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 |
Paket URI'sini oluşturmak çok adımlı bir işlemdir. Örneğin, paket URI'sini oluşturmanın bir adımı, öğesinin eğik çizgi (/) karakterlerini packageUri virgül (,) ile değiştirmektir.
Dize dönüştürme ve paket URI'lerinin nasıl oluşturulduğu hakkında daha fazla bilgi için, Belirtimler ve Lisans İndirmeleri sayfasında indirilebilen Açık Paketleme Kuralları belirtimindeki Ek A.4 "Dize Dönüştürme Örnekleri" ve Ek B.3 "Paket URI'sini Oluşturma" konularına bakın.
Ayrıca bkz.
Şunlara uygulanır
Create(Uri, Uri)
Paketteki bir parçanın URI'sini ve URI'sini verilen Package bir paket URI'sini oluşturur.
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
Parametreler
- partUri
- Uri
Paketindeki öğesinin PackagePart URI'sini.
Döndürülenler
Verilen PackagePartöğesinin paket URI'si.
Özel durumlar
packageUri, null'e eşittir.
packageUri mutlak bir URI değildir.
-veya-
partUri geçerli bir bölüm URI söz dizimi değildir.
Örnekler
Aşağıdaki örnekte, bir pakete başvuran bir paket URI'sini tanımlamak için yönteminin nasıl kullanılacağı Create(Uri) gösterilmektedir.
// ------------------------ 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()
Açıklamalar
packageUri null veya boş olarak belirtilmeyebilir.
ise partUrinull, döndürülen paket URI'si paketi gösterir.
Aşağıdaki tabloda yöntemi için örnek durumlar gösterilmektedir Create .
packageUri |
partUri |
Döndürülen paket URI'si |
|---|---|---|
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 |
sıfır | 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 |
Paket URI'sini oluşturmak çok adımlı bir işlemdir. Örneğin, paket URI'sini oluşturmanın bir adımı, öğesinin eğik çizgi (/) karakterlerini packageUri virgül (,) ile değiştirmektir.
Dize dönüştürme ve paket URI'lerinin nasıl oluşturulduğu hakkında daha fazla bilgi için, Belirtimler ve Lisans İndirmeleri sayfasında indirilebilen Açık Paketleme Kuralları belirtimindeki Ek A.4 "Dize Dönüştürme Örnekleri" ve Ek B.3 "Paket URI'sini Oluşturma" konularına bakın.
Ayrıca bkz.
Şunlara uygulanır
Create(Uri, Uri, String)
URI verilen bir Package paket URI'sini, paketteki bir bölümün URI'sini ve eklenecek bir "#" parçasını oluşturur.
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
Parametreler
- partUri
- Uri
Paketindeki öğesinin PackagePart URI'sini.
- fragment
- String
Paket bölümündeki bir öğeyi tanımlayan bir "#" başvurusu.
Döndürülenler
Belirtilen paketi, paket bölümünü ve parçasını tanımlayan paket URI'si.
Özel durumlar
packageUri, null'e eşittir.
packageUri mutlak bir URI değildir.
-veya-
partUri geçerli bir bölüm URI söz dizimi değildir.
-veya-
fragment boş veya "#" ile başlıyor.
Örnekler
Aşağıdaki örnekte, bir pakete başvuran bir paket URI'sini tanımlamak için yönteminin nasıl kullanılacağı Create(Uri) gösterilmektedir.
// ------------------------ 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()
Açıklamalar
packageUri veya boş olarak null belirtilmeyebilir.
ise partUrinull, döndürülen paket URI'si paketi gösterir.
fragment boş bir dize olamaz, ancak olarak nullbelirtilebilir. olarak nullfragment belirtilmediğinde, dize '#' karakteriyle başlamalıdır. Başvuruların söz dizimi fragment hakkında daha fazla bilgi için bkz. RFC 3986'nın Bölüm 3.5 "Parçası".
Aşağıdaki tabloda yöntemi için örnek durumlar gösterilmektedir Create .
packageUri |
partUri |
fragment |
Döndürülen paket URI'si |
|---|---|---|---|
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 | sıfır | pack://http:,,www.proseware.com,mypackage.pkg/page2.xaml |
http://www.proseware.com/mypackage.pkg |
/a/page4.xaml | sıfır | pack://http:,,www.proseware.com,mypackage.pkg/a/page4.xaml |
http://www.proseware.com/mypackage.pkg |
/%41/%61.xml | sıfır | pack://http:,,www.proseware.com,mypackage.pkg/A/a.xml |
http://www.proseware.com/mypackage.pkg |
/%25XY.xml | sıfır | 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 |
sıfır | sıfır | pack://http:,,www.proseware.com,mypackage.pkg |
ftp://ftp.proseware.com/packages/mypackage1.abc |
/a/mydoc.xaml | sıfır | 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 |
Paket URI'sini oluşturmak çok adımlı bir işlemdir. Örneğin, paket URI'sini oluşturmanın bir adımı, öğesinin eğik çizgi (/) karakterlerini packageUri virgül (,) ile değiştirmektir.
Dize dönüştürme ve paket URI'lerinin nasıl oluşturulduğu hakkında daha fazla bilgi için, Belirtimler ve Lisans İndirmeleri sayfasında indirilebilen Açık Paketleme Kuralları belirtimindeki Ek A.4 "Dize Dönüştürme Örnekleri" ve Ek B.3 "Paket URI'sini Oluşturma" konularına bakın.