public void WriteToBms1Stream(IBms1Writer writer)
        {
            writer.WriteBlock(Bms1BlockTypeId, () =>
                {
                    writer.WriteString(InterfaceName);
                    writer.WriteInt16(InterfaceVersion);
                    writer.WriteString(ApplicationName);

                    ApplicationVersion.WriteToBms1Stream(writer);

                    writer.WriteString(ApplicationInstance);
                });
        }
        public void WriteBlock(IBms1Writer writer, int blockTypeId, Action writeDtoAction)
        {
            WriteAttributes();
            if (blockTypeId < 0)
            {
                Stream.Write((byte)Bms1Tag.BlockStart);
            }
            else
            {
                Stream.Write((byte)(Bms1Tag.BlockStart + 1)); // 247
                Stream.Write((UInt16)blockTypeId);
            }

            writeDtoAction();
            
            Stream.Write((byte)Bms1Tag.BlockEnd);
            ClearAttributes();
        }
 public abstract void WriteToBms1Stream(IBms1Writer writer);
 public void WriteToBms1Stream(IBms1Writer writer)
 {
     writer.WriteBlock(Bms1BlockTypeId, () => { });
 }
 /// <summary>
 /// Here we demonstrate how to stream a member class of a closed library.
 /// The extension method writes System.Version to a BMS1 stream.
 /// </summary>
 public static void WriteToBms1Stream(this Version version, IBms1Writer writer)
 {
     if (version == null)
     {
         writer.WriteBlock(null);
     }
     else
     {
         writer.WriteBlock(() =>
             {
                 writer.WriteInt32(version.Major);
                 writer.WriteInt32(version.Minor);
                 writer.WriteInt32(version.Build);
                 writer.WriteInt32(version.Revision);
             });
     }
 }
 public override void WriteToBms1Stream(IBms1Writer writer)
 {
     writer.WriteBlock(Bms1BlockTypeId, () =>
         {
             Version.WriteToBms1Stream(writer);
             writer.WriteString(AdditionaInfo); // not sent before V.2
         });
 }
 public override void WriteToBms1Stream(IBms1Writer writer)
 {
     writer.WriteBlock(Bms1BlockTypeId, () =>
     {
         writer.WriteString(Version);
         writer.WriteEnum(CpuType);
         // Intentionally, we do not write AdditionalInfo. This simulates an older sender and a newer receiver;
     });
 }