Example #1
0
        /// <summary>
        /// Konvertira string u pokemon byte text
        /// </summary>
        /// <param name="text">text za konvertirat</param>
        /// <returns>vraca konvertirani byte array</returns>
        public static byte[] StringToPokemonText(string text)
        {
            byte[] pokeText = new byte[text.Length];
            char[] chars    = text.ToCharArray();

            for (int i = 0; i < text.Length; i++)
            {
                pokeText[i] = PokemonConstants.CharToPokemonChar(chars[i]);
            }

            return(pokeText);
        }
Example #2
0
        /// <summary>
        /// Konvertira pokemon byte text u string
        /// </summary>
        /// <param name="pokeText">pokemon byte text koji trebamo konvertirat</param>
        /// <returns>vraca konvertirani string</returns>
        public static string PokemonTextToString(byte[] pokeText)
        {
            string text = "";

            foreach (byte b in pokeText)
            {
                //Provjeravamo prekidajuci byte koji oznacava kraj texta
                if (b != 0xFF)
                {
                    text += PokemonConstants.PokemonCharToString(b);
                }
            }

            return(text);
        }