예제 #1
0
        public string GetDiscription(int?precision = null, ITimeFormatter formatter = null)
        {
            precision = precision ?? int.MaxValue;
            formatter = formatter ?? TimeFormatter.Instance;

            precision.Value.ShouldBePositive("precision");

            var elapsedTimes = new[]
            {
                ElapsedYears,
                ElapsedMonths,
                ElapsedDays,
                ElapsedHours,
                ElapsedMinutes,
                ElapsedSeconds
            };

            if (precision <= elapsedTimes.Length - 1)
            {
                for (var i = precision.Value; i < elapsedTimes.Length; i++)
                {
                    elapsedTimes[i] = 0;
                }
            }

            return(formatter.GetDuration(elapsedTimes[0],
                                         elapsedTimes[1],
                                         elapsedTimes[2],
                                         elapsedTimes[3],
                                         elapsedTimes[4],
                                         elapsedTimes[5]));
        }
예제 #2
0
        }         // ElapsedSeconds

        // ----------------------------------------------------------------------
        public string GetDescription(int precision = int.MaxValue, ITimeFormatter formatter = null)
        {
            if (precision < 1)
            {
                throw new ArgumentOutOfRangeException("precision");
            }

            formatter = formatter ?? TimeFormatter.Instance;

            int[] elapsedItems = new int[6];
            elapsedItems[0] = ElapsedYears;
            elapsedItems[1] = ElapsedMonths;
            elapsedItems[2] = ElapsedDays;
            elapsedItems[3] = ElapsedHours;
            elapsedItems[4] = ElapsedMinutes;
            elapsedItems[5] = ElapsedSeconds;

            if (precision <= elapsedItems.Length - 1)
            {
                for (int i = precision; i < elapsedItems.Length; i++)
                {
                    elapsedItems[i] = 0;
                }
            }

            return(formatter.GetDuration(
                       elapsedItems[0],
                       elapsedItems[1],
                       elapsedItems[2],
                       elapsedItems[3],
                       elapsedItems[4],
                       elapsedItems[5]));
        }         // GetDescription
예제 #3
0
 protected override string Format(ITimeFormatter formatter) {
     return formatter.GetCalendarPeriod(StartYearName,
                                        EndYearName,
                                        formatter.GetShortDate(Start),
                                        formatter.GetShortDate(End),
                                        Duration);
 }
 public CommonMealShoppingInfoMapper(ITimeFormatter timeFormatter, ICommonMealExpenseMapper commonMealExpenseMapper, ICommonMealRepository commonMealRepository, IPersonGroupMapper personGroupMapper)
 {
     _timeFormatter           = timeFormatter;
     _commonMealExpenseMapper = commonMealExpenseMapper;
     _commonMealRepository    = commonMealRepository;
     _personGroupMapper       = personGroupMapper;
 }
예제 #5
0
        protected override string Format(ITimeFormatter formatter) {
            var fmt = formatter ?? TimeFormatter.Instance;

            return fmt.GetCalendarPeriod(QuarterOfYearName,
                                         fmt.GetShortDate(Start),
                                         fmt.GetShortDate(End),
                                         Duration);
        }
예제 #6
0
 public CommonMealMapper(ITimeFormatter timeFormatter, ICommonMealRegistrationGroupFactory registrationGroupFactory, ICommonMealRegistrationMapper commonMealRegistrationMapper, ICommonMealChefMapper commonMealChefMapper, ITimeProvider timeProvider)
 {
     _timeFormatter                = timeFormatter;
     _registrationGroupFactory     = registrationGroupFactory;
     _commonMealRegistrationMapper = commonMealRegistrationMapper;
     _commonMealChefMapper         = commonMealChefMapper;
     _timeProvider = timeProvider;
 }
예제 #7
0
 protected override string Format(ITimeFormatter formatter)
 {
     return(formatter.GetCalendarPeriod(StartYearName,
                                        EndYearName,
                                        formatter.GetShortDate(Start),
                                        formatter.GetShortDate(End),
                                        Duration));
 }
예제 #8
0
        protected override string Format(ITimeFormatter formatter)
        {
            var fmt = formatter ?? TimeFormatter.Instance;

            return(fmt.GetCalendarPeriod(QuarterOfYearName,
                                         fmt.GetShortDate(Start),
                                         fmt.GetShortDate(End),
                                         Duration));
        }
예제 #9
0
        public Crysis3Component(LiveSplitState state)
        {
            this.Settings = new Crysis3.Crysis3Settings();

            SplitTimeFormatter = new RegularTimeFormatter(TimeAccuracy.Hundredths);
            Model = new TimerModel();
            State = state;

            Model.CurrentState = State;

            Start();
        }
예제 #10
0
        public ActionEditor(SplitAction action)
        {
            TimeFormatter  = new ShortTimeFormatter();
            ReturnedAction = (SplitAction)action.Clone();
            DialogResult   = DialogResult.Cancel;
            InitializeComponent();

            //Bindings for whatever reason cause "right to left"...
            RB_Prediction_Name.Text = ReturnedAction.Header;
            RB_Option1.Text         = ReturnedAction.Answer1;
            RB_Option2.Text         = ReturnedAction.Answer2;
            PredictionLenght        = TimeSpan.FromSeconds(ReturnedAction.Lenght);

            L_PreditionLenghtLimit.Text   = $"{RB_Prediction_Name.TextLength}/{RB_Prediction_Name.MaxLength}";
            L_CharactersUsedOutcome1.Text = $"{RB_Option1.TextLength}/{RB_Option1.MaxLength}";
            L_CharactersUsedOutcome2.Text = $"{RB_Option2.TextLength}/{RB_Option2.MaxLength}";
            TB_PredictionLenght.DataBindings.Add("Text", this, "PredictionLenghtGetSetter");
        }
예제 #11
0
 public MessageService(IMessageRepository messageRepository, ITimeFormatter timeFormatter, IFollowRepository followRepository)
 {
     _messageRepository = messageRepository;
     _timeFormatter     = timeFormatter;
     _followRepository  = followRepository;
 }
예제 #12
0
 /// <summary>
 /// TimePeriod의 설명을 표현합니다.
 /// </summary>
 /// <returns></returns>
 public virtual string GetDescription(ITimeFormatter formatter)
 {
     return(Format(formatter ?? TimeFormatter.Instance));
 }
예제 #13
0
 protected override string Format(ITimeFormatter formatter)
 {
     return(formatter.GetCalendarPeriod(Year.ToString(CultureInfo.InvariantCulture),
                                        formatter.GetShortDate(Start), formatter.GetShortDate(End), Duration));
 }
 public TimeService(ITimeProvider timeProvider, ITimeFormatter timeFormatter)
 {
     TimeProvider = timeProvider;
     TimeFormatter = timeFormatter;
 }
예제 #15
0
        } // Reset

        // ----------------------------------------------------------------------
        public string GetDescription(ITimeFormatter formatter = null)
        {
            return(Format(formatter ?? TimeFormatter.Instance));
        } // GetDescription
예제 #16
0
        } // Copy

        // ----------------------------------------------------------------------
        protected override string Format(ITimeFormatter formatter)
        {
            return(formatter.GetCalendarPeriod(formatter.GetDateTime(Start), formatter.GetDateTime(End), Duration));
        } // Format
예제 #17
0
 /// <summary>
 /// <paramref name="formatter"/>로 포맷한 문자열을 반환합니다.
 /// </summary>
 /// <param name="formatter"></param>
 /// <returns></returns>
 public virtual string Format(ITimeFormatter formatter = null) {
     return (formatter ?? TimeFormatter.Instance).GetCollectionPeriod(Count, Start, End, Duration);
 }
예제 #18
0
 public BerlinClockTimeConverter(ITimeFormatter timeFormatter, ITimeParser timeParser)
 {
     this.timeFormatter = timeFormatter;
     this.timeParser    = timeParser;
 }
예제 #19
0
 // ----------------------------------------------------------------------
 protected override string Format( ITimeFormatter formatter )
 {
     return formatter.GetCalendarPeriod( formatter.GetDateTime( Start), formatter.GetDateTime( End ), Duration );
 }
예제 #20
0
 // ----------------------------------------------------------------------
 protected virtual string Format( ITimeFormatter formatter )
 {
     return formatter.GetInterval( startInterval, endInterval, startEdge, endEdge, Duration );
 }
예제 #21
0
        public Settings()
        {
            //Init setting to default values
            InitializeComponent();
            CanUnBet         = true;
            UnBetPenalty     = 50;
            MinimumTime      = new TimeSpan(0, 0, 1);
            NbScores         = 5;
            UseGlobalTime    = false;
            Method           = "Current Timing Method";
            AllowMods        = false;
            SingleLineScores = false;
            TimeToShow       = "Best Segments";
            Delay            = 0;
            ParentSubSplits  = false;
            SelectedSegments = new List <string>();

            //Init messages to default values
            msgEnable          = "SplitsBet enabled!";
            msgDisable         = "SplitsBet disabled!";
            msgReset           = "Run is kill. RIP :(";
            msgTimerNotRunning = "Timer is not running; bets are closed;";
            msgTimerPaused     = "Timer is paused; bets are paused too.";
            msgTimerEnded      = "Run is over; there is nothing to bet on!";
            msgNoScore         = "Timer is not running; no score available.";
            msgNoHighscore     = "No highscore yet!";
            msgNoUnbet         = "You can't unbet :(";
            msgUnbetTimerEnd   = "The run has ended, you can't unbet!";
            msgCheckTimerEnd   = "The run has ended; nothing to check!";
            msgTooLateToBet    = "Too late to bet for this split; wait for the next one!";

            Formatter = new RegularTimeFormatter();

            //DataBindings for Settings
            chkCancelBets.DataBindings.Add("Checked", this, "CanUnBet", false, DataSourceUpdateMode.OnPropertyChanged);
            txtCancelingPenalty.DataBindings.Add("Text", this, "UnBetPenalty", false, DataSourceUpdateMode.OnPropertyChanged);
            numScores.DataBindings.Add("Value", this, "NbScores", false, DataSourceUpdateMode.OnPropertyChanged);
            chkGlobalTime.DataBindings.Add("Checked", this, "UseGlobalTime", false, DataSourceUpdateMode.OnPropertyChanged);
            cmbTimingMethod.DataBindings.Add("SelectedItem", this, "OverridenTimingMethod", false, DataSourceUpdateMode.OnPropertyChanged);
            chkAllowMods.DataBindings.Add("Checked", this, "AllowMods", false, DataSourceUpdateMode.OnPropertyChanged);
            chkSingleLineScores.DataBindings.Add("Checked", this, "SingleLineScores", false, DataSourceUpdateMode.OnPropertyChanged);
            cmbTimeToShow.DataBindings.Add("SelectedItem", this, "TimeToShow", false, DataSourceUpdateMode.OnPropertyChanged);
            txtDelay.DataBindings.Add("Text", this, "Delay", false, DataSourceUpdateMode.OnPropertyChanged);
            chkSubsplits.DataBindings.Add("Checked", this, "ParentSubSplits", false, DataSourceUpdateMode.OnPropertyChanged);

            //DataBindings for Bot Messages
            txtMsgEnable.DataBindings.Add("Text", this, "msgEnable", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMsgDisable.DataBindings.Add("Text", this, "msgDisable", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMsgReset.DataBindings.Add("Text", this, "msgReset", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMsgTimerNotRunning.DataBindings.Add("Text", this, "msgTimerNotRunning", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMsgTimerPaused.DataBindings.Add("Text", this, "msgTimerPaused", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMsgTimerEnded.DataBindings.Add("Text", this, "msgTimerEnded", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMsgNoScore.DataBindings.Add("Text", this, "msgNoScore", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMsgNoHighscore.DataBindings.Add("Text", this, "msgNoHighscore", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMsgNoUnbet.DataBindings.Add("Text", this, "msgNoUnbet", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMsgUnbetTimerEnd.DataBindings.Add("Text", this, "msgUnbetTimerEnd", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMsgCheckTimerEnd.DataBindings.Add("Text", this, "msgCheckTimerEnd", false, DataSourceUpdateMode.OnPropertyChanged);
            txtMsgTooLateToBet.DataBindings.Add("Text", this, "msgTooLateToBet", false, DataSourceUpdateMode.OnPropertyChanged);

            this.Load += Settings_Load;
        }
예제 #22
0
 // ----------------------------------------------------------------------
 protected virtual string Format( ITimeFormatter formatter )
 {
     return formatter.GetCollectionPeriod( Count, Start, End, Duration );
 }
예제 #23
0
 public string Format(ITimeFormatter formatter)
 {
     return Second.HasValue
         ? formatter.GetTimeString(Hour, Minute, Second.Value)
         : formatter.GetTimeString(Hour, Minute);
 }
예제 #24
0
 public InfoTimeComponent(String informationName, TimeSpan?timeValue, ITimeFormatter formatter)
     : base(informationName, "")
 {
     Formatter = formatter;
     TimeValue = timeValue;
 }
 public void Setup()
 {
     formatter = Substitute.For <ITimeFormatter>();
     parser    = Substitute.For <ITimeParser>();
 }
예제 #26
0
 public string GetFormattedTime(ITimeFormatter formatter)
 {
     var duration = GetTime();
     return formatter.Format(duration);
 }
예제 #27
0
        } // GetDescription

        // ----------------------------------------------------------------------
        protected virtual string Format(ITimeFormatter formatter)
        {
            return(formatter.GetCollectionPeriod(Count, Start, End, Duration));
        } // Format
예제 #28
0
 /// <summary>
 /// TimePeriod의 설명을 표현합니다.
 /// </summary>
 /// <returns></returns>
 public virtual string GetDescription(ITimeFormatter formatter) {
     return Format(formatter ?? TimeFormatter.Instance);
 }
예제 #29
0
 /// <summary>
 /// TimePeriod의 설명을 문자열로 반환합니다.
 /// </summary>
 /// <returns></returns>
 public string GetDescription(ITimeFormatter formatter = null) {
     return Format(formatter);
 }
예제 #30
0
 // ----------------------------------------------------------------------
 protected override string Format( ITimeFormatter formatter )
 {
     return string.Format( "{0}{1}", base.Format( formatter ), Direction == PlayDirection.Forward ? ">" : "<" );
 }
        }         // IsSamePeriod

        // ----------------------------------------------------------------------
        protected override string Format(ITimeFormatter formatter)
        {
            return(string.Format("{0}{1}", base.Format(formatter), Direction == PlayDirection.Forward ? ">" : "<"));
        }         // Format
예제 #32
0
        //---------------------------------------------------------------------

        protected override string Format(ITimeFormatter formatter) {
            return formatter.GetInterval(_start, _end, _startEdge, _endEdge, Duration);
        }
 public void TestSetup()
 {
     this.formatter = new SmartTimeFormatter();
 }
예제 #34
0
 /// <summary>
 /// TimePeriod의 설명을 문자열로 반환합니다.
 /// </summary>
 /// <returns></returns>
 public string GetDescription(ITimeFormatter formatter = null)
 {
     return(Format(formatter));
 }
예제 #35
0
 /// <summary>
 /// <paramref name="formatter"/>를 이용하여 기간 내용을 문자열로 표현합니다.
 /// </summary>
 /// <param name="formatter"></param>
 /// <returns></returns>
 protected virtual string Format(ITimeFormatter formatter) {
     return formatter.GetPeriod(Start, End, Duration);
 }
예제 #36
0
 /// <summary>
 /// <paramref name="formatter"/>로 포맷한 문자열을 반환합니다.
 /// </summary>
 /// <param name="formatter"></param>
 /// <returns></returns>
 public virtual string Format(ITimeFormatter formatter = null)
 {
     return((formatter ?? TimeFormatter.Instance).GetCollectionPeriod(Count, Start, End, Duration));
 }
예제 #37
0
 public InfoTimeComponent(string informationName, TimeSpan? timeValue, ITimeFormatter formatter)
     : base(informationName, "")
 {
     Formatter = formatter;
     TimeValue = timeValue;
 }
예제 #38
0
 // ----------------------------------------------------------------------
 public string GetDescription( ITimeFormatter formatter = null )
 {
     return Format( formatter ?? TimeFormatter.Instance );
 }
예제 #39
0
        } // GetDescription

        // ----------------------------------------------------------------------
        protected virtual string Format(ITimeFormatter formatter)
        {
            return(formatter.GetPeriod(start, end, Duration));
        } // Format
예제 #40
0
        // ----------------------------------------------------------------------
        public string GetDescription( int precision = int.MaxValue, ITimeFormatter formatter = null )
        {
            if ( precision < 1 )
            {
                throw new ArgumentOutOfRangeException( "precision" );
            }

            formatter = formatter ?? TimeFormatter.Instance;

            int[] elapsedItems = new int[ 6 ];
            elapsedItems[ 0 ] = ElapsedYears;
            elapsedItems[ 1 ] = ElapsedMonths;
            elapsedItems[ 2 ] = ElapsedDays;
            elapsedItems[ 3 ] = ElapsedHours;
            elapsedItems[ 4 ] = ElapsedMinutes;
            elapsedItems[ 5 ] = ElapsedSeconds;

            if ( precision <= elapsedItems.Length - 1 )
            {
                for ( int i = precision; i < elapsedItems.Length; i++ )
                {
                    elapsedItems[ i ] = 0;
                }
            }

            return formatter.GetDuration(
                elapsedItems[ 0 ],
                elapsedItems[ 1 ],
                elapsedItems[ 2 ],
                elapsedItems[ 3 ],
                elapsedItems[ 4 ],
                elapsedItems[ 5 ] );
        }
예제 #41
0
        }         // AddMonths

        // ----------------------------------------------------------------------
        protected override string Format(ITimeFormatter formatter)
        {
            return(formatter.GetCalendarPeriod(string.Format("{0}/{1}", Year, Month),
                                               formatter.GetShortDate(Start), formatter.GetShortDate(End), Duration));
        }         // Format
예제 #42
0
 public BerlinClockFormat(ITimeFormatter timeFormatter)
 {
     this.timeFormatter = timeFormatter;
 }
        }         // GetDescription

        // ----------------------------------------------------------------------
        protected virtual string Format(ITimeFormatter formatter)
        {
            return(formatter.GetInterval(startInterval, endInterval, startEdge, endEdge, Duration));
        }         // Format
예제 #44
0
        //---------------------------------------------------------------------

        protected override string Format(ITimeFormatter formatter)
        {
            return(formatter.GetInterval(_start, _end, _startEdge, _endEdge, Duration));
        }