Example #1
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="entry"></param>
 public HPFFile(DataArchiveEntry entry)
 {
     using (var stream = entry.Open())
     {
         Init(stream);
     }
 }
Example #2
0
        private bool EntryIsEffect(DataArchiveEntry entry)
        {
            int    effectNumber;
            string name = Path.GetFileNameWithoutExtension(entry.EntryName);
            string ext  = Path.GetExtension(entry.EntryName);

            return(name.StartsWith("efct", StringComparison.CurrentCultureIgnoreCase) && name.Length == 7 &&
                   (ext.Equals(".epf", StringComparison.CurrentCultureIgnoreCase) || ext.Equals(".efa", StringComparison.CurrentCultureIgnoreCase)) &&
                   int.TryParse(name.Substring(4, 3), out effectNumber));
        }
Example #3
0
        private bool EntryIsItem(DataArchiveEntry entry)
        {
            int    itemTile;
            string name = Path.GetFileNameWithoutExtension(entry.EntryName);
            string ext  = Path.GetExtension(entry.EntryName);

            return(name.StartsWith("item", StringComparison.CurrentCultureIgnoreCase) && name.Length == 7 &&
                   ext.Equals(".epf", StringComparison.CurrentCultureIgnoreCase) &&
                   int.TryParse(name.Substring(4, 3), out itemTile));
        }
Example #4
0
        private bool EntryIsMonster(DataArchiveEntry entry)
        {
            int    monsterTile;
            string name = Path.GetFileNameWithoutExtension(entry.EntryName);
            string ext  = Path.GetExtension(entry.EntryName);

            return(name.StartsWith("mns", StringComparison.CurrentCultureIgnoreCase) && name.Length == 6 &&
                   ext.Equals(".mpf", StringComparison.CurrentCultureIgnoreCase) &&
                   int.TryParse(name.Substring(3, 3), out monsterTile));
        }
Example #5
0
        public void AddTable(DataArchiveEntry entry)
        {
            using (var stream = entry.Open())
                using (var reader = new StreamReader(stream))
                {
                    while (!reader.EndOfStream)
                    {
                        string   line  = reader.ReadLine();
                        string[] parts = line.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

                        int minimum, second, third;
                        int maximum, palette, misc;

                        if (parts.Length < 2)
                        {
                            continue;
                        }

                        minimum = int.Parse(parts[0]);

                        if (parts.Length == 2)
                        {
                            maximum = minimum;
                            palette = int.Parse(parts[1]);
                            misc    = 0;
                        }
                        else if (parts.Length == 3)
                        {
                            second = int.Parse(parts[1]);
                            third  = int.Parse(parts[2]);

                            if (third < 0)
                            {
                                maximum = minimum;
                                palette = second;
                                misc    = third;
                            }
                            else
                            {
                                maximum = second;
                                palette = third;
                                misc    = 0;
                            }
                        }
                        else
                        {
                            maximum = int.Parse(parts[1]);
                            palette = int.Parse(parts[2]);
                            misc    = int.Parse(parts[3]);
                        }

                        _entries.Add(new PaletteTableEntry(minimum, maximum, palette, misc));
                    }
                }
        }
Example #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="entry"></param>
 public Palette(DataArchiveEntry entry) : this(entry.Open())
 {
 }
Example #7
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="entry"></param>
 public MPFFile(DataArchiveEntry entry) : this(entry.Open())
 {
 }