public MNReferencedCore FindContentObject(SMContentType type, string contentId) { MNReferencedCore value = null; if (CurrentLanguage != null) { value = CurrentLanguage.FindObject(contentId); } if (value == null && DefaultLanguage != null) { value = DefaultLanguage.FindObject(contentId); } if (value == null && type == SMContentType.Text) { MNReferencedText rt = FindText(contentId); if (rt != null) { MNReferencedText str = new MNReferencedText(); str.Text = rt.Text; value = str; } } return(value); }
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 MNReferencedText FindText(string styleName) { MNReferencedText s = null; if (CurrentLanguage != null) { s = CurrentLanguage.FindText(styleName); } if (s != null) { return(s); } if (DefaultLanguage != null) { s = DefaultLanguage.FindText(styleName); } return(s); }
public MNReferencedText CreateNewText(bool isScript) { MNReferencedText rt = new MNReferencedText(); rt.Name = "Untitled"; if (isScript) { Data.Scripts.Add(rt); } else { DefaultLanguage.Texts.Add(rt); DefaultLanguage.Modified = true; } MNNotificationCenter.BroadcastMessage(this, "TextInserted", rt); return(rt); }
public bool Load(RSFileReader br, bool fullRead) { if (!br.ReadHeader(p_FileHeader)) { return(false); } Clear(); byte tag; while ((tag = br.ReadByte()) != 0) { switch (tag) { case 10: string key = br.ReadString(); string value = br.ReadString(); Properties.Add(key, value); if (key.Equals("TotalWork")) { long la; if (long.TryParse(value, out la)) { WorkTime.SetTotalWorkTime(la); } } break; case 100: if (!fullRead) { return(true); } MNReferencedText rt = new MNReferencedText(); rt.Load(br); Texts.Add(rt); break; case 101: if (!fullRead) { return(true); } MNReferencedImage ri = new MNReferencedImage(); ri.Load(br); Images.Add(ri); break; case 102: if (!fullRead) { return(true); } MNReferencedSound rs = new MNReferencedSound(); rs.Load(br); Sounds.Add(rs); break; case 103: if (!fullRead) { return(true); } MNReferencedAudioText ra = new MNReferencedAudioText(); ra.Load(br); AudioTexts.Add(ra); break; case 104: if (!fullRead) { return(true); } MNReferencedStyle rsa = new MNReferencedStyle(); rsa.Load(br); Styles.Add(rsa); break; default: LoadMessage = string.Format("Unknown tag {0} at position {1} in the file.", tag, br.Position); return(false); } } Modified = false; return(true); }