public T[] ReadFixedPrimitiveArray <T>(int actual_count) where T : struct { int size = NdrNativeUtils.GetPrimitiveTypeSize <T>(); Align(size); byte[] total_buffer = ReadFixedByteArray(size * actual_count); T[] ret = new T[actual_count]; Buffer.BlockCopy(total_buffer, 0, ret, 0, total_buffer.Length); return(ret); }
public void WriteFixedPrimitiveArray <T>(T[] array, int fixed_count) where T : struct { int size = NdrNativeUtils.GetPrimitiveTypeSize <T>(); int actual_size = array.Length * size; byte[] total_buffer = new byte[size * fixed_count]; Buffer.BlockCopy(array, 0, total_buffer, 0, Math.Min(actual_size, total_buffer.Length)); Align(size); WriteFixedByteArray(total_buffer, total_buffer.Length); }
public byte[] ToArray() { byte[] ret = _stm.ToArray(); int alignment = NdrNativeUtils.CalculateAlignment(ret.Length, 8); if (alignment > 0) { Array.Resize(ref ret, ret.Length + alignment); } return(ret); }
private void Align(int alignment) { byte[] buffer = new byte[NdrNativeUtils.CalculateAlignment((int)_stm.Length, alignment)]; _stm.Write(buffer, 0, buffer.Length); }
public void Align(int alignment) { _stm.Position += NdrNativeUtils.CalculateAlignment((int)_stm.Position, alignment); }
private void Align(int alignment) { _stm.Position += NdrNativeUtils.CalculateAlignment((int)_stm.Position, alignment); System.Diagnostics.Debug.WriteLine($"Pos: {_stm.Position} - Align: {alignment}"); }
private void Align(int alignment) { _stm.Position += NdrNativeUtils.CalculateAlignment((int)_stm.Position, alignment); NdrUtils.WriteLine($"Pos: {_stm.Position} - Align: {alignment}"); }