本文整理汇总了C#中DvInvocation.ReadBinary方法的典型用法代码示例。如果您正苦于以下问题:C# DvInvocation.ReadBinary方法的具体用法?C# DvInvocation.ReadBinary怎么用?C# DvInvocation.ReadBinary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DvInvocation
的用法示例。
在下文中一共展示了DvInvocation.ReadBinary方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoSetBinary
private static int DoSetBinary(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderOpenhomeOrgTestBasic1 self = (DvProviderOpenhomeOrgTestBasic1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
byte[] valueBin;
try
{
invocation.ReadStart();
valueBin = invocation.ReadBinary("ValueBin");
invocation.ReadEnd();
self.SetBinary(invocation, valueBin);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "SetBinary");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", new object[] { "SetBinary" }));
return -1;
}
catch (Exception e)
{
System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "SetBinary" });
System.Diagnostics.Debug.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)
{
System.Diagnostics.Debug.WriteLine("WARNING: unexpected exception {0} thrown by {1}", new object[] { e, "SetBinary" });
System.Diagnostics.Debug.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例2: DoEchoBinary
private static int DoEchoBinary(IntPtr aPtr, IntPtr aInvocation, uint aVersion)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderOpenhomeOrgTestBasic1 self = (DvProviderOpenhomeOrgTestBasic1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
byte[] value;
byte[] result;
try
{
invocation.ReadStart();
value = invocation.ReadBinary("Value");
invocation.ReadEnd();
self.EchoBinary(aVersion, value, out result);
}
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.WriteBinary("Result", result);
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;
}
示例3: DoSetBinary
private static int DoSetBinary(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderOpenhomeOrgTestBasic1 self = (DvProviderOpenhomeOrgTestBasic1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
byte[] valueBin;
try
{
invocation.ReadStart();
valueBin = invocation.ReadBinary("ValueBin");
invocation.ReadEnd();
self.SetBinary(invocation, valueBin);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "SetBinary");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "SetBinary"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "SetBinary", 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, "SetBinary", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}
示例4: DoSet
private static int DoSet(IntPtr aPtr, IntPtr aInvocation)
{
GCHandle gch = GCHandle.FromIntPtr(aPtr);
DvProviderAvOpenhomeOrgCredentials1 self = (DvProviderAvOpenhomeOrgCredentials1)gch.Target;
DvInvocation invocation = new DvInvocation(aInvocation);
string id;
string userName;
byte[] password;
try
{
invocation.ReadStart();
id = invocation.ReadString("Id");
userName = invocation.ReadString("UserName");
password = invocation.ReadBinary("Password");
invocation.ReadEnd();
self.Set(invocation, id, userName, password);
}
catch (ActionError e)
{
invocation.ReportActionError(e, "Set");
return -1;
}
catch (PropertyUpdateError)
{
invocation.ReportError(501, String.Format("Invalid value for property {0}", "Set"));
return -1;
}
catch (Exception e)
{
Console.WriteLine("WARNING: unexpected exception {0}(\"{1}\") thrown by {2} in {3}", e.GetType(), e.Message, "Set", 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, "Set", e.TargetSite.Name);
Console.WriteLine(" Only ActionError can be thrown by action response writer");
}
return 0;
}