/// <summary> /// Reads an unsigned 64-bit integer from the byte array starting at the given offset. /// It's assumed the value can be used to create a DateTime. /// </summary> /// <param name="bytes">Array of bytes</param> /// <param name="offset">The starting position within the array. Defaults to zero.</param> /// <returns>ulong</returns> public static ulong GetFileTime(this byte[] bytes, int offset = 0) { var localFileTimeStruct = new FileTimeStruct { dwLowDateTime = BitConverter.ToUInt32(bytes, offset), dwHighDateTime = BitConverter.ToUInt32(bytes, checked(offset + 4)) }; return localFileTimeStruct.value; }
/// <summary> /// Reads an unsigned 64-bit integer from the byte array starting at the given offset. /// It's assumed the value can be used to create a DateTime. /// </summary> /// <param name="bytes">Array of bytes</param> /// <param name="offset">The starting position within the array. Defaults to zero.</param> /// <returns>ulong</returns> public static ulong GetFileTime(this byte[] bytes, int offset = 0) { var localFileTimeStruct = new FileTimeStruct { dwLowDateTime = BitConverter.ToUInt32(bytes, offset), dwHighDateTime = BitConverter.ToUInt32(bytes, checked (offset + 4)) }; return(localFileTimeStruct.value); }