private void ParseInner(string message, bool hasRequestid) { foreach (var symbol in GetSymbols(message, hasRequestid)) { Chains.Add(EquityOption.Parse(symbol)); } }
public void ParseInner(string message, bool hasRequestId) { foreach (var symbol in GetSymbols(message, hasRequestId)) { Chains.Add(FutureSpread.Parse(symbol)); } }
private void ChainDeeper(Node firstNode, Node secondNode) { ElementsChain chain = new ElementsChain(); chain.AddNode(firstNode); // Добавляем текущую ноду в цепь chain.AddNode(secondNode); // Добавляем предыдущую ноду в цепь Node currentNode = secondNode; Node prevNode = firstNode; while (currentNode.Connections.Count < 3) { if (currentNode.Connections.Count < 2) // Тупик { return; } Node nextNode = currentNode.Connections.Keys.FirstOrDefault(i => i != prevNode); prevNode = currentNode; // Переходим на следующую currentNode = nextNode; chain.AddNode(currentNode); // Записываем ноду в цепь } if (Chains.FirstOrDefault(i => i.Nodes.First() == chain.Nodes.Last() && i.Nodes.Last() == chain.Nodes.First()) == null) // Проверка на существующий путь { Chains.Add(chain); // Добавляем цепь в список цепей } }
private void refreshChains() { _ignoreChainsChanges = true; Chains.Clear(); foreach (var chain in NetworkArchitectureData.Chains) { Chains.Add(new ChainViewModel(chain, this)); } _ignoreChainsChanges = false; }
/// <summary> /// Create a new Block in the Blockchain /// </summary> /// <param name="proof">The proof given by the Proof of Work algorithm</param> /// <param name="previousHash">Hash of previous Block</param> public Block NewBlock(int proof, string previousHash = null) { var block = new Block { Index = Chains.Count + 1, Timestamp = DateTime.Now.ToUnixTime(), Transactions = CurrentTransactions, Proof = proof, PreviousHash = previousHash ?? Hash(LastBlock) }; //Reset the current list of transactions CurrentTransactions = new List <Transaction>(); Chains.Add(block); return(block); }