private void ReadCurrentUnit(BinaryReader br, Enums.UnitBlock unitBlock) { var unit = new Unit(); unit.UnitBlock = unitBlock; unit.ReadFromReader(br); Units.Add(unit); }
private void ReadCurrentUnit(BinaryReader br, Enums.UnitBlock unitBlock) { byte[] chunk; var unit = new Character(); unit.UnitBlock = unitBlock; chunk = new byte[Model.Character.RawBlock1Length]; br.Read(chunk, 0, Model.Character.RawBlock1Length); unit.RawBlock1 = chunk; chunk = new byte[Model.Character.RawInventoryLength]; br.Read(chunk, 0, Model.Character.RawInventoryLength); unit.RawInventory = chunk; chunk = new byte[0x01]; br.Read(chunk, 0, 0x01); unit.RawNumberOfSupports = chunk.First(); chunk = new byte[unit.RawNumberOfSupports]; br.Read(chunk, 0, unit.RawNumberOfSupports); unit.RawSupports = chunk; chunk = new byte[Model.Character.RawBlock2Length]; br.Read(chunk, 0, Model.Character.RawBlock2Length); unit.RawBlock2 = chunk; chunk = new byte[Model.Character.RawLearnedSkillsLength]; br.Read(chunk, 0, Model.Character.RawLearnedSkillsLength); unit.RawLearnedSkills = chunk; var depLength = (unit.UnitBlock == Enums.UnitBlock.Deployed ? Model.Character.RawDeployedUnitInfoLengthIfDeployed : Model.Character.RawDeployedUnitInfoLengthIfNotDeployed); chunk = new byte[depLength]; br.Read(chunk, 0, depLength); unit.RawDeployedUnitInfo = chunk; chunk = new byte[Model.Character.RawBlock3Length]; br.Read(chunk, 0, Model.Character.RawBlock3Length); unit.RawBlock3 = chunk; chunk = new byte[0x01]; br.Read(chunk, 0, 0x01); unit.RawEndBlockType = chunk.First(); chunk = new byte[unit.GetRawEndBlockSize()]; br.Read(chunk, 0, unit.GetRawEndBlockSize()); unit.RawEndBlock = chunk; Units.Add(unit); }