コード例 #1
0
 public static void Populate(this PInfo[,] info, PInfo data = null)
 {
     if (data == null)
     {
         data = new PInfo()
         {
             HasBackground = false, HasCharacter = false, HasForeground = false
         };
     }
     for (int x = 0; x < info.GetLength(0); x++)
     {
         for (int y = 0; y < info.GetLength(1); y++)
         {
             info[x, y] = new PInfo()
             {
                 Background    = data.Background,
                 HasBackground = data.HasBackground,
                 Character     = data.Character,
                 HasCharacter  = data.HasCharacter,
                 Foreground    = data.Foreground,
                 HasForeground = data.HasForeground
             };
         }
     }
 }
コード例 #2
0
        public override bool Equals(object obj)
        {
            if (obj is PInfo)
            {
                PInfo t = obj as PInfo;
                if (t.HasBackground == HasBackground)
                {
                    if (t.HasBackground == true && t.Background != Background)
                    {
                        return(false);
                    }
                }
                if (t.HasForeground == HasForeground)
                {
                    if (t.HasForeground == true && t.Foreground != Foreground)
                    {
                        return(false);
                    }
                }
                if (t.HasCharacter == HasCharacter)
                {
                    if (t.HasCharacter == true && t.Character != Character)
                    {
                        return(false);
                    }
                }

                return(true);
            }
            return(false);
        }
コード例 #3
0
        public PInfo Copy()
        {
            PInfo n = new PInfo();

            n.Override(this);
            return(n);
        }
コード例 #4
0
        protected override void PrintPixel(int y, int x)
        {
            PInfo pi = ScreenBuffer[x, y];
            Brush b  = PInfoUtil.GetPInfoBrush(pi);

            g.FillRectangle(b, new Rectangle(x * PixelSize, y * PixelSize, PixelSize, PixelSize));
        }
コード例 #5
0
        public static Brush GetPInfoBrush(PInfo pi)
        {
            switch (pi.Background)
            {
            case ConsoleColor.Black:
                return(Brushes.Black);

            case ConsoleColor.DarkBlue:
                return(Brushes.DarkBlue);

            case ConsoleColor.DarkGreen:
                return(Brushes.DarkGreen);

            case ConsoleColor.DarkCyan:
                return(Brushes.DarkCyan);

            case ConsoleColor.DarkRed:
                return(Brushes.DarkRed);

            case ConsoleColor.DarkMagenta:
                return(Brushes.DarkMagenta);

            case ConsoleColor.DarkYellow:
                return(Brushes.Yellow);

            case ConsoleColor.Gray:
                return(Brushes.Gray);

            case ConsoleColor.DarkGray:
                return(Brushes.DarkGray);

            case ConsoleColor.Blue:
                return(Brushes.Blue);

            case ConsoleColor.Green:
                return(Brushes.Green);

            case ConsoleColor.Cyan:
                return(Brushes.Cyan);

            case ConsoleColor.Red:
                return(Brushes.Red);

            case ConsoleColor.Magenta:
                return(Brushes.Magenta);

            case ConsoleColor.Yellow:
                return(Brushes.LightYellow);

            case ConsoleColor.White:
                return(Brushes.White);

            default:
                return(Brushes.White);
            }
        }
コード例 #6
0
        /// <summary>
        /// adds the value of an other <see cref="PInfo"/> to this
        /// </summary>
        public void Override(PInfo info)
        {
            if (this.HasBackground)
            {
                if (info.HasBackground)
                {
                    this.Background = info.Background;
                }
            }
            else
            {
                this.HasBackground = info.HasBackground;
                this.Background    = info.Background;
            }

            if (this.HasForeground)
            {
                if (info.HasForeground)
                {
                    this.Foreground = info.Foreground;
                }
            }
            else
            {
                this.HasForeground = info.HasForeground;
                this.Foreground    = info.Foreground;
            }

            if (this.HasCharacter)
            {
                if (info.HasCharacter)
                {
                    this.Character = info.Character;
                }
            }
            else
            {
                this.HasCharacter = info.HasCharacter;
                this.Character    = info.Character;
            }
        }