Esempio n. 1
0
        public PODSectionItem(PODSectionBase Root, PODSectionBase Parent, SectionTag Tag)
        {
            this.Root = Root;
            this.Parent = Parent;

            this.Tag = Tag;

            switch (Tag.Tag)
            {
                case "head1": Render = new TagRenderHead(1, Tag.Text); break;
                case "head2": Render = new TagRenderHead(2, Tag.Text); break;
                case "head3": Render = new TagRenderHead(3, Tag.Text); break;
                case "head4": Render = new TagRenderHead(4, Tag.Text); break;

                case "over": Render = new TagRenderList(true).SetIndent(Tag.Type);break;
                case "item": Render = new TagRenderListItem(Tag.Text); break;
                case "back": Render = new TagRenderList(false).SetIndent(Tag.Type); break;

                case "for": Render = new TagRender(Tag.Tag); break;

                case "pod": Render = new TagRender(Tag.Tag); break;
                case "cut": Render = new TagRender(Tag.Tag); break;

                case "encoding": ; break;
            }
        }
Esempio n. 2
0
        public override void AddChild(PODSectionBase NewChild)
        {
            base.AddChild(NewChild);

            // check if list tag is given, and no sub-sections already added
            if (Tag.Tag == "over" && Sections.Count == 1 && typeof(PODSectionItem).IsAssignableFrom(NewChild.GetType()))
            {
                var item = (PODSectionItem)NewChild;
                if (item != null)
                {
                    var thistype = GetListType();
                    var othertype = item.GetListType();
                    if (thistype != othertype)
                    {
                        OverrideType(othertype);
                    }
                }
            }
        }
Esempio n. 3
0
 protected override void Parse(string[] lines)
 {
     Root = new PODSectionBase(lines);
 }
Esempio n. 4
0
        public override bool ShouldParent(PODSectionBase Previous)
        {
            if (Previous != null && Previous.GetType() == typeof(PODSectionItem))
            {
                //if (Previous.Sections.Count == 0)
                {
                    var item = (PODSectionItem)Previous;
                    if (item != null && Tag.Tag == "item" && item.Tag.Tag == "over")
                    {
                        Previous.AddChild(this);
                        return true;
                    }
                    else if (item != null && Tag.Tag == "back" && item.Tag.Tag == "over")
                    {
                        var thistype = GetListType();
                        var othertype = item.GetListType();
                        if (thistype != othertype)
                        {
                            OverrideType(othertype);
                        }
                    }
                }
                //else
                //{
                //	return ShouldParent(Previous.Sections.Last());
                //}
            }

            return false;
        }