Esempio n. 1
0
        public void ShowProductionTrace(ILogger logger, string slotName, SlotStatus status, PPDCalculation ppdCalculation, BonusCalculation bonusCalculation)
        {
            // test the level
            if (!logger.IsDebugEnabled)
            {
                return;
            }

            if (ProteinIsUnknown(CurrentProtein))
            {
                logger.Debug(String.Format(Logger.NameFormat, slotName, "Protein is unknown... 0 PPD."));
                return;
            }

            switch (bonusCalculation)
            {
            case BonusCalculation.DownloadTime:
                logger.Debug(String.Format(Logger.NameFormat, slotName,
                                           status == SlotStatus.RunningNoFrameTimes
                            ? "Calculate Bonus PPD by Frame Time."
                            : "Calculate Bonus PPD by Download Time."));
                break;

            case BonusCalculation.FrameTime:
                logger.Debug(String.Format(Logger.NameFormat, slotName, "Calculate Bonus PPD by Frame Time."));
                break;

            default:
                logger.Debug(String.Format(Logger.NameFormat, slotName, "Calculate Standard PPD."));
                break;
            }

            TimeSpan frameTime = GetFrameTime(ppdCalculation);
            var      noBonus   = CurrentProtein.GetProteinProduction(frameTime, TimeSpan.Zero);
            TimeSpan unitTimeByDownloadTime = GetUnitTimeByDownloadTime(frameTime);
            var      bonusByDownload        = CurrentProtein.GetProteinProduction(frameTime, unitTimeByDownloadTime);
            TimeSpan unitTimeByFrameTime    = GetUnitTimeByFrameTime(frameTime);
            var      bonusByFrame           = CurrentProtein.GetProteinProduction(frameTime, unitTimeByFrameTime);

            logger.Debug(CreateProductionDebugOutput(WorkUnit.ToShortProjectString(), frameTime, CurrentProtein, noBonus,
                                                     unitTimeByDownloadTime, bonusByDownload,
                                                     unitTimeByFrameTime, bonusByFrame));
        }
Esempio n. 2
0
        public void ShowProductionTrace(ILogger logger, string slotName, SlotStatus status, PpdCalculationType calculationType, BonusCalculationType bonusCalculationType)
        {
            // test the level
            if (!logger.IsDebugEnabled)
            {
                return;
            }

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

            switch (bonusCalculationType)
            {
            case BonusCalculationType.DownloadTime:
                logger.DebugFormat(Constants.ClientNameFormat, slotName,
                                   status == SlotStatus.RunningNoFrameTimes
                            ? "Calculate Bonus PPD by Frame Time."
                            : "Calculate Bonus PPD by Download Time.");
                break;

            case BonusCalculationType.FrameTime:
                logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Bonus PPD by Frame Time.");
                break;

            default:
                logger.DebugFormat(Constants.ClientNameFormat, slotName, "Calculate Standard PPD.");
                break;
            }

            TimeSpan frameTime              = GetFrameTime(calculationType);
            var      noBonusValues          = CurrentProtein.GetProductionValues(frameTime, TimeSpan.Zero);
            TimeSpan unitTimeByDownloadTime = GetUnitTimeByDownloadTime(frameTime);
            var      bonusByDownloadValues  = CurrentProtein.GetProductionValues(frameTime, unitTimeByDownloadTime);
            TimeSpan unitTimeByFrameTime    = GetUnitTimeByFrameTime(frameTime);
            var      bonusByFrameValues     = CurrentProtein.GetProductionValues(frameTime, unitTimeByFrameTime);

            logger.Debug(CreateProductionDebugOutput(UnitInfoData.ToShortProjectString(), frameTime, CurrentProtein, noBonusValues,
                                                     unitTimeByDownloadTime, bonusByDownloadValues,
                                                     unitTimeByFrameTime, bonusByFrameValues));
        }
Esempio n. 3
0
        private double GetPPD(TimeSpan frameTime, TimeSpan unitTimeByDownloadTime, TimeSpan unitTimeByFrameTime, SlotStatus status, BonusCalculation calculateBonus)
        {
            if (ProteinIsUnknown(CurrentProtein))
            {
                return(0.0);
            }

            switch (calculateBonus)
            {
            case BonusCalculation.DownloadTime when status == SlotStatus.RunningNoFrameTimes:
                return(CurrentProtein.GetBonusPPD(frameTime, unitTimeByFrameTime));

            case BonusCalculation.DownloadTime:
                return(CurrentProtein.GetBonusPPD(frameTime, unitTimeByDownloadTime));

            case BonusCalculation.FrameTime:
                return(CurrentProtein.GetBonusPPD(frameTime, unitTimeByFrameTime));

            default:
                return(CurrentProtein.GetPPD(frameTime));
            }
        }
Esempio n. 4
0
        private double GetCredit(TimeSpan unitTimeByDownloadTime, TimeSpan unitTimeByFrameTime, SlotStatus status, BonusCalculationType calculateBonus)
        {
            if (CurrentProtein.IsUnknown())
            {
                return(0.0);
            }

            switch (calculateBonus)
            {
            case BonusCalculationType.DownloadTime when status == SlotStatus.RunningNoFrameTimes:
                return(CurrentProtein.GetBonusCredit(unitTimeByFrameTime));

            case BonusCalculationType.DownloadTime:
                return(CurrentProtein.GetBonusCredit(unitTimeByDownloadTime));

            case BonusCalculationType.FrameTime:
                return(CurrentProtein.GetBonusCredit(unitTimeByFrameTime));

            default:
                return(CurrentProtein.Credit);
            }
        }