private void Read(BinaryReader br, Archive parent) { Num = br.ReadUInt32(); Size = br.ReadUInt32(); Checksum = br.ReadUInt64(); Table1count = br.ReadUInt32(); Table2count = br.ReadUInt32(); Table3count = br.ReadUInt32(); // read tables for (int i = 0; i < Table1count; i++) { var entry = new ArchiveItem(br, parent); if (!FileInfo.ContainsKey(entry.NameHash64)) { FileInfo.Add(entry.NameHash64, entry); } else { // TODO } } for (int i = 0; i < Table2count; i++) { Offsets.Add(new OffsetEntry(br, i)); } for (int i = 0; i < Table3count; i++) { Dependencies.Add(new HashEntry(br, i)); } }
public override void Load(BinaryReaderEx reader) { BasePosition = reader.BaseStream.Position; Type = reader.ReadInt16(); Unk1 = reader.ReadInt16(); Unk2 = reader.ReadInt16(); NumOffsets = reader.ReadInt16(); StringTableOffset = reader.ReadInt32(); for (var i = 0; i < NumOffsets; i++) { Offsets.Add(reader.ReadInt32()); } if (StringTableOffset != 0) { reader.BaseStream.Position = BasePosition + StringTableOffset; StringTableBase = BasePosition + StringTableOffset; NumStrings = reader.ReadInt32(); for (var i = 0; i < NumStrings; i++) { StringOffsets.Add(reader.ReadInt32()); } for (var i = 0; i < NumStrings; i++) { reader.BaseStream.Position = StringTableBase + StringOffsets[i] + 4; Strings.Add(reader.ReadNullTerminatedString()); } } for (var i = 0; i < NumOffsets; i++) { reader.BaseStream.Position = BasePosition + this.Offsets[i]; short type = reader.ReadInt16(); SparkleChunkBase c; switch (type) { case 1: c = new SparkleChunk1(); break; case 2: c = new SparkleChunk2(); break; case 3: c = new SparkleChunk3(); break; default: throw new InvalidOperationException("Unexpected Sparkle Chunk Type: " + type); } reader.BaseStream.Position = BasePosition + this.Offsets[i]; c.Load(reader); this.Chunks.Add(c); } }
public Pointer(IntPtr baseAddress, params int[] offsets) { BaseAddress = baseAddress; foreach (var i in offsets) { Offsets.Add(i); } }
private void ReadOffsets(BlockBuffer buffer, ushort offsetCount) { int recordOffsetSize = new RecordOffset(0, 0).Size; for (int i = 0; i < offsetCount; i++) { RecordOffset offset = new RecordOffset(buffer.ReadBytes(recordOffsetSize)); Offsets.Add(offset); } }
public Pointer(SafeMemoryHandle processHandle, IntPtr baseAddress, params int[] offsets) { ProcessHandle = processHandle; BaseAddress = baseAddress; foreach (int i in offsets) { Offsets.Add(i); } }
/// <summary> /// 値をすべて特定の型に変換する /// </summary> /// <typeparam name="T">型</typeparam> public override void ConvertAll <T>() { var tempSize = GetArgSize <T>(); var tempNumber = Values.Count / tempSize; Values = Values.GetRange(0, tempNumber * tempSize); Offsets.Clear(); Numbers.Clear(); Sizes.Clear(); Offsets.Add(0); Numbers.Add(tempNumber); Sizes.Add(Values.Count); }
private void LoadProcessData(XElement xelem) { ProcessName = xelem.Element("ProcessName").Value; Module = xelem.Element("Module").Value; BaseAddress = HexStringToInt(xelem.Element("BaseAddress").Value); WindowTitle = xelem.Element("WindowTitle").Value; try { foreach (XElement xElement in xelem.Element("OffsetList").Elements("Offset")) { Offsets.Add(HexStringToInt(xElement.Value)); } } catch (NullReferenceException nullReferenceException) { } }
public Record(Relation relation, byte[] bytes) { int offsetBytes = 0; int offsetSize = new Offset().Size; for (int i = 0; i < relation.Count(); i++) { Offset offset = new Offset { Bytes = BitConverter.ToUInt16(new byte[] { bytes[i * offsetSize], bytes[(i * offsetSize) + 1] }) }; Offsets.Add(offset); offsetBytes += offsetSize; } Content = bytes.Skip(offsetBytes).ToArray(); }
public void writeOutput(FileOutput d) { foreach (RelocOffset o in d.Offsets) { o.Position += data.Count; Offsets.Add(o); } foreach (RelocOffset o in Offsets) { if (o.output == d || o.output == null) { o.Value += data.Count; } } foreach (byte b in d.data) { data.Add(b); } }
protected override void ReadInternal(BinaryReader br) { CreateField <GraphicsDataHeader>("Minimum Graphics Data Header", br); var pointsCount = CreateField <ScaleAndPointsCount>("Scale and Points count", br).PointCount; CreateField <N>("Type Code", br); var info = CreateField <BgInfoAndMultConst>("Add background info", br); MultConst = (int)Math.Pow(2, info.MultConstant); var x = CreateField <StartCoordinate>("Starting X-coordinate (Longitude)", br); var y = CreateField <StartCoordinate>("Starting Y-coordinate (Latitude)", br); StartX = x.Coordinate; StartY = y.Coordinate; IntegratedX = x.RelativePositionWithinParcel; IntegratedY = y.RelativePositionWithinParcel; for (int i = 0; i < pointsCount; i++) { var offset = CreateField <OffsetCoordinate>($"Offset coord {i}", br); Offsets.Add(new Point(offset.XOffset, offset.YOffset)); } //CreateField<D>("Name Offset", br); //CreateField<N>("Auxiliary Data", br); }
/// <summary> /// 加入移動調整值並檢查移動調整值數量,超出上限時移除多餘項目 /// </summary> /// <param name="stepOffset">移動調整值</param> public void AddOffset(PointF stepOffset) { if (_NextOffsetFixX != 0 || _NextOffsetFixY != 0) { stepOffset = new PointF(stepOffset.X + _NextOffsetFixX, stepOffset.Y + _NextOffsetFixY); _NextOffsetFixX = 0; _NextOffsetFixY = 0; } MoveX += stepOffset.X; MoveY += stepOffset.Y; Offsets.Add(stepOffset); if (Offsets.Count > OffsetsLimit) { for (int i = 0; i < Offsets.Count - OffsetsLimit; i++) { MoveX -= Offsets[i].X; MoveY -= Offsets[i].Y; } Offsets.RemoveRange(0, Offsets.Count - OffsetsLimit); } OnOffsetsChanged(); }
public static void ApplyOffsets(Vector2 off) { Offsets.Add(off); }
public void Add(T item) { Offsets.Add(item); }
public VMInstruction Translate(VMBody body, MethodDef method, int index, Offsets helper, out bool success) { helper.Add(index, -1); success = true; return(new VMInstruction(VMOpCode.UNUSED)); }
void IData <Circuit> .Save(DataSaver <Circuit> saver, object parameter) { Offsets.Add((int)saver.Position); saver.WriteUInt32(3); saver.WriteUInt32(0); // Save events and macros. saver.WriteInt32(Events.Count); int bufferSize = 0; foreach (Event evnt in Events) { if (evnt.ParamData.Length > 0) { bufferSize += evnt.ParamData.Length * evnt.ParamData[0].Length; } } saver.WriteInt32(bufferSize); saver.SaveMany(Events); saver.WriteInt32(MacrosBase.Count); saver.SaveMany(MacrosBase); saver.WriteInt32(Macros.Count); saver.SaveMany(Macros); saver.WriteInt32(MacrosInit.Count); saver.SaveMany(MacrosInit); saver.WriteInt32(MacrosActive.Count); saver.SaveMany(MacrosActive); saver.WriteInt32(MacrosInactive.Count); saver.SaveMany(MacrosInactive); saver.WriteInt32(MacrosReplace.Count); saver.SaveMany(MacrosReplace); saver.WriteInt32(MacrosExchange.Count); saver.SaveMany(MacrosExchange); // Save general data. saver.WritePodString(TrackName); saver.WriteUInt32s(LevelOfDetail); saver.WritePodString(ProjectName); saver.Save(Textures as TextureList <Circuit>); saver.WriteBoolean(HasNamedSectorFaces, BooleanCoding.Dword); saver.WriteInt32(Sectors.Count); saver.SaveMany(Sectors); saver.WriteInt32(Visibilities.Count); saver.SaveMany(Visibilities); saver.SaveSection(EnvironmentSection); saver.SaveSection(LightSection); saver.SaveSection(Anim1Section); saver.SaveSection(SoundSection); saver.Save(Background); saver.Save(Sky); saver.Save(Anim2Sections); saver.SaveSection(RepairZoneSection); // Save forward specifications. saver.Save(DesignationForward); saver.SaveDifficultySection(DifficultyForwardEasy, "EASY"); saver.SaveSection(LevelForwardEasy); Offsets.Add((int)saver.Position); saver.SaveDifficultySection(DifficultyForwardNormal, "NORMAL"); saver.SaveSection(LevelForwardNormal); Offsets.Add((int)saver.Position); saver.SaveDifficultySection(DifficultyForwardHard, "HARD"); saver.SaveSection(LevelForwardHard); // Save reverse specifications. Offsets.Add((int)saver.Position); saver.Save(DesignationReverse); saver.SaveDifficultySection(DifficultyReverseEasy, "EASY"); saver.SaveSection(LevelReverseEasy); Offsets.Add((int)saver.Position); saver.SaveDifficultySection(DifficultyReverseNormal, "NORMAL"); saver.SaveSection(LevelReverseNormal); Offsets.Add((int)saver.Position); saver.SaveDifficultySection(DifficultyReverseHard, "HARD"); saver.SaveSection(LevelReverseHard); // Save competitors. Offsets.Add((int)saver.Position); saver.SaveDifficultySection(CompetitorsEasy, "EASY"); Offsets.Add((int)saver.Position); saver.SaveDifficultySection(CompetitorsNormal, "NORMAL"); Offsets.Add((int)saver.Position); saver.SaveDifficultySection(CompetitorsHard, "HARD"); Offsets.Add(0); // Seems to be a random offset. }
public void Add(long offset) { Offsets.Add(offset); }
public void WriteLine(string str, long offset) { Lines.Add(str); Offsets.Add(offset); }