IWMSCacheProxyServerCallback.OnCompareContentInformation (Visual Basic .NET)
The OnCompareContentInformation method is called by the server to respond when a cache plug-in calls IWMSCacheProxyServer.CompareContentInformation.
IWMSCacheProxyServerCallback.OnCompareContentInformation( lHr As Integer,
CompareResponse As WMS_CACHE_VERSION_COMPARE_RESPONSE,
pNewContentInfo As IWMSContext,
varContext As Object
)
Arguments
[in] Integer indicating whether the call to IWMSCacheProxyServer.CompareContentInformation succeeded. |
|
[in] Member of the WMS_CACHE_VERSION_COMPARE_RESPONSE enumeration type indicating the server response. This must be one of the following values. |
Value |
Description |
---|---|
WMS_CACHE_VERSION_FAIL_TO_CHECK_VERSION |
There was a problem in checking the version. The cache plug-in should either delete the cached content, or try to compare versions again. |
WMS_CACHE_VERSION_CACHE_STALE |
The content is out of date. The cache plug-in must delete the cached content. |
WMS_CACHE_VERSION_CACHE_UP_TO_DATE |
The content is current. The content can be streamed. |
[in] IWMSContextIWMSContext Object (Visual Basic .NET) containing a Content Description Context. The context is associated with the URL passed when the plug-in calls CompareContentInformation. |
|
[in] Object containing a value defined by the plug-in when it called IWMSCacheProxyServer.CompareContentInformation. For example, your plug-in can use this parameter to persist state information. The server does not alter this value and passes it back when calling OnCompareContentInformation. |
Return Value
This method does not return a value. To report an error, the plug-in can throw a COMException object to the server. If the plug-in uses the IWMSEventLogIWMSEventLog Object (C#) to log error information, it is recommended that it throw NS_E_PLUGIN_ERROR_REPORTED (0xC00D157D). Typically, the server attempts to make plug-in error information available to the server object model, the Windows Event Viewer, and the troubleshooting list in the details pane of the Windows Media Services MMC. However, if the plug-in uses the IWMSEventLog object to send custom error information to the Windows Event Viewer, throwing NS_E_PLUGIN_ERROR_REPORTED stops the server from also logging to the event viewer. For more information about plug-in error information, see Identifying Plug-in Errors.
Example
Imports Microsoft.WindowsMediaServices.Interop
Imports System.Runtime.InteropServices
Public Sub OnCompareContentInformation(ByVal lHr As Integer, _
ByVal CompareResponse As WMS_CACHE_VERSION_COMPARE_RESPONSE, _
ByVal NewContentInfo As IWMSContext, _
ByVal varContext As Object) _
Implements IWMSCacheProxyServerCallback.OnCompareContentInformation
Dim Response As WMS_CACHE_QUERY_RESPONSE
Dim ci As ContentInfo
Dim Context As IWMSContext
Dim nIndex As Integer
Dim strCacheUrl As String
Try
' Set the response equal to a cache miss.
Response = WMS_CACHE_QUERY_RESPONSE.WMS_CACHE_QUERY_MISS
' Retrieve the user defined ContentInfo object
' from the varContext parameter.
ci = varContext
' The call to IWMSCacheProxyServer.CompareContentInfo succeeded.
If lHr = 0 Then
Select Case CompareResponse
Case WMS_CACHE_VERSION_COMPARE_RESPONSE.WMS_CACHE_VERSION_CACHE_STALE
' The content has expired. Remove it from the DataSet object.
RemoveEntryFromDataBase(ci, True)
Case WMS_CACHE_VERSION_COMPARE_RESPONSE.WMS_CACHE_VERSION_CACHE_UP_TO_DATE
' The content is current.
If (ci.ContentType And 1) <> 0 Then
' Broadcast content.
Response = WMS_CACHE_QUERY_RESPONSE.WMS_CACHE_QUERY_HIT_PLAY_BROADCAST
Else
' On-demand content.
Response = WMS_CACHE_QUERY_RESPONSE.WMS_CACHE_QUERY_HIT_PLAY_ON_DEMAND
End If
' Update the DataTable object with new information.
' The RemoveEntryFromDataBase(), GetContentInfoFromContext(),
' and UpdateTable() functions are user-defined.
RemoveEntryFromDataBase(ci, False)
GetContentInfoFromContext(NewContentInfo, ci)
UpdateTable(ci)
GetContentInfoContext(ci, Context)
Case WMS_CACHE_VERSION_COMPARE_RESPONSE.WMS_CACHE_VERSION_FAIL_TO_CHECK_VERSION
' The server did not check version information.
End Select
' Specify the cache URL. A basic starting point searches for
' the :// character sequence in the URL. If this sequence is
' not found, prefix the URL with file://.
nIndex = ci.CacheUrl.IndexOf("://")
If nIndex = -1 Then
strCacheUrl = String.Format("file://", ci.CacheUrl)
End If
' Send the response to the server.
ci.CacheProxyCallback.OnQueryCache(0, _
Response, _
strCacheUrl, _
Context, _
Nothing, _
ci.varContext)
End If
Catch
Throw New COMException()
End Try
End Sub
Requirements
Reference: Add a reference to Microsoft.WindowsMediaServices.
Namespace: Microsoft.WindowsMediaServices.Interop.
Assembly: Microsoft.WindowsMediaServices.dll.
Library: WMSServerTypeLib.dll.
Platform: Windows Server 2003, Enterprise Edition; Windows Server 2003, Datacenter Edition; Windows Server 2008.