Esempio n. 1
0
        public static IEnumerable <Node> GetNodes()
        {
            lock (_thisLock)
            {
                var list = new List <Node>();

                foreach (var item in Clipboard.GetText().Split(new string[] { "\r", "\n" }, StringSplitOptions.RemoveEmptyEntries))
                {
                    try
                    {
                        var node = AmoebaConverter.FromNodeString(item);
                        if (node == null)
                        {
                            continue;
                        }

                        list.Add(node);
                    }
                    catch (Exception)
                    {
                    }
                }

                return(list);
            }
        }
        public void Test_AmoebaConverter_Node()
        {
            Node node = null;

            {
                var id = new byte[32];
                _random.NextBytes(id);
                var uris = new string[] { "net.tcp://localhost:9000", "net.tcp://localhost:9001", "net.tcp://localhost:9002" };

                node = new Node(id, uris);
            }

            var stringNode = AmoebaConverter.ToNodeString(node);
            var node2      = AmoebaConverter.FromNodeString(stringNode);

            Assert.AreEqual(node, node2, "AmoebaConverter #1");
        }