MailKit.Security.Ntlm.TargetInfo.DecodeTimestamp C# (CSharp) Method

DecodeTimestamp() static private method

static private DecodeTimestamp ( byte buffer, int &index ) : long
buffer byte
index int
return long
		static long DecodeTimestamp (byte[] buffer, ref int index)
		{
			short nbytes = BitConverterLE.ToInt16 (buffer, index);
			long lo, hi;

			index += 2;

			switch (nbytes) {
			case 8:
				lo = BitConverterLE.ToUInt32 (buffer, index);
				index += 4;
				hi = BitConverterLE.ToUInt32 (buffer, index);
				index += 4;
				return (hi << 32) | lo;
			case 4:
				lo = BitConverterLE.ToUInt32 (buffer, index);
				index += 4;
				return lo;
			case 2:
				lo = BitConverterLE.ToUInt16 (buffer, index);
				index += 2;
				return lo;
			default:
				index += nbytes;
				return 0;
			}
		}