public MapSearchResult FindBeatmap(Dictionary<string, string> mapDictionary) { MapSearchResult mapSearchResult = new MapSearchResult(); mapSearchResult.MapSearchString = mapDictionary["raw"]; return mapSearchResult; }
public MapSearchResult FindBeatmap(Dictionary<string, string> mapDictionary) { var result = new MapSearchResult(); var b = _sqliteControler.GetBeatmap(mapDictionary["artist"], mapDictionary["title"], mapDictionary["diff"], mapDictionary["raw"]); if (b?.MapId > -1 && !(string.IsNullOrWhiteSpace(b.ArtistRoman) || string.IsNullOrWhiteSpace(b.TitleRoman))) { result.BeatmapsFound.Add(b); } result.MapSearchString = mapDictionary["raw"]; return result; }
public void SetNewMap(MapSearchResult map) { if (map.FoundBeatmaps) { var nowPlaying = string.Format("{0} - {1}", map.BeatmapsFound[0].ArtistRoman,map.BeatmapsFound[0].TitleRoman); if (map.Action == OsuStatus.Playing) nowPlaying += string.Format(" [{0}] {1}", map.BeatmapsFound[0].DiffName,map.Mods); _mainwindowHandle.NowPlaying = nowPlaying; } else { _mainwindowHandle.NowPlaying = "notFound:( " + map.MapSearchString; } }
public Dictionary<string, string> GetMapReplacements(MapSearchResult map) { if (map.Action == OsuStatus.Playing) { if (lastMapSearchString == map.MapSearchString) Retrys++; else Plays++; lastMapSearchString = map.MapSearchString; } var ret = new Dictionary<string, string>(); ret.Add("!Plays!", Plays.ToString()); ret.Add("!Retrys!", Retrys.ToString()); return ret; }
public Dictionary<string, string> GetMapReplacements(MapSearchResult map) { if (map.FoundBeatmaps) { var dict = map.BeatmapsFound[0].GetDict(map.Mods); var osuLocation = _settings.Get<string>(_names.MainOsuDirectory); if (string.IsNullOrWhiteSpace(osuLocation)) dict.Add("!OsuFileLocation!",""); else dict.Add("!OsuFileLocation!",System.IO.Path.Combine(osuLocation, "Songs", map.BeatmapsFound[0].Dir, map.BeatmapsFound[0].OsuFileName)); return dict; } return new Dictionary<string, string>(); }
private Dictionary<string, string> GetMapReplacements(MapSearchResult mapSearchResult) { var ret = new Dictionary<string,string>(); foreach (var mapDataReplacementsGetter in _mapDataReplacementsGetters) { var temp = mapDataReplacementsGetter.GetMapReplacements(mapSearchResult); if (temp?.Count > 0) { foreach (var t in temp) { if (ret.ContainsKey(t.Key)) continue; ret.Add(t.Key, t.Value); } } } return ret; }
public Dictionary<string, string> GetMapReplacements(MapSearchResult map) { if (_settings.Get<bool>(_names.EnableModImages)) { if (map.FoundBeatmaps) { if (!string.IsNullOrWhiteSpace(map.Mods)) { var fullPathOfCreatedImage = Path.Combine(_saver.SaveDirectory, "ModImage.png"); using (Bitmap img = _imageGenerator.GenerateImage(map.Mods.Split(','))) { img.Save(fullPathOfCreatedImage, ImageFormat.Png); } } } } return null; }
public void FindMapData(Dictionary<string,string> mapDict, OsuStatus status) { for (int i = 0; i < _mapDataFinders.Count; i++) { if ((_mapDataFinders[i].SearchModes & status) == 0) continue; _mapSearchResult = _mapDataFinders[i].FindBeatmap(mapDict); if (_mapSearchResult.FoundBeatmaps) { _logger.Log(string.Format(">Found data using \"{0}\" ID: {1}", _mapDataFinders[i].SearcherName,_mapSearchResult.BeatmapsFound[0]?.MapId),LogLevel.Advanced); break; } } if(_mapSearchResult==null) _mapSearchResult = new MapSearchResult(); _mapSearchResult.Action = status; var mapReplacements = GetMapReplacements(_mapSearchResult); _mapSearchResult.FormatedStrings = GetMapFormatedStrings(mapReplacements,_mapSearchResult.Action); SaveMapStrings(_mapSearchResult.FormatedStrings); SetNewMap(_mapSearchResult); }
public void NewMap(MapSearchResult map, bool isOnline = true) { if (!_isLoginDataSet) return; string postData; string response; if (map.Action == OsuStatus.Playing || map.Action == OsuStatus.Watching) { postData = FormatRequest(map, isOnline); response = SendRequestToServer(postData); } else { postData = FormatRequest(map, isOnline); response = SendRequestToServer(postData); } if (response == "ERROR") { Error("There was a problem while contacting server.", "osu!Post Error"); } else { switch (response) { case "true": break; case "false": Error("Key Provided is incorrect.", "osu!Post Error"); break; case "null": Error("User not found.", "osu!Post Error"); break; } } }
private int GetMapSetId(MapSearchResult map) { try { if (map?.BeatmapsFound[0]?.MapSetId > 0) return map.BeatmapsFound[0].MapSetId; } catch { return -1; } return -1; }
private string GetMapName(MapSearchResult map) { if (!string.IsNullOrWhiteSpace(map.MapSearchString)) return map.MapSearchString; else return "NoMap"; }
private string GetMapAction(MapSearchResult map) { var act = map.Action; if (act == OsuStatus.Playing) return "Playing"; if (act == OsuStatus.Watching) return "Watching"; if (act == OsuStatus.Listening) return "Listening"; if (act == OsuStatus.Editing) return "Editing"; if (act == OsuStatus.Null) return "NoAction"; return "NoAction"; }
private string FormatRequest(MapSearchResult map, bool isOnline) { var output = "key=" + _userKey; output += "&isOnline=" + (isOnline ? "true" : "false"); output += "&mapName=" + Uri.EscapeDataString((GetMapName(map))); output += "&mapID=" + GetMapId(map); output += "&mapSetID=" + GetMapSetId(map); output += "&userAction=" + GetMapAction(map); return output; }
private void SetNewMap(MapSearchResult map) { foreach (var dataGetter in _mapDataGetters) { dataGetter.SetNewMap(map); } }
public Dictionary<string, string> GetMapReplacements(MapSearchResult map) { var ret = new Dictionary<string, string>(); for (int i = 0; i < _keyList.Count; i++) { ret.Add($"!{_filenames[_keyList[i]]}!", _keyCount[_keyList[i]].ToString()); } ret.Add("!M1!", _rightMouseCount.ToString()); ret.Add("!M2!", _leftMouseCount.ToString()); return ret; }