public OsuDatabase(string filename) { if (!File.Exists(filename)) { throw new FileNotFoundException(filename); } using (var stream = new FileStream(filename, FileMode.Open)) { using (var reader = new DatabaseReader(stream)) { OsuVersion = reader.ReadInt(); FolderCount = reader.ReadInt(); AccoundUnlocked = reader.ReadBoolean(); UnlockTime = reader.ReadDateTime(); PlayerName = reader.ReadString(); BeatmapsCount = reader.ReadInt(); var beatmaps = new List <BeatmapInformation>(); for (int i = 0; i < BeatmapsCount; i++) { beatmaps.Add(BeatmapInformation.ReadFromStream(stream)); } Beatmaps = beatmaps.ToArray(); UnknownInt = reader.ReadInt(); } } }
public static BeatmapInformation ReadFromStream(Stream stream) { var reader = new DatabaseReader(stream); return(new BeatmapInformation { EntrySize = reader.ReadInt(), ArtistName = reader.ReadString(), ArtistNameUnicode = reader.ReadString(), SongTitle = reader.ReadString(), SongTitleUnicode = reader.ReadString(), CreatorName = reader.ReadString(), Difficulty = reader.ReadString(), AudioFileName = reader.ReadString(), Md5Hash = reader.ReadString(), NameOfOsuFile = reader.ReadString(), RankedStatus = reader.ReadByte(), HitcirclesCount = reader.ReadInt16(), SlidersCount = reader.ReadInt16(), SpinnersCount = reader.ReadInt16(), LastModificationTime = reader.ReadInt64(), ApproachRate = reader.ReadSingle(), CircleSize = reader.ReadSingle(), HpDrain = reader.ReadSingle(), OverallDifficulty = reader.ReadSingle(), SliderVelocity = reader.ReadDouble(), StdStars = StarRating.ReadFromStream(stream), TaikoStars = StarRating.ReadFromStream(stream), CtbStars = StarRating.ReadFromStream(stream), ManiaStars = StarRating.ReadFromStream(stream), DrainTime = reader.ReadInt(), TotalTime = reader.ReadInt(), TimeIdkLol = reader.ReadInt(), TimingPoints = TimingPoint.ReadPointsFromStream(stream), BeatmapId = reader.ReadInt(), BeatmapSetId = reader.ReadInt(), ThreadId = reader.ReadInt(), GradeAchievedOsu = reader.ReadByte(), GradeAchievedTaiko = reader.ReadByte(), GradeAchievedCtb = reader.ReadByte(), GradeAchievedMania = reader.ReadByte(), LocalBeatmapOffset = reader.ReadInt16(), StackLeniency = reader.ReadSingle(), OsuGameplayMode = reader.ReadByte(), SongSource = reader.ReadString(), SongTags = reader.ReadString(), OnlineOffset = reader.ReadInt16(), TitleSongFont = reader.ReadString(), IsUnplayed = reader.ReadBoolean(), LastPlayTime = reader.ReadInt64(), IsOsz2 = reader.ReadBoolean(), FolderName = reader.ReadString(), LastCheckedTime = reader.ReadInt64(), IgnoreHitsounds = reader.ReadBoolean(), IgnoreSkin = reader.ReadBoolean(), DisableStoryboard = reader.ReadBoolean(), DisableVideo = reader.ReadBoolean(), VisualOverride = reader.ReadBoolean(), LastEditTime = reader.ReadInt(), ManiaScrollSpeed = reader.ReadByte() }); }