public virtual void WriteTypeInfo(IWriteContext context, ArrayInfo info) { BitMap4 typeInfoBitmap = new BitMap4(2); typeInfoBitmap.Set(0, info.Primitive()); typeInfoBitmap.Set(1, info.Nullable()); context.WriteByte(typeInfoBitmap.GetByte(0)); }
// ITypeHandler4 override public override void Write(IWriteContext context, object obj) { // Write the data. var cfi = (CustomFieldInfo)obj; context.WriteInt(cfi.m_flid); context.WriteInt((int)cfi.m_fieldType); context.WriteInt(cfi.m_destinationClass); var cvtr = new UnicodeEncoding(); var bytes = cvtr.GetBytes(cfi.m_classname); context.WriteInt(bytes.Length); context.WriteBytes(bytes); bytes = cvtr.GetBytes(cfi.m_fieldname); context.WriteInt(bytes.Length); context.WriteBytes(bytes); if (cfi.m_fieldname != cfi.Label) { // marker to distinguish this from any other optional info we may one day write, // and from cases where no label is written. context.WriteByte(1); bytes = cvtr.GetBytes(cfi.Label); context.WriteInt(bytes.Length); context.WriteBytes(bytes); } if (!String.IsNullOrEmpty(cfi.m_fieldHelp)) { context.WriteByte(2); bytes = cvtr.GetBytes(cfi.m_fieldHelp); context.WriteInt(bytes.Length); context.WriteBytes(bytes); } if (cfi.m_fieldListRoot != Guid.Empty) { context.WriteByte(3); bytes = cfi.m_fieldListRoot.ToByteArray(); context.WriteInt(bytes.Length); context.WriteBytes(bytes); } if (cfi.m_fieldWs != 0) { context.WriteByte(4); context.WriteInt(cfi.m_fieldWs); } // End marker context.WriteByte(0); }
public override void Write(IWriteContext context, object obj) { context.WriteByte(GetEncodedByteValue(obj)); }
public override void Write(IWriteContext context, object obj) { context.WriteByte((byte)(((sbyte)obj) + 128)); }