예제 #1
0
        private void OnProgress(string cmdId, string args)
        {
            if (String.IsNullOrEmpty(args))
            {
                return;
            }

            String[] vals = Regex.Split(args, ";");

            if (vals == null || vals.Length != 3)
            {
                return;
            }

            try
            {
                CollectPageInformation collectType = (CollectPageInformation)Enum.ToObject(typeof(CollectPageInformation), int.Parse(vals[0]));

                int prg = int.Parse(vals[1]);
                int tot = int.Parse(vals[2]);

                if ((collectType & CollectPageInformation.Screenshots_Small) == CollectPageInformation.Screenshots_Small ||
                    (collectType & CollectPageInformation.Screenshots_Full) == CollectPageInformation.Screenshots_Full)
                {
                    TestEvents.FireProgressEvent(TestEventType.CapturingSegment, prg, tot, null);
                }
                else
                {
                    TestEvents.FireProgressEvent(TestEventType.RenderingSegment, prg, tot, null);
                }
            }
            catch
            {
            }
        }
예제 #2
0
        public override void SendData(byte[] buffer, int offset, int length)
        {
            if (isRequest && this.PipesChain.ChainState.ContainsKey(STATE_KEY) == false && this.PipesChain.ChainState.ContainsKey("REQUEST_URI"))
            {
                HttpTransaction httpTranc = new HttpTransaction();

                httpTranc.URL  = (String)this.PipesChain.ChainState["REQUEST_URI"];
                httpTranc.Mode = HttpMode.SendingRequest;

                httpTranc.ConnectionStartTime     = DateTime.Now;
                httpTranc.SendingRequestStartTime = DateTime.Now;
                httpTranc.TotalSent = length;

                TestEvents.FireProgressEvent(TestEventType.RequestingFile, httpTranc.URL);
                TestEvents.FireProgressEvent(TestEventType.SendingData, length, 0, httpTranc.URL);

                this.PipesChain.ChainState.Add(STATE_KEY, httpTranc);

                AddRequestToTracker(httpTranc);
            }
            else if (isRequest)
            {
                HttpTransaction httpTranc = (HttpTransaction)this.PipesChain.ChainState[STATE_KEY];
                httpTranc.TotalSent += length;
                TestEvents.FireProgressEvent(TestEventType.SendingData, length, 0, httpTranc.URL);
            }
            else if (isRequest == false && this.PipesChain.ChainState.ContainsKey(STATE_KEY))
            {
                HttpTransaction httpTranc = (HttpTransaction)this.PipesChain.ChainState[STATE_KEY];

                if (httpTranc.Mode == HttpMode.WaitingForResponse)
                {
                    httpTranc.Mode = HttpMode.ReceivingResponse;
                    httpTranc.ReceivingResponseStartTime = DateTime.Now;
                }
                httpTranc.TotalReceived += length;

                TestEvents.FireProgressEvent(TestEventType.ReceivingData, length, 0, httpTranc.URL);
            }

            base.SendData(buffer, offset, length);
        }
예제 #3
0
        public override void Flush()
        {
            if (this.PipesChain.ChainState.ContainsKey(STATE_KEY))
            {
                HttpTransaction httpTranc = (HttpTransaction)this.PipesChain.ChainState[STATE_KEY];

                if (isRequest)
                {
                    httpTranc.Mode = HttpMode.WaitingForResponse;
                    httpTranc.SendingRequestEndTime = DateTime.Now;
                }
                else
                {
                    TestEvents.FireProgressEvent(TestEventType.ResponseEnded, httpTranc.URL);
                    httpTranc.Mode = HttpMode.Completed;
                    httpTranc.ReceivingResponseEndTime = DateTime.Now;
                    httpTranc.ConnectionEndTime        = DateTime.Now;
                }
            }

            base.Flush();
        }
예제 #4
0
파일: Program.cs 프로젝트: jerkyboy/msfast
        static void Main(string[] args)
        {
            commandArgs = args;
            AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
            PageDataCollectorStartInfo pdcsi = new PageDataCollectorStartInfo(args);

            if (pdcsi.IsValid() == false)
            {
                PageDataCollectorStartInfo.PrintUsage(System.Console.Error);
                System.Environment.ExitCode = (int)(PageDataCollectorErrors.InvalidOrMissingArguments);
            }
            else
            {
                TestEvents.IsVerbose = pdcsi.IsVerbose;

                TestEvents.FireProgressEvent(TestEventType.TestStarted);

                pdcsi.IsDebug = true;

                _Collector c = new _Collector(pdcsi);

                try
                {
                    System.Environment.ExitCode = c.Run();
                }
                catch {
                    System.Environment.ExitCode = (int)PageDataCollectorErrors.Unknown;
                }
                finally
                {
                    c.Release();
                }

                TestEvents.FireProgressEvent(TestEventType.TestEnded);
            }
        }