Example #1
0
        public void ApplyChanges(IConsoleBox box)
        {
            foreach (var kvp in changes)
            {
                var last = buffer[kvp.Key.X, kvp.Key.Y];

                var changed =
                    last.Char == kvp.Value.Char &&
                    last.Background == kvp.Value.Background &&
                    last.Foreground == kvp.Value.Foreground &&
                    last.Attributes == kvp.Value.Attributes;

                if (!changed)
                {
                    box.Set(
                        kvp.Key.X,
                        kvp.Key.Y,
                        kvp.Value.Char,
                        kvp.Value.Foreground,
                        kvp.Value.Background,
                        kvp.Value.Attributes);

                    buffer[kvp.Key.X, kvp.Key.Y] = kvp.Value;
                }
            }

            changes.Clear();
        }