Stores and manages the assignment of System.Drawing.Color objects to ConsoleColor objects.
コード例 #1
0
        public ColorManager GetManager(ConcurrentDictionary <Color, ConsoleColor> colorMap, ConcurrentDictionary <ConsoleColor, Color> consoleColorMap, int maxColorChanges, int initialColorChangeCountValue, bool isInCompatibilityMode)
        {
            ColorStore  colorStore  = new ColorStore(colorMap, consoleColorMap);
            ColorMapper colorMapper = GetColorMapperSafe(ColorManager.IsWindows());

            return(new ColorManager(colorStore, colorMapper, maxColorChanges, initialColorChangeCountValue, isInCompatibilityMode));
        }
コード例 #2
0
        public static ColorStore GetColorStore()
        {
            ColorStore colorStore = new ColorStore(new Dictionary<Color, ConsoleColor>(), new Dictionary<ConsoleColor, Color>());
            colorStore.Update(TEST_COLOR, TEST_CONSOLE_COLOR);

            return colorStore;
        }
コード例 #3
0
        public ColorManager GetManager(ConcurrentDictionary <Color, ConsoleColor> colorMap, ConcurrentDictionary <ConsoleColor, Color> consoleColorMap, int maxColorChanges, int initialColorChangeCountValue)
        {
            ColorStore  colorStore  = GetColorStore(colorMap, consoleColorMap);
            ColorMapper colorMapper = GetColorMapper();

            return(new ColorManager(colorStore, colorMapper, maxColorChanges, initialColorChangeCountValue));
        }
コード例 #4
0
        /// <summary>
        /// Manages the number of different colors that the Windows console is able to display in a given session.
        /// </summary>
        /// <param name="colorStore">The ColorStore instance in which the ColorManager will store colors.</param>
        /// <param name="colorMapper">The ColorMapper instance the ColorManager will use to relate different color
        /// types to one another.</param>
        /// <param name="maxColorChanges">The maximum number of color changes allowed by the ColorManager.  It's
        /// necessary to keep track of this, because the Windows console can only display 16 different colors in
        /// a given session.</param>
        /// <param name="initialColorChangeCountValue">The number of color changes which have already occurred.</param>
        public ColorManager(ColorStore colorStore, ColorMapper colorMapper, int maxColorChanges , int initialColorChangeCountValue)
        {
            this.colorStore = colorStore;
            this.colorMapper = colorMapper;

            colorChangeCount = initialColorChangeCountValue;
            this.maxColorChanges = maxColorChanges;
        }
コード例 #5
0
        /// <summary>
        /// Manages the number of different colors that the Windows console is able to display in a given session.
        /// </summary>
        /// <param name="colorStore">The ColorStore instance in which the ColorManager will store colors.</param>
        /// <param name="colorMapper">The ColorMapper instance the ColorManager will use to relate different color
        /// types to one another.</param>
        /// <param name="maxColorChanges">The maximum number of color changes allowed by the ColorManager.  It's
        /// necessary to keep track of this, because the Windows console can only display 16 different colors in
        /// a given session.</param>
        /// <param name="initialColorChangeCountValue">The number of color changes which have already occurred.</param>
        public ColorManager(ColorStore colorStore, ColorMapper colorMapper, int maxColorChanges, int initialColorChangeCountValue)
        {
            this.colorStore  = colorStore;
            this.colorMapper = colorMapper;

            colorChangeCount     = initialColorChangeCountValue;
            this.maxColorChanges = maxColorChanges;
        }
コード例 #6
0
ファイル: ColorManager.cs プロジェクト: itsph-ru/RC.Core
        /// <summary>
        /// Manages the number of different colors that the Windows console is able to display in a given session.
        /// </summary>
        /// <param name="colorStore">The ColorStore instance in which the ColorManager will store colors.</param>
        /// <param name="colorMapper">The ColorMapper instance the ColorManager will use to relate different color
        /// types to one another.</param>
        /// <param name="maxColorChanges">The maximum number of color changes allowed by the ColorManager.  It's
        /// necessary to keep track of this, because the Windows console can only display 16 different colors in
        /// a given session.</param>
        /// <param name="initialColorChangeCountValue">The number of color changes which have already occurred.</param>
        /// <param name="isInCompatibilityMode"></param>
        public ColorManager(ColorStore colorStore, ColorMapper colorMapper, int maxColorChanges, int initialColorChangeCountValue, bool isInCompatibilityMode)
        {
            this.colorStore  = colorStore;
            this.colorMapper = colorMapper;

            colorChangeCount      = initialColorChangeCountValue;
            this.maxColorChanges  = maxColorChanges;
            IsInCompatibilityMode = isInCompatibilityMode;
        }
コード例 #7
0
        private static void ReplaceAllColorsWithDefaults(bool isInCompatibilityMode)
        {
            colorStore = GetColorStore();
            colorManagerFactory = new ColorManagerFactory();
            colorManager = colorManagerFactory.GetManager(colorStore, MAX_COLOR_CHANGES, INITIAL_COLOR_CHANGE_COUNT_VALUE, isInCompatibilityMode);

            // There's no need to do this if in compatibility mode, as more than 16 colors won't be used, anyway.
            if (!colorManager.IsInCompatibilityMode)
            {
                new ColorMapper().SetBatchBufferColors(defaultColorMap);
            }
        }
コード例 #8
0
 public ColorManager GetManager(ColorStore colorStore, int maxColorChanges, int initialColorChangeCountValue)
 {
     return new ColorManager(colorStore, GetColorMapper(), maxColorChanges, initialColorChangeCountValue);
 }
コード例 #9
0
        public ColorManager GetManager(ColorStore colorStore, int maxColorChanges, int initialColorChangeCountValue, bool isInCompatibilityMode)
        {
            ColorMapper colorMapper = GetColorMapperSafe(ColorManager.IsWindows());

            return(new ColorManager(colorStore, colorMapper, maxColorChanges, initialColorChangeCountValue, isInCompatibilityMode));
        }
コード例 #10
0
 public ColorManager GetManager(ColorStore colorStore, int maxColorChanges, int initialColorChangeCountValue, bool isInCompatibilityMode)
 {
     return(new ColorManager(colorStore, new ColorMapper(), maxColorChanges, initialColorChangeCountValue, isInCompatibilityMode));
 }
コード例 #11
0
 public ColorManager GetManager(ColorStore colorStore, int maxColorChanges, int initialColorChangeCountValue)
 {
     return(new ColorManager(colorStore, GetColorMapper(), maxColorChanges, initialColorChangeCountValue));
 }