Move upload commands to engine (#16582)
This commit is contained in:
@@ -1,36 +0,0 @@
|
||||
using Content.Shared.Administration;
|
||||
using Robust.Shared.Network;
|
||||
using Robust.Shared.Prototypes;
|
||||
|
||||
namespace Content.Client.Administration.Managers;
|
||||
|
||||
public sealed class GamePrototypeLoadManager : IGamePrototypeLoadManager
|
||||
{
|
||||
[Dependency] private readonly IClientNetManager _netManager = default!;
|
||||
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
|
||||
[Dependency] private readonly ILocalizationManager _localizationManager = default!;
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
_netManager.RegisterNetMessage<GamePrototypeLoadMessage>(LoadGamePrototype);
|
||||
}
|
||||
|
||||
private void LoadGamePrototype(GamePrototypeLoadMessage message)
|
||||
{
|
||||
var changed = new Dictionary<Type, HashSet<string>>();
|
||||
_prototypeManager.LoadString(message.PrototypeData, true, changed);
|
||||
_prototypeManager.ResolveResults();
|
||||
_prototypeManager.ReloadPrototypes(changed);
|
||||
_localizationManager.ReloadLocalizations();
|
||||
Logger.InfoS("adminbus", "Loaded adminbus prototype data.");
|
||||
}
|
||||
|
||||
public void SendGamePrototype(string prototype)
|
||||
{
|
||||
var msg = new GamePrototypeLoadMessage
|
||||
{
|
||||
PrototypeData = prototype
|
||||
};
|
||||
_netManager.ClientSendMessage(msg);
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using Content.Shared.Administration;
|
||||
|
||||
namespace Content.Client.Administration.Managers;
|
||||
|
||||
public sealed class NetworkResourceManager : SharedNetworkResourceManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Callback for when the server sends a new resource.
|
||||
/// </summary>
|
||||
/// <param name="msg">The network message containing the data.</param>
|
||||
protected override void ResourceUploadMsg(NetworkResourceUploadMessage msg)
|
||||
{
|
||||
ContentRoot.AddOrUpdateFile(msg.RelativePath, msg.Data);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user