public static Word Deserialise(FileStream inFile, FileStream inFileValues, byte[] buffer)
        {
            int type;

            inFile.Read(buffer, 0, 1);
            type = buffer[0];

            if (type == 1 || type == 3)
            {
                return(Kanji.Deserialise(inFile, inFileValues, type, buffer));
            }
            else if (type == 2 || type == 4)
            {
                return(Kana.Deserialise(inFile, inFileValues, type, buffer));
            }
            else
            {
                throw new Exception("Invalid type.");
            }
        }
        public static Kana Deserialise(FileStream inFile, FileStream inFileValues, int type, byte[] buffer)
        {
            var  pointer = Word.ReadInt(inFile, buffer);
            Kana result;

            if (Word.WordPointers.TryGetValue(pointer, out Word word))
            {
                result = word as Kana;

                if (result.Defined)
                {
                    return(result);
                }
            }
            else
            {
                result = new Kana(pointer);
            }
            if (type == 2)
            {
                int meaningLength;

                result.Value = SerialisedString.Deserialise(inFile, inFileValues, buffer);
                inFile.Read(buffer, 0, 2);
                meaningLength = BitConverter.ToInt16(buffer, 0);

                for (var i = 0; i < meaningLength; i++)
                {
                    result.Meanings.Add(SerialisedString.Deserialise(inFile, inFileValues, buffer));
                }
                result.Defined = true;

                return(result);
            }
            return(result);
        }