json generator alternator and vibrator (#718)
* json generator alternator and vibrator * каким хуем ты не закоммитился уебан
This commit is contained in:
27
Content.Server/_White/GuideGenerator/EntityJsonGenerator.cs
Normal file
27
Content.Server/_White/GuideGenerator/EntityJsonGenerator.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text.Json;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Server.GuideGenerator;
|
||||
|
||||
public sealed class EntityJsonGenerator
|
||||
{
|
||||
public static void PublishJson(StreamWriter file)
|
||||
{
|
||||
var prototype = IoCManager.Resolve<IPrototypeManager>();
|
||||
var prototypes =
|
||||
prototype
|
||||
.EnumeratePrototypes<EntityPrototype>()
|
||||
.Where(x => !x.Abstract)
|
||||
.Select(x => new EntityEntry(x))
|
||||
.ToDictionary(x => x.Id, x => x);
|
||||
|
||||
var serializeOptions = new JsonSerializerOptions
|
||||
{
|
||||
WriteIndented = true,
|
||||
};
|
||||
|
||||
file.Write(JsonSerializer.Serialize(prototypes, serializeOptions));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user