Esempio n. 1
0
        /// <summary>
        /// Writes the body of the given <see cref="IWebPage"/> to the <see cref="Html32TextWriter"/>.
        /// </summary>
        /// <param name='htw'>
        /// The <see cref="Html32TextWriter"/> to write the content to.
        /// </param>
        /// <param name='webpage'>
        /// The <see cref="IWebPage"/> to write to the <see cref="Html32TextWriter"/>.
        /// </param>
        private void WriteBody(Html32TextWriter htw, IWebPage webpage)
        {
            this.WriteMasthead(htw, webpage);
            htw.AddAttribute(HtmlTextWriterAttribute.Class, "container");
            htw.RenderBeginTag(HtmlTextWriterTag.Div);
            htw.RenderBeginTag(HtmlTextWriterTag.Hr);
            htw.RenderEndTag();

            webpage.Render(this.device.Manager.ServerFolder, this, htw);

            this.WriteFooter(htw);
            htw.RenderEndTag();
        }
Esempio n. 2
0
        /// <summary>
        /// Converts the set of <see cref="IdpGie.Shapes.IShape"/> by converting it into a readable format.
        /// </summary>
        public override void Process()
        {
            using (StreamReader inputStream = new StreamReader(client.GetStream())) {
                String   request = inputStream.ReadLine(), line;
                string[] tokens = request.Split(' ');
                if (tokens.Length != 3)
                {
                    throw new Exception("invalid http request line");
                }
                StringBuilder rest = new StringBuilder();
                do
                {
                    line = inputStream.ReadLine();
                    rest.AppendLine(line);
                } while(line != string.Empty && line != null);
                //string http_url = tokens [1];
                string http_filename = tokens [1];
                Console.WriteLine("\"{0}\"", http_filename);

                if (http_filename == "/" + IconName)
                {
                    this.device.Navigationbar.FavIcon.RenderIcon(this.device.Manager.ServerFolder, this, client.GetStream());
                }
                else
                {
                    bool     border;
                    IWebPage wp = this.device.Navigationbar.GetPage(http_filename.Substring(0x01), out border);
                    using (StreamWriter sw = new StreamWriter(client.GetStream())) {
                        using (Html32TextWriter tw = new Html32TextWriter(sw)) {
                            if (border)
                            {
                                tw.WriteLine("<!DOCTYPE html>");
                                tw.RenderBeginTag(HtmlTextWriterTag.Html);
                                tw.RenderBeginTag(HtmlTextWriterTag.Head);
                                this.WriteHeader(tw);
                                tw.RenderEndTag();
                                tw.RenderBeginTag(HtmlTextWriterTag.Body);
                                this.WriteBody(tw, wp);
                                this.WriteJavascript(tw);
                                tw.RenderEndTag();
                                tw.RenderEndTag();
                            }
                            else
                            {
                                wp.Render(this.device.Manager.ServerFolder, this, tw);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// Writes the body of the given <see cref="IWebPage"/> to the <see cref="Html32TextWriter"/>.
        /// </summary>
        /// <param name='htw'>
        /// The <see cref="Html32TextWriter"/> to write the content to.
        /// </param>
        /// <param name='webpage'>
        /// The <see cref="IWebPage"/> to write to the <see cref="Html32TextWriter"/>.
        /// </param>
        private void WriteBody(Html32TextWriter htw, IWebPage webpage)
        {
            this.WriteMasthead (htw, webpage);
            htw.AddAttribute (HtmlTextWriterAttribute.Class, "container");
            htw.RenderBeginTag (HtmlTextWriterTag.Div);
            htw.RenderBeginTag (HtmlTextWriterTag.Hr);
            htw.RenderEndTag ();

            webpage.Render (this.device.Manager.ServerFolder, this, htw);

            this.WriteFooter (htw);
            htw.RenderEndTag ();
        }