コード例 #1
0
        public List <int> Diff(ConsoleRenderBuffer other)
        {
            if (other.Width != Width || other.Height != Height)
            {
                throw new NotSupportedException("Diff for different sized buffers is not supported");
            }
            List <int> result = new List <int>();

            for (int idx = 0; idx <= GetIndex(Width - 1, Height - 1); idx++)
            {
                bool valueDiffers = Buffer[idx] != other.Buffer[idx];
                bool colorDiffers = ColorBuffer[idx] != other.ColorBuffer[idx];
                if (valueDiffers || colorDiffers)
                {
                    result.Add(idx);
                }
            }

            return(result);
        }
コード例 #2
0
 public void CopyFrom(ConsoleRenderBuffer other)
 {
     other.Buffer.CopyTo(Buffer, 0);
     other.ColorBuffer.CopyTo(ColorBuffer, 0);
 }