コード例 #1
0
        public NotificationLogId First(int notificationsPerLog, long totalLogged)
        {
            var first = new NotificationLogId(1, notificationsPerLog);

            if (totalLogged < 1)
            {
                first = null;
            }
            return(first);
        }
コード例 #2
0
 public static string GetEncoded(NotificationLogId notificationLogId)
 {
     if (notificationLogId != null)
     {
         return(notificationLogId.Encoded);
     }
     else
     {
         return(null);
     }
 }
コード例 #3
0
        public NotificationLogId Previous(int notificationsPerLog, long totalLogged)
        {
            var previousLow  = Math.Max(this.Low - notificationsPerLog, 1);
            var previousHigh = this.Low - 1;
            var previous     = new NotificationLogId(previousLow, previousHigh);

            if (previousHigh <= 0 || previousLow > totalLogged)
            {
                previous = null;
            }
            return(previous);
        }
コード例 #4
0
        public NotificationLogId Next(int notificationsPerLog, long totalLogged)
        {
            var nextLow  = this.High + 1;
            var nextHigh = nextLow + notificationsPerLog - 1;
            var next     = new NotificationLogId(nextLow, nextHigh);

            if (nextLow > totalLogged)
            {
                next = null;
            }
            return(next);
        }
コード例 #5
0
        public static bool TryParse(string value, out NotificationLogId logId)
        {
            bool result = false;

            logId = null;

            var m = Regex.Match(value, Event.NotificationLog.LogId.Regex.Pattern, RegexOptions.Multiline | RegexOptions.IgnorePatternWhitespace);

            if (m.Success)
            {
                logId = new NotificationLogId(
                    long.Parse(m.Groups[Event.NotificationLog.LogId.Regex.CaptureName.Low].Value),
                    long.Parse(m.Groups[Event.NotificationLog.LogId.Regex.CaptureName.High].Value)
                    );
                result = true;
            }

            return(result);
        }
コード例 #6
0
 public NotificationLogId(NotificationLogId original)
 {
     this.Low  = original.Low;
     this.High = original.High;
 }