public Task Upload(Tag tag, CommentContent comment, DigitalSignature digitalSignature, TimeSpan miningTime, CancellationToken token) { if (tag == null) { throw new ArgumentNullException(nameof(tag)); } if (comment == null) { throw new ArgumentNullException(nameof(comment)); } if (digitalSignature == null) { throw new ArgumentNullException(nameof(digitalSignature)); } return(_coreManager.VolatileSetStream(ContentConverter.ToStream(comment, 0), TimeSpan.FromDays(360), token) .ContinueWith(task => { MulticastClue MulticastClue; try { var miner = new Miner(CashAlgorithm.Version1, -1, miningTime); MulticastClue = new MulticastClue("ChatMessage", tag, DateTime.UtcNow, task.Result, digitalSignature, miner, token); } catch (MinerException) { return; } _coreManager.UploadMetadata(MulticastClue); })); }
public void UploadMetadata(MulticastClue metadata) { this.Check(); lock (_lockObject) { _networkManager.Upload(metadata); } }