/* ---------------------------------------------------------------------------- * This file was automatically generated by SWIG (http://www.swig.org). * Version 2.0.12 * * Do not make changes to this file unless you know what you are doing--modify * the SWIG interface file instead. * ----------------------------------------------------------------------------- */ namespace RakNet { using System; using System.Runtime.InteropServices; public class ByteQueue : IDisposable { private HandleRef swigCPtr; protected bool swigCMemOwn; internal ByteQueue(IntPtr cPtr, bool cMemoryOwn) { swigCMemOwn = cMemoryOwn; swigCPtr = new HandleRef(this, cPtr); } internal static HandleRef getCPtr(ByteQueue obj) { return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr; } ~ByteQueue() { Dispose(); } public virtual void Dispose() { lock(this) { if (swigCPtr.Handle != IntPtr.Zero) { if (swigCMemOwn) { swigCMemOwn = false; RakNetPINVOKE.delete_ByteQueue(swigCPtr); } swigCPtr = new HandleRef(null, IntPtr.Zero); } GC.SuppressFinalize(this); } } public byte[] PeekContiguousBytes(out uint outLength) { return PeekContiguousBytesHelper(out outLength); } public ByteQueue() : this(RakNetPINVOKE.new_ByteQueue(), true) { } public uint GetBytesWritten() { uint ret = RakNetPINVOKE.ByteQueue_GetBytesWritten(swigCPtr); return ret; } public void IncrementReadOffset(uint length) { RakNetPINVOKE.ByteQueue_IncrementReadOffset(swigCPtr, length); } public void DecrementReadOffset(uint length) { RakNetPINVOKE.ByteQueue_DecrementReadOffset(swigCPtr, length); } public void Clear(string file, uint line) { RakNetPINVOKE.ByteQueue_Clear(swigCPtr, file, line); } public void Print() { RakNetPINVOKE.ByteQueue_Print(swigCPtr); } public void WriteBytes(byte[] inByteArray, uint length, string file, uint line) { RakNetPINVOKE.ByteQueue_WriteBytes(swigCPtr, inByteArray, length, file, line); } public bool ReadBytes(byte[] inOutByteArray, uint maxLengthToRead, bool peek) { bool ret = RakNetPINVOKE.ByteQueue_ReadBytes(swigCPtr, inOutByteArray, maxLengthToRead, peek); return ret; } private byte[] PeekContiguousBytesHelper(out uint outLength) { IntPtr cPtr = RakNetPINVOKE.ByteQueue_PeekContiguousBytesHelper(swigCPtr, out outLength); int len = (int)outLength; if (len <= 0) { return null; } byte[] returnBytes = new byte[len]; Marshal.Copy(cPtr, returnBytes, 0, len); return returnBytes; } } }