public virtual void SendRunProgramRequest(string argument) { var msg = new RunProgramMsg(); msg.EntityId = m_programmableBlock.EntityId; msg.Argument = StringCompressor.CompressString(argument ?? string.Empty); Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }
public virtual void SendUpdateProgramRequest(string program, string storage) { var msg = new UpdateProgramMsg(); msg.EntityId = m_programmableBlock.EntityId; msg.Program = StringCompressor.CompressString(program); msg.Storage = StringCompressor.CompressString(storage); Sync.Layer.SendMessageToServer(ref msg, MyTransportMessageEnum.Request); }
static void RunProgramRequest(ref RunProgramMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); if (entity is MyProgrammableBlock) { (entity as MyProgrammableBlock).Run(StringCompressor.DecompressString(msg.Argument)); } }
static void UpdateProgramSuccess(ref UpdateProgramMsg msg, MyNetworkClient sender) { MyEntity entity; MyEntities.TryGetEntityById(msg.EntityId, out entity); if (entity is MyProgrammableBlock) { (entity as MyProgrammableBlock).UpdateProgram(StringCompressor.DecompressString(msg.Program), StringCompressor.DecompressString(msg.Storage)); } }