Ejemplo n.º 1
0
        internal void SetResults(ProcessedDataPackage package, int index)
        {
            lastRenderTimestamp = 0;
            if (package == null)
            {
                //  Clear();
                return;
            }

            lock (setResultsLock)
            {
                this.currentResultsIndex = index;

                if (lastPackageHashNumber != package.GetHashCode())
                {
                    this.currentResults        = null;
                    this.package               = package;
                    this.lastPackageHashNumber = package.GetHashCode();

                    if (package.ContainsKey(typeof(BrokenSourceData)) != false &&
                        String.IsNullOrEmpty(((BrokenSourceData)package[typeof(BrokenSourceData)]).PageSource) == false &&
                        ((BrokenSourceData)package[typeof(BrokenSourceData)]).InjectionBreaks != null)
                    {
                        BrokenSourceData brokenSourceData = ((BrokenSourceData)package[typeof(BrokenSourceData)]);

                        SourcePiece[] sp = new SourcePiece[brokenSourceData.InjectionBreaks.Count];
                        int           i  = 0;
                        foreach (SourcePiece s in brokenSourceData.InjectionBreaks)
                        {
                            sp[i] = s;
                            i++;
                        }
                        this.currentResults = sp;
                        SetBuffer(brokenSourceData.PageSource);
                    }
                    if (package.ContainsKey(typeof(RenderData)) != false)
                    {
                        RenderData rd = (RenderData)package[typeof(RenderData)];
                        foreach (RenderedSegment rs in rd.Values)
                        {
                            lastRenderTimestamp = Math.Max(lastRenderTimestamp, rs.EndTime);
                        }
                    }
                }

                RedrawResultsNextPrev();
            }
        }
Ejemplo n.º 2
0
        private void AddRenderTimesData(XmlDocument xml, XmlElement results)
        {
            if (this.ContainsKey(typeof(RenderData)) == false)
            {
                return;
            }

            RenderData r = (RenderData)this[typeof(RenderData)];

            XmlElement b = xml.CreateElement("render");

            b.SetAttribute("un", r.ReadyStateUninitialized.ToString());
            b.SetAttribute("li", r.ReadyStateLoading.ToString());
            b.SetAttribute("lo", r.ReadyStateLoaded.ToString());
            b.SetAttribute("in", r.ReadyStateInteractive.ToString());
            b.SetAttribute("co", r.ReadyStateComplete.ToString());
            b.SetAttribute("ol", r.OnLoad.ToString());

            results.AppendChild(b);

            XmlElement t  = null;
            int        ss = 0;
            int        sl = 0;

            SourcePiece[] ib = null;
            if (this.ContainsKey(typeof(BrokenSourceData)))
            {
                BrokenSourceData bs = (BrokenSourceData)this[typeof(BrokenSourceData)];
                if (bs.InjectionBreaks != null)
                {
                    ib = new SourcePiece[bs.InjectionBreaks.Count];
                    int i = 0;

                    foreach (SourcePiece sp in bs.InjectionBreaks)
                    {
                        ib[i] = sp;
                        i++;
                    }
                }
            }
            foreach (RenderedSegment rp in r.Values)
            {
                ss = 0;
                sl = 0;

                t = xml.CreateElement("r");
                t.SetAttribute("s", rp.StartTime.ToString());
                t.SetAttribute("e", rp.EndTime.ToString());
                t.SetAttribute("i", rp.InjectionID.ToString());
                t.SetAttribute("st", rp.SegmentType.ToString());

                if (ib != null && ib.Length > rp.InjectionID)
                {
                    ss = ib[rp.InjectionID].StartIndex;
                    sl = ib[rp.InjectionID].Length;
                }

                t.SetAttribute("ss", ss.ToString());
                t.SetAttribute("sl", sl.ToString());

                b.AppendChild(t);
            }
        }