예제 #1
0
        /// <summary>
        /// EA Execution
        /// </summary>
        protected override void Execute()
        {
            _Project = _manager.GetValueFromINI(EnumINIFile.Environment, "IEX", "Project");
            if (string.IsNullOrEmpty(_Project))
            {
                ExceptionUtils.ThrowEx(new EAException(ExitCodes.INIFailure, "Failed to fetch Project from Environment.ini"));
            }
            else
            {
                EPG.Utils.LogCommentInfo("Project fetched is: " + _Project);
            }
            if (_IsLastDelivery)
            {
                res = _manager.MountGw(EnumMountAs.NOFORMAT, IsLastDelivery: _IsLastDelivery);
                if (!res.CommandSucceeded)
                {
                    ExceptionUtils.ThrowEx(new EAException(ExitCodes.MountFailure, "Failed to Mount the last delivery image"));
                }
                _iex.Wait(120);
                if (_isLive)
                {
                    res = _manager.StandBy(true);
                    if (!res.CommandSucceeded)
                    {
                        ExceptionUtils.ThrowEx(new EAException(ExitCodes.StandByFailure, "Failed to come out of stand by after mouting last delivery binary"));
                    }
                    _iex.Wait(10);
                }
            }
            //Copy binary
            EPG.OTA.CopyBinary();

            //Modify Imgae version
            EPG.OTA.ModifyImageVersion(_VersionID);

            if (_Project != ("IPC"))
            {
                //Create carousel
                EPG.OTA.Create_Carousel(_VersionID, _UsageID, _RFFeed);

                //Broadcast and rest carousel
                EPG.OTA.BroadcastCarousel(_RFFeed);
            }
            //Broadcast NIT
            EPG.OTA.NITBraodcast(_NITTable);
        }
        protected override void Execute()
        {
            String SoftVersion = "";
            String UsageID     = "";

            EPG.Utils.NavigateToDiagnostics();
            res = _iex.MilestonesEPG.GetEPGInfo("software version", out _SoftVersion);
            if (!res.CommandSucceeded)
            {
                EPG.Utils.LogCommentFail("Failed to get software version");
            }

            res = _iex.MilestonesEPG.GetEPGInfo("CPE USAGE ID", out _UsageID);
            if (!res.CommandSucceeded)
            {
                EPG.Utils.LogCommentFail("Failed to get Usage ID");
            }

            SoftVersion = _SoftVersion.Split('_').Last();
            UsageID     = _UsageID;
            _iex.LogComment("Version ID is : " + SoftVersion);

            if (_IsVerify)
            {
                try
                {
                    EPG.OTA.VerifySoftVersion(SoftVersion, _OldSoftVersion);
                }
                catch
                {
                    ExceptionUtils.ThrowEx(new EAException(ExitCodes.MountFailure, "Failed to verify software version is updated after download"));
                }
            }

            SetReturnValues(new String[] { SoftVersion, UsageID });
        }
        protected override void Execute()
        {
            IEXGateway._IEXResult res  = default(IEXGateway._IEXResult);
            string EventName           = "";
            string StartTime           = "";
            string EndTime             = "";
            int    OriginalDuration    = 0;
            int    Duration            = 0;
            string milestoneDateFormat = "";
            string EventDate           = "";
            int    TimeLeft            = 0;

            milestoneDateFormat = EPG.Utils.GetValueFromProject("EPG", "MILESTONE_DATE_FORMAT");
            if (string.IsNullOrEmpty(_EventKeyName))
            {
                ExceptionUtils.ThrowEx(new EAException(ExitCodes.NoValidParameters, "EventKeyName Is Empty"));
            }

            if (Convert.ToInt32(_ChannelNumber) <= 0)
            {
                ExceptionUtils.ThrowEx(new EAException(ExitCodes.NoValidParameters, "ChannelNumber Can't Be Equal Or Less Than 0"));
            }

            res = _manager.ChannelSurf(EnumSurfIn.Live, _ChannelNumber);

            if (this._MinTimeBeforeEvEnd > 0)
            {
                EPG.Banner.GetEventTimeLeft(ref TimeLeft);

                if (TimeLeft <= _MinTimeBeforeEvEnd * 60)
                {
                    EPG.Utils.LogCommentImportant("Current Event Time Left Was Less Than " + Convert.ToString(_MinTimeBeforeEvEnd) + " Minutes Waiting " + (TimeLeft + 5).ToString() + " Seconds");
                    EPG.Utils.ReturnToLiveViewing();
                    _iex.Wait(TimeLeft + 5);

                    EPG.Utils.EPG_Milestones_NavigateByName("STATE:LIVE");
                }
            }


            switch (_RecordIn)
            {
            case EnumRecordIn.Guide:
            {
                EPG.Guide.Navigate();
                EPG.Guide.NavigateToChannel(_ChannelNumber, true);
                if (!(_IsCurrent))
                {
                    EPG.Guide.NextEvent();
                }
                break;
            }

            case EnumRecordIn.ChannelBar:
            {
                if (_IsCurrent)
                {
                    EPG.ChannelBar.Navigate();
                }

                else
                {
                    EPG.ChannelBar.NextEvent(false);
                }
                break;
            }

            case EnumRecordIn.ActionBar:
            {
                EPG.Banner.Navigate();
                break;
            }

            case EnumRecordIn.Live:
            {
                EPG.Utils.ReturnToLiveViewing(true);
                break;
            }
            }

            EPG.Banner.GetEventName(ref EventName);

            if (string.IsNullOrEmpty(EventName) | EventName == "null")
            {
                SetWarning("Event Name Is Empty Will Fail Test If Tryied To Use");
            }

            EPG.Banner.GetEventStartTime(ref StartTime);

            EPG.Banner.GetEventEndTime(ref EndTime);
            EPG.Live.GetEpgDate(ref EventDate);
            EventDate = DateTime.ParseExact(EventDate, milestoneDateFormat, CultureInfo.InvariantCulture).ToString(EPG.Utils.GetEpgDateFormat());

            OriginalDuration = EPG.Utils._DateTime.SubtractInSec(Convert.ToDateTime(EndTime), Convert.ToDateTime(StartTime));

            EPG.Banner.GetEventTimeLeft(ref Duration);

            EPG.Utils.InsertEventToCollection(_EventKeyName, EventName, "GuideCurrent", StartTime, EndTime, Convert.ToString(_ChannelNumber), Duration, OriginalDuration, "", "",
                                              0, EventDate);

            if (_IsConflict)
            {
                try
                {
                    EPG.Menu.SelectToConflict();
                }
                catch
                {
                    EPG.Events.Remove(_EventKeyName);
                    ExceptionUtils.ThrowEx(new EAException(ExitCodes.SelectEventFailure, "Failed to select event " + _EventKeyName + "'"));
                }
            }
            else
            {
                try
                {
                    EPG.Utils.PreRecordRECkey(_IsCurrent, _IsConflict, _IsSeries);
                    _iex.Wait(2);
                    EPG.Banner.RecordEvent(_IsCurrent, false, _IsConflict, false, _IsSeries);
                }
                catch
                {
                    EPG.Events.Remove(_EventKeyName);
                    ExceptionUtils.ThrowEx(new EAException(ExitCodes.RecordEventFailure, "Failed to Record event " + _EventKeyName + "'"));
                }
                if (_IsCurrent)
                {
                    if (this._VerifyBookingInPCAT)
                    {
                        res = this._manager.PCAT.VerifyEventBooked(this._EventKeyName);
                        if (!res.CommandSucceeded)
                        {
                            EPG.Events.Remove(_EventKeyName);
                            ExceptionUtils.ThrowEx(new EAException(ExitCodes.PCATFailure, res.FailureReason));
                        }
                    }
                }
                else
                {
                    if (this._VerifyBookingInPCAT)
                    {
                        res = this._manager.PCAT.VerifyEventBooked(this._EventKeyName);
                        if (!res.CommandSucceeded)
                        {
                            EPG.Events.Remove(_EventKeyName);
                            ExceptionUtils.ThrowEx(new EAException(ExitCodes.PCATFailure, res.FailureReason));
                        }
                        res = this._manager.PCAT.VerifyEventStatus(this._EventKeyName, EnumPCATtables.FromBookings, "BOOKING_TYPE", "RECORD", false);
                        if (!res.CommandSucceeded)
                        {
                            EPG.Events.Remove(_EventKeyName);
                            ExceptionUtils.ThrowEx(new EAException(ExitCodes.PCATFailure, res.FailureReason));
                        }
                    }
                }

                if (this._ReturnToLive)
                {
                    EPG.Utils.ReturnToLiveViewing();
                }
            }
        }