Example #1
0
        /// <summary>
        ///   Determines whether this PluginFile is less than, equal to,
        ///   or greater than the given PluginFile.
        /// </summary>
        /// <param name="other">The PluginFile to which to compare this PluginFile.</param>
        /// <returns>
        ///   A value less than 0 if this PluginFile is less than the given PluginFile,
        ///   or 0 if this PluginFile is equal to the given PluginFile,
        ///   or a value greater than 0 if this PluginFile is greater than the given PluginFile.
        /// </returns>
        public int CompareTo(PluginFile other)
        {
            var intResult = Priority.CompareTo(other.Priority);

            if (intResult == 0)
            {
                intResult = IsFolder.CompareTo(other.IsFolder);
                if (intResult == 0)
                {
                    intResult = Source.CompareTo(other.Source);
                    if (intResult == 0)
                    {
                        intResult = Destination.CompareTo(other.Destination);
                    }
                }
            }
            return(intResult);
        }
        /// <summary>
        /// Determines whether this PluginFile is less than, equal to,
        /// or greater than the given PluginFile.
        /// </summary>
        /// <param name="other">The PluginFile to which to compare this PluginFile.</param>
        /// <returns>A value less than 0 if this PluginFile is less than the given PluginFile,
        /// or 0 if this PluginFile is equal to the given PluginFile,
        ///or a value greater than 0 if this PluginFile is greater than the given PluginFile.</returns>
        public int CompareTo(InstallableFile other)
        {
            Int32 intResult = Priority.CompareTo(other.Priority);

            if (intResult == 0)
            {
                intResult = IsFolder.CompareTo(other.IsFolder);
                if (intResult == 0)
                {
                    intResult = String.Compare(Source, other.Source, StringComparison.OrdinalIgnoreCase);
                    if (intResult == 0)
                    {
                        intResult = String.Compare(Destination, other.Destination, StringComparison.OrdinalIgnoreCase);
                    }
                }
            }
            return(intResult);
        }
Example #3
0
        /// <summary>
        /// Returns a hash code for this instance.
        /// </summary>
        /// <returns>A hash code for this instance, suitable for use in hashing algorithms and data structures like a hash table.</returns>
        public override int GetHashCode()
        {
            var hashCode = Constants.HashInitializer;

            unchecked
            {
                hashCode = Constants.HashMultiplier * hashCode + IsFolder.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + (AccessRights != null ? AccessRights.GetHashCode() : 0);
                hashCode = Constants.HashMultiplier * hashCode + Number.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + (Owner != null ? Owner.GetHashCode() : 0);
                hashCode = Constants.HashMultiplier * hashCode + (Group != null ? Group.GetHashCode() : 0);
                hashCode = Constants.HashMultiplier * hashCode + FileSize.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + Created.GetHashCode();
                hashCode = Constants.HashMultiplier * hashCode + (Name != null ? Name.GetHashCode() : 0);
            }

            return(hashCode);
        }