本文整理汇总了C#中DvInvocation.WriteString方法的典型用法代码示例。如果您正苦于以下问题:C# DvInvocation.WriteString方法的具体用法?C# DvInvocation.WriteString怎么用?C# DvInvocation.WriteString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DvInvocation
的用法示例。
在下文中一共展示了DvInvocation.WriteString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoCreateRecordSchedule
private static int DoCreateRecordSchedule(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgScheduledRecording1 self = (DvProviderUpnpOrgScheduledRecording1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
string elements;
string recordScheduleID;
string result;
uint updateID;
try
{
invocation.ReadStart();
elements = invocation.ReadString("Elements");
invocation.ReadEnd();
self.CreateRecordSchedule(aVersion, elements, out recordScheduleID, out result, out updateID);
}
catch (ActionError)
{
invocation.ReportError(501, "Invalid XML");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, "Invalid XML");
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError can be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("RecordScheduleID", recordScheduleID);
invocation.WriteString("Result", result);
invocation.WriteUint("UpdateID", updateID);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
return 0;
}
示例2: DoGetTransportSettings
private static int DoGetTransportSettings(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgAVTransport1 self = (DvProviderUpnpOrgAVTransport1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint instanceID;
string playMode;
string recQualityMode;
try
{
invocation.ReadStart();
instanceID = invocation.ReadUint("InstanceID");
invocation.ReadEnd();
self.GetTransportSettings(invocation, instanceID, out playMode, out recQualityMode);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "GetTransportSettings");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetTransportSettings"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetTransportSettings", e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("PlayMode", playMode);
invocation.WriteString("RecQualityMode", recQualityMode);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetTransportSettings", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例3: DoGetCurrentConnectionInfo
private static int DoGetCurrentConnectionInfo(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgConnectionManager1 self = (DvProviderUpnpOrgConnectionManager1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
int connectionID;
int rcsID;
int aVTransportID;
string protocolInfo;
string peerConnectionManager;
int peerConnectionID;
string direction;
string status;
try
{
invocation.ReadStart();
connectionID = invocation.ReadInt("ConnectionID");
invocation.ReadEnd();
self.GetCurrentConnectionInfo(invocation, connectionID, out rcsID, out aVTransportID, out protocolInfo, out peerConnectionManager, out peerConnectionID, out direction, out status);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "GetCurrentConnectionInfo");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "GetCurrentConnectionInfo" }));
return -1;
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetCurrentConnectionInfo" });
System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteInt("RcsID", rcsID);
invocation.WriteInt("AVTransportID", aVTransportID);
invocation.WriteString("ProtocolInfo", protocolInfo);
invocation.WriteString("PeerConnectionManager", peerConnectionManager);
invocation.WriteInt("PeerConnectionID", peerConnectionID);
invocation.WriteString("Direction", direction);
invocation.WriteString("Status", status);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetCurrentConnectionInfo" });
System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例4: DoListPresets
private static int DoListPresets(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgRenderingControl1 self = (DvProviderUpnpOrgRenderingControl1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint instanceID;
string currentPresetNameList;
try
{
invocation.ReadStart();
instanceID = invocation.ReadUint("InstanceID");
invocation.ReadEnd();
self.ListPresets(aVersion, instanceID, out currentPresetNameList);
}
catch (ActionError)
{
invocation.ReportError(501, "Invalid XML");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, "Invalid XML");
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError can be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("CurrentPresetNameList", currentPresetNameList);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
return 0;
}
示例5: DoGetMediaInfo
private static int DoGetMediaInfo(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgAVTransport1 self = (DvProviderUpnpOrgAVTransport1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint instanceID;
uint nrTracks;
string mediaDuration;
string currentURI;
string currentURIMetaData;
string nextURI;
string nextURIMetaData;
string playMedium;
string recordMedium;
string writeStatus;
try
{
invocation.ReadStart();
instanceID = invocation.ReadUint("InstanceID");
invocation.ReadEnd();
self.GetMediaInfo(invocation, instanceID, out nrTracks, out mediaDuration, out currentURI, out currentURIMetaData, out nextURI, out nextURIMetaData, out playMedium, out recordMedium, out writeStatus);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "GetMediaInfo");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetMediaInfo"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetMediaInfo", e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteUint("NrTracks", nrTracks);
invocation.WriteString("MediaDuration", mediaDuration);
invocation.WriteString("CurrentURI", currentURI);
invocation.WriteString("CurrentURIMetaData", currentURIMetaData);
invocation.WriteString("NextURI", nextURI);
invocation.WriteString("NextURIMetaData", nextURIMetaData);
invocation.WriteString("PlayMedium", playMedium);
invocation.WriteString("RecordMedium", recordMedium);
invocation.WriteString("WriteStatus", writeStatus);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetMediaInfo", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例6: DoGetOnEffectParameters
private static int DoGetOnEffectParameters(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgDimming1 self = (DvProviderUpnpOrgDimming1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
string retOnEffect;
uint retOnEffectLevel;
try
{
invocation.ReadStart();
invocation.ReadEnd();
self.GetOnEffectParameters(aVersion, out retOnEffect, out retOnEffectLevel);
}
catch (ActionError)
{
invocation.ReportError(501, "Invalid XML");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, "Invalid XML");
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError can be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("retOnEffect", retOnEffect);
invocation.WriteUint("retOnEffectLevel", retOnEffectLevel);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
return 0;
}
示例7: DoBrowse
private static int DoBrowse(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgContentDirectory2 self = (DvProviderUpnpOrgContentDirectory2)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
string objectID;
string browseFlag;
string filter;
uint startingIndex;
uint requestedCount;
string sortCriteria;
string result;
uint numberReturned;
uint totalMatches;
uint updateID;
try
{
invocation.ReadStart();
objectID = invocation.ReadString("ObjectID");
browseFlag = invocation.ReadString("BrowseFlag");
filter = invocation.ReadString("Filter");
startingIndex = invocation.ReadUint("StartingIndex");
requestedCount = invocation.ReadUint("RequestedCount");
sortCriteria = invocation.ReadString("SortCriteria");
invocation.ReadEnd();
self.Browse(invocation, objectID, browseFlag, filter, startingIndex, requestedCount, sortCriteria, out result, out numberReturned, out totalMatches, out updateID);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "Browse");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "Browse"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Browse", e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("Result", result);
invocation.WriteUint("NumberReturned", numberReturned);
invocation.WriteUint("TotalMatches", totalMatches);
invocation.WriteUint("UpdateID", updateID);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Browse", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例8: DoDeviceSettings
private static int DoDeviceSettings(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderAvOpenhomeOrgExakt2 self = (DvProviderAvOpenhomeOrgExakt2)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
string deviceId;
string settings;
try
{
invocation.ReadStart();
deviceId = invocation.ReadString("DeviceId");
invocation.ReadEnd();
self.DeviceSettings(invocation, deviceId, out settings);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "DeviceSettings");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "DeviceSettings"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "DeviceSettings", e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("Settings", settings);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "DeviceSettings", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例9: DoProduct
private static int DoProduct(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderAvOpenhomeOrgProduct1 self = (DvProviderAvOpenhomeOrgProduct1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
string room;
string name;
string info;
string url;
string imageUri;
try
{
invocation.ReadStart();
invocation.ReadEnd();
self.Product(invocation, out room, out name, out info, out url, out imageUri);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "Product");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "Product" }));
return -1;
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Product" });
System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("Room", room);
invocation.WriteString("Name", name);
invocation.WriteString("Info", info);
invocation.WriteString("Url", url);
invocation.WriteString("ImageUri", imageUri);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Product" });
System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例10: DoProduct
private static int DoProduct(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderAvOpenhomeOrgProduct1 self = (DvProviderAvOpenhomeOrgProduct1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
string room;
string name;
string info;
string url;
string imageUri;
try
{
invocation.ReadStart();
invocation.ReadEnd();
self.Product(aVersion, out room, out name, out info, out url, out imageUri);
}
catch (ActionError)
{
invocation.ReportError(501, "Invalid XML");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, "Invalid XML");
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError can be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("Room", room);
invocation.WriteString("Name", name);
invocation.WriteString("Info", info);
invocation.WriteString("Url", url);
invocation.WriteString("ImageUri", imageUri);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
return 0;
}
示例11: DoSource
private static int DoSource(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderAvOpenhomeOrgProduct1 self = (DvProviderAvOpenhomeOrgProduct1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint index;
string systemName;
string type;
string name;
bool visible;
try
{
invocation.ReadStart();
index = invocation.ReadUint("Index");
invocation.ReadEnd();
self.Source(aVersion, index, out systemName, out type, out name, out visible);
}
catch (ActionError)
{
invocation.ReportError(501, "Invalid XML");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, "Invalid XML");
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError can be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("SystemName", systemName);
invocation.WriteString("Type", type);
invocation.WriteString("Name", name);
invocation.WriteBool("Visible", visible);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2}", e.GetType(), e.Message, e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
System.Diagnostics.Process.GetCurrentProcess().Kill();
}
return 0;
}
示例12: DoSubscribe
private static int DoSubscribe(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderOpenhomeOrgSubscriptionLongPoll1 self = (DvProviderOpenhomeOrgSubscriptionLongPoll1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
string clientId;
string udn;
string service;
uint requestedDuration;
string sid;
uint duration;
try
{
invocation.ReadStart();
clientId = invocation.ReadString("ClientId");
udn = invocation.ReadString("Udn");
service = invocation.ReadString("Service");
requestedDuration = invocation.ReadUint("RequestedDuration");
invocation.ReadEnd();
self.Subscribe(invocation, clientId, udn, service, requestedDuration, out sid, out duration);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "Subscribe");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "Subscribe" }));
return -1;
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Subscribe" });
System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("Sid", sid);
invocation.WriteUint("Duration", duration);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "Subscribe" });
System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例13: DoGetPropertyUpdates
private static int DoGetPropertyUpdates(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderOpenhomeOrgSubscriptionLongPoll1 self = (DvProviderOpenhomeOrgSubscriptionLongPoll1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
string clientId;
string updates;
try
{
invocation.ReadStart();
clientId = invocation.ReadString("ClientId");
invocation.ReadEnd();
self.GetPropertyUpdates(invocation, clientId, out updates);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "GetPropertyUpdates");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "GetPropertyUpdates" }));
return -1;
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetPropertyUpdates" });
System.Diagnostics.Debug.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("Updates", updates);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "GetPropertyUpdates" });
System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例14: DoGetCurrentConnectionIDs
private static int DoGetCurrentConnectionIDs(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgConnectionManager1 self = (DvProviderUpnpOrgConnectionManager1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
string connectionIDs;
try
{
invocation.ReadStart();
invocation.ReadEnd();
self.GetCurrentConnectionIDs(invocation, out connectionIDs);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "GetCurrentConnectionIDs");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetCurrentConnectionIDs"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetCurrentConnectionIDs", e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("ConnectionIDs", connectionIDs);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetCurrentConnectionIDs", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例15: DoChannel
private static int DoChannel(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderAvOpenhomeOrgRadio1 self = (DvProviderAvOpenhomeOrgRadio1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
string uri;
string metadata;
try
{
invocation.ReadStart();
invocation.ReadEnd();
self.Channel(invocation, out uri, out metadata);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "Channel");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "Channel"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Channel", e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("Uri", uri);
invocation.WriteString("Metadata", metadata);
invocation.WriteEnd();
}
catch (ActionError)
{
return -1;
}
catch (System.Exception e)
{
Console.WriteLine("ERROR: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Channel", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}