Beispiel #1
0
 private byte[] Read(int inCount)
 {
     byte[] theData = new byte[inCount];
     while (true)
     {
         if (Queue.Count >= theData.Length)
         {
             lock (Queue)
             {
                 for (int i = 0; i < theData.Length; i++)
                 {
                     theData[i] = Queue.Dequeue();
                 }
             }
             break;
         }
         else if (!PipeServer.IsConnected)
         {
             throw new Exception();
         }
         HasData.Reset();
         HasData.WaitOne(1000);
     }
     return(theData);
 }
Beispiel #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (Name.Length != 0)
            {
                hash ^= Name.GetHashCode();
            }
            if (Kind != 0)
            {
                hash ^= Kind.GetHashCode();
            }
            if (nodeId_ != null)
            {
                hash ^= NodeId.GetHashCode();
            }
            if (HasData != false)
            {
                hash ^= HasData.GetHashCode();
            }
            if (Data.Length != 0)
            {
                hash ^= Data.GetHashCode();
            }
            if (_unknownFields != null)
            {
                hash ^= _unknownFields.GetHashCode();
            }
            return(hash);
        }
 private bool Equals(JSendResponse <T> other)
 {
     return(Status == other.Status &&
            object.Equals(Error, other.Error) &&
            object.Equals(HttpResponse, other.HttpResponse) &&
            EqualityComparer <T> .Default.Equals(GetDataOrDefault(), other.GetDataOrDefault()) &&
            HasData.Equals(other.HasData));
 }
        /// <summary>Serves as a hash function for this <see cref="JSendResponse{T}"/>.</summary>
        /// <returns>A hash code for this <see cref="JSendResponse{T}"/>.</returns>
        public override int GetHashCode()
        {
            unchecked
            {
                var hashCode = (int)Status;
                hashCode = (hashCode * 397) ^ (Error?.GetHashCode() ?? 0);
                hashCode = (hashCode * 397) ^ HttpResponse.GetHashCode();
                hashCode = (hashCode * 397) ^ EqualityComparer <T> .Default.GetHashCode(GetDataOrDefault());

                hashCode = (hashCode * 397) ^ HasData.GetHashCode();
                return(hashCode);
            }
        }
Beispiel #5
0
 public ClassB()
 {
     m_hasData = new HasData(this);
 }