コード例 #1
0
ファイル: IgsRegex.cs プロジェクト: omegaGoTeam/omegaGo.Core
        /// <summary>
        /// Attempts to parse a line as an IGS game heading starting with the code 15. If it fails, it returns null.
        /// </summary>
        /// <param name="line">The line, such as "15 Game 693 I: Robot730 (0 4500 -1) vs OmegaGo3 (0 4500 -1)".</param>
        /// <returns></returns>
        public static GameHeading ParseGameHeading(IgsLine line)
        {
            Match match = regexGameHeading.Match(line.EntireLine);

            if (match.Success)
            {/*empty string
             *  1. 352
             *  2. SANYOSHI
             *  3. 0
             *  4. 849
             *  5. 13 (or -1)
             *  6. hamas5ngo
             *  7. 0
             *  8. 900
             *  9. 25
             *  empty string*/
                CanadianTimeInformation black = IgsRegex.TimeInformationFromGameHeading(
                    match.Groups[8].Value.AsInteger(),
                    match.Groups[9].Value.AsInteger());
                CanadianTimeInformation white = IgsRegex.TimeInformationFromGameHeading(
                    match.Groups[4].Value.AsInteger(),
                    match.Groups[5].Value.AsInteger());
                return(new GameHeading(
                           match.Groups[1].Value.AsInteger(),
                           match.Groups[2].Value,
                           match.Groups[6].Value,
                           black,
                           white));
            }
            return(null);
        }
コード例 #2
0
 public GameHeading(int gameNumber, string whiteName, string blackName, CanadianTimeInformation blackTime, CanadianTimeInformation whiteTime)
 {
     this.GameNumber         = gameNumber;
     this.WhiteName          = whiteName;
     this.BlackName          = blackName;
     this.WhiteTimeRemaining = whiteTime;
     this.BlackTimeRemaining = blackTime;
 }
コード例 #3
0
 private static TimeControlTexts TranslateCanadianSubtext(CanadianTimeInformation canadianTimeInformation,
                                                          CanadianTimeControl control)
 {
     if (canadianTimeInformation.MainTimeLeft > TimeSpan.Zero)
     {
         return(new TimeControlTexts(
                    string.Format(Localizer.TimeControl_CanadianSubtextMain,
                                  control.StonesPerPeriod, control.PeriodTime.TotalMinutes),
                    string.Format(Localizer.TimeControl_CanadianTooltipMain,
                                  control.StonesPerPeriod, control.PeriodTime.TotalMinutes)
                    ));
     }
     else
     {
         return(new TimeControlTexts(
                    string.Format(Localizer.TimeControl_CanadianSubtextByoyomi,
                                  canadianTimeInformation.PeriodStonesLeft, control.StonesPerPeriod, control.PeriodTime.TotalMinutes),
                    Localizer.TimeControl_CanadianTooltipByoyomi
                    ));
     }
 }
コード例 #4
0
 public IgsTimeControlAdjustmentEventArgs(CanadianTimeInformation white, CanadianTimeInformation black)
 {
     this.White = white;
     this.Black = black;
 }