/// <summary> /// Creates web socket message from model and sends to specified client /// </summary> public static void Send <TModel>(this SocketBase socket, TModel model, IModelWriter writer) where TModel : ISerializableModel { WebSocketMessage message = new WebSocketMessage { OpCode = SocketOpCode.UTF8, Content = new MemoryStream(Encoding.UTF8.GetBytes(writer.Serialize(model))) }; socket.Send(_writer.Create(message).Result); }
public FileImporter( IFileStreamer fileStreamer, IDataReader <TRead> valueReader, IValueParser <TRead> valueParser, IModelWriter modelWriter) { _fileStreamer = fileStreamer; _valueReader = valueReader; _valueParser = valueParser; _modelWriter = modelWriter; }
public InventoryItemDenormalizer(IModelWriter <InventoryItem> itemWriter, ILogger logger, IRepository repository) { _itemWriter = itemWriter; _logger = logger; _repository = repository; }
public ModelWriterDecorator_FaceIndexCorrection(IModelWriter decoratee) => _decoratee = decoratee;
public InventoryItemDenormalizer(IModelWriter<InventoryItem> itemWriter, ILogger logger, IRepository repository) { _itemWriter = itemWriter; _logger = logger; _repository = repository; }
/// <summary> /// Escreve os atributos do model no template /// </summary> /// <param name="writer">O ModelWriter</param> public void WriteModel(IModelWriter writer) { writer.SetAttributes(this.Model); }
public CustomModelRW() { _writer = new CustomModelWriter(); _reader = new CustomModelReader(); }
public DefaultModelRW() { _writer = new TwinoModelWriter(); _reader = new TwinoModelReader(); }
/// <summary> /// Creates web socket message from model and sends to specified client /// </summary> public static async Task SendAsync <TModel>(this SocketBase socket, TModel model, IModelWriter writer) where TModel : ISerializableModel { WebSocketMessage message = new WebSocketMessage { OpCode = SocketOpCode.UTF8, Content = new MemoryStream(Encoding.UTF8.GetBytes(writer.Serialize(model))) }; await socket.SendAsync(await _writer.Create(message)); }