コード例 #1
0
ファイル: Extensions.cs プロジェクト: Akrotiri/twino
        /// <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);
        }
コード例 #2
0
 public FileImporter(
     IFileStreamer fileStreamer,
     IDataReader <TRead> valueReader,
     IValueParser <TRead> valueParser,
     IModelWriter modelWriter)
 {
     _fileStreamer = fileStreamer;
     _valueReader  = valueReader;
     _valueParser  = valueParser;
     _modelWriter  = modelWriter;
 }
コード例 #3
0
 public InventoryItemDenormalizer(IModelWriter <InventoryItem> itemWriter, ILogger logger, IRepository repository)
 {
     _itemWriter = itemWriter;
     _logger     = logger;
     _repository = repository;
 }
 public ModelWriterDecorator_FaceIndexCorrection(IModelWriter decoratee)
 => _decoratee = decoratee;
コード例 #5
0
 public InventoryItemDenormalizer(IModelWriter<InventoryItem> itemWriter, ILogger logger, IRepository repository)
 {
     _itemWriter = itemWriter;
     _logger = logger;
     _repository = repository;
 }
コード例 #6
0
 /// <summary>
 /// Escreve os atributos do model no template
 /// </summary>
 /// <param name="writer">O ModelWriter</param>
 public void WriteModel(IModelWriter writer)
 {
     writer.SetAttributes(this.Model);
 }
コード例 #7
0
 public CustomModelRW()
 {
     _writer = new CustomModelWriter();
     _reader = new CustomModelReader();
 }
コード例 #8
0
ファイル: DefaultModelRW.cs プロジェクト: Akrotiri/twino
 public DefaultModelRW()
 {
     _writer = new TwinoModelWriter();
     _reader = new TwinoModelReader();
 }
コード例 #9
0
ファイル: Extensions.cs プロジェクト: Akrotiri/twino
        /// <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));
        }