예제 #1
0
        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);
 }
예제 #3
0
 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 );
 }
예제 #4
0
 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");
 }
예제 #5
0
        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);
            }
        }
예제 #6
0
        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);
 }
예제 #8
0
        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);
        }
예제 #9
0
        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");
        }
예제 #10
0
        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");
        }
예제 #11
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 );
		}
예제 #12
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);
        }
예제 #13
0
 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);
     }
 }
예제 #14
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);
                }
            }
        }
예제 #15
0
        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();
        }
예제 #16
0
        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();
        }
예제 #17
0
        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);
 }
 /// <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);
 }
예제 #22
0
파일: HtmlRenderer.cs 프로젝트: m309/ForkUO
        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" );
        }
예제 #24
0
 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");
 }
 /// <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));
 }
예제 #28
0
 public abstract void ReadDocument(PersistableObject root);
 /// <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);
 }
예제 #30
0
 public void AddRange(PersistableObject[] col)
 {
     this.InnerList.AddRange(col);
 }
 /// <summary>
 /// Reset the cursor, so it points to the beginning of the enumerator.
 /// </summary>
 public void Reset()
 {
     _index = -1;
     _currentElement = null;
 }
예제 #32
0
 public abstract void ReadDocument(PersistableObject root);
 /// <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);
 }
예제 #36
0
 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);
 }
예제 #38
0
파일: HtmlRenderer.cs 프로젝트: m309/ForkUO
        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);
            }
        }
 /// <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);
 }
예제 #40
0
파일: HtmlRenderer.cs 프로젝트: m309/ForkUO
        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 );
 }