//--------------------------------------------------------------------- //SAVING //--------------------------------------------------------------------- public void Write(Stream stream) { //Brute force solution //RenumberElements(HAMType.EClip); //RenumberElements(HAMType.Weapon); //RenumberElements(HAMType.Robot); //RenumberElements(HAMType.Model); //Science experiment GenerateObjectBitmapTables(CompatObjBitmaps); NumRobotJoints = 0; Console.WriteLine("Loaded {0} joints", Joints.Count); Joints.Clear(); foreach (Robot robot in Robots) { LoadAnimations(robot, Models[robot.ModelNum]); } Console.WriteLine("Constructed {0} joints", Joints.Count); foreach (Reactor reactor in Reactors) { LoadReactorGuns(reactor); } LoadShipGuns(PlayerShip); CreateDataLists(); BaseFile.Write(stream); }
public override void SetSize(long size) { Header.SetSize(size, VerificationKey); BaseFile.Write(Header.ToBytes(false), 0); BaseStorage.SetSize(size); }
//--------------------------------------------------------------------- // SAVING //--------------------------------------------------------------------- /// <summary> /// Saves the HXM file to a given stream. /// </summary> /// <param name="stream">The stream to write to.</param> public void Write(Stream stream) { ReplacedJoints.Clear(); foreach (Robot robot in ReplacedRobots) { LoadAnimations(robot, GetModel(robot.ModelNum)); } LoadModelTextures(); CreateDataLists(); BaseFile.Write(stream); }
protected override Result SetSizeImpl(long size) { Header.SetSize(size, VerificationKey); Result rc = BaseFile.Write(0, Header.ToBytes(false)); if (rc.IsFailure()) { return(rc); } return(BaseStorage.SetSize(Util.AlignUp(size, 0x10))); }
protected override Result DoWrite(long offset, ReadOnlySpan <byte> source) { if (source.Length == 0) { return(Result.Success); } Result rc = UpdateSize(); if (rc.IsFailure()) { return(rc); } if (!IsRangeValid(offset, source.Length, FileSize)) { return(ResultFs.OutOfRange.Log()); } return(BaseFile.Write(offset, source, WriteOption.None)); }
protected override Result WriteImpl(long offset, ReadOnlySpan <byte> source, WriteOption options) { return(BaseFile.Write(offset, source, options)); }
public override void Write(byte[] buffer, int offset, int count) { BaseFile.Write(buffer.AsSpan(offset, count), Position); Position += count; }
public override void Write(ReadOnlySpan <byte> source, long offset, WriteOption options) { BaseFile.Write(source, offset, options); }