/// <summary> /// Used for inserting beatmap data to SQL table. /// When adding large amount of beatmaps it is advised to use MassStoring to speed up adding. /// When MassStoring is active, only new maps are queried to Sqlite /// </summary> /// <param name="beatmap">Beatmap to insert</param> public void StoreBeatmap(Beatmap beatmap) { lock (_sqlConnector) { if (_sqlConnector.MassInsertIsActive) { if (_md5List.Contains(beatmap.Md5)) { return;//no need to save same data. } } _sqlConnector.StoreBeatmap(beatmap); } }
/// <summary> /// Used for inserting beatmap data to SQL table. /// When adding large amount of beatmaps it is advised to use MassStoring to speed up adding. /// When MassStoring is active, only new maps are queried to Sqlite /// </summary> /// <param name="beatmap">Beatmap to insert</param> public void StoreBeatmap(IBeatmap beatmap) { lock (_sqlConnector) { if (_sqlConnector.MassInsertIsActive) { var md5 = beatmap.Md5; if (_beatmapChecksums.TryGetValue(md5, out var foundPair)) { foundPair.Found = true; return; } } _sqlConnector.StoreBeatmap(beatmap); } }
/// <summary> /// Used for inserting beatmap data to SQL table. /// When adding large amount of beatmaps it is advised to use MassStoring to speed up adding. /// When MassStoring is active, only new maps are queried to Sqlite /// </summary> /// <param name="beatmap">Beatmap to insert</param> public void StoreBeatmap(Beatmap beatmap) { lock (_sqlConnector) { if (_sqlConnector.MassInsertIsActive) { var hash = beatmap.Md5; if (_md5List.ContainsKey(hash)) { if (_md5List[hash] == beatmap.MapId) { return; //no need to save same data. } else {//We need to first remove old entry _sqlConnector.RemoveBeatmap(beatmap.Md5); } } } _sqlConnector.StoreBeatmap(beatmap); } }
/// <summary> /// Used for inserting beatmap data to SQL table. /// When adding large amount of beatmaps it is advised to use MassStoring to speed up adding. /// When MassStoring is active, only new maps are queried to Sqlite /// </summary> /// <param name="beatmap">Beatmap to insert</param> public void StoreBeatmap(IBeatmap beatmap) { lock (_sqlConnector) { if (_sqlConnector.MassInsertIsActive) { var checksum = beatmap.GetChecksum(); if (_beatmapChecksums.ContainsKey(checksum)) { _beatmapChecksums[checksum].Found = true; return; } else { var existingEntry = _beatmapChecksums.FirstOrDefault(x => x.Value.Md5 == beatmap.Md5); if (!existingEntry.Equals(default(KeyValuePair <string, MapIdMd5Pair>))) { _beatmapChecksums.Remove(existingEntry.Key); } } } _sqlConnector.StoreBeatmap(beatmap); } }