コード例 #1
0
        public static void WriteTypeMetaInfo(IStreamWriter writer, ITypeStructure typeItem, bool writeTypeMetaPrefix = true)
        {
            if (writeTypeMetaPrefix)
            {
                writer.WriteUInt8(ValueItem.TypeMetaInfo);
            }
            writer.WriteUInt8(SingleTypeDescr);

            Type type = typeItem.RuntimeType;

            writer.WriteString(type.Assembly.GetName().Name);

            writer.WriteString(type.FullName);

            short itemCount = (short)typeItem.Items.Count;

            writer.WriteInt16(itemCount);


            for (int i = 0; i < itemCount; i++)
            {
                var memberItem = typeItem.Items[i];

                writer.WriteInt16((short)memberItem.Type);  // ItemType Enum
                writer.WriteUInt32(memberItem.TypeId);      // TypeId (Type Hash)
                writer.WriteString(memberItem.Name);        // Property Name
                writer.WriteBool(memberItem.IsNullable);    // Nullable Flag
            }
        }
コード例 #2
0
ファイル: BoolItem.cs プロジェクト: bennil/ioctalk
 public override void WriteValue(IStreamWriter writer, ISerializeContext context, object value)
 {
     NullableWrite(writer, value, () =>
     {
         writer.WriteBool((bool)value);
     });
 }
コード例 #3
0
 public static void SerializeStreamData(IStreamWriter stream, StreamDataCommand command)
 {
     ChannelIdSerializer.SerializeChannelId(stream, command.Channel);
     StreamOffsetSerializer.SerializeStreamOffset(stream, command.Offset);
     stream.WriteBool(command.IsAtEndPosition);
     stream.WriteLength((ushort)command.Payload.Length);
     stream.WriteOctets(command.Payload);
 }