Exemplo n.º 1
0
        public override void WriteFullEndElement()
        {
            string localName = this.elementStack.Pop();

            base.WriteFullEndElement();

            switch (this.state)
            {
            case Fb2TextWriterState.Description:
                if (!this.indentHeader)
                {
                    switch (localName)
                    {
                    case "title-info":
                    case "src-title-info":
                    case "document-info":
                    case "publish-info":
                    case "custom-info":
                    case "output":
                        writer.WriteLine();
                        break;
                    }
                }

                if (String.Compare(localName, "description") == 0)
                {
                    this.state = Fb2TextWriterState.Root;
                    writer.WriteLine();
                }

                break;

            case Fb2TextWriterState.Body:
                if (!this.indentBody)
                {
                    switch (localName)
                    {
                    case "image":
                    case "title":
                    case "epigraph":
                    case "section":
                    case "p":
                        writer.WriteLine();
                        break;
                    }
                }

                if (String.Compare(localName, "body") == 0)
                {
                    this.state = Fb2TextWriterState.Root;
                }

                break;
            }
        }
Exemplo n.º 2
0
        public override void WriteStartElement(string prefix, string localName, string ns)
        {
            this.elementStack.Push(localName);

            switch (this.state)
            {
            case Fb2TextWriterState.StartDocument:
                if (String.Compare(localName, "FictionBook") == 0)
                {
                    this.state = Fb2TextWriterState.Root;
                }
                break;

            case Fb2TextWriterState.Root:
                if (String.Compare(localName, "description") == 0)
                {
                    this.state = Fb2TextWriterState.Description;
                    if (!this.indentHeader)
                    {
                        base.Formatting = Formatting.None;
                    }
                }
                else if (String.Compare(localName, "body") == 0)
                {
                    base.Formatting = (this.indentBody) ? Formatting.Indented : Formatting.None;
                    this.state      = Fb2TextWriterState.Body;
                }
                else
                {
                    base.Formatting = Formatting.Indented;
                }
                break;
            }

            base.WriteStartElement(prefix, localName, ns);
        }
Exemplo n.º 3
0
        public override void WriteStartElement(string prefix, string localName, string ns)
        {
            this.elementStack.Push(localName);

            switch(this.state)
            {
                case Fb2TextWriterState.StartDocument:
                    if (String.Compare(localName, "FictionBook") == 0)
                    {
                        this.state = Fb2TextWriterState.Root;
                    }
                    break;

                case Fb2TextWriterState.Root:
                    if (String.Compare(localName, "description") == 0)
                    {
                        this.state = Fb2TextWriterState.Description;
                        if(!this.indentHeader)
                        {
                            base.Formatting = Formatting.None;
                        }
                    }
                    else if (String.Compare(localName, "body") == 0)
                    {
                        base.Formatting = (this.indentBody) ? Formatting.Indented : Formatting.None;
                        this.state = Fb2TextWriterState.Body;
                    }
                    else
                    {
                        base.Formatting = Formatting.Indented;
                    }
                    break;
            }

            base.WriteStartElement(prefix, localName, ns);
        }
Exemplo n.º 4
0
 public override void WriteStartDocument(bool standalone)
 {
     base.Formatting = Formatting.Indented;
     base.WriteStartDocument(standalone);
     state = Fb2TextWriterState.StartDocument;
 }
Exemplo n.º 5
0
        public override void WriteFullEndElement()
        {
            string localName = this.elementStack.Pop();

            base.WriteFullEndElement();

            switch (this.state)
            {
                case Fb2TextWriterState.Description:
                    if (!this.indentHeader)
                    {
                        switch (localName)
                        {
                            case "title-info":
                            case "src-title-info":
                            case "document-info":
                            case "publish-info":
                            case "custom-info":
                            case "output":
                                writer.WriteLine();
                                break;
                        }
                    }

                    if (String.Compare(localName, "description") == 0)
                    {
                        this.state = Fb2TextWriterState.Root;
                        writer.WriteLine();
                    }

                    break;

                case Fb2TextWriterState.Body:
                    if (!this.indentBody)
                    {
                        switch (localName)
                        {
                            case "image":
                            case "title":
                            case "epigraph":
                            case "section":
                            case "p":
                                writer.WriteLine();
                                break;
                        }
                    }

                    if(String.Compare(localName, "body") == 0)
                    {
                        this.state = Fb2TextWriterState.Root;
                    }

                    break;
            }
        }
Exemplo n.º 6
0
 public override void WriteStartDocument(bool standalone)
 {
     base.Formatting = Formatting.Indented;
     base.WriteStartDocument(standalone);
     state = Fb2TextWriterState.StartDocument;
 }