/// <summary>
        /// Returns true if AvailabilityMetricsDowntime instances are equal
        /// </summary>
        /// <param name="other">Instance of AvailabilityMetricsDowntime to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(AvailabilityMetricsDowntime other)
        {
            if (ReferenceEquals(null, other))
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     GeneralDowntime == other.GeneralDowntime ||
                     GeneralDowntime != null &&
                     GeneralDowntime.Equals(other.GeneralDowntime)
                     ) &&
                 (
                     ScheduledOutage == other.ScheduledOutage ||
                     ScheduledOutage != null &&
                     ScheduledOutage.Equals(other.ScheduledOutage)
                 ) &&
                 (
                     Endpoints == other.Endpoints ||
                     Endpoints != null &&
                     Endpoints.Equals(other.Endpoints)
                 ));
        }
Exemplo n.º 2
0
        private void SetImportedEquipmentScheduledOutages(StreamReader statusLines)
        {
            string line;

            while (!(line = statusLines.ReadLine()).Equals("End Equipment"))
            {
                var outageOptions  = line.Split(',');
                var importedOutage = new ScheduledOutage()
                {
                    OutageStart = new DateTime(
                        int.Parse(outageOptions[0].Substring(outageOptions[0].Length - 4)),
                        int.Parse(outageOptions[0].Substring(outageOptions[0].Length - 8, 2)),
                        int.Parse(outageOptions[0].Substring(outageOptions[0].Length - 6, 2)),
                        int.Parse(outageOptions[1].Substring(outageOptions[1].Length - 4, 2)),
                        int.Parse(outageOptions[1].Substring(outageOptions[1].Length - 2)), 0, DateTimeKind.Utc),

                    OutageEnd = new DateTime(
                        int.Parse(outageOptions[2].Substring(outageOptions[2].Length - 4)),
                        int.Parse(outageOptions[2].Substring(outageOptions[2].Length - 8, 2)),
                        int.Parse(outageOptions[2].Substring(outageOptions[2].Length - 6, 2)),
                        int.Parse(outageOptions[3].Substring(outageOptions[3].Length - 4, 2)),
                        int.Parse(outageOptions[3].Substring(outageOptions[3].Length - 2)), 0, DateTimeKind.Utc),

                    Notes = outageOptions[4].Substring(9)
                };

                var outage = new EquipmentScheduledOutage(this, importedOutage);

                scheduledOutages.Add(outage);
                ScheduledOutages.AddOutage(outage);
            }
        }
 /// <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 (GeneralDowntime != null)
         {
             hashCode = hashCode * 59 + GeneralDowntime.GetHashCode();
         }
         if (ScheduledOutage != null)
         {
             hashCode = hashCode * 59 + ScheduledOutage.GetHashCode();
         }
         if (Endpoints != null)
         {
             hashCode = hashCode * 59 + Endpoints.GetHashCode();
         }
         return(hashCode);
     }
 }
 public static void AddOutage(Equipment equipment, ScheduledOutage scheduledOutage)
 {
 }