/* ----------------------------------------------------------------------------
 * 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 SLNet {

using System;
using System.Runtime.InteropServices;

public class FileListTransfer : PluginInterface2 {
  private HandleRef swigCPtr;

  internal FileListTransfer(IntPtr cPtr, bool cMemoryOwn) : base(SLikeNetPINVOKE.FileListTransfer_SWIGUpcast(cPtr), cMemoryOwn) {
    swigCPtr = new HandleRef(this, cPtr);
  }

  internal static HandleRef getCPtr(FileListTransfer obj) {
    return (obj == null) ? new HandleRef(null, IntPtr.Zero) : obj.swigCPtr;
  }

  ~FileListTransfer() {
    Dispose();
  }

  public override void Dispose() {
    lock(this) {
      if (swigCPtr.Handle != IntPtr.Zero) {
        if (swigCMemOwn) {
          swigCMemOwn = false;
          SLikeNetPINVOKE.delete_FileListTransfer(swigCPtr);
        }
        swigCPtr = new HandleRef(null, IntPtr.Zero);
      }
      GC.SuppressFinalize(this);
      base.Dispose();
    }
  }

  public static FileListTransfer GetInstance() {
    IntPtr cPtr = SLikeNetPINVOKE.FileListTransfer_GetInstance();
    FileListTransfer ret = (cPtr == IntPtr.Zero) ? null : new FileListTransfer(cPtr, false);
    return ret;
  }

  public static void DestroyInstance(FileListTransfer i) {
    SLikeNetPINVOKE.FileListTransfer_DestroyInstance(FileListTransfer.getCPtr(i));
  }

  public FileListTransfer() : this(SLikeNetPINVOKE.new_FileListTransfer(), true) {
  }

  public void StartIncrementalReadThreads(int numThreads, int threadPriority) {
    SLikeNetPINVOKE.FileListTransfer_StartIncrementalReadThreads__SWIG_0(swigCPtr, numThreads, threadPriority);
  }

  public void StartIncrementalReadThreads(int numThreads) {
    SLikeNetPINVOKE.FileListTransfer_StartIncrementalReadThreads__SWIG_1(swigCPtr, numThreads);
  }

  public ushort SetupReceive(FileListTransferCBInterface handler, bool deleteHandler, SystemAddress allowedSender) {
    ushort ret = SLikeNetPINVOKE.FileListTransfer_SetupReceive(swigCPtr, FileListTransferCBInterface.getCPtr(handler), deleteHandler, SystemAddress.getCPtr(allowedSender));
    if (SLikeNetPINVOKE.SWIGPendingException.Pending) throw SLikeNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void Send(FileList fileList, RakPeerInterface rakPeer, SystemAddress recipient, ushort setID, PacketPriority priority, char orderingChannel, IncrementalReadInterface _incrementalReadInterface, uint _chunkSize) {
    SLikeNetPINVOKE.FileListTransfer_Send__SWIG_0(swigCPtr, FileList.getCPtr(fileList), RakPeerInterface.getCPtr(rakPeer), SystemAddress.getCPtr(recipient), setID, (int)priority, orderingChannel, IncrementalReadInterface.getCPtr(_incrementalReadInterface), _chunkSize);
    if (SLikeNetPINVOKE.SWIGPendingException.Pending) throw SLikeNetPINVOKE.SWIGPendingException.Retrieve();
  }

  public void Send(FileList fileList, RakPeerInterface rakPeer, SystemAddress recipient, ushort setID, PacketPriority priority, char orderingChannel, IncrementalReadInterface _incrementalReadInterface) {
    SLikeNetPINVOKE.FileListTransfer_Send__SWIG_1(swigCPtr, FileList.getCPtr(fileList), RakPeerInterface.getCPtr(rakPeer), SystemAddress.getCPtr(recipient), setID, (int)priority, orderingChannel, IncrementalReadInterface.getCPtr(_incrementalReadInterface));
    if (SLikeNetPINVOKE.SWIGPendingException.Pending) throw SLikeNetPINVOKE.SWIGPendingException.Retrieve();
  }

  public void Send(FileList fileList, RakPeerInterface rakPeer, SystemAddress recipient, ushort setID, PacketPriority priority, char orderingChannel) {
    SLikeNetPINVOKE.FileListTransfer_Send__SWIG_2(swigCPtr, FileList.getCPtr(fileList), RakPeerInterface.getCPtr(rakPeer), SystemAddress.getCPtr(recipient), setID, (int)priority, orderingChannel);
    if (SLikeNetPINVOKE.SWIGPendingException.Pending) throw SLikeNetPINVOKE.SWIGPendingException.Retrieve();
  }

  public uint GetPendingFilesToAddress(SystemAddress recipient) {
    uint ret = SLikeNetPINVOKE.FileListTransfer_GetPendingFilesToAddress(swigCPtr, SystemAddress.getCPtr(recipient));
    if (SLikeNetPINVOKE.SWIGPendingException.Pending) throw SLikeNetPINVOKE.SWIGPendingException.Retrieve();
    return ret;
  }

  public void CancelReceive(ushort inSetId) {
    SLikeNetPINVOKE.FileListTransfer_CancelReceive(swigCPtr, inSetId);
  }

  public void RemoveReceiver(SystemAddress systemAddress) {
    SLikeNetPINVOKE.FileListTransfer_RemoveReceiver(swigCPtr, SystemAddress.getCPtr(systemAddress));
    if (SLikeNetPINVOKE.SWIGPendingException.Pending) throw SLikeNetPINVOKE.SWIGPendingException.Retrieve();
  }

  public bool IsHandlerActive(ushort inSetId) {
    bool ret = SLikeNetPINVOKE.FileListTransfer_IsHandlerActive(swigCPtr, inSetId);
    return ret;
  }

  public void AddCallback(FileListProgress cb) {
    SLikeNetPINVOKE.FileListTransfer_AddCallback(swigCPtr, FileListProgress.getCPtr(cb));
  }

  public void RemoveCallback(FileListProgress cb) {
    SLikeNetPINVOKE.FileListTransfer_RemoveCallback(swigCPtr, FileListProgress.getCPtr(cb));
  }

  public void ClearCallbacks() {
    SLikeNetPINVOKE.FileListTransfer_ClearCallbacks(swigCPtr);
  }

}

}
