本文整理汇总了C#中DvInvocation.ReadUint方法的典型用法代码示例。如果您正苦于以下问题:C# DvInvocation.ReadUint方法的具体用法?C# DvInvocation.ReadUint怎么用?C# DvInvocation.ReadUint使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DvInvocation
的用法示例。
在下文中一共展示了DvInvocation.ReadUint方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoGetColorComponents
private static int DoGetColorComponents(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderOpenhomeOrgTestLights1 self = (DvProviderOpenhomeOrgTestLights1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint color;
uint brightness;
uint red;
uint green;
uint blue;
try
{
invocation.ReadStart();
color = invocation.ReadUint("Color");
invocation.ReadEnd();
self.GetColorComponents(invocation, color, out brightness, out red, out green, out blue);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "GetColorComponents");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetColorComponents"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetColorComponents", e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteUint("Brightness", brightness);
invocation.WriteUint("Red", red);
invocation.WriteUint("Green", green);
invocation.WriteUint("Blue", blue);
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, "GetColorComponents", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例2: DoGetPositionInfo
private static int DoGetPositionInfo(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgAVTransport1 self = (DvProviderUpnpOrgAVTransport1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint instanceID;
uint track;
string trackDuration;
string trackMetaData;
string trackURI;
string relTime;
string absTime;
int relCount;
int absCount;
try
{
invocation.ReadStart();
instanceID = invocation.ReadUint("InstanceID");
invocation.ReadEnd();
self.GetPositionInfo(invocation, instanceID, out track, out trackDuration, out trackMetaData, out trackURI, out relTime, out absTime, out relCount, out absCount);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "GetPositionInfo");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetPositionInfo"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetPositionInfo", e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteUint("Track", track);
invocation.WriteString("TrackDuration", trackDuration);
invocation.WriteString("TrackMetaData", trackMetaData);
invocation.WriteString("TrackURI", trackURI);
invocation.WriteString("RelTime", relTime);
invocation.WriteString("AbsTime", absTime);
invocation.WriteInt("RelCount", relCount);
invocation.WriteInt("AbsCount", absCount);
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, "GetPositionInfo", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例3: DoSetStateVariables
private static int DoSetStateVariables(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgRenderingControl2 self = (DvProviderUpnpOrgRenderingControl2)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint instanceID;
string renderingControlUDN;
string serviceType;
string serviceId;
string stateVariableValuePairs;
string stateVariableList;
try
{
invocation.ReadStart();
instanceID = invocation.ReadUint("InstanceID");
renderingControlUDN = invocation.ReadString("RenderingControlUDN");
serviceType = invocation.ReadString("ServiceType");
serviceId = invocation.ReadString("ServiceId");
stateVariableValuePairs = invocation.ReadString("StateVariableValuePairs");
invocation.ReadEnd();
self.SetStateVariables(invocation, instanceID, renderingControlUDN, serviceType, serviceId, stateVariableValuePairs, out stateVariableList);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "SetStateVariables");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "SetStateVariables"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "SetStateVariables", e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("StateVariableList", stateVariableList);
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, "SetStateVariables", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例4: DoSetVolumeDB
private static int DoSetVolumeDB(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgRenderingControl1 self = (DvProviderUpnpOrgRenderingControl1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint instanceID;
string channel;
int desiredVolume;
try
{
invocation.ReadStart();
instanceID = invocation.ReadUint("InstanceID");
channel = invocation.ReadString("Channel");
desiredVolume = invocation.ReadInt("DesiredVolume");
invocation.ReadEnd();
self.SetVolumeDB(aVersion, instanceID, channel, desiredVolume);
}
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.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: DoDeleteAll
private static int DoDeleteAll(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderAvOpenhomeOrgPlaylistManager1 self = (DvProviderAvOpenhomeOrgPlaylistManager1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint id;
try
{
invocation.ReadStart();
id = invocation.ReadUint("Id");
invocation.ReadEnd();
self.DeleteAll(invocation, id);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "DeleteAll");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "DeleteAll"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "DeleteAll", e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
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, "DeleteAll", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例6: DoGetTransportInfo
private static int DoGetTransportInfo(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgAVTransport1 self = (DvProviderUpnpOrgAVTransport1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint instanceID;
string currentTransportState;
string currentTransportStatus;
string currentSpeed;
try
{
invocation.ReadStart();
instanceID = invocation.ReadUint("InstanceID");
invocation.ReadEnd();
self.GetTransportInfo(aVersion, instanceID, out currentTransportState, out currentTransportStatus, out currentSpeed);
}
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("CurrentTransportState", currentTransportState);
invocation.WriteString("CurrentTransportStatus", currentTransportStatus);
invocation.WriteString("CurrentSpeed", currentSpeed);
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: DoStopTransferResource
private static int DoStopTransferResource(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgContentDirectory2 self = (DvProviderUpnpOrgContentDirectory2)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint transferID;
try
{
invocation.ReadStart();
transferID = invocation.ReadUint("TransferID");
invocation.ReadEnd();
self.StopTransferResource(invocation, transferID);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "StopTransferResource");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "StopTransferResource"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "StopTransferResource", e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
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, "StopTransferResource", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例8: DoBrowseRecordTasks
private static int DoBrowseRecordTasks(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgScheduledRecording1 self = (DvProviderUpnpOrgScheduledRecording1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
string recordScheduleID;
string filter;
uint startingIndex;
uint requestedCount;
string sortCriteria;
string result;
uint numberReturned;
uint totalMatches;
uint updateID;
try
{
invocation.ReadStart();
recordScheduleID = invocation.ReadString("RecordScheduleID");
filter = invocation.ReadString("Filter");
startingIndex = invocation.ReadUint("StartingIndex");
requestedCount = invocation.ReadUint("RequestedCount");
sortCriteria = invocation.ReadString("SortCriteria");
invocation.ReadEnd();
self.BrowseRecordTasks(aVersion, recordScheduleID, filter, startingIndex, requestedCount, sortCriteria, out result, out numberReturned, out totalMatches, 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("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}", 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;
}
示例9: 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;
}
示例10: DoSetStateVariables
private static int DoSetStateVariables(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgAVTransport2 self = (DvProviderUpnpOrgAVTransport2)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint instanceID;
string aVTransportUDN;
string serviceType;
string serviceId;
string stateVariableValuePairs;
string stateVariableList;
try
{
invocation.ReadStart();
instanceID = invocation.ReadUint("InstanceID");
aVTransportUDN = invocation.ReadString("AVTransportUDN");
serviceType = invocation.ReadString("ServiceType");
serviceId = invocation.ReadString("ServiceId");
stateVariableValuePairs = invocation.ReadString("StateVariableValuePairs");
invocation.ReadEnd();
self.SetStateVariables(aVersion, instanceID, aVTransportUDN, serviceType, serviceId, stateVariableValuePairs, out stateVariableList);
}
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("StateVariableList", stateVariableList);
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: DoGetDeviceCapabilities
private static int DoGetDeviceCapabilities(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgAVTransport2 self = (DvProviderUpnpOrgAVTransport2)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint instanceID;
string playMedia;
string recMedia;
string recQualityModes;
try
{
invocation.ReadStart();
instanceID = invocation.ReadUint("InstanceID");
invocation.ReadEnd();
self.GetDeviceCapabilities(aVersion, instanceID, out playMedia, out recMedia, out recQualityModes);
}
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("PlayMedia", playMedia);
invocation.WriteString("RecMedia", recMedia);
invocation.WriteString("RecQualityModes", recQualityModes);
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: DoSetNextAVTransportURI
private static int DoSetNextAVTransportURI(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgAVTransport2 self = (DvProviderUpnpOrgAVTransport2)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint instanceID;
string nextURI;
string nextURIMetaData;
try
{
invocation.ReadStart();
instanceID = invocation.ReadUint("InstanceID");
nextURI = invocation.ReadString("NextURI");
nextURIMetaData = invocation.ReadString("NextURIMetaData");
invocation.ReadEnd();
self.SetNextAVTransportURI(invocation, instanceID, nextURI, nextURIMetaData);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "SetNextAVTransportURI");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "SetNextAVTransportURI"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "SetNextAVTransportURI", e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
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, "SetNextAVTransportURI", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例13: DoStopTransferResource
private static int DoStopTransferResource(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderUpnpOrgContentDirectory2 self = (DvProviderUpnpOrgContentDirectory2)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint transferID;
try
{
invocation.ReadStart();
transferID = invocation.ReadUint("TransferID");
invocation.ReadEnd();
self.StopTransferResource(aVersion, transferID);
}
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.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;
}
示例14: DoGetRoom
private static int DoGetRoom(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderOpenhomeOrgTestLights1 self = (DvProviderOpenhomeOrgTestLights1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint index;
string roomName;
try
{
invocation.ReadStart();
index = invocation.ReadUint("Index");
invocation.ReadEnd();
self.GetRoom(invocation, index, out roomName);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "GetRoom");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "GetRoom"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "GetRoom", e.TargetSite.Name);
Console.WriteLine(" Only ActionError or PropertyUpdateError should be thrown by actions");
return -1;
}
try
{
invocation.WriteStart();
invocation.WriteString("RoomName", roomName);
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, "GetRoom", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例15: DoSetId
private static int DoSetId(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderAvOpenhomeOrgRadio1 self = (DvProviderAvOpenhomeOrgRadio1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
uint value;
string uri;
try
{
invocation.ReadStart();
value = invocation.ReadUint("Value");
uri = invocation.ReadString("Uri");
invocation.ReadEnd();
self.SetId(aVersion, value, uri);
}
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.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;
}