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>"); TimeZone tz = TimeZone.CurrentTimeZone; 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 ReadDocument(PersistableObject root) { log.Info("Reports: Loading..."); m_Xml.Read(); m_Xml.Read(); m_HasChild = !m_Xml.IsEmptyElement; root.Deserialize(this); }
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 ); }
public override void ReadDocument(PersistableObject root) { Console.Write("Reports: {0}: Loading...", this.m_Title); this.m_Xml.Read(); this.m_Xml.Read(); this.m_HasChild = !this.m_Xml.IsEmptyElement; root.Deserialize(this); Console.WriteLine("done"); }
public void RenderSingle(PersistableObject obj) { string filePath = Path.Combine(this.m_OutputDirectory, SafeFileName(this.FindNameFrom(obj)) + ".html"); using (StreamWriter op = new StreamWriter(filePath)) { using (HtmlTextWriter html = new HtmlTextWriter(op, "\t")) this.RenderSingle(obj, html); } }
public void RenderSingle(PersistableObject obj) { string filePath = Path.Combine(m_OutputDirectory, SafeFileName(FindNameFrom(obj)) + ".html"); using (StreamWriter op = new StreamWriter(filePath)) { var settings = new XmlWriterSettings(); settings.Indent = true; using (var html = XmlWriter.Create(op, settings)) RenderSingle(obj, html); } }
/// <summary> /// Advances the enumerator to the next queue of the enumeration, if one is currently available. /// </summary> /// <returns>true, if the enumerator was succesfully advanced to the next queue; false, if the enumerator has reached the end of the enumeration.</returns> public bool MoveNext() { if ((_index < (_collection.Count - 1))) { _index = (_index + 1); _currentElement = _collection[_index]; return(true); } _index = _collection.Count; return(false); }
public override PersistableObject GetChild() { PersistableType type = PersistableTypeRegistry.Find(this.m_Xml.Name); PersistableObject obj = type.Constructor(); this.m_WasEmptyElement = this.m_Xml.IsEmptyElement; obj.Deserialize(this); this.m_HasChild = (this.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"); }
public override void WriteDocument(PersistableObject root) { log.Info("Reports: Save started"); m_Xml.Formatting = Formatting.Indented; m_Xml.IndentChar = '\t'; m_Xml.Indentation = 1; m_Xml.WriteStartDocument(true); root.Serialize(this); log.Info("Reports: Save complete"); }
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 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) { this.RenderReport(obj as Report, html); } else if (obj is BarGraph) { this.RenderBarGraph(obj as BarGraph, html); } else if (obj is PieChart) { this.RenderPieChart(obj as PieChart, html); } }
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, XmlWriter html) { html.WriteStartElement("html"); html.WriteStartElement("head"); html.WriteStartElement("title"); html.WriteValue($"{ShardTitle} Statistics - {FindNameFrom(obj)}"); html.WriteEndElement(); html.WriteStartElement("a"); html.WriteAttributeString("rel", "stylesheet"); html.WriteAttributeString("type", "text/css"); html.WriteAttributeString("href", "styles.css"); html.WriteEndElement(); html.WriteEndElement(); html.WriteStartElement("body"); html.WriteStartElement("center"); RenderDirect(obj, html); html.WriteValue("<br>"); TimeZoneInfo tz = TimeZoneInfo.Local; bool isDaylight = tz.IsDaylightSavingTime(m_TimeStamp); TimeSpan utcOffset = tz.GetUtcOffset(m_TimeStamp); html.WriteValue($"Snapshot taken at {m_TimeStamp:d} {m_TimeStamp:t}. All times are {tz.StandardName}."); html.WriteEndElement(); html.WriteEndElement(); html.WriteEndElement(); }
public void RenderSingle(PersistableObject obj, HtmlTextWriter html) { html.RenderBeginTag(HtmlTag.Html); html.RenderBeginTag(HtmlTag.Head); html.RenderBeginTag(HtmlTag.Title); html.Write("{0} Statistics - {1}", ServerList.ServerName, this.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); this.RenderDirect(obj, html); html.Write("<br>"); TimeZone tz = TimeZone.CurrentTimeZone; bool isDaylight = tz.IsDaylightSavingTime(this.m_TimeStamp); TimeSpan utcOffset = tz.GetUtcOffset(this.m_TimeStamp); html.Write("Snapshot taken at {0:d} {0:t}. All times are {1}.", this.m_TimeStamp, tz.StandardName); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); }
public override void DeserializeChildren(PersistenceReader 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); } } } }
/// <summary> /// Reset the cursor, so it points to the beginning of the enumerator. /// </summary> public void Reset() { _index = -1; _currentElement = null; }
/// <summary> /// Insert a Server.Engines.Reports.PersistableObject instance into this collection at a specified index. /// </summary> /// <param name="index">Zero-based index.</param> /// <param name="value">The Server.Engines.Reports.PersistableObject instance to insert.</param> public void Insert(int index, PersistableObject value) { List.Insert(index, value); }
/// <summary> /// Removes a specified Server.Engines.Reports.PersistableObject instance from this collection. /// </summary> /// <param name="value">The Server.Engines.Reports.PersistableObject instance to remove.</param> public void Remove(PersistableObject value) { List.Remove(value); }
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, this.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); this.RenderDirect(obj, html); html.Write("<br>"); TimeZone tz = TimeZone.CurrentTimeZone; bool isDaylight = tz.IsDaylightSavingTime(this.m_TimeStamp); TimeSpan utcOffset = tz.GetUtcOffset(this.m_TimeStamp); html.Write("Snapshot taken at {0:d} {0:t}. All times are {1}.", this.m_TimeStamp, tz.StandardName); html.RenderEndTag(); html.RenderEndTag(); html.RenderEndTag(); }
public override void WriteDocument( PersistableObject root ) { log.Info( "Reports: Save started" ); m_Xml.Formatting = Formatting.Indented; m_Xml.IndentChar = '\t'; m_Xml.Indentation = 1; m_Xml.WriteStartDocument( true ); root.Serialize( this ); log.Info( "Reports: Save complete" ); }
/// <summary> /// Determines whether a specified Server.Engines.Reports.PersistableObject instance is in this collection. /// </summary> /// <param name="value">Server.Engines.Reports.PersistableObject instance to search for.</param> /// <returns>True if the Server.Engines.Reports.PersistableObject instance is in the collection; otherwise false.</returns> public bool Contains(PersistableObject value) { return(List.Contains(value)); }
/// <summary> /// Retrieve the index a specified Server.Engines.Reports.PersistableObject instance is in this collection. /// </summary> /// <param name="value">Server.Engines.Reports.PersistableObject instance to find.</param> /// <returns>The zero-based index of the specified Server.Engines.Reports.PersistableObject instance. If the object is not found, the return value is -1.</returns> public int IndexOf(PersistableObject value) { return(List.IndexOf(value)); }
/// <summary> /// Append a Server.Engines.Reports.PersistableObject entry to this collection. /// </summary> /// <param name="value">Server.Engines.Reports.PersistableObject instance.</param> /// <returns>The position into which the new element was inserted.</returns> public int Add(PersistableObject value) { return(List.Add(value)); }
public abstract void ReadDocument(PersistableObject root);
public void AddRange(PersistableObject[] col) { this.InnerList.AddRange(col); }
/// <summary> /// Advances the enumerator to the next queue of the enumeration, if one is currently available. /// </summary> /// <returns>true, if the enumerator was succesfully advanced to the next queue; false, if the enumerator has reached the end of the enumeration.</returns> public bool MoveNext() { if ((_index < (_collection.Count - 1))) { _index = (_index + 1); _currentElement = _collection[_index]; return true; } _index = _collection.Count; return false; }
public abstract void WriteDocument( PersistableObject root );
/// <summary> /// Append a Server.Engines.Reports.PersistableObject entry to this collection. /// </summary> /// <param name="value">Server.Engines.Reports.PersistableObject instance.</param> /// <returns>The position into which the new element was inserted.</returns> public int Add(PersistableObject value) { return List.Add(value); }
public abstract void WriteDocument(PersistableObject root);
/// <summary> /// Determines whether a specified Server.Engines.Reports.PersistableObject instance is in this collection. /// </summary> /// <param name="value">Server.Engines.Reports.PersistableObject instance to search for.</param> /// <returns>True if the Server.Engines.Reports.PersistableObject instance is in the collection; otherwise false.</returns> public bool Contains(PersistableObject value) { return List.Contains(value); }
/// <summary> /// Retrieve the index a specified Server.Engines.Reports.PersistableObject instance is in this collection. /// </summary> /// <param name="value">Server.Engines.Reports.PersistableObject instance to find.</param> /// <returns>The zero-based index of the specified Server.Engines.Reports.PersistableObject instance. If the object is not found, the return value is -1.</returns> public int IndexOf(PersistableObject value) { return List.IndexOf(value); }
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"; }
public override void ReadDocument( PersistableObject root ) { log.Info("Reports: Loading..." ); m_Xml.Read(); m_Xml.Read(); m_HasChild = !m_Xml.IsEmptyElement; root.Deserialize( this ); }