Esempio n. 1
0
        /// <summary>
        /// Load a color palette from file. Supported file formats: .aco, .gpl, .pal.
        /// </summary>
        /// <exception cref='NotImplementedException'>Palette format not supported.</exception>
        public static ColorPalette Load(string fullFilename)
        {
            switch (Path.GetExtension(fullFilename).ToLower())
            {
            case ".aco":
                return(FormatACO.Load(fullFilename));

            case ".gpl":
                return(FormatGPL.Load(fullFilename));

            case ".pal":
                return(FormatPAL.Load(fullFilename));

            default:
                throw new NotImplementedException("Palette format not supported.");
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Save a color palette to file. Supported file formats: .aco, .gpl, .pal.
        /// </summary>
        /// <exception cref='NotImplementedException'>Palette format not supported.</exception>
        public void Save(string fullFilename)
        {
            switch (Path.GetExtension(fullFilename).ToLower())
            {
            case ".aco":
                FormatACO.Save(fullFilename, this);
                break;

            case ".gpl":
                FormatGPL.Save(fullFilename, this);
                break;

            case ".pal":
                FormatPAL.Save(fullFilename, this);
                break;

            default:
                throw new NotImplementedException("Palette format not supported.");
            }
        }
        /// <summary>Load and return color palette from file.</summary>
        /// <param name="fullFilename">Path + filename + extension.</param>
        public static ColorPalette Load(string fullFilename)
        {
            FormatGPL gpl = new FormatGPL(fullFilename);

            return(gpl.ColorPalette);
        }