Example #1
0
        public PopUpNews(Stream stream) : base(stream)
        {
            using (BinaryDataReader reader = new BinaryDataReader(stream, true))
            {
                // Read the title key
                reader.Seek(0x50, SeekOrigin.Begin);
                TitleKey = reader.ReadString(StringDataFormat.ZeroTerminated, Encoding.ASCII);

                // Read the content key
                reader.Seek(0x90, SeekOrigin.Begin);
                ContentKey = reader.ReadString(StringDataFormat.ZeroTerminated, Encoding.ASCII);

                // Split the title key by underscores
                string[] splitKey = TitleKey.Split("_");

                // Check if this is a pop-up for an event
                if (splitKey[2] == "event")
                {
                    // Combine the event ID and the pop-up ID
                    Id = splitKey[3] + "_" + splitKey[4];

                    // Set the event flag
                    IsPopUpForEvent = true;
                }
                else
                {
                    // The ID is simply the last entry
                    Id = splitKey.Last();

                    // Set the event flag
                    IsPopUpForEvent = false;
                }

                // Seek to the data
                reader.Seek(0xF0, SeekOrigin.Begin);

                // Read the MSBTs
                Dictionary <Language, Dictionary <string, string> > msbts = this.ReadMsbts(reader);

                // Loop over every MSBT combination
                foreach (KeyValuePair <Language, Dictionary <string, string> > pair in msbts)
                {
                    // Add the title and content to their respective Dictionaries
                    TitleText.Add(pair.Key, pair.Value[TitleKey]);
                    ContentText.Add(pair.Key, pair.Value[ContentKey]);
                }

                // Read the image
                Image = this.ReadDataEntry(reader);

                // Read the URL
                Url = this.ReadDataEntryAsString(reader);
            }
        }
Example #2
0
        public Present(Stream stream) : base(stream)
        {
            using (BinaryDataReader reader = new BinaryDataReader(stream, true))
            {
                // Read the title key
                reader.Seek(0x50, SeekOrigin.Begin);
                TitleKey = reader.ReadString(StringDataFormat.ZeroTerminated, Encoding.ASCII);

                // Read the content key
                reader.Seek(0x90, SeekOrigin.Begin);
                ContentKey = reader.ReadString(StringDataFormat.ZeroTerminated, Encoding.ASCII);

                // Parse the ID from the title key
                Id = TitleKey.Split("_").Last();

                // Seek to the data
                reader.Seek(0xF0, SeekOrigin.Begin);

                // Read the MSBTs
                Dictionary <Language, Dictionary <string, string> > msbts = this.ReadMsbts(reader);

                // Loop over every MSBT combination
                foreach (KeyValuePair <Language, Dictionary <string, string> > pair in msbts)
                {
                    // Add the title and content to their respective Dictionaries
                    TitleText.Add(pair.Key, pair.Value[TitleKey]);
                    ContentText.Add(pair.Key, pair.Value[ContentKey]);
                }

                // Read the image
                Image = this.ReadDataEntry(reader);

                // Seek to the unknown
                reader.Seek(0x174, SeekOrigin.Begin);
                SpiritId = reader.ReadUInt32();
            }
        }
Example #3
0
        public Event(Stream stream) : base(stream)
        {
            using (BinaryDataReader reader = new BinaryDataReader(stream, true))
            {
                // Read the title key
                reader.Seek(0x40, SeekOrigin.Begin);
                TitleKey = reader.ReadString(StringDataFormat.ZeroTerminated, Encoding.ASCII);

                // Parse the ID from the title key
                Id = TitleKey.Split("_").Last();

                // Read the third DateTime
                reader.Seek(0x80, SeekOrigin.Begin);
                StartDateTimeDuplicate = ReadDateTime(reader);

                // Read the unknown data
                UnknownDataOne = reader.ReadBytes(0x44);

                // Read the MSBTs
                Dictionary <Language, Dictionary <string, string> > msbts = this.ReadMsbts(reader);

                // Loop over every MSBT combination
                foreach (KeyValuePair <Language, Dictionary <string, string> > pair in msbts)
                {
                    // Add the title text
                    TitleText.Add(pair.Key, pair.Value[TitleKey]);
                }

                // Read the image
                Image = this.ReadDataEntry(reader);

                // Read the URL
                Url = this.ReadDataEntryAsString(reader);

                // Read the fixed time spirits
                ReadFixedTimeSpirits(reader, FixedTimeSpirits);

                // Read the unknown data offset
                uint unknownDataTwoOffset = reader.ReadUInt32();

                // Read more unknown data
                using (reader.TemporarySeek(unknownDataTwoOffset, SeekOrigin.Begin))
                {
                    UnknownDataTwo = reader.ReadBytes(0x10);
                }

                // Read randomly appearing spirits
                ReadRandomlyAppearingSpirits(reader, RandomSpiritsOne, ref RandomSpiritsOneUnknown);
                ReadRandomlyAppearingSpirits(reader, RandomSpiritsTwo, ref RandomSpiritsTwoUnknown);
                ReadRandomlyAppearingSpirits(reader, RandomSpiritsThree, ref RandomSpiritsThreeUnknown);

                // Read the rates offset
                uint ratesOffset = reader.ReadUInt32();

                // Seek to the rates
                using (reader.TemporarySeek(ratesOffset, SeekOrigin.Begin))
                {
                    // Read the rates
                    Rates = new Rates(reader);
                }
            }
        }