Ejemplo n.º 1
0
        /// <summary>
        /// Loads the default palettes from the specified archive.
        /// </summary>
        /// <param name="pattern">Pattern to check for (prefix string).</param>
        /// <param name="path">Folder path to read from.</param>
        /// <returns>Number of palettes loaded.</returns>
        public int LoadPalettes(string pattern, string path)
        {
            // Get Files
            string[] files = Directory.GetFiles(path, pattern + "*.PAL", SearchOption.TopDirectoryOnly);

            palettes.Clear();
            foreach (string file in files)
            {
                // Check for Palette
                if (Path.GetFileName(file).ToUpper().EndsWith(".PAL") && Path.GetFileName(file).ToUpper().StartsWith(pattern.ToUpper()))
                {
                    // Get Index
                    int index = Convert.ToInt32(
                        Path.GetFileNameWithoutExtension(file).Remove(0, pattern.Length));

                    // Get File from File
                    Palette256 palette = Palette256.FromFile(file);

                    // Add Palette
                    palettes.Add(index, palette);
                }
            }

            // Return Count
            return(palettes.Count);
        }
Ejemplo n.º 2
0
 public int LoadPalettes(string pattern, string path)
 {
     string[] files = Directory.GetFiles(path, pattern + "*.PAL", SearchOption.TopDirectoryOnly);
     this.palettes.Clear();
     foreach (string str in files)
     {
         if (Path.GetFileName(str).ToUpper().EndsWith(".PAL") && Path.GetFileName(str).ToUpper().StartsWith(pattern.ToUpper()))
         {
             this.palettes.Add(Convert.ToInt32(Path.GetFileNameWithoutExtension(str).Remove(0, pattern.Length)), Palette256.FromFile(str));
         }
     }
     return(this.palettes.Count);
 }