Here are the examples of the csharp api System.IO.Stream.ReadUInt32(ByteOrder) taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
19
Source : StreamExtensions.cs
with GNU General Public License v3.0
from ME3Tweaks
with GNU General Public License v3.0
from ME3Tweaks
public static T ReadEnum<T>(this Stream stream, ByteOrder byteOrder = ByteOrder.LittleEndian)
{
var type = typeof (T);
object value;
switch (EnumTypeCache.Get(type))
{
case TypeCode.Byte:
{
value = stream.ReadByte();
break;
}
case TypeCode.Int16:
{
value = stream.ReadInt16(byteOrder);
break;
}
case TypeCode.Int32:
{
value = stream.ReadInt32(byteOrder);
break;
}
case TypeCode.Int64:
{
value = stream.ReadInt64(byteOrder);
break;
}
case TypeCode.SByte:
{
value = stream.ReadSByte();
break;
}
case TypeCode.UInt16:
{
value = stream.ReadUInt16(byteOrder);
break;
}
case TypeCode.UInt32:
{
value = stream.ReadUInt32(byteOrder);
break;
}
case TypeCode.UInt64:
{
value = stream.ReadUInt64(byteOrder);
break;
}
default:
{
throw new NotSupportedException();
}
}
return (T) Enum.ToObject(type, value);
}