Esempio n. 1
0
        public PersonalTable(byte[] data, GameVersion format)
        {
            int size = 0;

            switch (format)
            {
            case GameVersion.XY: size = PersonalInfoXY.SIZE; break;

            case GameVersion.ORASDEMO:
            case GameVersion.ORAS: size = PersonalInfoORAS.SIZE; break;

            case GameVersion.SMDEMO:
            case GameVersion.SM: size = PersonalInfoSM.SIZE; break;
            }

            if (size == 0)
            {
                Table = null; return;
            }

            byte[][]       entries = splitBytes(data, size);
            PersonalInfo[] d       = new PersonalInfo[data.Length / size];

            switch (format)
            {
            case GameVersion.XY:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoXY(entries[i]);
                }
                break;

            case GameVersion.ORASDEMO:
            case GameVersion.ORAS:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoORAS(entries[i]);
                }
                break;

            case GameVersion.SMDEMO:
            case GameVersion.SM:
                for (int i = 0; i < d.Length; i++)
                {
                    d[i] = new PersonalInfoSM(entries[i]);
                }
                break;
            }
            Table = d;
        }
Esempio n. 2
0
        public PersonalTable(byte[] data, GameVersion format)
        {
            int size = 0;
            switch (format)
            {
                case GameVersion.XY: size = PersonalInfoXY.SIZE; break;
                case GameVersion.ORASDEMO:
                case GameVersion.ORAS: size = PersonalInfoORAS.SIZE; break;
                case GameVersion.SMDEMO:
                case GameVersion.SM: size = PersonalInfoSM.SIZE; break;
            }

            if (size == 0)
            { Table = null; return; }

            byte[][] entries = splitBytes(data, size);
            PersonalInfo[] d = new PersonalInfo[data.Length / size];

            switch (format)
            {
                case GameVersion.XY:
                    for (int i = 0; i < d.Length; i++)
                        d[i] = new PersonalInfoXY(entries[i]);
                    break;
                case GameVersion.ORASDEMO:
                case GameVersion.ORAS:
                    for (int i = 0; i < d.Length; i++)
                        d[i] = new PersonalInfoORAS(entries[i]);
                    break;
                case GameVersion.SMDEMO:
                case GameVersion.SM:
                    for (int i = 0; i < d.Length; i++)
                        d[i] = new PersonalInfoSM(entries[i]);
                    break;
            }
            Table = d;
        }