Example #1
0
        /// <summary>
        /// Loads a <see cref="PAL"/> file.
        /// </summary>
        /// <param name="buffer">A memory buffer that contains <see cref="PAL"/> file.</param>
        public PAL(byte[] buffer)
            : this()
        {
            try
            {
                using (var stream = new BinaryReader(new MemoryStream(buffer)))
                {
                    if (PAL_FILE_HEADER.Validate(stream.ReadBytes(DIVFileHeader.SIZE)))
                    {
                        this.Colors = new ColorPalette(stream.ReadBytes(ColorPalette.SIZE));
                        this.Ranges = new ColorRangeTable(stream.ReadBytes(ColorRangeTable.SIZE));

                        this.GetHashCode();
                    }
                    else
                    {
                        throw new DIVFormatHeaderException();
                    }
                }
            }
            catch (Exception ex)
            {
                throw new DIVFileFormatException <PAL>(ex);
            }
        }
Example #2
0
 /// <summary>
 /// Creates a new <see cref="PAL"/> instance.
 /// </summary>
 /// <param name="colors"><see cref="ColorPalette"/> instance.</param>
 public PAL(ColorPalette colors)
 {
     this.Colors = colors;
     this.Ranges = new ColorRangeTable();
 }
Example #3
0
 /// <summary>
 /// Creates a new <see cref="PAL"/> instance.
 /// </summary>
 /// <param name="colors"><see cref="ColorPalette"/> instance.</param>
 /// <param name="ranges"><see cref="ColorRangeTable"/> instance.</param>
 public PAL(ColorPalette colors, ColorRangeTable ranges)
 {
     this.Colors = colors;
     this.Ranges = ranges;
 }
Example #4
0
 /// <summary>
 /// Creates a new <see cref="PAL"/> instance.
 /// </summary>
 public PAL()
 {
     this.Colors = new ColorPalette();
     this.Ranges = new ColorRangeTable();
 }