System.IO.BinaryWriter.WriteInt32BigEndian(int)

Here are the examples of the csharp api System.IO.BinaryWriter.WriteInt32BigEndian(int) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

1 Examples 7

19 Source : BinaryStreamExtensions.cs
with GNU General Public License v3.0
from JayArrowz

public static void WriteAwkwardInt(this BinaryWriter writer, int value)
        {
            if (value < -1)
            {
                throw new ArgumentException("Awkward int can not be less than -1.");
            }

            if (value == -1)
            {
                writer.WriteInt16BigEndian(short.MaxValue);
            }
            else if (value < short.MaxValue)
            {
                writer.WriteInt16BigEndian((short)value);
            }
            else
            {
                writer.WriteInt32BigEndian((int)(value | 0x80000000));
            }
        }