public void Read(Stream stream) { //If a namefile isn't present, automatically generate namelists for our convenience. bool generateNameLists = true; BaseFile.Read(stream); CreateLocalLists(); foreach (Robot robot in Robots) { BuildModelAnimation(robot); } BuildModelTextureTables(); if (generateNameLists) { for (int i = 0; i < Weapons.Count; i++) { Weapons[i].Name = String.Format("New Weapon {0}", i + 1); } for (int i = 0; i < Robots.Count; i++) { Robots[i].Name = String.Format("New Robot {0}", i + 1); } for (int i = 0; i < Models.Count; i++) { Models[i].Name = String.Format("New Model {0}", i + 1); } } }
public override int Read(byte[] buffer, int offset, int count) { int toRead = (int)Math.Min(count, Length - Position); BaseFile.Read(buffer.AsSpan(offset, toRead), Position); Position += toRead; return(toRead); }
//--------------------------------------------------------------------- // LOADING //--------------------------------------------------------------------- public void Read(Stream stream) { BaseFile.Read(stream); CreateLocalLists(); GenerateNameTable(); BuildModelTextureTables(); //f**k hxm files foreach (Robot robot in ReplacedRobots) { BuildModelAnimation(robot); } }
/// <summary> /// Reads the base HAM file from a given stream, and then the additional data used by the editor. /// </summary> /// <param name="stream">The stream to read from.</param> public void Read(Stream stream) { BaseFile.Read(stream); CreateLocalLists(); BinaryReader br = new BinaryReader(stream); bool generateNameLists = true; if (generateNameLists) { GenerateDefaultNamelists(); } TranslateData(); }
protected override Result DoRead(long offset, Span <byte> destination) { if (destination.Length == 0) { return(Result.Success); } Result rc = UpdateSize(); if (rc.IsFailure()) { return(rc); } if (!IsRangeValid(offset, destination.Length, FileSize)) { return(ResultFs.OutOfRange.Log()); } return(BaseFile.Read(out _, offset, destination, ReadOption.None)); }
protected override Result ReadImpl(out long bytesRead, long offset, Span <byte> destination, ReadOption options) { return(BaseFile.Read(out bytesRead, offset, destination, options)); }
/// <summary> /// The ReadFile method reads any file derived from BaseFile /// </summary> /// <param name="file"></param> public void ReadFile(BaseFile file) { file.Read(); }
public override int Read(Span <byte> destination, long offset, ReadOption options) { return(BaseFile.Read(destination, offset, options)); }