Example #1
0
 public void Visit(uint tag, string name, bool require, ref IStruct val)
 {
     if (val == null)
     {
         return;
     }
     if (require)
     {
         PackHead(tag, SdpPackDataType.SdpPackDataType_StructBegin);
         val.Visit(this);
         PackHead(0u, SdpPackDataType.SdpPackDataType_StructEnd);
     }
     else
     {
         SdpWriter sdp = new SdpWriter();
         sdp.PackHead(tag, SdpPackDataType.SdpPackDataType_StructBegin);
         uint iStartPos = sdp.CurrPos();
         val.Visit(sdp);
         if (iStartPos < sdp.CurrPos())
         {
             sdp.PackHead(0u, SdpPackDataType.SdpPackDataType_StructEnd);
             WriteRawByte(sdp.ToBytes());
         }
     }
 }
Example #2
0
 public void Visit(uint tag, string name, bool require, ref IStruct val)
 {
     if (SkipToTag(tag))
     {
         SdpPackDataType type = UnPackHead(ref tag);
         if (type == SdpPackDataType.SdpPackDataType_StructBegin)
         {
             val.Visit(this);
             SkipToStructEnd();
         }
     }
 }