public static NowPlaying Parse(string text) { NowPlaying np = new NowPlaying(); GetSongId(np, text); var mods = GetMods(text); var mode = GetMode(text); np.Mods = mods; np.Mode = mode; np.NpType = GetNpType(text); return(np); }
public static void GetSongId(NowPlaying np, string text) { var tmp = text.Split("\u0001ACTION ")[1].Split(GetNpType(text).GetSplitValue() + " [")[1].Split(" ")[0]; if (tmp.StartsWith("https://osu.ppy.sh/b/")) { np.IsMapSet = false; np.Id = int.Parse(tmp.Split("https://osu.ppy.sh/b/")[1]); } else if (tmp.StartsWith("https://osu.ppy.sh/s/")) { np.IsMapSet = true; np.Id = int.Parse(tmp.Split("https://osu.ppy.sh/s/")[1]); } else { throw new Exception("Cannot parse url for id: " + tmp); } }