Beispiel #1
0
        public string ToString(LsnStringType stringType)
        {
            switch (stringType)
            {
            case LsnStringType.DecimalSeparated:
                return(LsnConverter.DecimalToDecimalSeparated(_lsnValue));

            case LsnStringType.HexidecimalSeparated:
                return(LsnConverter.DecimalToHexSeparated(_lsnValue));

            case LsnStringType.Hexadecimal:
                return(LsnConverter.DecimalToHexadecimal(_lsnValue));

            case LsnStringType.Decimal:
                return(_lsnValue.ToString());

            default:
                throw new ArgumentException("Unknown LsnStringType specified.", nameof(stringType));
            }
        }
Beispiel #2
0
        public LogSequenceNumber(string lsnValue, LsnStringType stringType)
        {
            switch (stringType)
            {
            case LsnStringType.DecimalSeparated:
                _lsnValue = LsnConverter.DecimalSeparatedToDecimal(lsnValue);
                break;

            case LsnStringType.HexidecimalSeparated:
                _lsnValue = LsnConverter.HexSeparatedToDecimal(lsnValue);
                break;

            case LsnStringType.Hexadecimal:
                _lsnValue = LsnConverter.HexadecimalToDecimal(lsnValue);
                break;

            case LsnStringType.Decimal:
                _lsnValue = decimal.Parse(lsnValue);
                break;

            default:
                throw new ArgumentException("Unknown LsnStringType specified.", nameof(stringType));
            }
        }
Beispiel #3
0
 public LogSequenceNumber(byte[] lsnBytes)
 {
     _lsnValue = LsnConverter.BytesToDecimal(lsnBytes);
 }
Beispiel #4
0
 public byte[] ToBytes()
 {
     return(LsnConverter.DecimalToBytes(_lsnValue));
 }