public byte ReadByte() { byte Value = Memory.ReadByte(Position); Position++; return(Value); }
private ElfSym GetSymbol(long Position, long StrTblAddr) { int NameIndex = Memory.ReadInt32(Position + 0); int Info = Memory.ReadByte(Position + 4); int Other = Memory.ReadByte(Position + 5); int SHIdx = Memory.ReadInt16(Position + 6); long Value = Memory.ReadInt64(Position + 8); long Size = Memory.ReadInt64(Position + 16); string Name = string.Empty; for (int Chr; (Chr = Memory.ReadByte(StrTblAddr + NameIndex++)) != 0;) { Name += (char)Chr; } return(new ElfSym(Name, Info, Other, SHIdx, Value, Size)); }
private int GetVertexCountFromIndexBuffer( AMemory Memory, long IndexPosition, int IndexCount, int IndexSize) { int MaxIndex = -1; if (IndexSize == 2) { while (IndexCount-- > 0) { ushort Value = Memory.ReadUInt16(IndexPosition); IndexPosition += 2; if (MaxIndex < Value) { MaxIndex = Value; } } } else if (IndexSize == 1) { while (IndexCount-- > 0) { byte Value = Memory.ReadByte(IndexPosition++); if (MaxIndex < Value) { MaxIndex = Value; } } } else if (IndexSize == 4) { while (IndexCount-- > 0) { uint Value = Memory.ReadUInt32(IndexPosition); IndexPosition += 2; if (MaxIndex < Value) { MaxIndex = (int)Value; } } } else { throw new ArgumentOutOfRangeException(nameof(IndexSize)); } return(MaxIndex + 1); }