Example #1
0
        public void UploadScreenshot(string name)
        {
            if (ChessService.CurrentGame == null || ChessService.CurrentGame.HasEnded)
            {
                RespondRaw("Failed", 500);
                return;
            }
            if (SelfPlayer == null)
            {
                RespondRaw("Failed", 400);
                return;
            }
            var p = ChessService.CurrentGame.GetPlayer(SelfPlayer.Id);

            if (p == null)
            {
                RespondRaw("Not connected to chess", 403);
                return;
            }
            if (!p.ExpectDemand)
            {
                RespondRaw("Unexpected image", 400);
                return;
            }
            var path = Path.Combine(Program.BASE_PATH, "ChessO", "Demands", DateTime.Now.DayOfYear.ToString("000"));

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string fName = $"{SelfPlayer.Id.ToString("00")}_{p.DemandsSent.ToString("000")}_{name}.png";

            p.DemandsSent++;
            path = Path.Combine(path, fName);
            SaveFile(Context.Request.ContentEncoding, GetBoundary(Context.Request.ContentType),
                     new MemoryStream(Encoding.UTF8.GetBytes(Context.Body)), path);
            var builder = new Discord.EmbedBuilder();

            builder.Title       = "Desktop Uploaded";
            builder.Description = $"In response to admin demand, {SelfPlayer.Name} has uploaded a screenshot of their screens.\n" +
                                  $"For privacy purposes, this screenshot will be reviewed by the Chief Justice and released to their discretion";
            builder.AddField("File Name", fName);
            ChessS.LogAdmin(builder);
            RespondRaw("Saved");
        }
Example #2
0
        public void UploadProcesses()
        {
            if (ChessService.CurrentGame == null || ChessService.CurrentGame.HasEnded)
            {
                RespondRaw("Failed", 500);
                return;
            }
            if (SelfPlayer == null)
            {
                RespondRaw("Failed", 400);
                return;
            }
            var p = ChessService.CurrentGame.GetPlayer(SelfPlayer.Id);

            if (p == null)
            {
                RespondRaw("Not connected to chess", 403);
                return;
            }
            if (!p.ExpectDemand)
            {
                RespondRaw("Unexpected image", 400);
                return;
            }

            var path = Path.Combine(Program.BASE_PATH, "ChessO", "Demands", DateTime.Now.DayOfYear.ToString("000"));

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string fName = $"{SelfPlayer.Id.ToString("00")}_{p.DemandsSent.ToString("000")}_processes.txt";

            p.DemandsSent++;
            File.WriteAllText(Path.Combine(path, fName), Context.Body);
            var builder = new Discord.EmbedBuilder();

            builder.Title       = "Processes Gathered";
            builder.Description = $"In response to admin demand, {SelfPlayer.Name} has sent a list of active processes.\n" +
                                  $"For privacy purposes, this screenshot will be reviewed by the Chief Justice and released to their discretion";
            builder.AddField("File Name", fName);
            ChessS.LogAdmin(builder);
            RespondRaw("Saved");
        }
Example #3
0
        public void UploadChromeTabs()
        {
            if (ChessService.CurrentGame == null || ChessService.CurrentGame.HasEnded)
            {
                RespondRaw("Failed", 500);
                return;
            }
            if (SelfPlayer == null)
            {
                RespondRaw("Failed", 400);
                return;
            }
            var p = ChessService.CurrentGame.GetPlayer(SelfPlayer.Id);

            if (p == null)
            {
                RespondRaw("Not connected to chess", 403);
                return;
            }
            // we dont expect anything, client pro-actively notifies

            var path = Path.Combine(Program.BASE_PATH, "ChessO", "Demands", DateTime.Now.DayOfYear.ToString("000"));

            if (!Directory.Exists(path))
            {
                Directory.CreateDirectory(path);
            }
            string fName = $"{SelfPlayer.Id.ToString("00")}_{p.DemandsSent.ToString("000")}_chrome.txt";

            p.DemandsSent++;
            File.WriteAllText(Path.Combine(path, fName), Context.Body);
            var builder = new Discord.EmbedBuilder();

            builder.Title       = "Chrome Processes";
            builder.Description = $"Client has identified possible concern in open Chrome tabs.\n" +
                                  $"For privacy purposes, the tab names will be reviewed by the Chief Justice and released to their discretion";
            builder.AddField("File Name", fName);
            ChessS.LogAdmin(builder);
            RespondRaw("Saved");
        }