public Mapset Parse(DirectoryInfo directory, Mapset mapset) { mapset.Maps.Clear(); mapset.Files.Clear(); mapset.Files.AddRange(directory.GetFiles()); // Search for map files in the directory. foreach (var file in mapset.Files) { // If a valid beatmap file extension if (file.Extension.Equals(".osu")) { // Open stream for read using (var stream = file.OpenText()) { // Get decoder. var decoder = Decoders.GetDecoder <OriginalMap>(stream); if (decoder != null) { // Decode file into beatmap. OriginalMap map = decoder.Decode(stream); if (map != null) { // Store file info. map.Detail.MapFile = file; // Assign beatmap set id. if (!mapset.MapsetId.HasValue) { mapset.MapsetId = map.Detail.MapsetId; } // Assign beatmap set. map.Detail.Mapset = mapset; // Add beatmap to beatmap set. mapset.Maps.Add(map); } } } } } // If there is no map included, this is an invalid map. if (mapset.Maps.Count == 0) { Logger.LogWarning($"OsuMapsetParser - No map file found for directory: {directory.FullName}"); return(null); } foreach (var map in mapset.Maps) { // Prepare converted maps for different modes. map.CreatePlayable(modeManager); // Calculate beatmap file hash. map.Detail.Hash = FileUtils.GetHash(map.Detail.MapFile); } return(mapset); }
/// <summary> /// Updates the mapset this drawable represents. /// </summary> public void UpdateWithNewMapset(Mapset set, int mapsetIndex) { Mapset = set; MapsetIndex = mapsetIndex; Title.Text = Mapset.Title; Artist.Text = Mapset.Artist; Creator.Text = "By: " + Mapset.Creator; }
public Task <IMapset> Import(FileInfo file, TaskListener <IMapset> listener = null) { return(Task.Run <IMapset>(async() => { try { // Start importing the file Mapset mapset = await store.Import(file, listener: listener?.CreateSubListener <Mapset>()); if (mapset != null) { // Mapset must be fully loaded. Mapset loadedMapset = store.LoadData(mapset); if (loadedMapset != null) { // Dispatch mapset imported event on main thread. UnityThread.Dispatch(() => { // Add to all mapsets allMapsets.AddOrReplace(loadedMapset); // Reapply filter Search(lastSearch); OnImportMapset?.Invoke(loadedMapset); return null; }); } else { notificationBox?.Add(new Notification() { Message = $"Failed to load imported mapset ({mapset.Metadata.Artist} - {mapset.Metadata.Title})", Type = NotificationType.Error }); } } else { notificationBox?.Add(new Notification() { Message = $"Failed to import mapset at ({file.FullName})", Type = NotificationType.Error }); } listener?.SetFinished(mapset); return mapset; } catch (Exception e) { Logger.LogError($"Error while importing mapset: {e.Message}\n{e.StackTrace}"); listener?.SetFinished(); return null; } })); }
public Match(int i, Team t1, Team t2, string date, string league, int bo, bool lan, string hltv, string csgo, Team fav, int t1p, int t2p, Mapset m, int amnt) { ID = i; this.t1 = t1; this.t2 = t2; start = DateTime.ParseExact(date, "YYYY_MM_dd_HH_mm", CultureInfo.InvariantCulture); this.league = league; this.bo = bo; this.lan = lan; this.urlHltv = hltv; this.urlCsgo = csgo; this.fav = fav; this.t1p = t1p; this.t2p = t2p; this.mapset = m; this.amntBet = amnt; }
public MapsetDeletedEventArgs(Mapset m, int index) { Mapset = m; Index = index; }
public void setMapset(Mapset m) { mapset = m; }