Example #1
0
        bool RollActivityPart(ref OMSDIO ini, ref int MessID, ref int LogStep, int ToStep)
        {
            if (LogStep > ToStep)
            {
                return(false);
            }

            if (MessID <= ini.GetMessageCount())
            {
                string s = ini.GetMessage(MessID);
                if (!string.IsNullOrEmpty(s))
                {
                    EventConsumer.FireLogStepEvent(s);
                }
                MessID++;
                int MC = ini.GetMessageOfs(LogStep + 1);
                if ((MC > 0) && (MessID >= MC))
                {
                    if ((ini.GetFailBits() & (1 << LogStep)) == 0)
                    //if ((ini.GetPassBits() & (1 << LogStep)) != 0)
                    {
                        EventConsumer.FireStepPassed();
                        InStep = false;
                    }
                    else
                    {
                        string ErrorLine;
                        GetErrorDescription(out ErrorLine);
                        throw new VideoException(ErrorLine);
                    }

                    do
                    {   // bypassing steps
                        LogStep++;
                        MC = ini.GetMessageOfs(LogStep);
                        System.Threading.Thread.Sleep(1);
                    }while ((MC > 0) && (MessID >= MC));
                    LogStep--;

                    if (LogStep <= ToStep)
                    {
                        EventConsumer.FireBeginStep(StepNames[LogStep]);
                        InStep = true;
                    }
                }
                return(true);
            }
            else
            {
                System.Threading.Thread.Sleep(100);
                return(false);
            }
        }
Example #2
0
            public void FireBeginStep(string Name)
            {
                string str = "[Profile: " + profile.Name + "] " + Name;

                if (!skipLog)
                {
                    lock (eventConsumer)
                    {
                        eventConsumer.FireBeginStep(str);
                    }
                }
                else
                {
                    skippedLog.Add(str);
                }
            }
Example #3
0
        public static void RegisterCallbacks()
        {
            VerifyFilterRegistration();
            SharpStepCallback callback =
                (ObjectId, StepNumber, Type, Text) =>
            {
                VideoContainer2 v             = null;
                IVideoFormEvent EventConsumer = null;
                lock (AllContainers)
                {
                    v = AllContainers[ObjectId];
                }
                if (v != null)
                {
                    EventConsumer = v.EventConsumer;
                }
                try
                {
                    switch (Type)
                    {
                    case 0:
                        if (EventConsumer != null)
                        {
                            EventConsumer.FireBeginStep(Text);
                        }
                        ;
                        Console.WriteLine("\nFilter = {0}, step{1}: Begin {2}", ObjectId, StepNumber, Text);
                        break;

                    case 1:
                        if (EventConsumer != null)
                        {
                            EventConsumer.FireStepRequest(Text);
                        }
                        ;
                        Console.WriteLine("\nFilter = {0}, step{1}: Send [{2}]", ObjectId, StepNumber, Text);
                        break;

                    case 2:
                        if (EventConsumer != null)
                        {
                            EventConsumer.FireStepResponse(Text);
                        }
                        ;
                        Console.WriteLine("\nFilter = {0}, step{1}: Recv [{2}]", ObjectId, StepNumber, Text);
                        break;

                    case 3:
                        if (EventConsumer != null)
                        {
                            EventConsumer.FireLogStepEvent(Text);
                        }
                        ;
                        Console.WriteLine("\nFilter = {0}, step{1}: Log  [{2}]", ObjectId, StepNumber, Text);
                        break;

                    case 4:
                        if (EventConsumer != null)
                        {
                            EventConsumer.FireStepPassed();
                        }
                        ;
                        Console.WriteLine("\nFilter = {0}, step{1}: Success {2}", ObjectId, StepNumber, Text);
                        break;

                    case 5:
                        v.Failed     = true;
                        v.FailedText = Text;
                        //if (EventConsumer != null) { EventConsumer.FireStepFailed(Text); };
                        Console.WriteLine("\nFilter = {0}, step{1}: Failure {2}", ObjectId, StepNumber, Text);
                        break;

                    default:
                        Console.WriteLine("\nFilter = {0}, step{1}: Undefined type {3}, Text=[{2}]", ObjectId, StepNumber, Text, Type);
                        break;
                    }
                }
                catch (Exception ex)
                {
                    v.Failed     = true;
                    v.FailedText = ex.Message;
                }
            };

            SetGlobalStepCallback(callback);
        }