public static Kanji Deserialise(FileStream inFile, FileStream inFileValues, int type, byte[] buffer)
        {
            var   pointer = Word.ReadInt(inFile, buffer);
            Kanji result;

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

                if (result.Defined)
                {
                    return(result);
                }
            }
            else
            {
                result = new Kanji(pointer);
            }
            if (type == 1)
            {
                int meaningLength;
                int readingLength;

                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));
                }
                inFile.Read(buffer, 0, 2);
                readingLength = BitConverter.ToInt16(buffer, 0);

                for (var i = 0; i < readingLength; i++)
                {
                    result.ReadingList.Add(Word.Deserialise(inFile, inFileValues, buffer) as Kana);
                }
                result.Defined = true;

                return(result);
            }
            return(result);
        }
        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.");
            }
        }