public void BlockVerify(Block block) { lock (Chain) { Chain.Add(block); } lock (TransactionPool) { var ids = block.Transactions.Select(x => x.Id).ToArray(); TransactionPool.RemoveTxs(ids); } lock (Utxos) { var inEntries = block.Transactions.SelectMany(x => x.Inputs); Utxos.RemoveAll(x => inEntries.Any(inEntry => inEntry.OutputIndex == x.OutIndex && inEntry.TransactionId.Equals(x.TransactionId))); var utxos = block.Transactions .Select(x => (x.Outputs, x.Id)) .SelectMany(x => ToTxO(x.Outputs, x.Id)); Utxos.AddRange(utxos); } //if(Chain.Count % 100 == 0) Difficulty.CalculateNextDifficulty() Applied?.Invoke(); }
private async Task ApplyInternal(bool reset = true) { try { using (MessageView.ShowLoad("Применение изменений...")) { Repository.SaveScenario(_clonedScenario); StatisticsManager.ReRegister(_clonedScenario); await _clonedScenario.Initialize(); _clonedScenario.AfterInitilize(); } IsModified = false; if (reset) { if (await SetScenario(_clonedScenario)) { Applied?.Invoke(); } } else { _originalSenario = _clonedScenario; //crutch Applied?.Invoke(); } } catch (Exception e) { Log.Error($"Ошибка инициализации сценария [{_clonedScenario.Name}]", e); } }
public void Apply(BehavioursComponent behaviours) { behaviours.Apply(Behaviour, behaviours.gameObject); IsApplied = true; Applied?.Invoke(this); }
public void Apply() { if (IsApplied) return; IsApplied = true; OnApplied(); Applied?.Invoke(this); }
protected override void OnApply(PageApplyEventArgs e) { if (e.ApplyBehavior == ApplyKind.Apply) { Applied?.Invoke(); } base.OnApply(e); }
private void ApplyInternal() { _originalTrigger.Stop(); _repository.SaveTrigger(_clonedTrigger); _clonedTrigger.Initialize(); _clonedTrigger.AfterInitialize(); SetTrigger( _clonedTrigger, () => { Applied?.Invoke(); IsModified = false; }); }
void LockedChainApply(List <Block> newChain) { var localTxs = Chain.SelectMany(x => x.Transactions); var remoteTxs = newChain.SelectMany(x => x.Transactions); var txNotIncludeRemote = localTxs.Where(tx => !remoteTxs.Any(x => x.Id.Equals(tx.Id))).ToArray(); lock (TransactionPool) { var txIds = TransactionPool.GetPool().Select(x => x.Id) .Where(x => remoteTxs.Any(tx => x.Equals(tx.Id))).ToArray(); TransactionPool.RemoveTxs(txIds); TransactionPool.AddTxs(txNotIncludeRemote); } lock (Chain) { Chain.Clear(); Chain.AddRange(newChain); } UpdateUtxos(); Applied?.Invoke(); }
private void ApplyInternal(bool reset = true) { try { Repository.SaveScenario(_clonedScenario); StatisticsManager.ReRegister(_clonedScenario); _clonedScenario.InitializeAsync(); _clonedScenario.AfterInitilize(); IsModified = false; if (reset) { SetScenario(_clonedScenario, Applied); } else { _originalSenario = _clonedScenario; //crutch Applied?.Invoke(); } } catch (Exception e) { Log.ErrorFormat(e, "Ошибка инициализации сценария {0}", _clonedScenario.Name); } }
private void OnApply() { Applied?.Invoke(this, new SettingsEventArgs(this)); }
protected virtual void OnApplied() { Applied?.Invoke(this, EventArgs.Empty); }
private void OnApplied() => Applied?.Invoke(this, EventArgs.Empty);
protected override void OnApply(PageApplyEventArgs e) { base.OnApply(e); Applied?.Invoke(this, EventArgs.Empty); }
protected virtual void OnApplied(EventArgs e) { Applied?.Invoke(this, e); }