Revert "Admin logs (#5419)"

This reverts commit 319aec109d.
This commit is contained in:
DrSmugleaf
2021-11-22 18:55:17 +01:00
parent edeccabb36
commit c18d07538a
65 changed files with 236 additions and 7021 deletions

View File

@@ -1,15 +0,0 @@
using System;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Content.Server.Administration.Logs.Converters;
public abstract class AdminLogConverter<T> : JsonConverter<T>
{
public override T Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
throw new NotSupportedException();
}
public abstract override void Write(Utf8JsonWriter writer, T value, JsonSerializerOptions options);
}

View File

@@ -1,10 +0,0 @@
using System;
using JetBrains.Annotations;
namespace Content.Server.Administration.Logs.Converters;
[AttributeUsage(AttributeTargets.Class)]
[BaseTypeRequired(typeof(AdminLogConverter<>))]
public class AdminLogConverterAttribute : Attribute
{
}

View File

@@ -1,27 +0,0 @@
using System.Text.Json;
using Robust.Server.GameObjects;
using Robust.Shared.GameObjects;
using Robust.Shared.IoC;
namespace Content.Server.Administration.Logs.Converters;
[AdminLogConverter]
public class EntityJsonConverter : AdminLogConverter<Entity>
{
[Dependency] private readonly IEntityManager _entities = default!;
public override void Write(Utf8JsonWriter writer, Entity value, JsonSerializerOptions options)
{
writer.WriteStartObject();
writer.WriteNumber("id", (int) value.Uid);
writer.WriteString("name", value.Name);
if (_entities.TryGetComponent(value.Uid, out ActorComponent? actor))
{
writer.WriteString("player", actor.PlayerSession.UserId.UserId);
}
writer.WriteEndObject();
}
}

View File

@@ -1,13 +0,0 @@
using System.Text.Json;
using Content.Shared.FixedPoint;
namespace Content.Server.Administration.Logs.Converters;
[AdminLogConverter]
public class FixedPoint2Converter : AdminLogConverter<FixedPoint2>
{
public override void Write(Utf8JsonWriter writer, FixedPoint2 value, JsonSerializerOptions options)
{
writer.WriteNumberValue(value.Int());
}
}