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 SerialisedString Deserialise(FileStream inFile, FileStream inFileValues, byte[] buffer)
        {
            inFile.Read(buffer, 0, 4);

            var pointer = BitConverter.ToInt32(buffer, 0);

            if (LoadedPointers.TryGetValue(pointer, out SerialisedString serialisedString))
            {
                return(serialisedString);
            }
            inFileValues.Seek(pointer, SeekOrigin.Begin);
            inFileValues.Read(buffer, 0, 2);

            var length       = BitConverter.ToInt16(buffer, 0);
            var result       = new SerialisedString(pointer);
            var stringBuffer = new byte[length];

            inFileValues.Read(stringBuffer, 0, length);
            result.ID      = SerialisedString.Values.Count;
            result.Pointer = pointer;
            SerialisedString.Values.Add(Encoding.UTF8.GetString(stringBuffer));

            return(result);
        }
 public Word(string value, FileStream outFileValues)
 {
     Value = new SerialisedString(value, outFileValues);
 }