Example #1
0
        private void AddLine()
        {
            var line = new HexViewLineVM();

            SetLine(line, Lines.Count);
            Lines.Add(line);
        }
Example #2
0
        private void SetLine(HexViewLineVM line, int index)
        {
            long newoffset = startOffset + index * 16;

            line.SetOffset(newoffset);
            line.Reset();
            if (this.stream is Stream stream && stream.Length > newoffset)
            {
                stream.Position = newoffset;
                long available = stream.Length - stream.Position;
                if (available >= 16)
                {
                    byte[] temp = new byte[16];
                    stream.Read(temp, 0, 16);
                    line.SetBytes(temp);
                }
                else
                {
                    byte[] temp = new byte[available];
                    stream.Read(temp, 0, (int)available);
                    line.SetBytes(temp);
                }
            }
        }