예제 #1
0
        private double GetPPD(TimeSpan frameTime, TimeSpan eftByDownloadTime, TimeSpan eftByFrameTime, SlotStatus status, BonusCalculationType calculateBonus)
        {
            if (CurrentProtein.IsUnknown)
            {
                return(0);
            }

            // Issue 125
            if (calculateBonus.Equals(BonusCalculationType.DownloadTime))
            {
                // Issue 183
                if (status.Equals(SlotStatus.RunningAsync) ||
                    status.Equals(SlotStatus.RunningNoFrameTimes))
                {
                    return(ProductionCalculator.GetPPD(frameTime, CurrentProtein, eftByFrameTime));
                }

                return(ProductionCalculator.GetPPD(frameTime, CurrentProtein, eftByDownloadTime));
            }
            if (calculateBonus.Equals(BonusCalculationType.FrameTime))
            {
                return(ProductionCalculator.GetPPD(frameTime, CurrentProtein, eftByFrameTime));
            }

            return(ProductionCalculator.GetPPD(frameTime, CurrentProtein));
        }
예제 #2
0
 public static bool IsEnabled(this BonusCalculationType type)
 {
     return(type.Equals(BonusCalculationType.DownloadTime) ||
            type.Equals(BonusCalculationType.FrameTime));
 }
예제 #3
0
        private double GetPPD(TimeSpan frameTime, TimeSpan eftByDownloadTime, TimeSpan eftByFrameTime, SlotStatus status, BonusCalculationType calculateBonus)
        {
            if (CurrentProtein.IsUnknown())
             {
            return 0;
             }

             // Issue 125
             if (calculateBonus.Equals(BonusCalculationType.DownloadTime))
             {
            // Issue 183
            if (status.Equals(SlotStatus.RunningAsync) ||
                status.Equals(SlotStatus.RunningNoFrameTimes))
            {
               return CurrentProtein.GetPPD(frameTime, eftByFrameTime, true);
            }

            return CurrentProtein.GetPPD(frameTime, eftByDownloadTime, true);
             }
             if (calculateBonus.Equals(BonusCalculationType.FrameTime))
             {
            return CurrentProtein.GetPPD(frameTime, eftByFrameTime, true);
             }

             return CurrentProtein.GetPPD(frameTime);
        }
예제 #4
0
        public void ShowPPDTrace(ILogger logger, string slotName, SlotStatus status, PpdCalculationType calculationType, BonusCalculationType calculateBonus)
        {
            // test the level
             if (!logger.IsDebugEnabled) return;

             if (CurrentProtein.IsUnknown())
             {
            logger.DebugFormat(Constants.ClientNameFormat, slotName, "Protein is unknown... 0 PPD.");
            return;
             }

             // Issue 125
             if (calculateBonus.Equals(BonusCalculationType.DownloadTime))
             {
            // Issue 183
            if (status.Equals(SlotStatus.RunningAsync) ||
                status.Equals(SlotStatus.RunningNoFrameTimes))
            {
               logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Frame Time.");
            }
            else
            {
               logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Download Time.");
            }
             }
             else if (calculateBonus.Equals(BonusCalculationType.FrameTime))
             {
            logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Frame Time.");
             }
             else
             {
            logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Standard PPD.");
             }

             TimeSpan frameTime = GetFrameTime(calculationType);
             var values = CurrentProtein.GetProductionValues(frameTime, GetEftByDownloadTime(frameTime), GetEftByFrameTime(frameTime), calculateBonus.IsEnabled());
             logger.Debug(values.ToMultiLineString());
        }