public void Receive(RecordingDelegate Delegate)
 {
     Delegate(Receiver.Receive(ref InPath));
 }
 public void Listen(RecordingDelegate Delegate, int Frequency)
 {
     ListenLock.EnterWriteLock();
         Recorder = Delegate;
         InDelay = 1000 / Frequency;
     ListenLock.ExitWriteLock();
         //hang until access to the variable "InDelay" and the
         //delegate "Recorder" are secured for writing for this
         //thread, then restore general access
     if (ListenThread == null)
     {
         ListenThread = new Thread(ListenLoop);
         ListenThread.Start();
     }
         //keep the thread running unless asked to stop
 }
 public void Receive(RecordingDelegate Delegate)
 {
     int BufferSize = Transceiver.BytesToRead;
         //the amount could change between clock cycles
     byte[] Data = new byte[BufferSize];
     Transceiver.Read(Data, 0, BufferSize);
     Delegate(Data);
 }
 public void Receive(RecordingDelegate Delegate, int PacketSize)
 {
     if (PacketSize > Transceiver.ReadBufferSize)
     {
         Transceiver.ReadBufferSize = PacketSize;
     }
         //make sure the buffer is big enough
     if (PacketSize <= Transceiver.BytesToRead)
     {
         byte[] Data = new byte[PacketSize];
         Transceiver.Read(Data, 0, PacketSize);
         Delegate(Data);
     }
         //read a packet if there's a whole packet available
     else
     {
         byte[] Data = new byte[0];
         Delegate(Data);
     }
     //otherwise call record with an empty array
 }
 public void Listen(
     RecordingDelegate Delegate, int PacketSize, int Frequency)
 {
     if (PacketSize > Transceiver.ReadBufferSize)
     {
         Transceiver.ReadBufferSize = PacketSize;
     }
         //make sure the buffer is big enough
     ListenLock.EnterWriteLock();
         DataIn = new byte[PacketSize];
         Recorder = Delegate;
         InDelay = 1000 / Frequency;
     ListenLock.ExitWriteLock();
         //hang until access to the variables "InDelay" and
         //"DataIn" and the delegate "Recorder" are secured for
         //writing for this thread, then restore general access
     if (ListenThread == null)
     {
         ListenThread = new Thread(ListenLoop);
         ListenThread.Start();
     }
         //keep the thread running unless asked to stop
 }