UnsignedPublishLicense Constructores
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Inicializa una nueva instancia de la clase UnsignedPublishLicense.
Sobrecargas
| Nombre | Description |
|---|---|
| UnsignedPublishLicense() |
Inicializa una nueva instancia de la clase UnsignedPublishLicense. |
| UnsignedPublishLicense(String) |
Inicializa una nueva instancia de la UnsignedPublishLicense clase a partir de una plantilla de publicación-licencia XrML especificada. |
UnsignedPublishLicense()
Inicializa una nueva instancia de la clase UnsignedPublishLicense.
public:
UnsignedPublishLicense();
public UnsignedPublishLicense();
Public Sub New ()
Comentarios
UnsignedPublishLicense crea una licencia de publicación vacía y sin firmar.
Se aplica a
UnsignedPublishLicense(String)
Inicializa una nueva instancia de la UnsignedPublishLicense clase a partir de una plantilla de publicación-licencia XrML especificada.
public:
UnsignedPublishLicense(System::String ^ publishLicenseTemplate);
public UnsignedPublishLicense(string publishLicenseTemplate);
new System.Security.RightsManagement.UnsignedPublishLicense : string -> System.Security.RightsManagement.UnsignedPublishLicense
Public Sub New (publishLicenseTemplate As String)
Parámetros
- publishLicenseTemplate
- String
Plantilla de licencia de publicación del lenguaje de marcado de derechos extensible (XrML) que se usará para crear esta licencia.
Ejemplos
En el ejemplo siguiente se muestra cómo usar este constructor.
WriteStatus(" Reading '" + xrmlFilename + "' permissions.");
try
{
StreamReader sr = File.OpenText(xrmlFile);
xrmlString = sr.ReadToEnd();
}
catch (Exception ex)
{
MessageBox.Show("ERROR: '" + xrmlFilename + "' open failed.\n" +
"Exception: " + ex.Message, "XrML File Error",
MessageBoxButton.OK, MessageBoxImage.Error);
return false;
}
WriteStatus(" Building UnsignedPublishLicense");
WriteStatus(" from '" + xrmlFilename + "'.");
UnsignedPublishLicense unsignedLicense =
new UnsignedPublishLicense(xrmlString);
ContentUser author = unsignedLicense.Owner;
WriteStatus(" Reading '" & xrmlFilename & "' permissions.")
Try
Dim sr As StreamReader = File.OpenText(xrmlFile)
xrmlString = sr.ReadToEnd()
Catch ex As Exception
MessageBox.Show("ERROR: '" & xrmlFilename &"' open failed." & vbLf & "Exception: " & ex.Message, "XrML File Error", MessageBoxButton.OK, MessageBoxImage.Error)
Return False
End Try
WriteStatus(" Building UnsignedPublishLicense")
WriteStatus(" from '" & xrmlFilename & "'.")
Dim unsignedLicense As New UnsignedPublishLicense(xrmlString)
Dim author As ContentUser = unsignedLicense.Owner
Comentarios
El publishLicenseTemplate XrML <RANGETIME> o <INTERVALTIME> los elementos se omiten cuando el constructor (String) crea .UnsignedPublishLicenseUnsignedPublishLicense Para especificar estos valores para la licencia de publicación, las ContentGrant propiedades de ValidFrom y ValidUntil deben establecerse explícitamente. En el ejemplo siguiente se muestra cómo establecer explícitamente las ValidFrom propiedades y ValidUntil .
// The XRML template <RANGETIME> and <INTERVALTIME> elements are
// ignored by the UnsignedPublishLicense(xrmlString) constructor.
// To specify these values for the license, the ContentGrant
// ValidFrom and ValidUntil properties must be explicitly set.
// The following code sample demonstrates how to set the
// ContentGrant properties for ValidFrom and ValidUntil.
// Create a copy of the original XRML template ContentGrants
// set by the UnsignedPublishLicense(xrmlString) constructor.
ICollection<ContentGrant> tmpGrants = new List<ContentGrant>();
foreach (ContentGrant grant in unsignedLicense.Grants)
tmpGrants.Add(grant);
// Erase all original UnsignedPublishLicense ContentGrants.
unsignedLicense.Grants.Clear();
// Add each original grant back to the UnsignedPublishLicense
// with appropriate ValidFrom and ValidUntil date/time values.
foreach (ContentGrant grant in tmpGrants)
{
unsignedLicense.Grants.Add(new ContentGrant(
grant.User, grant.Right,
DateTime.MinValue, // set ValidFrom as appropriate
DateTime.MaxValue)); // set ValidUntil as appropriate
}
' The XRML template <RANGETIME> and <INTERVALTIME> elements are
' ignored by the UnsignedPublishLicense(xrmlString) constructor.
' To specify these values for the license, the ContentGrant
' ValidFrom and ValidUntil properties must be explicitly set.
' The following code sample demonstrates how to set the
' ContentGrant properties for ValidFrom and ValidUntil.
' Create a copy of the original XRML template ContentGrants
' set by the UnsignedPublishLicense(xrmlString) constructor.
Dim tmpGrants As ICollection(Of ContentGrant) = New List(Of ContentGrant)()
For Each grant As ContentGrant In unsignedLicense.Grants
tmpGrants.Add(grant)
Next grant
' Erase all original UnsignedPublishLicense ContentGrants.
unsignedLicense.Grants.Clear()
' Add each original grant back to the UnsignedPublishLicense
' with appropriate ValidFrom and ValidUntil date/time values.
For Each grant As ContentGrant In tmpGrants
unsignedLicense.Grants.Add(New ContentGrant(grant.User, grant.Right, Date.MinValue, Date.MaxValue)) ' set ValidUntil as appropriate - set ValidFrom as appropriate
Next grant