다음을 통해 공유


IWMSNamedValue Object (C#)

You can use the IWMSNamedValue object to specify the name and retrieve or specify the value of a name-value pair associated with the server. You can use the IWMSNamedValuesIWMSNamedValues Object (C#) to manage a collection of name-value pairs.

The IWMSNamedValue object exposes the following properties.

Property

Description

Name

Retrieves the name portion of the name-value pair.

Value

Specifies and retrieves the value portion of the name-value pair.

Example

The following example illustrates how to retrieve an IWMSNamedValue object.

using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer                   Server;
IWMSNamedValues             NamedValues;
IWMSNamedValue              NamedValue;

try {
    // Create a new WMSServer object.
    Server = new WMSServerClass();

    // Retrieve the IWMSNamedValues object
    // containing descriptive information about the server.
    NamedValues = Server.Properties;

    // Retrieve information about each name-value pair.
    for (int i = 0; i < NamedValues.Count; i++)
    {
        NamedValue = NamedValues.get_Item(i);
    }

System and custom plug-ins contain default name-value pairs that can be accessed by simply indexing the name of the property you want to retrieve. For a list of the default values that you can access, see Registering Plug-in Properties.

The following example illustrates how to retrieve some default configuration values from the WMS Digest Authentication plug-in.

using Microsoft.WindowsMediaServices.Interop;
using System.Runtime.InteropServices;

// Declare variables.
WMSServer                   Server;
IWMSNamedValues             Properties;
IWMSPlugin                  Plugin;

string                      ASPMoniker;
string                      Author;
string                      Copyright;
string                      Descr;
string                      MMCMoniker;
string                      Name;
string                      Realm;
int                         UnspptLdType;
int                         WMSSystemPlugin;

try {
    // Create a WMSServer object.
    Server = new WMSServerClass();

    // Retrieve a WMS Digest Authentication plug-in.
    Plugin = Server.Authenticators["WMS Digest Authentication"];

    // Retrieve a collection of properties for the WMS Digest
    // Authentication plug-in.
    Properties = Plugin.Properties;

    // Retrieve each configuration property specified
    // for the plug-in. The Value() property returns an
    // object type. You can unbox it using the appropriate 
    // explicit cast.
    WMSSystemPlugin = (int)Properties.get_Item("WMSSystemPlugin").Value;
    MMCMoniker = (string)Properties.get_Item("MMCMoniker").Value;
    ASPMoniker = (string)Properties.get_Item("ASPMoniker").Value;
    UnspptLdType = (int)Properties.get_Item("UnsupportedLoadTypes").Value;
    Realm = (string)Properties.get_Item("Realm").Value;
    Name = (string)Properties.get_Item("Name").Value;
    Descr = (string)Properties.get_Item("Description").Value;
    Author = (string)Properties.get_Item("Author").Value;
    Copyright = (string)Properties.get_Item("Copyright").Value;
}
catch (COMException comExc) {
    // TODO: Handle COM exceptions.
}
catch (Exception e) {
    // TODO: Handle exceptions.
}

See Also

Reference

IWMSNamedValue Interface

Concepts

Server Object Model (C#)