예제 #1
0
        private bool validateLinks()
        {
            Logger.LogValidation("Validate links:");
            Dictionary<string, Passage> _allPassages = _tree.Passages;

            foreach (Passage passage in _allPassages.Values)
            {
                for (int i = 0; i < passage.PassageContentList.Count; i++)
                {
                    PassageContent content = passage.PassageContentList[i];

                    if (content.Type == PassageContent.ContentType.LinkContent)
                    {
                        PassageLink link = content.PassageLink;
                        Passage targetPassage = _tree.GetPassage(link.Target);
                        if (targetPassage != null)
                        {
                            link.TargetPassage = targetPassage;
                        }
                        else if (link.Target == "previous()")
                        {
                        }
                        else
                        {
                            Logger.LogWarning("Ignore Link to: " + link.Target);

                            string name = link.DisplayText != null ? link.DisplayText : link.Target;

                            PassageText passageText = new PassageText(name);
                            passageText.ContentFormat = passage.PassageContentList[i].ContentFormat;

                            passage.PassageContentList[i] = passageText;
                        }
                    }
                }
            }
            return true;
        }
예제 #2
0
 public void MergePassageText(PassageText passageText)
 {
     _text += passageText.Text;
 }