Exemplo n.º 1
0
        /// <summary>Serves as the default hash function.</summary>
        /// <returns>A hash code for the current object.</returns>
        public override int GetHashCode()
        {
            var hash = 1;

            hash ^= Id.GetHashCode();
            hash ^= ParentProcessId.GetHashCode();
            hash ^= Image.GetHashCode();
            hash ^= Name.GetHashCode();
            hash ^= CommandLine.GetHashCode();
            hash ^= WorkingDirectory.GetHashCode();
            hash ^= CreationDate.GetHashCode();
            hash ^= SessionId.GetHashCode();
            return(hash);
        }
Exemplo n.º 2
0
        public override object GetValue(string key)
        {
            switch (key)
            {
            case "Id":
                return(Id.ToByteArray());

            case "ParentProcessId":
                return(ParentProcessId?.ToByteArray());

            case "RootProcessId":
                return(RootProcessId.ToByteArray());

            case "StartingTransition":
                return(StartingTransition);

            default:
                throw new Exception($"Column {key} is not exists");
            }
        }
Exemplo n.º 3
0
 /// <summary>
 /// Gets the hash code
 /// </summary>
 /// <returns>Hash code</returns>
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         // Suitable nullity checks etc, of course :)
         if (Id != null)
         {
             hashCode = hashCode * 59 + Id.GetHashCode();
         }
         if (StateName != null)
         {
             hashCode = hashCode * 59 + StateName.GetHashCode();
         }
         if (ActivityName != null)
         {
             hashCode = hashCode * 59 + ActivityName.GetHashCode();
         }
         if (SchemeId != null)
         {
             hashCode = hashCode * 59 + SchemeId.GetHashCode();
         }
         if (SchemeCode != null)
         {
             hashCode = hashCode * 59 + SchemeCode.GetHashCode();
         }
         if (PreviousState != null)
         {
             hashCode = hashCode * 59 + PreviousState.GetHashCode();
         }
         if (PreviousStateForDirect != null)
         {
             hashCode = hashCode * 59 + PreviousStateForDirect.GetHashCode();
         }
         if (PreviousStateForReverse != null)
         {
             hashCode = hashCode * 59 + PreviousStateForReverse.GetHashCode();
         }
         if (PreviousActivity != null)
         {
             hashCode = hashCode * 59 + PreviousActivity.GetHashCode();
         }
         if (PreviousActivityForDirect != null)
         {
             hashCode = hashCode * 59 + PreviousActivityForDirect.GetHashCode();
         }
         if (PreviousActivityForReverse != null)
         {
             hashCode = hashCode * 59 + PreviousActivityForReverse.GetHashCode();
         }
         if (ParentProcessId != null)
         {
             hashCode = hashCode * 59 + ParentProcessId.GetHashCode();
         }
         if (RootProcessId != null)
         {
             hashCode = hashCode * 59 + RootProcessId.GetHashCode();
         }
         if (InstanceStatus != null)
         {
             hashCode = hashCode * 59 + InstanceStatus.GetHashCode();
         }
         if (Transitions != null)
         {
             hashCode = hashCode * 59 + Transitions.GetHashCode();
         }
         if (History != null)
         {
             hashCode = hashCode * 59 + History.GetHashCode();
         }
         if (ProcessParameters != null)
         {
             hashCode = hashCode * 59 + ProcessParameters.GetHashCode();
         }
         return(hashCode);
     }
 }
Exemplo n.º 4
0
        /// <summary>
        /// Returns true if ProcessInfo instances are equal
        /// </summary>
        /// <param name="other">Instance of ProcessInfo to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ProcessInfo other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Id == other.Id ||
                     Id != null &&
                     Id.Equals(other.Id)
                     ) &&
                 (
                     StateName == other.StateName ||
                     StateName != null &&
                     StateName.Equals(other.StateName)
                 ) &&
                 (
                     ActivityName == other.ActivityName ||
                     ActivityName != null &&
                     ActivityName.Equals(other.ActivityName)
                 ) &&
                 (
                     SchemeId == other.SchemeId ||
                     SchemeId != null &&
                     SchemeId.Equals(other.SchemeId)
                 ) &&
                 (
                     SchemeCode == other.SchemeCode ||
                     SchemeCode != null &&
                     SchemeCode.Equals(other.SchemeCode)
                 ) &&
                 (
                     PreviousState == other.PreviousState ||
                     PreviousState != null &&
                     PreviousState.Equals(other.PreviousState)
                 ) &&
                 (
                     PreviousStateForDirect == other.PreviousStateForDirect ||
                     PreviousStateForDirect != null &&
                     PreviousStateForDirect.Equals(other.PreviousStateForDirect)
                 ) &&
                 (
                     PreviousStateForReverse == other.PreviousStateForReverse ||
                     PreviousStateForReverse != null &&
                     PreviousStateForReverse.Equals(other.PreviousStateForReverse)
                 ) &&
                 (
                     PreviousActivity == other.PreviousActivity ||
                     PreviousActivity != null &&
                     PreviousActivity.Equals(other.PreviousActivity)
                 ) &&
                 (
                     PreviousActivityForDirect == other.PreviousActivityForDirect ||
                     PreviousActivityForDirect != null &&
                     PreviousActivityForDirect.Equals(other.PreviousActivityForDirect)
                 ) &&
                 (
                     PreviousActivityForReverse == other.PreviousActivityForReverse ||
                     PreviousActivityForReverse != null &&
                     PreviousActivityForReverse.Equals(other.PreviousActivityForReverse)
                 ) &&
                 (
                     ParentProcessId == other.ParentProcessId ||
                     ParentProcessId != null &&
                     ParentProcessId.Equals(other.ParentProcessId)
                 ) &&
                 (
                     RootProcessId == other.RootProcessId ||
                     RootProcessId != null &&
                     RootProcessId.Equals(other.RootProcessId)
                 ) &&
                 (
                     InstanceStatus == other.InstanceStatus ||
                     InstanceStatus != null &&
                     InstanceStatus.Equals(other.InstanceStatus)
                 ) &&
                 (
                     Transitions == other.Transitions ||
                     Transitions != null &&
                     Transitions.SequenceEqual(other.Transitions)
                 ) &&
                 (
                     History == other.History ||
                     History != null &&
                     History.SequenceEqual(other.History)
                 ) &&
                 (
                     ProcessParameters == other.ProcessParameters ||
                     ProcessParameters != null &&
                     ProcessParameters.Equals(other.ProcessParameters)
                 ));
        }