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


C# FileSegmentGroup.AddSegment方法代码示例

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


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

示例1: 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

示例2: Load

        private void Load(StructureValueCollection values, FileSegmenter segmenter)
        {
            segmenter.DefineSegment(0, HeaderSize, 1, SegmentResizeOrigin.Beginning); // Define a segment for the header
            _eofSegment = segmenter.WrapEOF((int) values.GetInteger("file size"));

            LoadInteropData(values);
            RawTable = CalculateRawTableSegment(segmenter);

            Type = (CacheFileType) values.GetInteger("type");
            InternalName = values.GetString("internal name");
            ScenarioName = values.GetString("scenario name");
            XDKVersion = (int) values.GetInteger("xdk version");

            FileSegment metaSegment = CalculateTagDataSegment(values, segmenter);
            if (metaSegment != null)
            {
                uint virtualBase = values.GetInteger("virtual base address");
                MetaArea = new FileSegmentGroup(new MetaAddressConverter(metaSegment, virtualBase));
                MetaArea.AddSegment(metaSegment);

                IndexHeaderLocation = SegmentPointer.FromPointer(values.GetInteger("index header address"), MetaArea);
                Partitions = LoadPartitions(values.GetArray("partitions"));
            }
            else
            {
                Partitions = new Partition[0];
            }

            CalculateStringGroup(values, segmenter);
        }
开发者ID:ChadSki,项目名称:Assembly,代码行数:30,代码来源:ThirdGenHeader.cs

示例3: CalculateStringGroup

        private void CalculateStringGroup(StructureValueCollection values, FileSegmenter segmenter)
        {
            if (DebugPointerConverter == null)
                return;

            StringArea = new FileSegmentGroup(DebugPointerConverter);

            // StringIDs
            StringIDCount = (int) values.GetInteger("string table count");
            if (StringIDCount > 0)
            {
                int sidIndexTableOff = DebugPointerConverter.PointerToOffset(values.GetInteger("string index table offset"));
                int sidDataOff = DebugPointerConverter.PointerToOffset(values.GetInteger("string table offset"));

                var sidTableSize = (int) values.GetInteger("string table size");
                StringIDIndexTable = segmenter.WrapSegment(sidIndexTableOff, StringIDCount*4, 4, SegmentResizeOrigin.End);
                StringIDData = segmenter.WrapSegment(sidDataOff, sidTableSize, 1, SegmentResizeOrigin.End);

                StringIDIndexTableLocation = StringArea.AddSegment(StringIDIndexTable);
                StringIDDataLocation = StringArea.AddSegment(StringIDData);

                // idk what this is, but H3Beta has it
                if (values.HasInteger("string block offset"))
                {
                    int sidBlockOff = DebugPointerConverter.PointerToOffset(values.GetInteger("string block offset"));
                    StringBlock = segmenter.WrapSegment(sidBlockOff, StringIDCount*0x80, 0x80, SegmentResizeOrigin.End);
                    StringBlockLocation = StringArea.AddSegment(StringBlock);
                }
            }

            // Tag names
            FileNameCount = (int) values.GetInteger("file table count");
            if (FileNameCount > 0)
            {
                int nameIndexTableOff = DebugPointerConverter.PointerToOffset(values.GetInteger("file index table offset"));
                int nameDataOff = DebugPointerConverter.PointerToOffset(values.GetInteger("file table offset"));

                var fileTableSize = (int) values.GetInteger("file table size");
                FileNameIndexTable = segmenter.WrapSegment(nameIndexTableOff, FileNameCount*4, 4, SegmentResizeOrigin.End);
                FileNameData = segmenter.WrapSegment(nameDataOff, fileTableSize, 1, SegmentResizeOrigin.End);

                FileNameIndexTableLocation = StringArea.AddSegment(FileNameIndexTable);
                FileNameDataLocation = StringArea.AddSegment(FileNameData);
            }

            // Some H4-only unknown table
            if (values.HasInteger("unknown table count") && values.HasInteger("unknown table offset"))
            {
                UnknownCount = (int) values.GetInteger("unknown table count");
                if (UnknownCount > 0)
                {
                    int unknownOff = DebugPointerConverter.PointerToOffset(values.GetInteger("unknown table offset"));
                    UnknownTable = segmenter.WrapSegment(unknownOff, UnknownCount*0x10, 0x10, SegmentResizeOrigin.End);
                    UnknownTableLocation = StringArea.AddSegment(UnknownTable);
                }
            }
        }
开发者ID:ChadSki,项目名称:Assembly,代码行数:57,代码来源:ThirdGenHeader.cs

示例4: Load

        private void Load(StructureValueCollection values, FileSegmenter segmenter)
        {
            _eofSegment = segmenter.WrapEOF((int) values.GetInteger("file size"));

            var metaOffset = (int) values.GetInteger("meta offset");
            var metaSize = (int) values.GetInteger("meta size");
            uint metaOffsetMask = values.GetInteger("meta offset mask");

            var metaSegment = new FileSegment(
                segmenter.DefineSegment(metaOffset, metaSize, 0x200, SegmentResizeOrigin.Beginning), segmenter);
            MetaArea = new FileSegmentGroup(new MetaOffsetConverter(metaSegment, metaOffsetMask));
            IndexHeaderLocation = MetaArea.AddSegment(metaSegment);

            Type = (CacheFileType) values.GetInteger("type");

            var headerGroup = new FileSegmentGroup();
            headerGroup.AddSegment(segmenter.WrapSegment(0, HeaderSize, 1, SegmentResizeOrigin.None));

            StringIDCount = (int) values.GetInteger("string table count");
            var sidDataSize = (int) values.GetInteger("string table size");
            StringIDData = segmenter.WrapSegment((int) values.GetInteger("string table offset"), sidDataSize, 1,
                SegmentResizeOrigin.End);
            StringIDIndexTable = segmenter.WrapSegment((int) values.GetInteger("string index table offset"), StringIDCount*4, 4,
                SegmentResizeOrigin.End);

            FileNameCount = (int) values.GetInteger("file table count");
            var fileDataSize = (int) values.GetInteger("file table size");
            FileNameData = segmenter.WrapSegment((int) values.GetInteger("file table offset"), fileDataSize, 1,
                SegmentResizeOrigin.End);
            FileNameIndexTable = segmenter.WrapSegment((int) values.GetInteger("file index table offset"), FileNameCount*4, 4,
                SegmentResizeOrigin.End);

            InternalName = values.GetString("internal name");
            ScenarioName = values.GetString("scenario name");

            StringArea = new FileSegmentGroup();
            StringArea.AddSegment(segmenter.WrapSegment((int) values.GetInteger("string block offset"), StringIDCount*0x80, 0x80,
                SegmentResizeOrigin.End));
            StringArea.AddSegment(StringIDIndexTable);
            StringArea.AddSegment(StringIDData);
            StringArea.AddSegment(FileNameIndexTable);
            StringArea.AddSegment(FileNameData);

            StringIDIndexTableLocation = SegmentPointer.FromOffset(StringIDIndexTable.Offset, StringArea);
            StringIDDataLocation = SegmentPointer.FromOffset(StringIDData.Offset, StringArea);
            FileNameIndexTableLocation = SegmentPointer.FromOffset(FileNameIndexTable.Offset, StringArea);
            FileNameDataLocation = SegmentPointer.FromOffset(FileNameData.Offset, StringArea);

            LocaleArea = new FileSegmentGroup();

            var rawTableOffset = (int) values.GetInteger("raw table offset");
            var rawTableSize = (int) values.GetInteger("raw table size");
            RawTable = segmenter.WrapSegment(rawTableOffset, rawTableSize, 1, SegmentResizeOrigin.End);

            Checksum = values.GetInteger("checksum");

            // Set up a bogus partition table
            Partitions = new Partition[1];
            Partitions[0] = new Partition(SegmentPointer.FromOffset(MetaArea.Offset, MetaArea), (uint) MetaArea.Size);
        }
开发者ID:ChadSki,项目名称:Assembly,代码行数:60,代码来源:SecondGenHeader.cs

示例5: AdjustPartitions


//.........这里部分代码省略.........
			FourthGenInteropSection rsrcSection = Sections[(int) FourthGenInteropSectionType.Resource];
			FourthGenInteropSection tagSection = Sections[(int) FourthGenInteropSectionType.Tag];
			FourthGenInteropSection localeSection = Sections[(int) FourthGenInteropSectionType.Localization];
            
			// Recompute base addresses
			// Section addresses are usually in the following order: resource, locale, tag, debug.
			// Each address can immediately follow after the previous non-null section,
			// even though this isn't the case in some of the official files (because of removed debug data).
			//
			// TODO: This could possibly be made into a for loop and cleaned up if the pointer converters are stored in an array.
			// I just want to get this working for now.
			rsrcSection.VirtualAddress = 0; // This is always zero
			rsrcSection.Size = (ResourcePointerConverter != null) ? (uint) RawTable.Size : 0;
			localeSection.VirtualAddress = (LocalePointerConverter != null) ? rsrcSection.VirtualAddress + rsrcSection.Size : 0;
			localeSection.Size = (LocalePointerConverter != null) ? (uint) localeArea.Size : 0;
			tagSection.VirtualAddress = (TagBufferPointerConverter != null)
				? rsrcSection.VirtualAddress + rsrcSection.Size + localeSection.Size
				: 0;
			tagSection.Size = (TagBufferPointerConverter != null) ? (uint) MetaArea.Size : 0;
			debugSection.VirtualAddress = (DebugPointerConverter != null)
				? rsrcSection.VirtualAddress + rsrcSection.Size + localeSection.Size + tagSection.Size
				: 0;
			debugSection.Size = (DebugPointerConverter != null) ? (uint) StringArea.Size : 0;

			// If the offset mask for the debug section wasn't originally zero, then we have to subtract the first partition size from the debug base address
			// Not entirely sure why this is the case, but that's what the official files do
			if (debugSection.VirtualAddress != 0 && SectionOffsetMasks[(int) FourthGenInteropSectionType.Debug] != 0)
				debugSection.VirtualAddress -= Partitions[0].Size;

			// Recompute offset masks
			SectionOffsetMasks[(int) FourthGenInteropSectionType.Debug] = (debugSection.Size > 0)
				? (uint) (StringArea.Offset - debugSection.VirtualAddress)
				: 0;
			SectionOffsetMasks[(int) FourthGenInteropSectionType.Resource] = (rsrcSection.Size > 0)
				? (uint) (RawTable.Offset - rsrcSection.VirtualAddress)
				: 0;
			SectionOffsetMasks[(int) FourthGenInteropSectionType.Tag] = (tagSection.Size > 0)
				? (uint) (MetaArea.Offset - tagSection.VirtualAddress)
				: 0;
			SectionOffsetMasks[(int) FourthGenInteropSectionType.Localization] = (localeSection.Size > 0)
				? (uint) (localeArea.Offset - localeSection.VirtualAddress)
				: 0;

			// Update pointer converters
			if (DebugPointerConverter != null)
				DebugPointerConverter.BasePointer = debugSection.VirtualAddress;
			if (ResourcePointerConverter != null)
				ResourcePointerConverter.BasePointer = rsrcSection.VirtualAddress;
			if (TagBufferPointerConverter != null)
				TagBufferPointerConverter.BasePointer = tagSection.VirtualAddress;
			if (LocalePointerConverter != null)
				LocalePointerConverter.BasePointer = localeSection.VirtualAddress;
		}
        */

        private void Load(StructureValueCollection map_values, StructureValueCollection tag_values, StructureValueCollection string_values, FileSegmenter map_segmenter)
		{
            map_segmenter.DefineSegment(0, HeaderSize, 1, SegmentResizeOrigin.Beginning); // Define a segment for the header
            _eofSegment = map_segmenter.WrapEOF((int)map_values.GetInteger("file size"));



            //LoadInteropData(map_values, tag_values);
			//RawTable = CalculateRawTableSegment(segmenter);

            Type = (CacheFileType)map_values.GetInteger("type");
            InternalName = map_values.GetString("internal name");
            ScenarioPath = map_values.GetString("scenario path");

            uint index_header_address = map_values.GetInteger("index header address");

            // File Segment
            FileSegmenter tags_segmenter = new FileSegmenter();
            tags_segmenter.DefineSegment(0, (int)EngineInfo.TagsDataSize, 0x1, SegmentResizeOrigin.Beginning); // Define a segment for the header
            FileSegment metaSegment = new FileSegment(0, tags_segmenter);

            //FileSegment metaSegment = CalculateTagDataSegment(tag_values, segmenter);
            MetaArea = new FileSegmentGroup(new MetaAddressConverter(metaSegment, index_header_address));
            MetaArea.AddSegment(metaSegment);
            IndexHeaderLocation = SegmentPointer.FromPointer(index_header_address, MetaArea);

			//XDKVersion = (int) values.GetInteger("xdk version");
            /*
			FileSegment metaSegment = CalculateTagDataSegment(values, segmenter);
			if (metaSegment != null)
			{
				uint virtualBase = values.GetInteger("virtual base address");
				MetaArea = new FileSegmentGroup(new MetaAddressConverter(metaSegment, virtualBase));
				MetaArea.AddSegment(metaSegment);

				IndexHeaderLocation = SegmentPointer.FromPointer(values.GetInteger("index header address"), MetaArea);
				Partitions = LoadPartitions(values.GetArray("partitions"));
			}
			else
			{
				Partitions = new Partition[0];
			}
            */
            CalculateStringGroup(string_values, map_segmenter);
		}
开发者ID:t3hm00kz,项目名称:Assembly,代码行数:101,代码来源:FourthGenHeader.cs


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