Example #1
0
        public void AddBeatmap(Beatmap map)
        {
            var exMap = new BeatmapExtension();

            exMap.CloneValues(map);
            AddBeatmap(exMap);
        }
Example #2
0
 public void AddBeatmap(BeatmapExtension map)
 {
     if (_beatmapHashes.Contains(map.Md5))
     {
         return;
     }
     _beatmapHashes.Add(map.Md5);
     ProcessNewlyAddedMap(map);
 }
        public void AddBeatmap(BeatmapExtension map)
        {
            if (string.IsNullOrEmpty(map.Md5))
            {
                map.Md5 = "semiRandomHash:" + map.MapId + "|" + map.MapSetId;
            }
            if (_beatmapHashes.Contains(map.Md5))
            {
                return;
            }

            ProcessNewlyAddedMap(map);
        }
        protected virtual void ProcessNewlyAddedMap(BeatmapExtension map)
        {
            lock (LoadedMaps.LockingObject)
            {
                _beatmapHashes.Add(map.Md5);

                var knownMap = (BeatmapExtension)LoadedMaps.GetByHash(map.Md5);
                if (knownMap != null)
                {
                    ProcessAdditionalProps(map, knownMap);
                    KnownBeatmaps.Add(knownMap);
                    return;
                }
                knownMap = (BeatmapExtension)LoadedMaps.GetByMapId(map.MapId);
                if (map.MapId > 10 && knownMap != null)
                {
                    //Remove previously added map hash
                    _beatmapHashes.Remove(map.Md5);
                    //And add our local version of the map that instead.
                    _beatmapHashes.Add(knownMap.Md5);
                    ProcessAdditionalProps(map, knownMap);
                    KnownBeatmaps.Add(knownMap);
                    knownMap.LocalVersionDiffers = true;

                    return;
                }
                if (map.MapSetId != 0)
                {
                    DownloadableBeatmaps.Add(map);
                }
                else
                {
                    UnknownBeatmaps.Add(map);
                }

                map.LocalBeatmapMissing = true;
            }
        }
Example #5
0
 private void ProcessAdditionalProps(BeatmapExtension src, BeatmapExtension dest)
 {
     dest.UserComment = src.UserComment;
 }