Example #1
0
        public void Load(BinaryReaderBE reader)
        {
            long start = (int)reader.BaseStream.Position;

            TotalLength     = reader.ReadInt16();
            Flags           = reader.ReadInt16();
            LinesPerPage    = reader.ReadInt16();
            GroupingCount   = reader.ReadInt16();
            FontChangeCount = reader.ReadInt16();

            Groupings   = new List <Grouping>();
            FontChanges = new List <FontChange>();


            for (int i = 0; i < GroupingCount; ++i)
            {
                Grouping grouping = new Grouping();
                grouping.Load(reader);
                Groupings.Add(grouping);
            }

            for (int i = 0; i < FontChangeCount; ++i)
            {
                FontChange fontChange = new FontChange();
                fontChange.Load(reader);
                FontChanges.Add(fontChange);
            }


            int textLength = TotalLength - (int)(reader.BaseStream.Position - start);

            textBytes = reader.ReadBytes(textLength);

            if (Flags == 1)
            {
                //decode text
                for (int i = 0; i < textBytes.Length; ++i)
                {
                    i++;
                    if (textBytes.Length > ++i)
                    {
                        textBytes[i] ^= 0xfe;
                    }
                    if (textBytes.Length > ++i)
                    {
                        textBytes[i] ^= 0xed;
                    }
                }
            }



            Encoding macRoman = Encoding.GetEncoding(10000);

            Texts = macRoman.GetString(textBytes).Split('\0');
        }