|
1 | | -using CommandSystem; |
2 | | -using Newtonsoft.Json; |
3 | | -using System; |
4 | | -using System.Collections.Generic; |
5 | | -using System.Net.Http; |
6 | | -using System.Net; |
7 | | -using UncomplicatedCustomTeams.Utilities; |
8 | | - |
9 | | -namespace UncomplicatedCustomTeams.Commands |
10 | | -{ |
11 | | - [CommandHandler(typeof(GameConsoleCommandHandler))] |
12 | | - internal class UCTLogShare : ParentCommand |
13 | | - { |
14 | | - public UCTLogShare() => LoadGeneratedCommands(); |
15 | | - |
16 | | - public override string Command { get; } = "uctlogs"; |
17 | | - |
18 | | - public override string[] Aliases { get; } = new string[] { }; |
19 | | - |
20 | | - public override string Description { get; } = "Share the UCT Debug logs with the developers"; |
21 | | - |
22 | | - public override void LoadGeneratedCommands() { } |
23 | | - |
24 | | - protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSender sender, out string response) |
25 | | - { |
26 | | - if (sender.LogName is not "SERVER CONSOLE") |
27 | | - { |
28 | | - response = "Sorry but this command is reserved to the game console!"; |
29 | | - return false; |
30 | | - } |
31 | | - |
32 | | - long Start = DateTimeOffset.Now.ToUnixTimeMilliseconds(); |
33 | | - |
34 | | - HttpStatusCode Response = LogManager.SendReport(out HttpContent Content); |
35 | | - Dictionary<string, string> Data = JsonConvert.DeserializeObject<Dictionary<string, string>>(Plugin.HttpManager.RetriveString(Content)); |
36 | | - |
37 | | - if (Response is HttpStatusCode.OK && Data.ContainsKey("id")) |
38 | | - { |
39 | | - response = $"Successfully shared the UCT logs with the developers!\nSend this Id to the developers: {Data["id"]}\n\nTook {DateTimeOffset.Now.ToUnixTimeMilliseconds() - Start}ms"; |
40 | | - } |
41 | | - else |
42 | | - { |
43 | | - response = $"Failed to share the UCT logs with the developers: Server says: {Response}"; |
44 | | - } |
45 | | - |
46 | | - |
47 | | - return true; |
48 | | - } |
49 | | - } |
50 | | -} |
| 1 | +using CommandSystem; |
| 2 | +using Newtonsoft.Json; |
| 3 | +using System; |
| 4 | +using System.Collections.Generic; |
| 5 | +using System.Net.Http; |
| 6 | +using System.Net; |
| 7 | +using UncomplicatedCustomTeams.Utilities; |
| 8 | + |
| 9 | +namespace UncomplicatedCustomTeams.Commands |
| 10 | +{ |
| 11 | + [CommandHandler(typeof(GameConsoleCommandHandler))] |
| 12 | + internal class LogShare : ParentCommand |
| 13 | + { |
| 14 | + public LogShare() => LoadGeneratedCommands(); |
| 15 | + |
| 16 | + public override string Command { get; } = "uctlogs"; |
| 17 | + |
| 18 | + public override string[] Aliases { get; } = new string[] { }; |
| 19 | + |
| 20 | + public override string Description { get; } = "Share the UCT Debug logs with the developers"; |
| 21 | + |
| 22 | + public override void LoadGeneratedCommands() { } |
| 23 | + |
| 24 | + protected override bool ExecuteParent(ArraySegment<string> arguments, ICommandSender sender, out string response) |
| 25 | + { |
| 26 | + if (sender.LogName is not "SERVER CONSOLE") |
| 27 | + { |
| 28 | + response = "Sorry but this command is reserved to the game console!"; |
| 29 | + return false; |
| 30 | + } |
| 31 | + |
| 32 | + long Start = DateTimeOffset.Now.ToUnixTimeMilliseconds(); |
| 33 | + |
| 34 | + HttpStatusCode Response = LogManager.SendReport(out HttpContent Content); |
| 35 | + Dictionary<string, string> Data = JsonConvert.DeserializeObject<Dictionary<string, string>>(Plugin.HttpManager.RetriveString(Content)); |
| 36 | + |
| 37 | + if (Response is HttpStatusCode.OK && Data.ContainsKey("id")) |
| 38 | + { |
| 39 | + response = $"Successfully shared the UCT logs with the developers!\nSend this Id to the developers: {Data["id"]}\n\nTook {DateTimeOffset.Now.ToUnixTimeMilliseconds() - Start}ms"; |
| 40 | + } |
| 41 | + else |
| 42 | + { |
| 43 | + response = $"Failed to share the UCT logs with the developers: Server says: {Response}"; |
| 44 | + } |
| 45 | + |
| 46 | + |
| 47 | + return true; |
| 48 | + } |
| 49 | + } |
| 50 | +} |
0 commit comments