/// <summary> /// Decode specified buffer from specified index, with specified count /// of bytes, into the instance of current class. /// </summary> /// <param name="buffer">The specified buffer.</param> /// <param name="index">The specified index from beginning of buffer.</param> /// <param name="count">The specified count of bytes to be decoded.</param> internal override void DecodeBuffer(byte[] buffer, int index, int count) { NativePacCredentialInfo = PacUtility.MemoryToObject <PAC_CREDENTIAL_INFO>(buffer, index, count); int headerLength = sizeof(uint) + sizeof(uint); // This is vary length member without pre-defined calculate method. // Need to decode manually. NativePacCredentialInfo.SerializedData = new byte[count - headerLength]; Buffer.BlockCopy(buffer, index + headerLength, NativePacCredentialInfo.SerializedData, 0, count - headerLength); }
/// <summary> /// Decode specified buffer from specified index, with specified count /// of bytes, into the instance of current class. /// </summary> /// <param name="buffer">The specified buffer.</param> /// <param name="index">The specified index from beginning of buffer.</param> /// <param name="count">The specified count of bytes to be decoded.</param> internal override void DecodeBuffer(byte[] buffer, int index, int count) { NativePacCredentialInfo = PacUtility.MemoryToObject<PAC_CREDENTIAL_INFO>(buffer, index, count); int headerLength = sizeof(uint) + sizeof(uint); // This is vary length member without pre-defined calculate method. // Need to decode manually. NativePacCredentialInfo.SerializedData = new byte[count - headerLength]; Buffer.BlockCopy(buffer, index + headerLength, NativePacCredentialInfo.SerializedData, 0, count - headerLength); }