コード例 #1
0
        public void Setup()
        {
            _stream = new MemoryStream();
            var cgm = new BinaryCgmFile();

            _commandFactory = new Mock <ICommandFactory>();

            _writer = new DefaultBinaryWriter(_stream, cgm);
            _reader = new DefaultBinaryReader(_stream, cgm, _commandFactory.Object);
        }
コード例 #2
0
ファイル: BinaryCGMFile.cs プロジェクト: twenzel/CGM
        /// <summary>
        /// Writes the CGM commands to the given stream-
        /// </summary>
        /// <param name="stream">The stream to write the content to.</param>
        public void WriteFile(Stream stream)
        {
            ResetMetaDefinitions();

            using var writer = new DefaultBinaryWriter(stream, this);
            foreach (var command in _commands)
            {
                writer.WriteCommand(command);
            }

            _messages.AddRange(writer.Messages);
        }