예제 #1
0
    /// <summary>
    ///
    /// </summary>
    /// <param name="dexNumber"></param>
    /// <returns></returns>
    public static object PokedexNumbertoSpecies(int dexNumber)
    {
        object pokedexNumbertoSpeciesRet = default;
        var    curval = 0;

        byte[] bytesloaded;
        bytesloaded = File.ReadAllBytes(MainObject.LoadedRom);

        // If DexNumber = Int32.Parse((ReverseHEX(ReadHEX(LoadedROM, Int32.Parse((GetString(GetINIFileLocation(), header, "NationalDexTable", "")), System.Globalization.NumberStyles.HexNumber) + ((DexNumber - 1) * 2), 2))), System.Globalization.NumberStyles.HexNumber) Then
        string LocalReverseHex1()
        {
            var argHexData = MMainFunctions.Get2Bytes(bytesloaded, int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "NationalDexTable", ""), System.Globalization.NumberStyles.HexNumber) + (dexNumber - 1) * 2);
            var ret        = HexFunctions.ReverseHex(ref argHexData);

            return(ret);
        }

        if (dexNumber == int.Parse(LocalReverseHex1(), System.Globalization.NumberStyles.HexNumber))
        {
            curval = dexNumber - 1;
        }
        else
        {
            // While DexNumber <> Int32.Parse((ReverseHEX(ReadHEX(LoadedROM, Int32.Parse((GetString(GetINIFileLocation(), header, "NationalDexTable", "")), System.Globalization.NumberStyles.HexNumber) + (curval * 2), 2))), System.Globalization.NumberStyles.HexNumber)
            string LocalReverseHex()
            {
                var argHexData = MMainFunctions.Get2Bytes(bytesloaded, int.Parse(Ini.GetString(Conversions.ToString(MMainFunctions.GetIniFileLocation()), MainObject.Header, "NationalDexTable", ""), System.Globalization.NumberStyles.HexNumber) + curval * 2);
                var ret        = HexFunctions.ReverseHex(ref argHexData);

                return(ret);
            }

            while (dexNumber != int.Parse(LocalReverseHex(), System.Globalization.NumberStyles.HexNumber))
            {
                curval += 1;
            }
        }

        pokedexNumbertoSpeciesRet = curval + 1;
        return(pokedexNumbertoSpeciesRet);
    }