private void HandleGetBootstrapArguments(LimitedDSPExSession session, TransactionInitialMessage message) { if (message.DataLength != 4) { logger.Warn($"Expected {GetType().Name} initial message to have at least 4 bytes"); } else { // In the future, we should validate that the PID is the expected PID. var pid = BitConverter.ToUInt32(message.DataBuffer, message.DataOffset); logger.Info($"GetBootstrapArguments: sender pid is {pid}"); } // Send response data - properties and flags using (var ms = streamFactory.CreateMemoryStream()) { var writer = ms.Writer; var configuration = bootstrapConfigurationGenerator.Build(startupConfiguration.Components); var properties = configuration.Properties; writer.Write((uint)properties.Count); foreach (var property in properties) { writer.WriteLongText(property.Key); writer.WriteLongText(property.Value); } var flags = configuration.Flags; writer.Write((uint)flags.Count); foreach (var flag in flags) { writer.WriteLongText(flag); } var data = ms.ToArray(); session.SendMessage(new TransactionMessage( message.TransactionId, data, 0, data.Length )); } }
private void HandleGetInitialCommandList(LimitedDSPExSession session, TransactionInitialMessage message) { logger.Info("Processing Initial Message"); var commandListComponent = startupConfiguration.GetComponentOrNull <CommandListComponent>(); var commandList = commandListComponent.CommandList; using (var ms = new MemoryStream()) { using (var writer = new BinaryWriter(ms)) { writer.Write((uint)commandList.Count); foreach (var command in commandList) { writer.WriteLongText(command.Type); writer.Write(command.Data.Length); writer.Write(command.Data, 0, command.Data.Length); } } var data = ms.ToArray(); session.SendMessage(new TransactionMessage(message.TransactionId, data, 0, data.Length)); logger.Info("Sent Initial Command List"); } }
private void HandleGetInitialCommandList(LimitedDSPExSession session, TransactionInitialMessage message) { logger.Info("Processing Initial Message"); var commandListComponent = startupConfiguration.GetComponentOrNull<CommandListComponent>(); var commandList = commandListComponent.CommandList; using (var ms = new MemoryStream()) { using (var writer = new BinaryWriter(ms)) { writer.Write((uint)commandList.Count); foreach (var command in commandList) { writer.WriteLongText(command.Type); writer.Write(command.Data.Length); writer.Write(command.Data, 0, command.Data.Length); } } var data = ms.ToArray(); session.SendMessage(new TransactionMessage(message.TransactionId, data, 0, data.Length)); logger.Info("Sent Initial Command List"); } }