/// <summary>
        ///     Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                var hash = 41;
                // Suitable nullity checks etc, of course :)

                if (CountryCodes != null)
                {
                    hash = hash * 59 + CountryCodes.GetHashCode();
                }

                if (BettingTypes != null)
                {
                    hash = hash * 59 + BettingTypes.GetHashCode();
                }

                if (TurnInPlayEnabled != null)
                {
                    hash = hash * 59 + TurnInPlayEnabled.GetHashCode();
                }

                if (MarketTypes != null)
                {
                    hash = hash * 59 + MarketTypes.GetHashCode();
                }

                if (Venues != null)
                {
                    hash = hash * 59 + Venues.GetHashCode();
                }

                if (MarketIds != null)
                {
                    hash = hash * 59 + MarketIds.GetHashCode();
                }

                if (EventTypeIds != null)
                {
                    hash = hash * 59 + EventTypeIds.GetHashCode();
                }

                if (EventIds != null)
                {
                    hash = hash * 59 + EventIds.GetHashCode();
                }

                if (BspMarket != null)
                {
                    hash = hash * 59 + BspMarket.GetHashCode();
                }

                return(hash);
            }
        }
        /// <summary>
        ///     Returns true if MarketFilter instances are equal
        /// </summary>
        /// <param name="other">Instance of MarketFilter to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(MarketFilter other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
            {
                return(false);
            }

            return((CountryCodes == other.CountryCodes || CountryCodes != null && CountryCodes.SequenceEqual(other.CountryCodes)) &&
                   (BettingTypes == other.BettingTypes || BettingTypes != null && BettingTypes.SequenceEqual(other.BettingTypes)) &&
                   (TurnInPlayEnabled == other.TurnInPlayEnabled || TurnInPlayEnabled != null && TurnInPlayEnabled.Equals(other.TurnInPlayEnabled)) &&
                   (MarketTypes == other.MarketTypes || MarketTypes != null && MarketTypes.SequenceEqual(other.MarketTypes)) &&
                   (Venues == other.Venues || Venues != null && Venues.SequenceEqual(other.Venues)) &&
                   (MarketIds == other.MarketIds || MarketIds != null && MarketIds.SequenceEqual(other.MarketIds)) &&
                   (EventTypeIds == other.EventTypeIds || EventTypeIds != null && EventTypeIds.SequenceEqual(other.EventTypeIds)) &&
                   (EventIds == other.EventIds || EventIds != null && EventIds.SequenceEqual(other.EventIds)) &&
                   (BspMarket == other.BspMarket || BspMarket != null && BspMarket.Equals(other.BspMarket)));
        }
Esempio n. 3
0
 private static void Log(EventTypeIds EventTypeId, params object[] Args)
 {
     Current.Log((int)EventTypeId, Args);
 }
Esempio n. 4
0
        private static void LogPluginWarningOrMessage(EventTypeIds WarningOrMessage, PluginManifest Manifest, string Message, object[] ExportData)
        {
            if (WarningOrMessage != EventTypeIds.PluginMessage && WarningOrMessage != EventTypeIds.PluginWarning)
                throw new ArgumentException("Only PluginMessage/PluginWarning is allowed", "WarningOrMessage");

            object[] LogData;

            if (ExportData == null || ExportData.Length == 0)
            {
                LogData = new object[3];
            }
            else
            {
                LogData = new object[4 + ExportData.Length];
                for (int i = 0; i < ExportData.Length; i++)
                    LogData[4 + i] = ExportData[i];
            }

            LogData[0] = Manifest.Name;
            LogData[1] = Manifest.Id;
            LogData[2] = Manifest.VersionFormatted;
            LogData[3] = Message;

            Log(WarningOrMessage, LogData);
        }
Esempio n. 5
0
 public bool HasEventType(EventTypeId eventTypeId) => EventTypeIds.Any(ev => ev == eventTypeId);
Esempio n. 6
0
 public MarketFilter WithEventTypeId(string eventTypeId)
 {
     EventTypeIds ??= new HashSet <string>();
     EventTypeIds.Add(eventTypeId);
     return(this);
 }