Avalon.Utility.Stream.PacketWriter.WriteAsciiNull C# (CSharp) 메소드

WriteAsciiNull() 공개 메소드

Writes a dynamic-length ASCII-encoded string value to the underlying stream, followed by a 1-byte null character.
public WriteAsciiNull ( string value ) : void
value string
리턴 void
        public void WriteAsciiNull(string value)
        {
            if (value == null)
            {
                Console.WriteLine("Network: Attempted to WriteAsciiNull() with null value");
                value = String.Empty;
            }

            int length = value.Length;

            m_Stream.SetLength(m_Stream.Length + length + 1);

            Encoding.ASCII.GetBytes(value, 0, length, m_Stream.GetBuffer(), (int)m_Stream.Position);
            m_Stream.Position += length + 1;

            /*byte[] buffer = Encoding.ASCII.GetBytes( value );

            m_Stream.Write( buffer, 0, buffer.Length );
            m_Stream.WriteByte( 0 );*/
        }