コード例 #1
0
        private static EncounterArea7g GetArea(byte[] data)
        {
            var sf      = BitConverter.ToInt16(data, 0);
            int species = sf & 0x7FF;
            int form    = sf >> 11;

            // Files are padded to be multiples of 4 bytes. The last entry might actually be padding.
            // Since we aren't saving a count up-front, just check if the last entry is valid.
            int count = (data.Length - 2) / entrySize;

            if (data[data.Length - 1] == 0) // type of "None" is not valid
            {
                count--;
            }

            var result = new EncounterSlot7GO[count];
            var area   = new EncounterArea7g(species, form)
            {
                Slots = result
            };

            for (int i = 0; i < result.Length; i++)
            {
                var offset = (i * entrySize) + 2;
                var shiny  = (Shiny)data[offset];
                var type   = (PogoType)data[offset + 1];
                result[i] = new EncounterSlot7GO(area, species, form, shiny, type);
            }

            return(area);
        }
コード例 #2
0
        private static EncounterArea7g GetArea(byte[] data)
        {
            var sf      = BitConverter.ToInt16(data, 0);
            int species = sf & 0x7FF;
            int form    = sf >> 11;

            var result = new EncounterSlot7GO[(data.Length - 2) / entrySize];
            var area   = new EncounterArea7g(species, form)
            {
                Slots = result
            };

            for (int i = 0; i < result.Length; i++)
            {
                var offset = (i * entrySize) + 2;
                result[i] = ReadSlot(data, offset, area, species, form);
            }

            return(area);
        }