public override void ReadDocument(PersistableObject root)
 {
     Console.Write("Reports: {0}: Loading...", m_Title);
     m_Xml.Read();
     m_Xml.Read();
     m_HasChild = !m_Xml.IsEmptyElement;
     root.Deserialize(this);
     Console.WriteLine("done");
 }
        public void RenderSingle(PersistableObject obj)
        {
            string filePath = Path.Combine(m_OutputDirectory, SafeFileName(FindNameFrom(obj)) + ".html");

            using (StreamWriter op = new StreamWriter(filePath))
            {
                using (HtmlTextWriter html = new HtmlTextWriter(op, "\t"))
                    RenderSingle(obj, html);
            }
        }
        public override PersistableObject GetChild()
        {
            PersistableType   type = PersistableTypeRegistry.Find(m_Xml.Name);
            PersistableObject obj  = type.Constructor();

            m_WasEmptyElement = m_Xml.IsEmptyElement;

            obj.Deserialize(this);

            m_HasChild = (m_Xml.NodeType == XmlNodeType.Element);

            return(obj);
        }
        private string FindNameFrom(PersistableObject obj)
        {
            if (obj is Report)
            {
                return((obj as Report).Name);
            }
            else if (obj is Chart)
            {
                return((obj as Chart).Name);
            }

            return("Invalid");
        }
Example #5
0
        public override void WriteDocument(PersistableObject root)
        {
            Console.WriteLine("Reports: {0}: Save started", m_Title);

            m_Xml.Formatting  = Formatting.Indented;
            m_Xml.IndentChar  = '\t';
            m_Xml.Indentation = 1;

            m_Xml.WriteStartDocument(true);

            root.Serialize(this);

            Console.WriteLine("Reports: {0}: Save complete", m_Title);
        }
 public void RenderDirect(PersistableObject obj, HtmlTextWriter html)
 {
     if (obj is Report)
     {
         RenderReport(obj as Report, html);
     }
     else if (obj is BarGraph)
     {
         RenderBarGraph(obj as BarGraph, html);
     }
     else if (obj is PieChart)
     {
         RenderPieChart(obj as PieChart, html);
     }
 }
Example #7
0
        public override void DeserializeChildren(PersistanceReader ip)
        {
            while (ip.HasChild)
            {
                PersistableObject child = ip.GetChild();

                if (child is ReportColumn)
                {
                    m_Columns.Add((ReportColumn)child);
                }
                else if (child is ReportItem)
                {
                    m_Items.Add((ReportItem)child);
                }
            }
        }
        public void RenderSingle(PersistableObject obj, HtmlTextWriter html)
        {
            html.RenderBeginTag(HtmlTag.Html);

            html.RenderBeginTag(HtmlTag.Head);

            html.RenderBeginTag(HtmlTag.Title);
            html.Write("{0} Statistics - {1}", ShardTitle, FindNameFrom(obj));
            html.RenderEndTag();

            html.AddAttribute("rel", "stylesheet");
            html.AddAttribute(HtmlAttr.Type, "text/css");
            html.AddAttribute(HtmlAttr.Href, "styles.css");
            html.RenderBeginTag(HtmlTag.Link);
            html.RenderEndTag();

            html.RenderEndTag();

            html.RenderBeginTag(HtmlTag.Body);

            html.RenderBeginTag(HtmlTag.Center);

            RenderDirect(obj, html);

            html.Write("<br>");

            var      tz         = TimeZoneInfo.Local;
            bool     isDaylight = tz.IsDaylightSavingTime(m_TimeStamp);
            TimeSpan utcOffset  = tz.GetUtcOffset(m_TimeStamp);

            html.Write("Snapshot taken at {0:d} {0:t}. All times are {1}.", m_TimeStamp, tz.StandardName);
            html.RenderEndTag();

            html.RenderEndTag();

            html.RenderEndTag();
        }
        public override void DeserializeChildren(PersistanceReader ip)
        {
            DateTime min = DateTime.UtcNow - TimeSpan.FromDays(8.0);

            while (ip.HasChild)
            {
                PersistableObject obj = ip.GetChild();

                if (obj is PageInfo)
                {
                    PageInfo pageInfo = obj as PageInfo;

                    pageInfo.UpdateResolver();

                    if (pageInfo.TimeSent >= min || pageInfo.TimeResolved >= min)
                    {
                        m_Pages.Add(pageInfo);
                        pageInfo.History = this;
                    }
                    else
                    {
                        pageInfo.Sender   = null;
                        pageInfo.Resolver = null;
                    }
                }
                else if (obj is QueueStatus)
                {
                    QueueStatus queueStatus = obj as QueueStatus;

                    if (queueStatus.TimeStamp >= min)
                    {
                        m_QueueStats.Add(queueStatus);
                    }
                }
            }
        }
 public abstract void ReadDocument(PersistableObject root);
Example #11
0
 public abstract void WriteDocument(PersistableObject root);