/// <summary> /// In constructor, initialize the native PACTYPE structure. /// </summary> private void InitializeNativePacType() { NativePacType = new PACTYPE(); NativePacType.Version = PACTYPE_Version_Values.V1; NativePacType.cBuffers = (uint)pacInfoBuffers.Length; NativePacType.Buffers = new PAC_INFO_BUFFER[pacInfoBuffers.Length]; for (int i = 0; i < pacInfoBuffers.Length; i++) { NativePacType.Buffers[i] = pacInfoBuffers[i].CreateNativeInfoBuffer(); } }
/// <summary> /// Construct an instance of current class by decoding specified bytes. /// </summary> /// <param name="buffer">The specified bytes.</param> internal PacType(byte[] buffer) { NativePacType = PacUtility.MemoryToObject<PACTYPE>(buffer); pacInfoBuffers = new PacInfoBuffer[NativePacType.Buffers.Length]; for (int i = 0; i < NativePacType.Buffers.Length; ++i) { if (NativePacType.Buffers[i].cbBufferSize > 0) { PacInfoBuffers[i] = PacInfoBuffer.DecodeBuffer( NativePacType.Buffers[i], buffer); } else PacInfoBuffers[i] = null; } }
/// <summary> /// Construct an instance of current class by decoding specified bytes. /// </summary> /// <param name="buffer">The specified bytes.</param> internal PacType(byte[] buffer) { NativePacType = PacUtility.MemoryToObject <PACTYPE>(buffer); pacInfoBuffers = new PacInfoBuffer[NativePacType.Buffers.Length]; for (int i = 0; i < NativePacType.Buffers.Length; ++i) { if (NativePacType.Buffers[i].cbBufferSize > 0) { PacInfoBuffers[i] = PacInfoBuffer.DecodeBuffer( NativePacType.Buffers[i], buffer); } else { PacInfoBuffers[i] = null; } } }