Пример #1
0
        public static GMEFile ReadGMEFile(byte[] bytes)
        {
            // TODO: check validity of GME file

            GMEFile result = new GMEFile();

            foreach (int i in ValidateGMEFile(bytes))
            //for (int i = 0; i < 15; i++)
            {
                try
                {
                    List <Character> characters = new List <Character>(20);

                    for (int j = 0; j < 20; j++)
                    {
                        byte[] character = new byte[0xE0];
                        Savegame.CopyArray(bytes, character, (0x2F40 + 0x2000 * i) + (0x484 + 0xE0 * j), 0xE0);
                        characters.Add(new Character(character, j));;
                    }

                    string gameName = BuildSaveGameString(bytes, i);

                    result.gameNames.Add(gameName);
                    result.games.Add(characters);
                }
                catch (Exception)
                {
                    // Ignore saves in this file that can't be processed
                }
            }

            if ((result.games.Count == 0) || (result.gameNames.Count == 0))
            {
                return(null);
            }
            else
            {
                return(result);
            }
        }
Пример #2
0
        public static GMEFile ReadGMEFile(byte[] bytes)
        {
            // TODO: check validity of GME file

            GMEFile result = new GMEFile();
            foreach (int i in ValidateGMEFile(bytes))
            //for (int i = 0; i < 15; i++)
            {
                try
                {
                    List<Character> characters = new List<Character>(20);

                    for (int j = 0; j < 20; j++)
                    {
                        byte[] character = new byte[0xE0];
                        Savegame.CopyArray(bytes, character, (0x2F40 + 0x2000 * i) + (0x484 + 0xE0 * j), 0xE0);
                        characters.Add(new Character(character, j)); ;
                    }

                    string gameName = BuildSaveGameString(bytes, i);

                    result.gameNames.Add(gameName);
                    result.games.Add(characters);
                }
                catch (Exception)
                {
                    // Ignore saves in this file that can't be processed
                }
            }

            if ((result.games.Count == 0) || (result.gameNames.Count == 0))
            {
                return null;
            }
            else
            {
                return result;
            }
        }