本文整理汇总了C#中Endian类的典型用法代码示例。如果您正苦于以下问题:C# Endian类的具体用法?C# Endian怎么用?C# Endian使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Endian类属于命名空间,在下文中一共展示了Endian类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ByteBuffer
public ByteBuffer(byte[] data, Endian endian)
{
_data = data;
_endian = endian;
_encoding = Encoding.ASCII;
_specificCharacterSet = null;
}
示例2: ExportNamedConstants
public void ExportNamedConstants( GpuNamedConstants pConsts, string filename, Endian endianMode )
{
using ( var f = new FileStream( filename, FileMode.CreateNew, FileAccess.Write ) )
{
ExportNamedConstants( pConsts, f, endianMode );
}
}
示例3: NeedConvert
static private bool NeedConvert(Endian endian)
{
if (endian == Endian.LittleEndian)
return !isLittleEndian;
else
return isLittleEndian;
}
示例4: Create
public static BinaryReader Create(Stream s, Endian e)
{
if (BitConverter.IsLittleEndian)
{
if (Endian.Little == e)
{
return new BinaryReader(s);
}
else
{
return new EndianBinaryReader(s, e);
}
}
else
{
if (Endian.Big == e)
{
return new BinaryReader(s);
}
else
{
return new EndianBinaryReader(s, e);
}
}
}
示例5: writeBytes
/**
* Writes any number of bytes into a byte array, at a given position.
* This is an aux function used when creating the WAV data.
*/
public static void writeBytes(byte[] __bytes, ref int __position, byte[] __newBytes, Endian __endian) {
// Writes __newBytes to __bytes at position __position, increasing the position depending on the length of __newBytes
for (int i = 0; i < __newBytes.Length; i++) {
__bytes[__position] = __newBytes[__endian == Endian.BIG_ENDIAN ? i : __newBytes.Length - i - 1];
__position++;
}
}
示例6: DataStream
/// <summary>
/// Initializes a new instance of the DataStream class.
/// This will store all PDU information for either an InputStream or OutputStream.
/// </summary>
public DataStream()
{
// Test the machine to determine to see what it supports.
this.endianType = (BitConverter.IsLittleEndian ? Endian.Little : Endian.Big);
// create a new MemoryStream
this.Stream = new MemoryStream();
}
示例7: WriteValueF32
public static void WriteValueF32(this Stream stream, Single value, Endian endian)
{
byte[] data = ShouldSwap(endian) == true
? BitConverter.GetBytes(BitConverter.ToInt32(BitConverter.GetBytes(value), 0).Swap())
: BitConverter.GetBytes(value);
Debug.Assert(data.Length == 4);
stream.WriteBytes(data);
}
示例8: LuaCompilerConfig
/// <summary>
/// Constructor
/// </summary>
/// <param name="endianness">Big or little endian</param>
/// <param name="sizeofInt">Size of int in bytes</param>
/// <param name="sizeofSizeT">Size of size_t in bytes</param>
/// <param name="sizeofLuaNumber">Size of lua_Number in bytes</param>
/// <param name="stripDebugInfo">Whether to strip debug info or not</param>
public LuaCompilerConfig(Endian endianness, int sizeofInt, int sizeofSizeT, int sizeofLuaNumber, bool stripDebugInfo)
{
Endianness = endianness;
SizeOfInt = sizeofInt;
SizeOfSizeT = sizeofSizeT;
SizeOfLuaNumber = sizeofLuaNumber;
StripDebugInfo = stripDebugInfo;
}
示例9: FileReference
internal FileReference(DicomStreamOpener streamOpener, long offset, long length, Endian endian, DicomVr vr)
{
StreamOpener = streamOpener;
Offset = offset;
_length = length;
Endian = endian;
Vr = vr;
}
示例10: WriteValueF64
public static void WriteValueF64(this Stream stream, Double value, Endian endian)
{
byte[] data = ShouldSwap(endian) == true
? BitConverter.GetBytes(BitConverter.DoubleToInt64Bits(value).Swap())
: BitConverter.GetBytes(value);
Debug.Assert(data.Length == 8);
stream.WriteBytes(data);
}
示例11: EndianBinaryReader
/// <summary>
/// Constructor.
/// </summary>
/// <param name="data">Data to encapsulate</param>
/// <param name="endian"><see cref="Endian"/> to use when reading the data.</param>
public EndianBinaryReader(byte[] data, Endian endian)
: base(new MemoryStream(data))
{
if (data == null)
throw new ArgumentNullException("data");
this.CurrentEndian = endian;
}
示例12: FileReference
internal FileReference(string file, long offset, long length, Endian endian, DicomVr vr)
{
_filename = file;
_offset = offset;
_length = length;
_endian = endian;
_vr = vr;
}
示例13: ByteBuffer
private ByteBuffer(byte[] data, Endian endian, bool highCapacityMode = false)
{
_data = data;
_endian = endian;
Encoding = Encoding.ASCII;
SpecificCharacterSet = null;
_highCapacityMode = highCapacityMode;
}
示例14: ReadValueGuid
public static Guid ReadValueGuid(this Stream stream, Endian endian)
{
var a = stream.ReadValueS32(endian);
var b = stream.ReadValueS16(endian);
var c = stream.ReadValueS16(endian);
var d = stream.ReadBytes(8);
return new Guid(a, b, c, d);
}
示例15: MPEntryValue
public MPEntryValue(byte[] bytes, int startIndex, Endian endian)
{
ImageAttr = (uint)BitConverterEx.ToInt32(bytes, startIndex + 0, endian);
ImageSize = (uint)BitConverterEx.ToInt32(bytes, startIndex + 4, endian);
ImageDataOffset = (uint)BitConverterEx.ToInt32(bytes, startIndex + 8, endian);
DependentImage1 = (ushort)BitConverterEx.ToInt16(bytes, startIndex + 12, endian);
DependentImage2 = (ushort)BitConverterEx.ToInt16(bytes, startIndex + 14, endian);
}