当前位置: 首页>>代码示例>>C#>>正文


C# BinaryReader.ReadUInt64方法代码示例

本文整理汇总了C#中System.IO.BinaryReader.ReadUInt64方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryReader.ReadUInt64方法的具体用法?C# BinaryReader.ReadUInt64怎么用?C# BinaryReader.ReadUInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.BinaryReader的用法示例。


在下文中一共展示了BinaryReader.ReadUInt64方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: WindowsHeader

        /// <summary>
        /// Reads a windows-specific PE header from the given binary
        /// data stream.
        /// </summary>
        /// <param name="reader">The reader to use.</param>
        /// <param name="isPE32Plus">Whether the file format is PE32+.</param>
        public WindowsHeader(BinaryReader reader, bool isPE32Plus)
        {
            this.ImageBase = isPE32Plus ? reader.ReadUInt64() : reader.ReadUInt32();

            this.SectionAlignment = reader.ReadUInt32();
            this.FileAlignment    = reader.ReadUInt32();
            this.TargetOSVersion  = new Version(reader.ReadUInt16(), reader.ReadUInt16());
            this.ImageVersion     = new Version(reader.ReadUInt16(), reader.ReadUInt16());
            this.SubsystemVersion = new Version(reader.ReadUInt16(), reader.ReadUInt16());

            reader.ReadUInt32(); // Skip reserved field

            this.ImageSize  = reader.ReadUInt32();
            this.HeaderSize = reader.ReadUInt32();
            this.Checksum   = reader.ReadUInt32();
            this.Subsystem  = (Subsystem)reader.ReadUInt16();
            this.DLLFlags   = (DLLCharacteristics)reader.ReadUInt16();

            this.StackReserveSize = isPE32Plus ? reader.ReadUInt64() : reader.ReadUInt32();
            this.StackCommitSize  = isPE32Plus ? reader.ReadUInt64() : reader.ReadUInt32();
            this.HeapReserveSize  = isPE32Plus ? reader.ReadUInt64() : reader.ReadUInt32();
            this.HeapCommitSize   = isPE32Plus ? reader.ReadUInt64() : reader.ReadUInt32();

            reader.ReadUInt32(); // Skip reserved field

            this.DataDirectoryCount = reader.ReadUInt32();
        }
开发者ID:jsren,项目名称:DebugOS,代码行数:33,代码来源:WindowsHeader.cs

示例2: Load

 public override ThingList Load(BinaryReader BR, ProgressCallback ProgressCallback)
 {
     ThingList TL = new ThingList();
       if (ProgressCallback != null)
     ProgressCallback(I18N.GetText("FTM:CheckingFile"), 0);
       if (BR.BaseStream.Length < 0x40 || BR.BaseStream.Position != 0)
     return TL;
     FFXIEncoding E = new FFXIEncoding();
       if (E.GetString(BR.ReadBytes(8)) != "d_msg".PadRight(8, '\0'))
     return TL;
     ushort Flag1 = BR.ReadUInt16();
       if (Flag1 != 0 && Flag1 != 1)
     return TL;
     ushort Flag2 = BR.ReadUInt16();
       if (Flag2 != 0 && Flag2 != 1)
     return TL;
       if (BR.ReadUInt32() != 3 || BR.ReadUInt32() != 3)
     return TL;
     uint FileSize = BR.ReadUInt32();
       if (FileSize != BR.BaseStream.Length)
     return TL;
     uint HeaderBytes = BR.ReadUInt32();
       if (HeaderBytes != 0x40)
     return TL;
       if (BR.ReadUInt32() != 0)
     return TL;
     int BytesPerEntry = BR.ReadInt32();
       if (BytesPerEntry < 0)
     return TL;
     uint DataBytes = BR.ReadUInt32();
       if (FileSize != (HeaderBytes + DataBytes) || (DataBytes % BytesPerEntry) != 0)
     return TL;
     uint EntryCount = BR.ReadUInt32();
       if (EntryCount * BytesPerEntry != DataBytes)
     return TL;
       if (BR.ReadUInt32() != 1 || BR.ReadUInt64() != 0 || BR.ReadUInt64() != 0)
     return TL;
       if (ProgressCallback != null)
     ProgressCallback(I18N.GetText("FTM:LoadingData"), 0);
       for (uint i = 0; i < EntryCount; ++i) {
       BinaryReader EntryBR = new BinaryReader(new MemoryStream(BR.ReadBytes(BytesPerEntry)));
     EntryBR.BaseStream.Position = 0;
       bool ItemAdded = false;
     {
     Things.DMSGStringBlock SB = new Things.DMSGStringBlock();
       if (SB.Read(EntryBR, E, i)) {
     TL.Add(SB);
     ItemAdded = true;
       }
     }
     EntryBR.Close();
     if (!ItemAdded) {
       TL.Clear();
       break;
     }
     if (ProgressCallback != null)
       ProgressCallback(null, (double) (i + 1) / EntryCount);
       }
       return TL;
 }
开发者ID:Zastai,项目名称:POLUtils,代码行数:60,代码来源:DMSGStringTable3.cs

示例3: ProgramHeader

        public ProgramHeader(BinaryReader reader, bool Is64Bit)
        {
            this.Type = (HeaderType)reader.ReadUInt32();

            // 64-bit reads flags here
            if (Is64Bit) { this.SegmentFlags = (SegmentFlags)reader.ReadUInt32(); }

            this.SegmentOffset  = Is64Bit ? reader.ReadInt64()  : reader.ReadUInt32();
            this.VirtualAddress = Is64Bit ? reader.ReadUInt64() : reader.ReadUInt32();

            // Skip physical address - reserved
            if (Is64Bit) reader.ReadUInt64(); else reader.ReadUInt32();

            this.SegmentFileSize   = Is64Bit ? reader.ReadInt64() : reader.ReadUInt32();
            this.SegmentLoadedSize = Is64Bit ? reader.ReadInt64() : reader.ReadUInt32();

            // 32-bit reads flags here
            if (!Is64Bit) { this.SegmentFlags = (SegmentFlags)reader.ReadUInt32(); }

            this.Alignment = Is64Bit ? reader.ReadInt64() : reader.ReadUInt32();

            if (this.SegmentOffset < 0 || this.SegmentFileSize < 0 ||
                this.SegmentLoadedSize < 0 || this.Alignment < 0)
            {
                throw new BadImageFormatException("Program header values are too large to be " +
                    "supported by this implementation");
            }
        }
开发者ID:jsren,项目名称:DebugOS,代码行数:28,代码来源:ProgramHeader.cs

示例4: Read

 /// <summary>Reads a 128-bit binary value from the specified binary reader.</summary>
 public static Bin128 Read(BinaryReader br)
 {
     var result = new Bin128();
     result._a = br.ReadUInt64();
     result._b = br.ReadUInt64();
     return result;
 }
开发者ID:RT-Projects,项目名称:RT.Util,代码行数:8,代码来源:BinValues.cs

示例5: Parse

        protected override void Parse(Stream s)
        {
            BinaryReader r = new BinaryReader(s);
            base.Parse(s);
            this.unknown1 = new DataBlobHandler(RecommendedApiVersion, OnResourceChanged, r.ReadBytes(7 * 4));
            this.unknownFlags1 = r.ReadUInt32();
            this.unknownFlags2 = r.ReadUInt32();
            this.unknownFlags3 = r.ReadUInt32();
            this.unknownFlags4 = r.ReadUInt32();
            this.unknownFlags5 = r.ReadUInt32();
            this.unknownInstance1 = r.ReadUInt64();
            this.unknown2 = r.ReadByte();
            this.unknownInstance2 = r.ReadUInt64();
            this.unknown3 = r.ReadByte();
            this.colorList = new SwatchColorList(OnResourceChanged, s);
            this.unknownFlags = new DataBlobHandler(RecommendedApiVersion, OnResourceChanged, r.ReadBytes(5));
            this.buildBuyMode = r.ReadBoolean();

            if (base.Version >= 0x19)
            {
                this.unknown4 = r.ReadUInt32();
                this.unknown5 = r.ReadUInt32();
                this.unknown6 = r.ReadUInt32();
                this.unknown7 = r.ReadUInt32();
            }
        }
开发者ID:Kuree,项目名称:Sims4Tools,代码行数:26,代码来源:ObjectInstanceResource.cs

示例6: Binding

        public Binding(byte[] FileData)
        {
            MemoryStream MemStream = new MemoryStream(FileData);
            BinaryReader Reader = new BinaryReader(MemStream);

            m_Version = Endian.SwapUInt32(Reader.ReadUInt32());

            byte StrLength = Reader.ReadByte();
            string m_BoneName = Encoding.ASCII.GetString(Reader.ReadBytes(StrLength));

            //Should be 8.
            uint MeshAssetIDSize = Endian.SwapUInt32(Reader.ReadUInt32());

            //AssetID prefix, typical useless Maxis value...
            Reader.ReadUInt32();

            m_MeshAssetID = Endian.SwapUInt64(Reader.ReadUInt64());

            //Should be 8.
            uint TextureAssetIDSize = Endian.SwapUInt32(Reader.ReadUInt32());

            //AssetID prefix, typical useless Maxis value...
            Reader.ReadUInt32();

            m_TextureAssetID = Endian.SwapUInt64(Reader.ReadUInt64());
        }
开发者ID:pepster98,项目名称:Project-Dollhouse,代码行数:26,代码来源:Binding.cs

示例7: ELFProgramHeader

        internal ELFProgramHeader(BinaryReader reader, ELFSizeFormat sizeFormat)
        {
            p_type = reader.ReadUInt32();

            if (sizeFormat == ELFSizeFormat.ELF32)
            {
                p_offset = reader.ReadUInt32();
                p_vaddr = reader.ReadUInt32();
                p_paddr = reader.ReadUInt32();
            }
            else if (sizeFormat == ELFSizeFormat.ELF64)
            {
                p_offset = reader.ReadUInt64();
                p_vaddr = reader.ReadUInt64();
                p_paddr = reader.ReadUInt64();
            }
            else
            {
                throw new InvalidDataException("Unknown ELF size format value");
            }

            p_filesz = reader.ReadUInt32();
            p_memsz = reader.ReadUInt32();
            p_flags = reader.ReadUInt32();
            p_align = reader.ReadUInt32();
        }
开发者ID:TGEnigma,项目名称:Amicitia,代码行数:26,代码来源:ELFProgramHeader.cs

示例8: SdkMeshVertexBuffer

        public SdkMeshVertexBuffer(BinaryReader reader) {

            NumVertices = reader.ReadUInt64();
            SizeBytes = reader.ReadUInt64();
            StrideBytes = reader.ReadUInt64();
            Decl = new List<VertexElement>();
            var processElem = true;
            for (int j = 0; j < MaxVertexElements; j++) {
                var stream = reader.ReadUInt16();
                var offset = reader.ReadUInt16();
                var type = reader.ReadByte();
                var method = reader.ReadByte();
                var usage = reader.ReadByte();
                var usageIndex = reader.ReadByte();
                if (stream < 16 && processElem) {
                    var element = new VertexElement((short)stream, (short)offset, (DeclarationType)type, (DeclarationMethod)method, (DeclarationUsage)usage, usageIndex);
                    Decl.Add(element);
                } else {
                    processElem = false;
                }
            }
            DataOffset = reader.ReadUInt64();
            Vertices = new List<VertPosNormTexTan>();
            if (SizeBytes > 0) {
                ReadVertices(reader);
            }
        }
开发者ID:Hozuki,项目名称:Noire,代码行数:27,代码来源:SdkMeshVertexBuffer.cs

示例9: Load

 public bool Load(string path)
 {
     using (FileStream fs = new FileStream(path, FileMode.Open))
     {
         using (BinaryReader reader = new BinaryReader(fs))
         {
             for (int i = 0; i < 8; ++i)
             {
                 reader.ReadBytes(4);
             }
             uint count = reader.ReadUInt32();
             uint offset = reader.ReadUInt32();
             fs.Position = (long)offset;
             try
             {
                 for (int i = 0; i < count; ++i)
                 {
                     ulong ext = reader.ReadUInt64();
                     ulong fpath = reader.ReadUInt64();
                     uint language = reader.ReadUInt32();
                     reader.ReadBytes(4);
                     uint id = reader.ReadUInt32();
                     reader.ReadBytes(4);
                     this.Add(ext, fpath, language, id);
                 }
             }
             catch (Exception)
             {
                 return false;
             }
         }
     }
     return true;
 }
开发者ID:Last-Bullet-Development,项目名称:PD2BundleModder,代码行数:34,代码来源:NameIndex.cs

示例10: DirectorySectorEntry

		/* private ushort _padding; */

		/// <summary>
		/// Stream constructor.
		/// </summary>
		/// <param name="stream">The stream that contains the DirectorySectorEntry data.</param>
		public DirectorySectorEntry(Stream stream)
		{
			Debug.Assert(stream.Length >= Constants.DIR_ENTRY_SIZE);
			BinaryReader reader = new BinaryReader(stream);

			_name = Reader.ReadSimpleUnicodeString(reader, 64);
			_nameLength = reader.ReadUInt16();
			if(_nameLength > 0)
			{
				_nameLength /= 2;
				--_nameLength;
				_name = _name.Substring(0, _nameLength);
			}
			else
				_name = "";

			_type = (Stgty)reader.ReadByte();
			_color = (DeColor)reader.ReadByte();
			_leftSibling = new Sid(reader.ReadUInt32());
			_rightSibling = new Sid(reader.ReadUInt32());
			_child = new Sid(reader.ReadUInt32());
			_clsId = new Guid(reader.ReadBytes(16));
			_userFlags = reader.ReadUInt32();
			_createTimeStamp = reader.ReadUInt64();
			_modifyTimeStamp = reader.ReadUInt64();
			_sectStart = new Sect(reader.ReadUInt32());
			_size = reader.ReadUInt32();
			_propType = reader.ReadUInt16();
			/* _padding = */ reader.ReadUInt16();
		}
开发者ID:nicknystrom,项目名称:AscendRewards,代码行数:36,代码来源:DirectorySectorEntry.cs

示例11: Import

 public IEnumerable<Entry> Import()
 {
     using (var reader = new BinaryReader(File.OpenRead(filename)))
     {
         // 4
         Version = reader.ReadInt32();
         // 4
         Positions = reader.ReadInt32();
         foreach (var i in Enumerable.Range(0, Positions))
         {
             // 16
             var board = new Board(reader.ReadUInt64(), reader.ReadUInt64(), Color.Black);
             // 20
             var height = reader.ReadInt32();
             // 24
             var prune = reader.ReadInt32();
             // 25
             var wld = reader.ReadBoolean();
             // 26
             var knownSolve = reader.ReadBoolean();
             // 28
             var fillOut = reader.ReadInt16();
             // 30
             var cutoff = reader.ReadInt16();
             // 32
             var heuristic = reader.ReadInt16();
             // 34
             var black = reader.ReadInt16();
             // 36
             var white = reader.ReadInt16();
             // 37
             var set = reader.ReadBoolean();
             // 38
             var assigned = reader.ReadBoolean();
             // 39
             var wldSolved = reader.ReadBoolean();
             // 40
             var fill2 = reader.ReadByte();
             // 48
             var games = new int[] { reader.ReadInt32(), reader.ReadInt32() };
             // 49
             var root = reader.ReadBoolean();
             // 52
             var fill3 = reader.ReadBytes(3);
             yield return new Entry(board, height, heuristic, 72/*new BookData()
             {
                 Height = height,
                 Prune = prune,
                 WLD = wld,
                 KnownSolve = knownSolve,
                 Cutoff = cutoff,
                 HeuristicValue = heuristic,
                 BlackValue = black,
                 WhiteValue = white,
                 Games = games
             }*/);
         }
     }
 }
开发者ID:dlidstrom,项目名称:GridBook,代码行数:59,代码来源:NtestImporter.cs

示例12: ParseDataField

        // extracts ZIP 64 extra field element from a given byte array 
        internal override void ParseDataField(BinaryReader reader, UInt16 size)
        {
            Debug.Assert(reader != null);

            if ((_zip64ExtraFieldUsage & ZipIOZip64ExtraFieldUsage.UncompressedSize) != 0)
            {
                _uncompressedSize = reader.ReadUInt64();

                if (size < sizeof(UInt64))
                {
                    throw new FileFormatException(SR.Get(SRID.CorruptedData));
                }

                size -= sizeof(UInt64);
            }

            if ((_zip64ExtraFieldUsage & ZipIOZip64ExtraFieldUsage.CompressedSize) != 0)
            {
                _compressedSize = reader.ReadUInt64();

                if (size < sizeof(UInt64))
                {
                    throw new FileFormatException(SR.Get(SRID.CorruptedData));
                }

                size -= sizeof(UInt64);
            }

            if ((_zip64ExtraFieldUsage & ZipIOZip64ExtraFieldUsage.OffsetOfLocalHeader) != 0)
            {
                _offsetOfLocalHeader = reader.ReadUInt64();

                if (size < sizeof(UInt64))
                {
                    throw new FileFormatException(SR.Get(SRID.CorruptedData));
                }

                size -= sizeof(UInt64);
            }

            if ((_zip64ExtraFieldUsage & ZipIOZip64ExtraFieldUsage.DiskNumber) != 0)
            {
                _diskNumber = reader.ReadUInt32();

                if (size < sizeof(UInt32))
                {
                    throw new FileFormatException(SR.Get(SRID.CorruptedData));
                }

                size -= sizeof(UInt32);
            }

            if (size != 0)
            {
                throw new FileFormatException(SR.Get(SRID.CorruptedData));
            }

            Validate();
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:60,代码来源:ZipIOExtraFieldZip64Element.cs

示例13: Load

 public override ThingList Load(BinaryReader BR, ProgressCallback ProgressCallback)
 {
     ThingList TL = new ThingList();
       if (ProgressCallback != null)
     ProgressCallback(I18N.GetText("FTM:CheckingFile"), 0);
       if (BR.BaseStream.Length < 0x40 || BR.BaseStream.Position != 0)
     return TL;
     FFXIEncoding E = new FFXIEncoding();
       // Skip (presumably) fixed portion of the header
       if ((E.GetString(BR.ReadBytes(8)) != "d_msg".PadRight(8, '\0')) || BR.ReadUInt16() != 1 || BR.ReadUInt16() != 1 || BR.ReadUInt32() != 3 || BR.ReadUInt32() != 3)
     return TL;
       // Read the useful header fields
     uint FileSize = BR.ReadUInt32();
       if (FileSize != BR.BaseStream.Length)
     return TL;
     uint HeaderBytes = BR.ReadUInt32();
       if (HeaderBytes != 0x40)
     return TL;
     uint EntryBytes = BR.ReadUInt32();
       if (BR.ReadUInt32() != 0)
     return TL;
     uint DataBytes  = BR.ReadUInt32();
       if (FileSize != HeaderBytes + EntryBytes + DataBytes)
     return TL;
     uint EntryCount = BR.ReadUInt32();
       if (EntryBytes != EntryCount * 8)
     return TL;
       if (BR.ReadUInt32() != 1 || BR.ReadUInt64() != 0 || BR.ReadUInt64() != 0)
     return TL;
       if (ProgressCallback != null)
     ProgressCallback(I18N.GetText("FTM:LoadingData"), 0);
       for (uint i = 0; i < EntryCount; ++i) {
     BR.BaseStream.Position = HeaderBytes + i * 8;
       int Offset = ~BR.ReadInt32();
       int Length = ~BR.ReadInt32();
     if (Length < 0 || Offset < 0 || Offset + Length > DataBytes) {
       TL.Clear();
       break;
     }
     BR.BaseStream.Position = HeaderBytes + EntryBytes + Offset;
       BinaryReader EntryBR = new BinaryReader(new MemoryStream(BR.ReadBytes(Length)));
       bool ItemAdded = false;
     {
     Things.DMSGStringBlock SB = new Things.DMSGStringBlock();
       if (SB.Read(EntryBR, E, i)) {
     TL.Add(SB);
     ItemAdded = true;
       }
     }
     EntryBR.Close();
     if (!ItemAdded) {
       TL.Clear();
       break;
     }
     if (ProgressCallback != null)
       ProgressCallback(null, (double) (i + 1) / EntryCount);
       }
       return TL;
 }
开发者ID:Zastai,项目名称:POLUtils,代码行数:59,代码来源:DMSGStringTable2.cs

示例14: Reference

 public Reference(BinaryReader byteFile)
 {
     this.Station = new Id(byteFile);
     this.East = byteFile.ReadUInt64();
     this.North = byteFile.ReadUInt64();
     this.Altitude = byteFile.ReadUInt32();
     this.Comment = byteFile.ReadString();
 }
开发者ID:MaticDiba,项目名称:TopSharp,代码行数:8,代码来源:Reference.cs

示例15: InternalRead

 private void InternalRead(BinaryReader reader)
 {
     _gifTag0 = new GIFTag(reader);
     _trxPos = new TRXPOSRegister(reader);
     ulong trxPosAddress = reader.ReadUInt64();
     _trxReg = new TRXREGRegister(reader);
     ulong trxRegisterAddress = reader.ReadUInt64();
     _trxDir = new TRXDIRRegister(reader);
     ulong trxDirAddress = reader.ReadUInt64();
     _gifTag1 = new GIFTag(reader);
 }
开发者ID:TGEnigma,项目名称:Amicitia,代码行数:11,代码来源:PS2StandardImageHeader.cs


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