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


C# FileSegmentGroup.PointerToOffset方法代码示例

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


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

示例1: WriteReflexive

        /// <summary>
        ///     Writes data to a reflexive at a particular address.
        /// </summary>
        /// <param name="entries">The entries to write.</param>
        /// <param name="address">The address to write to.</param>
        /// <param name="layout">The layout of the data to write.</param>
        /// <param name="metaArea">The meta area of the cache file.</param>
        /// <param name="writer">The stream to write to.</param>
        public static void WriteReflexive(IEnumerable<StructureValueCollection> entries, uint address, StructureLayout layout,
			FileSegmentGroup metaArea, IWriter writer)
        {
            int offset = metaArea.PointerToOffset(address);
            int index = 0;
            foreach (StructureValueCollection entry in entries)
            {
                writer.SeekTo(offset + index*layout.Size);
                StructureWriter.WriteStructure(entry, layout, writer);
                index++;
            }
        }
开发者ID:ChadSki,项目名称:Assembly,代码行数:20,代码来源:ReflexiveWriter.cs

示例2: FromPointer

        /// <summary>
        /// Given a pointer, creates a SegmentPointer which points to a segment in a certain group.
        /// </summary>
        /// <param name="pointer">The pointer to create a SegmentPointer to.</param>
        /// <param name="baseGroup">The segment group containing the pointer.</param>
        /// <returns>The SegmentPointer corresponding to the file pointer.</returns>
        public static SegmentPointer FromPointer(uint pointer, FileSegmentGroup baseGroup)
        {
            if (baseGroup.Segments.Count == 0)
                throw new ArgumentException("Cannot create a SegmentPointer from an empty group");

            FileSegment baseSegment = baseGroup.FindSegmentWithPointer(pointer);
            if (baseSegment == null)
                throw new ArgumentException("Cannot create a SegmentPointer from an invalid pointer");

            int baseSegmentDelta = (int)(baseGroup.PointerToOffset(pointer) - baseSegment.Offset);
            return new SegmentPointer(baseSegment, baseGroup, baseSegmentDelta);
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:18,代码来源:SegmentPointer.cs

示例3: Load

		private void Load(StructureValueCollection values, FileSegmenter segmenter, FileSegmentGroup localeArea)
		{
			StringCount = (int) values.GetInteger("string count");
			if (StringCount > 0)
			{
				// Index table offset, segment, and pointer
				int localeIndexTableOffset = localeArea.PointerToOffset(values.GetInteger("locale index table offset"));
				LocaleIndexTable = segmenter.WrapSegment(localeIndexTableOffset, StringCount*8, 8, SegmentResizeOrigin.End);
				LocaleIndexTableLocation = localeArea.AddSegment(LocaleIndexTable);

				// Data offset, segment, and pointer
				int localeDataOffset = localeArea.PointerToOffset(values.GetInteger("locale data index offset"));
				var localeDataSize = (int) values.GetInteger("locale table size");
				LocaleData = segmenter.WrapSegment(localeDataOffset, localeDataSize, _sizeAlign, SegmentResizeOrigin.End);
				LocaleDataLocation = localeArea.AddSegment(LocaleData);

				// Load hashes if they exist
				if (values.HasRaw("index table hash"))
					IndexTableHash = values.GetRaw("index table hash");
				if (values.HasRaw("string data hash"))
					StringDataHash = values.GetRaw("string data hash");
			}
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:23,代码来源:FourthGenLanguage.cs

示例4: ReadReflexive

        public static StructureValueCollection[] ReadReflexive(IReader reader, int count, uint address, StructureLayout entryLayout, FileSegmentGroup metaArea)
        {
            if (entryLayout.Size == 0)
                throw new ArgumentException("The entry layout must have a size associated with it.");

            // Handle null pointers
            if (count <= 0 || !metaArea.ContainsPointer(address))
                return new StructureValueCollection[0];

            // Convert the address to an offset and seek to it
            int offset = metaArea.PointerToOffset(address);
            reader.SeekTo(offset);

            // Read the entries
            StructureValueCollection[] result = new StructureValueCollection[count];
            for (int i = 0; i < count; i++)
                result[i] = StructureReader.ReadStructure(reader, entryLayout);

            return result;
        }
开发者ID:iBotPeaches,项目名称:Assembly,代码行数:20,代码来源:ReflexiveReader.cs


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