Ejemplo n.º 1
0
        public int ReceiveData(
            PacketReader data,
            out NetworkGamer sender)
        {
            lock (receivedData) {
                if (receivedData.Count >= 0)
                {
                    data.Reset(0);

                    // take it off the queue
                    CommandReceiveData crd = (CommandReceiveData)receivedData.Dequeue();

                    // lets make sure that we can handle the data
                    if (data.Length < crd.data.Length)
                    {
                        data.Reset(crd.data.Length);
                    }

                    Array.Copy(crd.data, data.Data, data.Length);
                    sender = crd.gamer;
                    return(data.Length);
                }
                else
                {
                    sender = null;
                    return(0);
                }
            }
        }
Ejemplo n.º 2
0
 public int ReceiveData(PacketReader data, out NetworkGamer sender)
 {
     lock (this.receivedData)
     {
         if (this.receivedData.Count >= 0)
         {
             data.Reset(0);
             CommandReceiveData local_0 = this.receivedData.Dequeue();
             if (data.Length < local_0.data.Length)
             {
                 data.Reset(local_0.data.Length);
             }
             Array.Copy((Array)local_0.data, (Array)data.Data, data.Length);
             sender = local_0.gamer;
             return(data.Length);
         }
         else
         {
             sender = (NetworkGamer)null;
             return(0);
         }
     }
 }
Ejemplo n.º 3
0
		public int ReceiveData (
			PacketReader data,
			out NetworkGamer sender)
		{
			lock (receivedData) {
				if (receivedData.Count >= 0) {
					data.Reset(0);

					// take it off the queue
					CommandReceiveData crd = (CommandReceiveData)receivedData.Dequeue();
					
					// lets make sure that we can handle the data
					if (data.Length < crd.data.Length) {
						data.Reset(crd.data.Length);
					}

					Array.Copy(crd.data, data.Data, data.Length);
					sender = crd.gamer;
					return data.Length;	
					
				}
				else {
					sender = null;
					return 0;
				}
				
			}
		}
Ejemplo n.º 4
0
 public int ReceiveData(PacketReader data, out NetworkGamer sender)
 {
   lock (this.receivedData)
   {
     if (this.receivedData.Count >= 0)
     {
       data.Reset(0);
       CommandReceiveData local_0 = this.receivedData.Dequeue();
       if (data.Length < local_0.data.Length)
         data.Reset(local_0.data.Length);
       Array.Copy((Array) local_0.data, (Array) data.Data, data.Length);
       sender = local_0.gamer;
       return data.Length;
     }
     else
     {
       sender = (NetworkGamer) null;
       return 0;
     }
   }
 }