• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Endian类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中Endian的典型用法代码示例。如果您正苦于以下问题:C# Endian类的具体用法?C# Endian怎么用?C# Endian使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Endian类属于命名空间,在下文中一共展示了Endian类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ByteBuffer

 public ByteBuffer(byte[] data, Endian endian)
 {
     _data = data;
     _endian = endian;
     _encoding = Encoding.ASCII;
     _specificCharacterSet = null;
 }
开发者ID:nhannd,项目名称:Xian,代码行数:7,代码来源:ByteBuffer.cs


示例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 );
				}
			}
开发者ID:ryan-bunker,项目名称:axiom3d,代码行数:7,代码来源:GpuProgramParameters.GpuNamedConstantSerializer.cs


示例3: NeedConvert

 static private bool NeedConvert(Endian endian)
 {
     if (endian == Endian.LittleEndian)
         return !isLittleEndian;
     else
         return isLittleEndian;
 }
开发者ID:superkaka,项目名称:mycsharp,代码行数:7,代码来源:NetUtils.cs


示例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);
         }
     }
 }
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:25,代码来源:Endian.cs


示例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++;
		}
	}
开发者ID:OJ3D,项目名称:unity-tidbits,代码行数:11,代码来源:ByteUtils.cs


示例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();
        }
开发者ID:mcgredonps,项目名称:Unity_DIS,代码行数:12,代码来源:DataStream.cs


示例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);
 }
开发者ID:Juvidoh,项目名称:me3-lazarus,代码行数:8,代码来源:F32.cs


示例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;
	    }
开发者ID:arsaccol,项目名称:SLED,代码行数:16,代码来源:ILuaCompiler.cs


示例9: FileReference

		internal FileReference(DicomStreamOpener streamOpener, long offset, long length, Endian endian, DicomVr vr)
		{
			StreamOpener = streamOpener;
			Offset = offset;
			_length = length;
			Endian = endian;
			Vr = vr;
		}
开发者ID:m-berkani,项目名称:ClearCanvas,代码行数:8,代码来源:FileReference.cs


示例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);
 }
开发者ID:XxRaPiDK3LLERxX,项目名称:nucleuscoop,代码行数:8,代码来源:F64.cs


示例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;
        }
开发者ID:lioncash,项目名称:GameMusicInfoLib,代码行数:13,代码来源:EndianBinaryReader.cs


示例12: FileReference

		internal FileReference(string file, long offset, long length, Endian endian, DicomVr vr)
		{
			_filename = file;
			_offset = offset;
			_length = length;
			_endian = endian;
			_vr = vr;
		}
开发者ID:UIKit0,项目名称:ClearCanvas,代码行数:8,代码来源:FileReference.cs


示例13: ByteBuffer

		private ByteBuffer(byte[] data, Endian endian, bool highCapacityMode = false)
		{
			_data = data;
			_endian = endian;
			Encoding = Encoding.ASCII;
			SpecificCharacterSet = null;
			_highCapacityMode = highCapacityMode;
		}
开发者ID:kevinpig,项目名称:MyRepository,代码行数:8,代码来源:ByteBuffer.cs


示例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);
 }
开发者ID:XxRaPiDK3LLERxX,项目名称:nucleuscoop,代码行数:8,代码来源:Guid.cs


示例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);
 }
开发者ID:shimat,项目名称:mpo2jpg,代码行数:8,代码来源:MPEntryValue.cs


示例16: NeedToSwapBytes

        public static bool NeedToSwapBytes(Endian endian)
        {
            if (BitConverter.IsLittleEndian)
            {
                return Endian.Little != endian;
            }

            return Endian.Big != endian;
        }
开发者ID:kevinpig,项目名称:MyRepository,代码行数:9,代码来源:ByteConverter.cs


示例17: EndianStream

        /// <summary>
        /// Initializes a new instance of the <see cref="EndianStream"/> class.
        /// </summary>
        /// <param name="stream">The stream to read from and write to.</param>
        /// <param name="endianness">The initial endianness to use when operating on the stream.</param>
        /// <exception cref="System.ArgumentException">Thrown if <paramref name="stream"/> is not both readable and writable.</exception>
        public EndianStream(Stream stream, Endian endianness)
        {
            if (!stream.CanRead || !stream.CanWrite)
                throw new ArgumentException("The input stream must be both readable and writable.");

            _stream = stream;
            _reader = new EndianReader(stream, endianness);
            _writer = new EndianWriter(stream, endianness);
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:15,代码来源:EndianStream.cs


示例18: ShouldSwap

 internal static bool ShouldSwap(Endian endian)
 {
     switch (endian)
     {
         case Endian.Little: return BitConverter.IsLittleEndian == false;
         case Endian.Big: return BitConverter.IsLittleEndian == true;
         default: throw new ArgumentException("unsupported endianness", "endian");
     }
 }
开发者ID:Juvidoh,项目名称:me3-lazarus,代码行数:9,代码来源:StreamHelpers.cs


示例19: WriteValueGuid

 public static void WriteValueGuid(this Stream stream, Guid value, Endian endian)
 {
     var data = value.ToByteArray();
     Debug.Assert(data.Length == 16);
     stream.WriteValueS32(BitConverter.ToInt32(data, 0), endian);
     stream.WriteValueS16(BitConverter.ToInt16(data, 4), endian);
     stream.WriteValueS16(BitConverter.ToInt16(data, 6), endian);
     stream.Write(data, 8, 8);
 }
开发者ID:XxRaPiDK3LLERxX,项目名称:nucleuscoop,代码行数:9,代码来源:Guid.cs


示例20: ReadUInt32

        /// <summary>
        /// Reads a 4-byte unsigned integer from the current stream using provided endian and advances the
        ///  position of the stream by four bytes.
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="endian">Endian of binary stream.</param>
        /// <returns></returns>
        public static uint ReadUInt32(this BinaryReader reader, Endian endian)
        {
            if(endian == Endian.SmallEndian)
                return reader.ReadUInt32();

            var buffer = new byte[4];
            reader.Read(buffer, 0, 4);

            return BitConverter.ToUInt32(buffer.Reverse().ToArray(), 0);
        }
开发者ID:JibranRasheed,项目名称:booke,代码行数:17,代码来源:BinaryReaderExtensions.cs



注:本文中的Endian类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# EndianBinaryReader类代码示例发布时间:2022-05-24
下一篇:
C# EndPoint类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap