예제 #1
0
        // ----------------------------------------------------------------------------------------
        /// <!-- Pop -->
        /// <summary>
        ///      Pops a method name off the performance stack etc.
        /// </summary>
        private void Pop()
        {
            if (SecondaryConnection != null && SecondaryConnection.State == ConnectionState.Closed)
            {
                throw new Exception(TopMethod + " - Output Connection is closed");
            }
            if (PrimaryConnection != null && PrimaryConnection.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();
            }
        }
예제 #2
0
        private void Push(string methodName)
        {
            if (SecondaryConnection != null && SecondaryConnection.State == ConnectionState.Closed)
            {
                throw new Exception(TopMethod + " - Output Connection is closed");
            }
            if (PrimaryConnection != null && PrimaryConnection.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();
            }
        }