public void Load(RSFileReader br) { if (!br.ReadHeader(p_fileHeader)) { return; } Clear(); int pageIndex = 0; byte b; while ((b = br.ReadByte()) != 0) { switch (b) { case 6: p_id = br.ReadInt32(); break; case 10: MNPage p = new MNPage(p_document); p.Index = pageIndex; p.Load(br); p.ResetStatus(); Pages.Add(p); pageIndex++; break; case 11: MNPage pt = new MNPage(p_document); pt.Load(br); Templates.Add(pt); break; case 12: MNReferencedText tx = new MNReferencedText(); tx.Load(br); Scripts.Add(tx); break; case 13: MNMenu mn = new MNMenu(); mn.Load(p_document, br); Menus.Add(mn); break; } } }
public static void Load() { if (File.Exists(FilePath)) { using (Stream sr = File.OpenRead(FilePath)) { using (BinaryReader br = new BinaryReader(sr)) { RSFileReader fr = new RSFileReader(br); byte b = 0; internalDocument = new MNDocument(); while ((b = fr.ReadByte()) != 0) { switch (b) { case 10: MNPage p = new MNPage(internalDocument); p.Load(fr); p.TemplateName = ""; p.TemplateId = -1; internalDocument.Data.Templates.Add(p); break; case 11: MNReferencedImage img = new MNReferencedImage(); img.Load(fr); internalDocument.DefaultLanguage.Images.Add(img); break; case 12: MNReferencedStyle st = new MNReferencedStyle(); st.Load(fr); internalDocument.DefaultLanguage.Styles.Add(st); break; } } } } //internalDocument.ReapplyStyles(); } }