Exemplo n.º 1
0
 // This saves colors to configuration
 internal void SaveColors(Configuration cfg)
 {
     // Write all colors to config
     for (int i = 0; i < NUM_COLORS; i++)
     {
         // Write color
         cfg.WriteSetting("colors.color" + i.ToString(CultureInfo.InvariantCulture), colors[i].ToInt());
     }
 }
Exemplo n.º 2
0
        // Constructor for settings from configuration
        internal ColorCollection(Configuration cfg)
        {
            // Initialize
            colors       = new PixelColor[NUM_COLORS];
            brightcolors = new PixelColor[NUM_COLORS];
            darkcolors   = new PixelColor[NUM_COLORS];

            // Read all colors from config
            for (int i = 0; i < NUM_COLORS; i++)
            {
                // Read color
                colors[i] = PixelColor.FromInt(cfg.ReadSetting("colors.color" + i.ToString(CultureInfo.InvariantCulture), 0));
            }

            // Set new colors
            if (colors[THINGCOLOR00].ToInt() == 0)
            {
                colors[THINGCOLOR00] = PixelColor.FromColor(Color.DimGray);
            }
            if (colors[THINGCOLOR01].ToInt() == 0)
            {
                colors[THINGCOLOR01] = PixelColor.FromColor(Color.RoyalBlue);
            }
            if (colors[THINGCOLOR02].ToInt() == 0)
            {
                colors[THINGCOLOR02] = PixelColor.FromColor(Color.ForestGreen);
            }
            if (colors[THINGCOLOR03].ToInt() == 0)
            {
                colors[THINGCOLOR03] = PixelColor.FromColor(Color.LightSeaGreen);
            }
            if (colors[THINGCOLOR04].ToInt() == 0)
            {
                colors[THINGCOLOR04] = PixelColor.FromColor(Color.Firebrick);
            }
            if (colors[THINGCOLOR05].ToInt() == 0)
            {
                colors[THINGCOLOR05] = PixelColor.FromColor(Color.DarkViolet);
            }
            if (colors[THINGCOLOR06].ToInt() == 0)
            {
                colors[THINGCOLOR06] = PixelColor.FromColor(Color.DarkGoldenrod);
            }
            if (colors[THINGCOLOR07].ToInt() == 0)
            {
                colors[THINGCOLOR07] = PixelColor.FromColor(Color.Silver);
            }
            if (colors[THINGCOLOR08].ToInt() == 0)
            {
                colors[THINGCOLOR08] = PixelColor.FromColor(Color.Gray);
            }
            if (colors[THINGCOLOR09].ToInt() == 0)
            {
                colors[THINGCOLOR09] = PixelColor.FromColor(Color.DeepSkyBlue);
            }
            if (colors[THINGCOLOR10].ToInt() == 0)
            {
                colors[THINGCOLOR10] = PixelColor.FromColor(Color.LimeGreen);
            }
            if (colors[THINGCOLOR11].ToInt() == 0)
            {
                colors[THINGCOLOR11] = PixelColor.FromColor(Color.PaleTurquoise);
            }
            if (colors[THINGCOLOR12].ToInt() == 0)
            {
                colors[THINGCOLOR12] = PixelColor.FromColor(Color.Tomato);
            }
            if (colors[THINGCOLOR13].ToInt() == 0)
            {
                colors[THINGCOLOR13] = PixelColor.FromColor(Color.Violet);
            }
            if (colors[THINGCOLOR14].ToInt() == 0)
            {
                colors[THINGCOLOR14] = PixelColor.FromColor(Color.Yellow);
            }
            if (colors[THINGCOLOR15].ToInt() == 0)
            {
                colors[THINGCOLOR15] = PixelColor.FromColor(Color.WhiteSmoke);
            }
            if (colors[THINGCOLOR16].ToInt() == 0)
            {
                colors[THINGCOLOR16] = PixelColor.FromColor(Color.LightPink);
            }
            if (colors[THINGCOLOR17].ToInt() == 0)
            {
                colors[THINGCOLOR17] = PixelColor.FromColor(Color.DarkOrange);
            }
            if (colors[THINGCOLOR18].ToInt() == 0)
            {
                colors[THINGCOLOR18] = PixelColor.FromColor(Color.DarkKhaki);
            }
            if (colors[THINGCOLOR19].ToInt() == 0)
            {
                colors[THINGCOLOR19] = PixelColor.FromColor(Color.Goldenrod);
            }
            if (colors[PORTALS].ToInt() == 0)
            {
                colors[PORTALS]   = PixelColor.FromColor(Color.Magenta);
                colors[PORTALS].a = 128;
            }

            // Create assist colors
            CreateAssistColors();

            // Create color correction table
            CreateCorrectionTable();

            // We have no destructor
            GC.SuppressFinalize(this);
        }