public static byte[] ReadBytes(AMemory Memory, long Position, int Size) { byte[] Data = new byte[Size]; for (int Offs = 0; Offs < Size; Offs++) { Data[Offs] = (byte)Memory.ReadByte(Position + Offs); } return(Data); }
public static string ReadAsciiString(AMemory Memory, long Position, long MaxSize = -1) { using (MemoryStream MS = new MemoryStream()) { for (long Offs = 0; Offs < MaxSize || MaxSize == -1; Offs++) { byte Value = (byte)Memory.ReadByte(Position + Offs); if (Value == 0) { break; } MS.WriteByte(Value); } return(Encoding.ASCII.GetString(MS.ToArray())); } }