Ejemplo n.º 1
0
        // ----------------------------------------------------------------------------------------
        /// <!-- Pop -->
        /// <summary>
        ///      Pops a method name off the performance stack etc.
        /// </summary>
        private void Pop()
        {
            if (OutputConnection != null && OutputConnection.State == ConnectionState.Closed)
            {
                throw new Exception(TopMethod + " - Output Connection is closed");
            }
            if (InputConnection != null && InputConnection.State == ConnectionState.Closed)
            {
                throw new Exception(TopMethod + " - Input Connection is closed");
            }

            if (MeasurePerformance)
            {
                InfoAspect.Measured(TopMethod);
                Level--;
                if (Method.Count > 0)
                {
                    Method.RemoveAt(Method.Count - 1); // pop the stack
                }
                else
                {
                    Pause();
                }
            }

            if (Level != Method.Count + 1)
            {
                Pause();
            }
        }
Ejemplo n.º 2
0
        private void Push(string methodName)
        {
            if (OutputConnection != null && OutputConnection.State == ConnectionState.Closed)
            {
                throw new Exception(TopMethod + " - Output Connection is closed");
            }
            if (InputConnection != null && InputConnection.State == ConnectionState.Closed)
            {
                throw new Exception(TopMethod + " - Input Connection is closed");
            }

            if (MeasurePerformance)
            {
                Method.Add(methodName); // push the stack
                InfoAspect.Measuring(methodName);
                Level++;
            }
            if (Level != Method.Count + 1)
            {
                Pause();
            }
        }