本文整理汇总了C#中Udbus.BodyAdd_Structure方法的典型用法代码示例。如果您正苦于以下问题:C# Udbus.BodyAdd_Structure方法的具体用法?C# Udbus.BodyAdd_Structure怎么用?C# Udbus.BodyAdd_Structure使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Udbus
的用法示例。
在下文中一共展示了Udbus.BodyAdd_Structure方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteStruct
private int WriteStruct(Udbus.Serialization.UdbusMessageBuilder builder, object[] structFields)
{
int result = 0;
if (this.objectDelegate == null) // If no fields
{
if (structFields != null && structFields.Length > 0) // If there are fields to write
{
result = -1;
throw new ApplicationException("Struct has no delegates to write struct fields with");
} // Ends if there are fields to write
} // Ends if no fields
else // Else fields
{
result = builder.BodyAdd_Structure().Result;
if (result == 0) // If started struct
{
// Yay casting something to what we already know it is because, yeah, that's how this works...
System.Delegate[] delegates = this.objectDelegate.GetInvocationList();
int i = 0;
foreach (MarshalDelegate<object> fn in delegates)
{
result = fn(builder, structFields[i]);
if (result != 0) // If failed to read result
{
break;
} // Ends if failed to read result
++i;
} // Ends loop over delegates
if (result == 0) // If read fields
{
result = builder.BodyAdd_StructureEnd().Result;
} // Ends if read read fields
else // Else failed to read fields
{
} // Ends if failed to read fields
} // Ends if started struct
else // Else failed to start struct
{
} // Ends else failed to start struct
} // Ends else fields
return result;
}