UnsignedPublishLicense Constructors

Definition

Initializes a new instance of the UnsignedPublishLicense class.

Overloads

UnsignedPublishLicense()

Initializes a new instance of the UnsignedPublishLicense class.

UnsignedPublishLicense(String)

Initializes a new instance of the UnsignedPublishLicense class from a specified XrML publish-license template.

UnsignedPublishLicense()

Initializes a new instance of the UnsignedPublishLicense class.

public UnsignedPublishLicense ();

Remarks

UnsignedPublishLicense creates an empty and unsigned publish-license.

Applies to

.NET Framework 4.8.1 dan versi lain
Produk Versi
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9

UnsignedPublishLicense(String)

Initializes a new instance of the UnsignedPublishLicense class from a specified XrML publish-license template.

public UnsignedPublishLicense (string publishLicenseTemplate);

Parameters

publishLicenseTemplate
String

The Extensible Rights Markup Language (XrML) publish-license template to use to create this license.

Examples

The following example shows how to use this 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;

Remarks

The publishLicenseTemplate XrML <RANGETIME> or <INTERVALTIME> elements are ignored when the UnsignedPublishLicense is created by the UnsignedPublishLicense(String) constructor. To specify these values for the publish license, the ContentGrant properties for ValidFrom and ValidUntil must be explicitly set. The following example shows how to explicitly set the ValidFrom and ValidUntil properties.

// 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
}

Applies to

.NET Framework 4.8.1 dan versi lain
Produk Versi
.NET Framework 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9