Пример #1
0
        public bool Equals(SaveFileIV other)
        {
            if (other == null)
            {
                return(false);
            }

            return(Name.Equals(other.Name) &&
                   TimeStamp.Equals(other.TimeStamp) &&
                   SaveVersion.Equals(other.SaveVersion) &&
                   SaveSizeInBytes.Equals(other.SaveSizeInBytes) &&
                   ScriptSpaceSize.Equals(other.ScriptSpaceSize) &&
                   SimpleVars.Equals(other.SimpleVars) &&
                   PlayerInfo.Equals(other.PlayerInfo) &&
                   ExtraContent.Equals(other.ExtraContent) &&
                   Scripts.Equals(other.Scripts) &&
                   Garages.Equals(other.Garages) &&
                   GameLogic.Equals(other.GameLogic) &&
                   Paths.Equals(other.Paths) &&
                   Pickups.Equals(other.Pickups) &&
                   RestartPoints.Equals(other.RestartPoints) &&
                   RadarBlips.Equals(other.RadarBlips) &&
                   Zones.Equals(other.Zones) &&
                   GangData.Equals(other.GangData) &&
                   CarGenerators.Equals(other.CarGenerators) &&
                   Stats.Equals(other.Stats) &&
                   IplStore.Equals(other.IplStore) &&
                   StuntJumps.Equals(other.StuntJumps) &&
                   Radio.Equals(other.Radio) &&
                   Objects.Equals(other.Objects) &&
                   Relationships.Equals(other.Relationships) &&
                   Inventory.Equals(other.Inventory) &&
                   UnusedPools.Equals(other.UnusedPools) &&
                   UnusedPhoneInfo.Equals(other.UnusedPhoneInfo) &&
                   UnusedAudioScript.Equals(other.UnusedAudioScript) &&
                   UnusedSetPieces.Equals(other.UnusedSetPieces) &&
                   UnusedStreaming.Equals(other.UnusedStreaming) &&
                   UnusedPedTypeInfo.Equals(other.UnusedPedTypeInfo) &&
                   UnusedTags.Equals(other.UnusedTags) &&
                   UnusedShopping.Equals(other.UnusedShopping) &&
                   UnusedGangWars.Equals(other.UnusedGangWars) &&
                   UnusedEntryExits.Equals(other.UnusedEntryExits) &&
                   Unused3dMarkers.Equals(other.Unused3dMarkers) &&
                   UnusedVehicles.Equals(other.UnusedVehicles) &&
                   UnusedExtraBlock.Equals(other.UnusedExtraBlock) &&
                   GfwlData.Equals(other.GfwlData));
        }
Пример #2
0
        public async Task <IActionResult> OnGetAsync(int?id, string showHelp = "")
        {
            ShowHelp = showHelp;
            IdentityUser CurrentUser = await _userManager.GetUserAsync(User);

            if (id == null)
            {
                return(NotFound());
            }

            Mini = await _context.Mini
                   .AsNoTracking().TagWith("Edited Mini")
                   .Include(m => m.MiniTags)
                   .ThenInclude(mt => mt.Tag)
                   .Include(m => m.Creator)
                   .Include(m => m.User)
                   .Include(m => m.Sources)
                   .ThenInclude(s => s.Site)
                   .FirstOrDefaultAsync(m => m.ID == id);

            if (Mini == null)
            {
                return(NotFound());
            }

            _telemetry.TrackEvent("EditedMini", new Dictionary <string, string> {
                { "MiniId", Mini.ID.ToString() }
            });

            UnusedTags = _context
                         .Tag
                         .AsNoTracking()
                         .TagWith("Unused Tags")
                         .AsEnumerable()
                         .Except(Mini.MiniTags.Where(m => (m.Status == Status.Approved || m.Status == Status.Pending))
                                 .Select(mt => mt.Tag))
                         .OrderBy(m => m.Category.ToString())
                         .ThenBy(m => m.TagName)
                         .ToList();

            //TODO - Remove punctuation?
            //TODO - Get this to work PERFORMANTLY for creatures with more than 2 words in their name
            List <string> nameSplit = Mini.Name.ToUpperInvariant().Split(' ').ToList();

            //Doing this "normally" is an infinite loop.
            int listLength = nameSplit.Count - 1;

            for (int i = 0; i < listLength; i++)
            {
                nameSplit.Add(nameSplit.ElementAt(i) + " " + nameSplit.ElementAt(i + 1));
            }

            RecommendedTags = UnusedTags
                              .Where(t => nameSplit.Contains(t.TagName.ToUpperInvariant()))
                              .ToList();

            //TODO - Things that are creatures to ignore before using this automatically: "Shadow", "Vampire", "Troll"
            TargetedCreatureTags = RecommendedTags
                                   .Where(t => t.Category == TagCategory.CreatureName)
                                   .ToList();

            _telemetry.TrackEvent("SuperSmartTagSuggestions", new Dictionary <string, string> {
                { "MiniId", Mini.ID.ToString() }, { "MiniName", Mini.Name }, { "SuggestedTags", string.Join(", ", TargetedCreatureTags.Select(t => t.TagName).ToList()) }
            });

            return(Page());
        }