/// <summary>
 /// Create node stream encoder
 /// </summary>
 /// <param name="client"></param>
 /// <param name="endpoint"></param>
 /// <param name="diagnostics"></param>
 /// <param name="encoder"></param>
 /// <param name="elevation"></param>
 /// <param name="logger"></param>
 /// <param name="priority"></param>
 public BrowseStreamEncoder(IEndpointServices client, EndpointModel endpoint,
                            IEncoder encoder, DiagnosticsModel diagnostics, ILogger logger, CredentialModel elevation = null,
                            int priority = int.MaxValue) :
     this(client, endpoint, diagnostics, logger, elevation, priority)
 {
     _encoder = new ModelEncoder(encoder, PushNode);
 }
Exemplo n.º 2
0
 /// <summary>
 /// Create history encoder
 /// </summary>
 /// <param name="client"></param>
 /// <param name="endpoint"></param>
 /// <param name="encoder"></param>
 /// <param name="nodeId"></param>
 /// <param name="logger"></param>
 /// <param name="elevation"></param>
 /// <param name="startTime"></param>
 /// <param name="endTime"></param>
 /// <param name="maxValues"></param>
 /// <param name="priority"></param>
 public HistoryStreamEncoder(IEndpointServices client, EndpointModel endpoint,
                             IEncoder encoder, string nodeId, ILogger logger, CredentialModel elevation = null,
                             DateTime?startTime = null, DateTime?endTime = null, int?maxValues = null,
                             int priority       = int.MaxValue) :
     this(client, endpoint, nodeId, logger, elevation, startTime, endTime,
          maxValues, priority)
 {
     _encoder = new ModelEncoder(encoder);
 }
Exemplo n.º 3
0
        protected override int OnCalculateSize(bool force)
        {
            //Clean and sort influence list
            _influences.Clean();
            _influences.Sort();

            //Clean and sort texture list
            _textures.Clean();
            _textures.Sort();

            _linker = ModelLinker.Prepare(this);
            return(ModelEncoder.CalcSize(_linker));
        }
        /// <inheritdoc/>
        public async Task ArchiveAsync(CancellationToken ct)
        {
            var diagnostics = new List <OperationResultModel>();

            // Write manifest

            // Write nodes
            IEnumerable <string> historyNodes = null;

            using (var stream = _archive.GetStream("_nodes", FileMode.CreateNew))
                using (var encoder = new BrowseStreamEncoder(_client, _endpoint, stream,
                                                             _contentType, null, _logger, _elevation)) {
                    await encoder.EncodeAsync(ct);

                    historyNodes = encoder.HistoryNodes;
                    diagnostics.AddRange(encoder.Diagnostics);
                }

            if (historyNodes != null)
            {
                foreach (var nodeId in historyNodes)
                {
                    using (var stream = _archive.GetStream("_history/" + nodeId,
                                                           FileMode.CreateNew))
                        using (var encoder = new HistoryStreamEncoder(_client, _endpoint,
                                                                      stream, _contentType, nodeId, _logger, _elevation,
                                                                      _startTime, _endTime, _maxValues)) {
                            await encoder.EncodeAsync(ct);

                            diagnostics.AddRange(encoder.Diagnostics);
                        }
                }
            }

            using (var stream = _archive.GetStream("_diagnostics", FileMode.CreateNew))
                using (var encoder = new ModelEncoder(stream, _contentType)) {
                    foreach (var operation in diagnostics)
                    {
                        encoder.WriteEncodeable(null, operation, operation.GetType());
                    }
                }
        }
Exemplo n.º 5
0
 protected internal override void OnRebuild(VoidPtr address, int length, bool force)
 {
     ModelEncoder.Build(_linker, (MDL0Header *)address, length, force);
     _linker = null;
     //ModelEncoder.Build(this, (MDL0Header*)address, length, force);
 }