示例#1
0
        public override bool Equals(object obj)
        {
            var objAsMastery = obj as Mastery;

            if (objAsMastery == null)
            {
                return(false);
            }

            bool areRanksEqual = this.Ranks == objAsMastery.Ranks;
            bool areIdsEqual   = this.MasteryId == objAsMastery.MasteryId;
            bool areSanitizedDescriptionsEqual = CollectionEquality.CheckForEquality <string, string>(this.SanitizedDescription, objAsMastery.SanitizedDescription, x => x);
            bool areDescriptionsEqual          = CollectionEquality.CheckForEquality <string, string>(this.Description, objAsMastery.Description, x => x);
            bool areNamesEqual         = this.Name == objAsMastery.Name;
            bool areImagesEqual        = this.Image.Equals(objAsMastery.Image);
            bool arePrerequisitesEqual = this.Prerequisite == objAsMastery.Prerequisite;
            bool areMasteryTreesEqual  = this.MasteryTree == objAsMastery.MasteryTree;

            if (areRanksEqual && areIdsEqual && areSanitizedDescriptionsEqual && areDescriptionsEqual &&
                areNamesEqual && areImagesEqual && arePrerequisitesEqual && areMasteryTreesEqual)
            {
                return(true);
            }

            return(false);
        }
示例#2
0
        public override bool Equals(object obj)
        {
            var objAsItem = obj as Item;

            if (objAsItem == null)
            {
                return(false);
            }

            bool areTagsEqual = CollectionEquality.CheckForEquality <string, string>(this.Tags, objAsItem.Tags, x => x);
            bool areIdsEqual  = this.ItemId == objAsItem.ItemId;
            bool areSanitizedDescriptionsEqual = this.SanitizedDescription == objAsItem.SanitizedDescription;
            bool areDescriptionsEqual          = this.Description == objAsItem.Description;
            bool areNamesEqual  = this.Name == objAsItem.Name;
            bool areImagesEqual = this.Image.Equals(objAsItem.Image);

            bool isFromEqual   = CollectionEquality.CheckForEquality <int, int>(this.From, objAsItem.From, x => x);
            bool isIntoEqqual  = CollectionEquality.CheckForEquality <int, int>(this.Into, objAsItem.Into, x => x);
            bool areStatsEqual = CollectionEquality.CheckForEquality <Stat, double>(this.Stats, objAsItem.Stats, x => x.Value);
            bool isGroupEqual  = this.Group == objAsItem.Group;
            bool isDepthEqual  = this.Depth == objAsItem.Depth;

            if (areTagsEqual && areIdsEqual && areSanitizedDescriptionsEqual && areDescriptionsEqual && areNamesEqual &&
                areImagesEqual && isFromEqual && isIntoEqqual && areStatsEqual && isGroupEqual && isDepthEqual)
            {
                return(true);
            }

            return(false);
        }
示例#3
0
        public override bool Equals(object obj)
        {
            var objAsChamp = obj as Champion;

            if (objAsChamp == null)
            {
                return(false);
            }

            bool areTagsEqual     = CollectionEquality.CheckForEquality <string, string>(this.Tags, objAsChamp.Tags, x => x);
            bool areIDsEqual      = this.ChampionId == objAsChamp.ChampionId;
            bool areStatsEqual    = this.Stats.Equals(objAsChamp.Stats);
            bool areNamesEqual    = this.Name == objAsChamp.Name;
            bool arePassivesEqual = this.Passive.Equals(objAsChamp.Passive);
            bool areImagesEqual   = this.Image.Equals(objAsChamp.Image);
            bool areSpellsEqual   = CollectionEquality.CheckForEquality <Spell, string>(this.Spells, objAsChamp.Spells, x => x.Key);
            bool arePartypesEqual = this.Partype == objAsChamp.Partype;
            bool areTitlesEqual   = this.Title == objAsChamp.Title;

            if (areTagsEqual && areIDsEqual && areStatsEqual && areNamesEqual &&
                arePassivesEqual && areImagesEqual && areSpellsEqual && arePartypesEqual &&
                areTitlesEqual)
            {
                return(true);
            }

            return(false);
        }
示例#4
0
        public override bool Equals(object obj)
        {
            var objAsRune = obj as Rune;

            if (objAsRune == null)
            {
                return(false);
            }

            bool areTagsEqual = CollectionEquality.CheckForEquality <string, string>(this.Tags, objAsRune.Tags, t => t);
            bool areIdsEqual  = this.RuneId == objAsRune.RuneId;
            bool areSanitizedDescriptionsEqual = this.SanitizedDescription == objAsRune.SanitizedDescription;
            bool areStatsEqual        = CollectionEquality.CheckForEquality <Stat, double>(this.Stats, objAsRune.Stats, s => s.Value);
            bool areDescriptionsEqual = this.Description == objAsRune.Description;
            bool areNamesEqual        = this.Name == objAsRune.Name;
            bool areImagesEqual       = this.Image.Equals(objAsRune.Image);
            bool areRuneTypesEqual    = this.RuneType.Equals(objAsRune.RuneType);

            if (areTagsEqual && areIdsEqual && areSanitizedDescriptionsEqual && areStatsEqual &&
                areDescriptionsEqual && areNamesEqual && areImagesEqual && areRuneTypesEqual)
            {
                return(true);
            }

            return(false);
        }
示例#5
0
        public override bool Equals(object obj)
        {
            var objAsSpellEffect = obj as SpellEffect;

            if (objAsSpellEffect == null)
            {
                return(false);
            }

            bool areKeysEqual   = this.Key == objAsSpellEffect.Key;
            bool areValuesEqual = CollectionEquality.CheckForEquality <double, double>(this.Value, objAsSpellEffect.Value, v => v);

            if (areKeysEqual && areValuesEqual)
            {
                return(true);
            }

            return(false);
        }
        public async Task ProcessQueryResponse(IQueryResponse response)
        {
            try
            {
                var itemsFromResponse = await this.ConvertResponseContent(response.Content);

                var itemsFromCollection = await this.Repository.Find(i => i.Available == true);

                bool areCollectionsEqual = CollectionEquality.CheckForEquality <Rune, int>(itemsFromResponse, itemsFromCollection, r => r.RuneId);

                if (!areCollectionsEqual)
                {
                    await this.ProcessDifferences(itemsFromResponse, itemsFromCollection);
                }

                this.logger.Info("Finished processing Runes response");
            }
            catch (Exception ex)
            {
                this.logger.FatalFormat("Failed to process Runes response: {0}", ex);
            }
        }
示例#7
0
        public async Task ProcessQueryResponse(IQueryResponse response)
        {
            try
            {
                var championsFromResponse = await this.ConvertResponseContent(response.Content);

                var championsFromCollection = await this.championQueryingRepository.Find(c => c.Available == true);

                bool areCollectionsEqual = CollectionEquality.CheckForEquality <Champion, int>(championsFromResponse, championsFromCollection, c => c.ChampionId);

                if (!areCollectionsEqual)
                {
                    await this.ProcessDifferences(championsFromResponse, championsFromCollection);
                }

                this.logger.Info("Finished processing Champions response");
            }
            catch (Exception ex)
            {
                this.logger.FatalFormat("Failed to process Champions response: {0}", ex);
            }
        }
示例#8
0
        public override bool Equals(object obj)
        {
            var objAsSpell = obj as Spell;

            if (objAsSpell == null)
            {
                return(false);
            }

            bool areRangesEqual   = false;
            bool areRangesArrays  = (this.Range is IEnumerable <object> && objAsSpell.Range is IEnumerable <object>);
            bool areRangesStrings = (this.Range is string && objAsSpell.Range is string);

            if (areRangesArrays)
            {
                var thisRangeAsArray        = this.Range as IEnumerable <object>;
                var thisRangeAsDoublesArray = thisRangeAsArray.Select(r => Int32.Parse(r.ToString()));
                var objRangeAsArray         = objAsSpell.Range as IEnumerable <object>;
                var objRangeAsDoublesArray  = objRangeAsArray.Select(r => Int32.Parse(r.ToString()));

                areRangesEqual = thisRangeAsDoublesArray.OrderBy(r => r).SequenceEqual(objRangeAsDoublesArray.OrderBy(r => r));
            }

            if (areRangesStrings)
            {
                var thisRangeAsString = this.Range as string;
                var objRangeAsString  = objAsSpell.Range as string;
                areRangesEqual = thisRangeAsString == objRangeAsString;
            }

            bool areLevelTipsEqual             = this.LevelTip.Equals(objAsSpell.LevelTip);
            bool areResourcesEqual             = this.Resource == objAsSpell.Resource;
            bool areMaxRanksEqual              = this.MaxRank == objAsSpell.MaxRank;
            bool areEffectsBurnEqual           = CollectionEquality.CheckForEquality <string, string>(this.EffectBurn, objAsSpell.EffectBurn, e => e);
            bool areImagesEqual                = this.Image.Equals(objAsSpell.Image);
            bool areCooldownsEqual             = CollectionEquality.CheckForEquality <double, double>(this.Cooldown, objAsSpell.Cooldown, c => c);
            bool areCostsEqual                 = CollectionEquality.CheckForEquality <int, int>(this.Cost, objAsSpell.Cost, c => c);
            bool areVarsEqual                  = CollectionEquality.CheckForEquality <SpellVars, string>(this.Vars, objAsSpell.Vars, v => v.Key);
            bool areSanitizedDescriptionsEqual = this.SanitizedDescription == objAsSpell.SanitizedDescription;
            bool areRangeBurnsEqual            = this.RangeBurn == objAsSpell.RangeBurn;
            bool areCostTypesEqual             = this.CostType == objAsSpell.CostType;
            bool areEffectsEqual               = CollectionEquality.CheckForEquality <SpellEffect, string>(this.Effect, objAsSpell.Effect, e => e.Key);
            bool areCooldownBurnsEqual         = this.CooldownBurn == objAsSpell.CooldownBurn;
            bool areDescriptionsEqual          = this.Description == objAsSpell.Description;
            bool areNamesEqual                 = this.Name == objAsSpell.Name;
            bool areSanitizedTooltipsEqual     = this.SanitizedTooltip == objAsSpell.SanitizedTooltip;
            bool areKeysEqual                  = this.Key == objAsSpell.Key;
            bool areCostBurnsEqual             = this.CostBurn == objAsSpell.CostBurn;
            bool areTooltipsEqual              = this.Tooltip == objAsSpell.Tooltip;

            if (areRangesEqual && areLevelTipsEqual && areResourcesEqual && areMaxRanksEqual &&
                areEffectsBurnEqual && areImagesEqual && areCooldownsEqual && areCostsEqual &&
                areVarsEqual && areSanitizedDescriptionsEqual && areRangeBurnsEqual && areCostTypesEqual &&
                areEffectsEqual && areCooldownBurnsEqual && areDescriptionsEqual && areNamesEqual &&
                areSanitizedTooltipsEqual && areKeysEqual && areCostBurnsEqual && areTooltipsEqual)
            {
                return(true);
            }

            return(false);
        }