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); } }
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(); } }