Example #1
0
        public ActionResult DumpDatabase(string key)
        {
            if (key != Environment.GetEnvironmentVariable("PRIVATE_API_KEY"))
            {
                return(Unauthorized("Key is wrong!"));
            }

            lock (_lock) {
                var tmpStorage = _storage.GetStorageForDirectory("tmp");

                if (tmpStorage.Exists("dump.piss"))
                {
                    System.IO.File.Delete(tmpStorage.GetFullPath("dump.piss"));
                }

                using (var dumpStream = tmpStorage.GetStream("dump.piss", FileAccess.Write))
                    using (var sw = new MStreamWriter(dumpStream))
                    {
                        sw.Write(_contextFactory.Get().BeatmapSet.Count());
                        foreach (var bmSet in _contextFactory.Get().BeatmapSet)
                        {
                            bmSet.ChildrenBeatmaps = _contextFactory.Get().Beatmaps.Where(bm => bm.ParentSetId == bmSet.SetId).ToList();
                            sw.Write(bmSet);
                        }
                    }
                return(File(tmpStorage.GetStream("dump.piss"),
                            "application/octet-stream",
                            "dump.piss"));
            }
        }
Example #2
0
 public void WriteToStream(MStreamWriter sw)
 {
     sw.Write(Msg.Username);
     sw.Write(Msg.Message);
     sw.Write(Msg.ChannelTarget);
     sw.Write(Msg.SenderId);
 }
Example #3
0
 public void WriteToStream(MStreamWriter sw)
 {
     sw.Write(ButtonState);
     sw.Write(Button);
     sw.Write(MouseX);
     sw.Write(MouseY);
     sw.Write(Time);
 }
Example #4
0
 public void WriteToStream(MStreamWriter sw)
 {
     sw.Write(Extra);
     sw.Write((short)ReplayFrames.Count);
     foreach (var rframe in ReplayFrames)
     {
         sw.Write(rframe);
     }
     sw.Write(Action);
     sw.Write(ScoreFrame);
 }
Example #5
0
        public void WriteToStream(MStreamWriter sw)
        {
            sw.Write(Info.Count);

            ushort i = 0;

            foreach (var info in Info)
            {
                sw.Write(i);
                sw.Write(info.BeatmapId);
                sw.Write(info.SetId);
                sw.Write(0); // ???
                sw.Write((byte)info.OsuRank);
                sw.Write((byte)info.TaikoRank);
                sw.Write((byte)info.CatchRank);
                sw.Write((byte)info.ManiaRank);
                sw.Write(info.FileMd5);
                i++;
            }
        }
Example #6
0
 public void WriteToStream(MStreamWriter sw)
 {
     sw.Write((byte)Status.Status);
     sw.Write(Status.StatusText);
     sw.Write(Status.BeatmapChecksum);
     sw.Write((uint)Status.CurrentMods);
     sw.Write((byte)Status.Playmode);
     sw.Write(Status.BeatmapId);
 }
Example #7
0
        public void WritePackets(MStreamWriter writer)
        {
            if (this["IRC"] != null && (bool)this["IRC"])
            {
                return;
            }

            try
            {
                _rwl.AcquireWriterLock(5000);
                foreach (var packet in _packets)
                {
                    writer.Write(packet);
                }
                _packets.Clear();
            }
            finally
            {
                _rwl.ReleaseWriterLock();
            }
        }
Example #8
0
        public void WriteToStream(MStreamWriter sw)
        {
            sw.Write((short)MatchId);
            sw.Write(InProgress);

            sw.Write((byte)MatchType);
            sw.Write((uint)ActiveMods);

            sw.Write(Name);
            sw.Write(Password.Length > 0 ? Crypto.RandomString(16) : null, true);

            sw.Write(BeatmapName);
            sw.Write(BeatmapId);
            sw.Write(BeatmapMd5);

            foreach (var slot in Slots)
            {
                sw.Write((byte)slot.Status);
            }

            foreach (var slot in Slots)
            {
                sw.Write((byte)slot.Team);
            }

            foreach (var slot in Slots)
            {
                if ((slot.Status & (MultiSlotStatus)0x7c) > 0)
                {
                    sw.Write(slot.UserId);
                }
            }

            sw.Write(HostId);
            sw.Write((byte)PlayMode);
            sw.Write((byte)ScoringType);
            sw.Write((byte)TeamType);
            sw.Write((byte)SpecialModes);

            if (SpecialModes == MatchSpecialModes.Freemods)
            {
                foreach (var slot in Slots)
                {
                    sw.Write((uint)slot.Mods);
                }
            }

            sw.Write(Seed);
        }
Example #9
0
 public void WriteToStream(MStreamWriter sw)
 {
     sw.Write(SetId);
     sw.Write(ChildrenBeatmaps.Count);
     foreach (var bm in ChildrenBeatmaps)
     {
         sw.Write(bm);
     }
     sw.Write((sbyte)RankedStatus);
     sw.Write(ApprovedDate?.ToString(), true);
     sw.Write(LastUpdate?.ToString(), true);
     sw.Write(LastChecked?.ToString(), true);
     sw.Write(Artist, true);
     sw.Write(Title, true);
     sw.Write(Creator, true);
     sw.Write(Source, true);
     sw.Write(Tags, true);
     sw.Write(HasVideo);
     sw.Write((sbyte)Genre);
     sw.Write((sbyte)Language);
     sw.Write(Favourites);
     sw.Write(Disabled);
 }
Example #10
0
 public void WriteToStream(MStreamWriter sw)
 {
     sw.Write(Time);
     sw.Write(Id);
     sw.Write(Count300);
     sw.Write(Count100);
     sw.Write(Count50);
     sw.Write(CountGeki);
     sw.Write(CountKatu);
     sw.Write(CountMiss);
     sw.Write(TotalScore);
     sw.Write(MaxCombo);
     sw.Write(CurrentCombo);
     sw.Write(Perfect);
     sw.Write(CurrentHp);
     sw.Write(TagByte);
     sw.Write(ScoreV2);
     if (!ScoreV2)
     {
         return;
     }
     sw.Write(ComboPortion);
     sw.Write(BonusPortion);
 }
Example #11
0
 private void Exception(MStreamWriter dataWriter)
 {
     dataWriter.Write(new LoginResponse(LoginResponses.Exception));
 }
Example #12
0
 public void WriteToStream(MStreamWriter sw)
 {
     sw.Write(Protocol);
 }
Example #13
0
 public void WriteToStream(MStreamWriter sw)
 {
     sw.Write(UserIds);
 }
Example #14
0
 private void Success(MStreamWriter dataWriter, int userid)
 {
     dataWriter.Write(new LoginResponse((LoginResponses)userid));
 }
Example #15
0
 public void WriteToStream(MStreamWriter sw)
 {
     sw.Write((int)ErrorState);
 }
Example #16
0
 public void WriteToStream(MStreamWriter sw)
 {
     sw.Write(Frame);
 }
Example #17
0
 public void WriteToStream(MStreamWriter sw)
 {
     sw.Write(BeatmapId);
     sw.Write(ParentSetId);
     sw.Write(DiffName, true);
     sw.Write(FileMd5, true);
     sw.Write((sbyte)Mode);
     sw.Write(Bpm);
     sw.Write(Ar);
     sw.Write(Od);
     sw.Write(Cs);
     sw.Write(Hp);
     sw.Write(TotalLength);
     sw.Write(Playcount);
     sw.Write(Passcount);
     sw.Write(MaxCombo);
     sw.Write(DifficultyRating);
 }
Example #18
0
 public void WriteToStream(MStreamWriter sw)
 {
     sw.Write(ChannelName);
 }
Example #19
0
 private void LoginFailed(MStreamWriter dataWriter)
 {
     dataWriter.Write(new LoginResponse(LoginResponses.Failed));
 }