Esempio n. 1
0
 public static void ReadDb(string file)
 {
     using (System.IO.FileStream fs = new System.IO.FileStream(file, System.IO.FileMode.Open, System.IO.FileAccess.Read, System.IO.FileShare.ReadWrite))
     {
         BinaryReader reader = new BinaryReader(fs);
         int dbversion = reader.ReadInt32();
         int stash = reader.ReadInt32(); //folders
         stash = reader.ReadInt32();
         stash = reader.ReadInt32();
         stash = reader.ReadByte();
         string stashs = reader.ReadString(); //player
         bool stashb = false;
         int mapcount = reader.ReadInt32();
         Beatmap tmpbm = new Beatmap();
         BeatmapSet tmpset = new BeatmapSet();
         for (int i = 0; i < mapcount; i++)
         {
             tmpbm.ArtistRomanized = reader.ReadString();
             stashs = reader.ReadString();
             if (stashs != "") { tmpbm.Artist = stashs; }
             tmpbm.TitleRomanized = reader.ReadString();
             stashs = reader.ReadString();
             if (stashs != "") { tmpbm.Title = stashs; }
             tmpbm.Creator = reader.ReadString();
             tmpbm.Version = reader.ReadString();
             tmpbm.Audio = reader.ReadString();
             tmpbm.hash = reader.ReadString();
             tmpbm.Name = reader.ReadString();
             stash = reader.ReadByte(); //4=ranked 5=app 2=Unranked
             tmpbm.totalhitcount = reader.ReadUInt16(); //circles
             tmpbm.totalhitcount += reader.ReadUInt16(); //sliders
             tmpbm.totalhitcount += reader.ReadUInt16(); //spinners
             Int64 stashB = reader.ReadInt64(); //最后编辑
             stash = reader.ReadByte(); //AR
             stash = reader.ReadByte(); //CS
             stash = reader.ReadByte(); //HP
             stash = reader.ReadByte(); //OD
             double stashD = reader.ReadDouble(); //SV
             stash = reader.ReadInt32(); //playtime
             stash = reader.ReadInt32(); //totaltime
             stash = reader.ReadInt32(); //preview
             stash = reader.ReadInt32(); //timting points 数
             for (int j = 0; j < stash; j++)
             {
                 stashD = reader.ReadDouble(); //bpm
                 stashD = reader.ReadDouble(); //offset
                 stashb = reader.ReadBoolean();//红线
             }
             tmpbm.beatmapId = reader.ReadInt32();
             tmpbm.beatmapsetId = reader.ReadInt32();
             stash = reader.ReadInt32(); //threadid
             stash = reader.ReadByte();//Ranking osu
             stash = reader.ReadByte();//Ranking taiko
             stash = reader.ReadByte();//Ranking ctb
             stash = reader.ReadByte();//Ranking mania
             tmpbm.offset = reader.ReadInt16();
             stashD = reader.ReadSingle();  //stack
             tmpbm.mode = reader.ReadByte();
             tmpbm.Source = reader.ReadString();
             tmpbm.tags = reader.ReadString();
             stash = reader.ReadInt16();//online-offset
             if (tmpbm.offset == 0 && stash != 0) { tmpbm.offset = stash; }
             stashs = reader.ReadString(); //title-font
             stashb = reader.ReadBoolean(); //unplayed
             stashB = reader.ReadInt64(); //last_play
             stashb = reader.ReadBoolean(); //osz2
             tmpbm.Location = Path.Combine(Core.osupath, reader.ReadString());
             stashB = reader.ReadInt64(); //最后同步
             stashb = reader.ReadBoolean(); //忽略音效
             stashb = reader.ReadBoolean(); //忽略皮肤
             stashb = reader.ReadBoolean(); //禁用sb
             stash = reader.ReadByte(); //背景淡化
             stashB = reader.ReadInt64();
             if (tmpset.count == 0) { tmpset.add(tmpbm); }
             else
             {
                 if (tmpset.Contains(tmpbm)) { tmpset.add(tmpbm); }
                 else
                 {
                     Core.allsets.Add(tmpset);
                     tmpset = new BeatmapSet();
                     tmpset.add(tmpbm);
                 }
             }
             tmpbm = new Beatmap();
         }
     }
 }
Esempio n. 2
0
 public static void ReadDb(string file)
 {
     using (var fs = new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
     {
         var reader = new BinaryReader(fs);
         reader.ReadInt32();  //version
         reader.ReadInt32(); //folders
         reader.ReadInt32();
         reader.ReadInt32();
         reader.ReadByte();
         reader.ReadString(); //player
         string stashs;
         int stash;
         int mapcount = reader.ReadInt32();
         var tmpbm = new Beatmap();
         var tmpset = new BeatmapSet();
         for (int i = 0; i < mapcount; i++)
         {
             tmpbm.ArtistRomanized = reader.ReadString();
             stashs = reader.ReadString();
             if (stashs != "")
             {
                 tmpbm.Artist = stashs;
             }
             tmpbm.TitleRomanized = reader.ReadString();
             stashs = reader.ReadString();
             if (stashs != "")
             {
                 tmpbm.Title = stashs;
             }
             tmpbm.Creator = reader.ReadString();
             tmpbm.Version = reader.ReadString();
             tmpbm.Audio = reader.ReadString();
             tmpbm.Hash = reader.ReadString();
             tmpbm.Name = reader.ReadString();
             reader.ReadByte(); //4=ranked 5=app 2=Unranked
             tmpbm.Totalhitcount = reader.ReadUInt16(); //circles
             tmpbm.Totalhitcount += reader.ReadUInt16(); //sliders
             tmpbm.Totalhitcount += reader.ReadUInt16(); //spinners
             reader.ReadInt64(); //最后编辑
             reader.ReadByte(); //AR
             reader.ReadByte(); //CS
             reader.ReadByte(); //HP
             reader.ReadByte(); //OD
             reader.ReadDouble(); //SV
             reader.ReadInt32(); //playtime
             reader.ReadInt32(); //totaltime
             reader.ReadInt32(); //preview
             stash = reader.ReadInt32(); //timting points 数
             for (int j = 0; j < stash; j++)
             {
                 reader.ReadDouble(); //bpm
                 reader.ReadDouble(); //offset
                 reader.ReadBoolean(); //红线
             }
             tmpbm.beatmapId = reader.ReadInt32();
             tmpbm.beatmapsetId = reader.ReadInt32();
             reader.ReadInt32(); //threadid
             reader.ReadByte(); //Ranking osu
             reader.ReadByte(); //Ranking taiko
             reader.ReadByte(); //Ranking ctb
             reader.ReadByte(); //Ranking mania
             tmpbm.Offset = reader.ReadInt16();
             reader.ReadSingle(); //stack
             tmpbm.mode = reader.ReadByte();
             tmpbm.Source = reader.ReadString();
             tmpbm.tags = reader.ReadString();
             stash = reader.ReadInt16(); //online-offset
             if (tmpbm.Offset == 0 && stash != 0)
             {
                 tmpbm.Offset = stash;
             }
             reader.ReadString(); //title-font
             reader.ReadBoolean(); //unplayed
             reader.ReadInt64(); //last_play
             reader.ReadBoolean(); //osz2
             tmpbm.Location = Path.Combine(Settings.Default.OSUpath, reader.ReadString());
             reader.ReadInt64(); //最后同步
             reader.ReadBoolean(); //忽略音效
             reader.ReadBoolean(); //忽略皮肤
             reader.ReadBoolean(); //禁用sb
             reader.ReadByte(); //背景淡化
             reader.ReadInt64();
             if (tmpset.count == 0)
             {
                 tmpset.add(tmpbm);
             }
             else
             {
                 if (tmpset.Contains(tmpbm))
                 {
                     tmpset.add(tmpbm);
                 }
                 else
                 {
                     Core.allsets.Add(tmpset);
                     tmpset = new BeatmapSet();
                     tmpset.add(tmpbm);
                 }
             }
             tmpbm = new Beatmap();
         }
     }
 }